This is how i've done it
[code=Pascal]
PMethodList = ^TMethodList;
TMethodList = Array[0..$00FFFFFF] of TMethod;
// TPHXMethodList
//------------------------------------------------------------------------------
TPHXMethodList = class
private
FCount : Integer;
FCapacity: Integer;
FList: PMethodList;
Procedure Grow;
procedure SetCapacity(const Value: Integer);
procedure SetCount (const Value: Integer);
function GetItem(Index: integer): TMethod;
procedure SetItem(Index: Integer; const AValue: TMethod);
public
constructor Create;
destructor Destroy; override;
Procedure Clear;
// Add a method to the list
procedure Add(const AMethod: TMethod);
// Remove a method from the list
procedure Remove(const AMethod: TMethod);
// Returns the index of a method in the list, -1 if not found
Function IndexOf(const AMethod: TMethod): Integer;
// Number of items in the list
Property Count : Integer read FCount write SetCount;
// The capacity of the list
Property Capacity: Integer read FCapacity write SetCapacity;
// The internal list
Property List: PMethodList read FList;
// Gets and sets items in the list
Property Items[Index: Integer]: TMethod read GetItem write SetItem; default;
end;
[/code]
Bookmarks