Changeset 441
- Timestamp:
- Nov 19, 2012, 2:47:07 PM (12 years ago)
- Location:
- Generics/TemplateGenerics
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/TemplateGenerics/Additional/UBinarySerializer.pas
r410 r441 25 25 Position: Integer; 26 26 OwnsList: Boolean; 27 procedure Write(var Buffer; Count: Integer); inline;28 procedure Read(var Buffer; Count: Integer); inline;27 procedure Write(var Buffer; Count: Integer); //inline; 28 procedure Read(var Buffer; Count: Integer); //inline; 29 29 30 30 procedure Assign(Source: TBinarySerializer); … … 73 73 StringLength: Longint; 74 74 begin 75 FList.ReadBuffer(StringLength, SizeOf(StringLength)); 75 StringLength := 0; 76 Read(StringLength, SizeOf(StringLength)); 76 77 Result := ReadString(StringLength); 77 78 end; … … 102 103 function TBinarySerializer.ReadByte: Byte; 103 104 begin 105 Result := 0; 104 106 Read(Result, SizeOf(Byte)); 105 107 end; … … 107 109 function TBinarySerializer.ReadCardinal: Cardinal; 108 110 begin 111 Result := 0; 109 112 Read(Result, SizeOf(Cardinal)); 110 113 if SwapData then Result := SwapEndian(Result); … … 113 116 function TBinarySerializer.ReadInt64: Int64; 114 117 begin 118 Result := 0; 115 119 Read(Result, SizeOf(Int64)); 116 120 if SwapData then Result := SwapEndian(Result); … … 129 133 Count: Byte; 130 134 begin 135 Count := 0; 131 136 Read(Count, 1); 132 137 Result := ReadString(Count); … … 223 228 function TBinarySerializer.ReadDouble: Double; 224 229 begin 230 Result := 0; 225 231 Read(Result, SizeOf(Double)); 226 232 end; … … 228 234 function TBinarySerializer.ReadSingle: Single; 229 235 begin 236 Result := 0; 230 237 Read(Result, SizeOf(Single)); 231 238 end; … … 233 240 function TBinarySerializer.ReadWord: Word; 234 241 begin 242 Result := 0; 235 243 Read(Result, SizeOf(Word)); 236 244 if SwapData then Result := SwapEndian(Result); -
Generics/TemplateGenerics/Generic/GenericFileList.inc
r426 r441 15 15 procedure SetFileName(const Value: string); 16 16 procedure SetMode(const Value: Word); 17 function GetOpenned: Boolean; 17 18 public 18 19 constructor Create; override; … … 22 23 property FileName: string read FFileName write SetFileName; 23 24 property Mode: Word read FMode write SetMode; 25 property Openned: Boolean read GetOpenned; 24 26 end; 25 27 … … 81 83 end; 82 84 85 function TGFileList.GetOpenned: Boolean; 86 begin 87 Result := FHandle <> feInvalidHandle; 88 end; 83 89 84 90 {$UNDEF IMPLEMENTATION} -
Generics/TemplateGenerics/Generic/GenericList.inc
r427 r441 39 39 procedure SetFirst(AValue: TGListItem); 40 40 procedure QuickSort(L, R : TGListIndex; Compare: TSortCompare); 41 procedure DoUpdate; 41 42 protected 42 43 procedure Put(Index: TGListIndex; const AValue: TGListItem); virtual; … … 109 110 begin 110 111 FCount := 0; 112 FUpdateCount := 0; 111 113 end; 112 114 … … 341 343 if (Index < 0) or (Index > FCount) then 342 344 raise EListError.CreateFmt(SListIndexError, [Index]); 343 InsertCount(Index, 1); 344 FItems[Index] := Item; 345 Update; 345 try 346 BeginUpdate; 347 InsertCount(Index, 1); 348 FItems[Index] := Item; 349 finally 350 EndUpdate; 351 end; 346 352 end; 347 353 … … 564 570 procedure TGList.EndUpdate; 565 571 begin 566 Dec(FUpdateCount); 567 Update; 572 if FUpdateCount > 0 then Dec(FUpdateCount); 573 if FUpdateCount = 0 then DoUpdate; 574 end; 575 576 procedure TGList.DoUpdate; 577 begin 578 if Assigned(FOnUpdate) then FOnUpdate(Self); 568 579 end; 569 580 570 581 procedure TGList.Update; 571 582 begin 572 if Assigned(FOnUpdate) and (FUpdateCount = 0) then FOnUpdate(Self);583 if FUpdateCount = 0 then DoUpdate; 573 584 end; 574 585 -
Generics/TemplateGenerics/Generic/GenericListObject.inc
r426 r441 88 88 end; 89 89 end; 90 I := FCount; 90 91 inherited; 92 // Nil newly allocated items 93 while I < AValue do begin 94 FItems[I] := nil; 95 I := I + 1; 96 end; 91 97 end; 92 98 -
Generics/TemplateGenerics/Specialized/SpecializedList.pas
r426 r441 67 67 procedure AddStream(Stream: TStream); 68 68 procedure AddStreamPart(Stream: TStream; ItemCount: TGListIndex); 69 procedure WriteBuffer(var Buffer; Count: Integer);70 procedure ReadBuffer(var Buffer; Count: Integer);71 69 end; 72 70 … … 333 331 I: TGListIndex; 334 332 begin 335 I := 0;336 while (I < Count) do begin333 I := Count - 1; 334 while (I >= 0) do begin 337 335 TNotifyEvent(Items[I])(Sender); 338 I := I +1;336 I := I - 1; 339 337 end; 340 338 end; … … 414 412 end; 415 413 416 procedure TListByte.WriteBuffer(var Buffer; Count: Integer);417 begin418 419 end;420 421 procedure TListByte.ReadBuffer(var Buffer; Count: Integer);422 begin423 424 end;425 426 414 427 415 end.
Note:
See TracChangeset
for help on using the changeset viewer.