Changeset 251 for Generics


Ignore:
Timestamp:
Jun 13, 2011, 8:21:12 AM (13 years ago)
Author:
george
Message:
  • Modified: DebugLog transformed to component.
  • Fixed: String compare for template generics.
Location:
Generics/TemplateGenerics/Generic
Files:
2 edited

Legend:

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

    r247 r251  
    4242    function GetArray: TGListItemArray;
    4343    function Implode(Separator: string; Converter: TGListToStringConverter): string;
    44     function IndexOf(Item: TGListItem; Start: TGListIndex = 0): TGListIndex;
     44    function IndexOf(Item: TGListItem; Start: TGListIndex = 0): TGListIndex; virtual;
    4545    function IndexOfList(List: TGList; Start: TGListIndex = 0): TGListIndex;
    4646    procedure Insert(Index: TGListIndex; Item: TGListItem);
  • Generics/TemplateGenerics/Generic/GenericListString.inc

    r112 r251  
    1818    procedure Clear; override;
    1919    procedure Assign(Source: TGList); override;
     20    function IndexOf(Item: TGListItem; Start: TGListIndex = 0): TGListIndex; override;
    2021    constructor Create;
    2122    destructor Destroy; override;
     
    7172end;
    7273
     74function TGListString.IndexOf(Item: TGListItem; Start: TGListIndex): TGListIndex;
     75begin
     76  Result := Start;
     77  while (Result < Count) and
     78  (CompareStr(FItems[Result], Item) = -1) do
     79    Result := Result + 1;
     80  if Result = FCount then Result := -1;
     81end;
     82
    7383constructor TGListString.Create;
    7484begin
Note: See TracChangeset for help on using the changeset viewer.