From 2e7dbbda80c392fb59046547293de91769e0377e Mon Sep 17 00:00:00 2001 From: micha Date: Mon, 18 Dec 2006 22:03:36 +0000 Subject: [PATCH] * fix generic list add git-svn-id: trunk@5638 - --- rtl/objpas/fgl.pp | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/rtl/objpas/fgl.pp b/rtl/objpas/fgl.pp index 46b2eccfd1..113377397c 100644 --- a/rtl/objpas/fgl.pp +++ b/rtl/objpas/fgl.pp @@ -71,8 +71,6 @@ type function Remove(Item: Pointer): Integer; procedure Pack; procedure Sort(Compare: TFPSListCompareFunc); - procedure ForEachCall(Proc2call: TListCallback; Arg: Pointer); - procedure ForEachCall(Proc2call: TListStaticCallback; Arg: Pointer); property Capacity: Integer read FCapacity write SetCapacity; property Count: Integer read FCount write SetCount; property Items[Index: Integer]: Pointer read Get write Put; default; @@ -94,6 +92,7 @@ type procedure Put(Index: Integer; const Item: T); {$ifdef CLASSESINLINE} inline; {$endif} public constructor Create; + 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 IndexOf(const Item: T): Integer; {$ifdef CLASSESINLINE} inline; {$endif} @@ -533,23 +532,6 @@ begin Add(Obj[i]); end; -procedure TFPSList.ForEachCall(Proc2call: TListCallback; Arg: Pointer); -var - I: integer; -begin - for I:=0 to Count-1 do - proc2call(InternalItems[I],arg); -end; - - -procedure TFPSList.ForEachCall(Proc2call: TListStaticCallback; Arg: Pointer); -var - I: integer; -begin - for I:=0 to Count-1 do - Proc2call(InternalItems[I], Arg); -end; - {****************************************************************************} {* TFPGList *} {****************************************************************************} @@ -586,6 +568,11 @@ begin inherited Put(Index, @Item); end; +function TFPGList.Add(const Item: T): Integer; +begin + Result := inherited Add(@Item); +end; + function TFPGList.Extract(const Item: T): T; var ResPtr: Pointer;