Changeset 405 for Generics/TemplateGenerics/Generic/GenericList.inc
- Timestamp:
- Aug 14, 2012, 7:04:04 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/TemplateGenerics/Generic/GenericList.inc
r383 r405 39 39 procedure SetCount(const AValue: TGListIndex); virtual; 40 40 public 41 type 42 PItem = ^TGListItem; 41 43 function CompareMem(P1, P2: Pointer; Length: cardinal): Boolean; inline; 42 44 function Add(Item: TGListItem): TGListIndex; … … 57 59 function GetArray(Index, ACount: TGListIndex): TGListItemArray; 58 60 procedure GetList(List: TGList; Index, ACount: TGListIndex); 61 procedure GetBuffer(Index: TGListIndex; var Buffer; Count: TGListIndex); 59 62 function Implode(Separator: string; Converter: TGListToStringConverter): string; 60 63 function IndexOf(Item: TGListItem; Start: TGListIndex = 0): TGListIndex; virtual; … … 73 76 procedure ReplaceListPart(Index: TGListIndex; Source: TGList; 74 77 SourceIndex, SourceCount: TGListIndex); 78 procedure ReplaceBuffer(Index: TGListIndex; var Buffer; Count: TGListIndex); 75 79 procedure Sort(Compare: TGListSortCompare); 76 80 procedure SetArray(Values: array of TGListItem); … … 102 106 begin 103 107 FCount := 0; 108 end; 109 110 procedure TGList.GetBuffer(Index: TGListIndex; var Buffer; Count: TGListIndex); 111 var 112 P: PItem; 113 I: TGListIndex; 114 begin 115 if (Index + Count) > FCount then 116 raise EListError.CreateFmt(SListIndexError, [Index + Count]); 117 P := PItem(@Buffer); 118 I := 0; 119 while I < Count do begin 120 P^ := Items[Index + I]; 121 Inc(P, 1); 122 I := I + 1; 123 end; 124 end; 125 126 procedure TGList.ReplaceBuffer(Index: TGListIndex; var Buffer; Count: TGListIndex); 127 var 128 P: PItem; 129 I: TGListIndex; 130 begin 131 if (Index + Count) > FCount then 132 raise EListError.CreateFmt(SListIndexError, [Index + Count]); 133 P := PItem(@Buffer); 134 I := 0; 135 while I < Count do begin 136 Items[Index + I] := P^; 137 Inc(P, 1); 138 I := I + 1; 139 end; 104 140 end; 105 141
Note:
See TracChangeset
for help on using the changeset viewer.