TFPGObjectList

[Properties (by Name)][Methods (by Name)][Events (by Name)]

Generic object list

Declaration

Source position: fgl.pp line 166

Type
  generic TFPGObjectList<T> = class (TFPSList)
  private
    TCompareFunc = function(const Item1: T; const Item2: T) : Integer;
    PT = ^T;
    TTypeList = PT;
    PTypeList = ^TTypeList;
    TFPGListEnumeratorSpec = specialize TFPGListEnumerator<;
  protected
    FOnCompare : TCompareFunc;
    FFreeObjects : Boolean;
    procedure CopyItem(Src: Pointer; Dest: Pointer);  Override;
    procedure Deref(Item: Pointer);  Override;
    function Get(Index: Integer) : T;
    function GetList : PTypeList;
    function ItemPtrCompare(Item1: Pointer; Item2: Pointer) : Integer;
    procedure Put(Index: Integer; const Item: T);
    function GetLast : T;
    procedure SetLast(const Value: T);
    function GetFirst : T;
    procedure SetFirst(const Value: T);
  public
    constructor Create(FreeObjects: Boolean);
    function Add(const Item: T) : Integer;
    function Extract(const Item: T) : T;
    First : T;
    function GetEnumerator : TFPGListEnumeratorSpec;
    function IndexOf(const Item: T) : Integer;
    procedure Insert(Index: Integer; const Item: T);
    Last : T;
    procedure AddList(Source: TFPGObjectList);
    procedure Assign(Source: TFPGObjectList);
    function Remove(const Item: T) : Integer;
    procedure Sort(Compare: TCompareFunc);
    procedure Sort(Compare: TCompareFunc; 
                  SortingAlgorithm: PSortingAlgorithm);
    Items[Index: Integer]: T; default;
    List : PTypeList;
    FreeObjects : Boolean;
  end
  ;

Description

TFPGList can be used to specialize a list for any class type T that does not require reference counting (such as interfaced objects). It will specialize to a list with the same methods as TFPSList or classes.TFPList or TFPObjectList

Members

Member Type Visibility Description
Add Method public Add new object of class T to the list.
AddList Method public Adds the elements from another list
Assign Method public Copy objects from Source list
CopyItem Method protected
Create Method public Instantiate a new object list.
Deref Method protected
Extract Method public Extract an item from the list
FFreeObjects Field protected
First Property public First non-nil item
FOnCompare Field protected
FreeObjects Property public Does the list own the objects or not?
Get Method protected
GetEnumerator Method public Return a list enumerator for T.
GetFirst Method protected
GetLast Method protected
GetList Method protected
IndexOf Method public Index of item
Insert Method public Insert a new object in the list
ItemPtrCompare Method protected
Items Property public Indexed access to objects in the list.
Last Property public Last non-Nil object
List Property public Internal list pointer
PT Type private
PTypeList Type private
Put Method protected
Remove Method public Remove an object from the list.
SetFirst Method protected
SetLast Method protected
Sort Method public Sort the objects in the list
TCompareFunc Type private
TFPGListEnumeratorSpec Type private
TTypeList Type private

Inheritance

Class Description
TFPGObjectList Generic object list

See also

Name Description
classes.TFPList Class to manage collections of pointers.
TFPSList Basic list of memory blocks

results matching ""

    No results matching ""