Changeset 322 for Generics/NativeGenerics/Units/GenericList.pas
- Timestamp:
- Feb 8, 2012, 9:47:54 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/NativeGenerics/Units/GenericList.pas
r321 r322 38 38 procedure AddArray(Values: array of TItem); 39 39 procedure AddList(List: TGList<TItem>); 40 procedure AddListPart(List: TGList<TItem>; ItemIndex, ItemCount: TIndex); 40 41 procedure Assign(Source: TGList<TItem>); virtual; 41 42 procedure Clear; virtual; … … 48 49 property First: TItem read GetFirst write SetFirst; 49 50 procedure Fill(Start, Count: TIndex; Value: TItem); 50 function GetArray: TItemArray; 51 function GetArray(Index, ACount: TIndex): TItemArray; 52 procedure GetList(List: TGList<TItem>; Index, ACount: TIndex); 51 53 function Implode(Separator: string; Converter: TToStringConverter): string; 52 54 function IndexOf(Item: TItem; Start: TIndex = 0): TIndex; … … 161 163 end; 162 164 163 function TGList<TItem>.GetArray : TItemArray;165 function TGList<TItem>.GetArray(Index, ACount: TIndex): TItemArray; 164 166 var 165 167 I: Integer; 166 168 begin 167 SetLength(Result, Count);169 SetLength(Result, ACount); 168 170 I := 0; 169 171 while I < Count do begin 170 Result[I] := FItems[I]; 171 I := I + 1; 172 end; 172 Result[I] := FItems[Index + I]; 173 I := I + 1; 174 end; 175 end; 176 177 procedure TGList<TItem>.GetList(List: TGList; Index, ACount: TIndex); 178 begin 179 List.Clear; 180 List.AddListPart(Self, Index, ACount); 173 181 end; 174 182 … … 506 514 end; 507 515 516 procedure TGList<TItem>.AddListPart(List: TGList; ItemIndex, ItemCount: TIndex); 517 var 518 I: TIndex; 519 J: TIndex; 520 begin 521 I := Count; 522 J := ItemIndex; 523 Count := Count + ItemCount; 524 while I < Count do begin 525 Items[I] := List[J]; 526 I := I + 1; 527 J := J + 1; 528 end; 529 end; 530 508 531 procedure TGList<TItem>.Clear; 509 532 begin
Note:
See TracChangeset
for help on using the changeset viewer.