Browse Source

* added ForEachCall

git-svn-id: trunk@2781 -
peter 19 years ago
parent
commit
48d7cfb2a5
1 changed files with 16 additions and 0 deletions
  1. 16 0
      fcl/inc/contnrs.pp

+ 16 - 0
fcl/inc/contnrs.pp

@@ -25,6 +25,9 @@ uses
 
 
 Type
+  TObjectListCallback = procedure(data:TObject;arg:pointer) of object;
+  TObjectListStaticCallback = procedure(data:TObject;arg:pointer);
+
   TFPObjectList = class(TObject)
   private
     FFreeObjects : Boolean;
@@ -56,6 +59,8 @@ Type
     procedure Assign(Obj:TFPObjectList);
     procedure Pack;
     procedure Sort(Compare: TListSortCompare);
+    procedure ForEachCall(proc2call:TObjectListCallback;arg:pointer);
+    procedure ForEachCall(proc2call:TObjectListStaticCallback;arg:pointer);
     property Capacity: Integer read GetCapacity write SetCapacity;
     property Count: Integer read GetCount write SetCount;
     property OwnsObjects: Boolean read FFreeObjects write FFreeObjects;
@@ -436,6 +441,17 @@ begin
   Result := TObject(FList.Last);
 end;
 
+procedure TFPObjectList.ForEachCall(proc2call:TObjectListCallback;arg:pointer);
+begin
+  FList.ForEachCall(TListCallBack(proc2call),arg);
+end;
+
+procedure TFPObjectList.ForEachCall(proc2call:TObjectListStaticCallback;arg:pointer);
+begin
+  FList.ForEachCall(TListStaticCallBack(proc2call),arg);
+end;
+
+
 { TObjectList }
 
 constructor tobjectlist.create(freeobjects : boolean);