Ignore:
Timestamp:
Dec 19, 2011, 9:19:00 AM (13 years ago)
Author:
chronos
Message:
  • Added: Handling of TStream by TListByte.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Generics/TemplateGenerics/Generic/GenericList.inc

    r270 r304  
    2929    procedure AddArray(Values: array of TGListItem);
    3030    procedure AddList(List: TGList);
     31    procedure AddListPart(List: TGList; ItemIndex, ItemCount: TGListIndex);
    3132    procedure Assign(Source: TGList); virtual;
    3233    constructor Create; virtual;
     
    4243    function GetArray: TGListItemArray;
    4344    function Implode(Separator: string; Converter: TGListToStringConverter): string;
    44     function IndexOf(Item: TGListItem; Start: TGListIndex = 0): TGListIndex; virtual;
     45    function IndexOf(Item: TGListItem; Start: TGListIndex = 0): TGListIndex;
    4546    function IndexOfList(List: TGList; Start: TGListIndex = 0): TGListIndex;
    4647    procedure Insert(Index: TGListIndex; Item: TGListItem);
     
    5152    function Remove(Item: TGListItem): TGListIndex;
    5253    procedure Reverse;
    53     procedure Replace(Index: TGListIndex; Source: TGList);
     54    procedure ReplaceList(Index: TGListIndex; Source: TGList);
     55    procedure ReplaceListPart(Index: TGListIndex; Source: TGList;
     56      SourceIndex, SourceCount: TGListIndex);
    5457    procedure Sort(Compare: TGListSortCompare);
    5558    procedure SetArray(Values: array of TGListItem);
     
    8083end;
    8184
    82 procedure TGList.Replace(Index: TGListIndex; Source: TGList);
     85procedure TGList.ReplaceList(Index: TGListIndex; Source: TGList);
    8386var
    8487  I: TGListIndex;
     
    8790  while I < Source.Count do begin
    8891    Items[Index + I] := Source[I];
     92    I := I + 1;
     93  end;
     94end;
     95
     96procedure TGList.ReplaceListPart(Index: TGListIndex; Source: TGList;
     97  SourceIndex, SourceCount: TGListIndex);
     98var
     99  I: TGListIndex;
     100begin
     101  I := 0;
     102  while I < SourceCount do begin
     103    Items[Index + I] := Source[SourceIndex + I];
    89104    I := I + 1;
    90105  end;
     
    374389    I := 0;
    375390    while I < Count do begin
    376       if not CompareMem(@FItems[I], @List.FItems[I], SizeOf(TGListItem)) then begin
     391      if not CompareMem(Addr(FItems[I]), Addr(List.FItems[I]), SizeOf(TGListItem)) then begin
    377392        Result := False;
    378393        Break;
     
    469484var
    470485  I: TGListIndex;
    471 begin
    472   I := 0;
    473   while I < List.Count do begin
    474     Add(List[I]);
    475     I := I + 1;
     486  J: TGListIndex;
     487begin
     488  I := Count;
     489  J := 0;
     490  Count := Count + List.Count;
     491  while I < Count do begin
     492    Items[I] := List[J];
     493    I := I + 1;
     494    J := J + 1;
     495  end;
     496end;
     497
     498procedure TGList.AddListPart(List: TGList; ItemIndex, ItemCount: TGListIndex);
     499var
     500  I: TGListIndex;
     501  J: TGListIndex;
     502begin
     503  I := Count;
     504  J := ItemIndex;
     505  Count := Count + ItemCount;
     506  while I < Count do begin
     507    Items[I] := List[J];
     508    I := I + 1;
     509    J := J + 1;
    476510  end;
    477511end;
Note: See TracChangeset for help on using the changeset viewer.