* added ForEachCall

git-svn-id: trunk@2781 -
This commit is contained in:
peter 2006-03-06 09:48:56 +00:00
parent 33bd5edc31
commit 48d7cfb2a5

View File

@ -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);