+ TFPGObjectList.GetEnumerator and TFPGInterfacedObjectList.GetEnumerator, resolves #18094

git-svn-id: trunk@16471 -
This commit is contained in:
florian 2010-11-28 20:32:35 +00:00
parent 97ac6ab928
commit 6b42ba170b

View File

@ -140,6 +140,7 @@ type
TTypeList = array[0..MaxGListSize] of T;
PTypeList = ^TTypeList;
PT = ^T;
TFPGListEnumeratorSpec = specialize TFPGListEnumerator<T>;
{$ifndef OldSyntax}protected var{$else}var protected{$endif}
FOnCompare: TCompareFunc;
FFreeObjects: Boolean;
@ -154,6 +155,7 @@ type
function Add(const Item: T): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
function Extract(const Item: T): T; {$ifdef CLASSESINLINE} inline; {$endif}
function First: T; {$ifdef CLASSESINLINE} inline; {$endif}
function GetEnumerator: TFPGListEnumeratorSpec; {$ifdef CLASSESINLINE} inline; {$endif}
function IndexOf(const Item: T): Integer;
procedure Insert(Index: Integer; const Item: T); {$ifdef CLASSESINLINE} inline; {$endif}
function Last: T; {$ifdef CLASSESINLINE} inline; {$endif}
@ -174,6 +176,7 @@ type
TTypeList = array[0..MaxGListSize] of T;
PTypeList = ^TTypeList;
PT = ^T;
TFPGListEnumeratorSpec = specialize TFPGListEnumerator<T>;
{$ifndef OldSyntax}protected var{$else}var protected{$endif}
FOnCompare: TCompareFunc;
procedure CopyItem(Src, Dest: Pointer); override;
@ -187,6 +190,7 @@ type
function Add(const Item: T): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
function Extract(const Item: T): T; {$ifdef CLASSESINLINE} inline; {$endif}
function First: T; {$ifdef CLASSESINLINE} inline; {$endif}
function GetEnumerator: TFPGListEnumeratorSpec; {$ifdef CLASSESINLINE} inline; {$endif}
function IndexOf(const Item: T): Integer;
procedure Insert(Index: Integer; const Item: T); {$ifdef CLASSESINLINE} inline; {$endif}
function Last: T; {$ifdef CLASSESINLINE} inline; {$endif}
@ -880,6 +884,11 @@ begin
Result := T(inherited First^);
end;
function TFPGObjectList.GetEnumerator: TFPGListEnumeratorSpec;
begin
Result := TFPGListEnumeratorSpec.Create(Self);
end;
function TFPGObjectList.IndexOf(const Item: T): Integer;
begin
Result := 0;
@ -990,6 +999,11 @@ begin
Result := T(inherited First^);
end;
function TFPGInterfacedObjectList.GetEnumerator: TFPGListEnumeratorSpec;
begin
Result := TFPGListEnumeratorSpec.Create(Self);
end;
function TFPGInterfacedObjectList.IndexOf(const Item: T): Integer;
begin
Result := 0;