TFPGList
[Properties (by Name)][Methods (by Name)][Events (by Name)]
Generic list
Declaration
Source position: fgl.pp line 123
Type
generic TFPGList<T> = class (TFPSList)
private
TCompareFunc = function(const Item1: T; const Item2: T) : Integer;
PT = ^T;
TTypeList = PT;
PTypeList = ^TTypeList;
protected
FOnCompare : TCompareFunc;
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
TFPGListEnumeratorSpec = specialize TFPGListEnumerator<;
constructor Create;
class function ItemIsManaged : Boolean; Override;
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 Assign(Source: TFPGList);
procedure AddList(Source: TFPGList);
function Remove(const Item: T) : Integer;
procedure Sort(Compare: TCompareFunc);
procedure Sort(Compare: TCompareFunc;
SortingAlgorithm: PSortingAlgorithm);
Items[Index: Integer]: T; default;
List : PTypeList;
end
;
Description
TFPGList can be used to specialize a list for any 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
Members
| Member | Type | Visibility | Description |
|---|---|---|---|
| Add | Method | public | Add new item of type T to the list. |
| AddList | Method | public | Adds the elements from another list |
| Assign | Method | public | Copy elements from Source list |
| CopyItem | Method | protected | |
| Create | Method | public | Instantiate a new list |
| Deref | Method | protected | |
| Extract | Method | public | Extract an item from the list |
| First | Property | public | First non-empty item |
| FOnCompare | Field | protected | |
| 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 item in the list |
| ItemIsManaged | Method | public | |
| ItemPtrCompare | Method | protected | |
| Items | Property | public | Indexed access to items in the list |
| Last | Property | public | Last non-empty item |
| List | Property | public | Internal list object |
| PT | Type | private | |
| PTypeList | Type | private | |
| Put | Method | protected | |
| Remove | Method | public | Remove an item from the list. |
| SetFirst | Method | protected | |
| SetLast | Method | protected | |
| Sort | Method | public | Sort the list |
| TCompareFunc | Type | private | |
| TFPGListEnumeratorSpec | Type | public | |
| TTypeList | Type | private |
Inheritance
| Class | Description |
|---|---|
| TFPGList | Generic list |
See also
| Name | Description |
|---|---|
| classes.TFPList | Class to manage collections of pointers. |
| TFPSList | Basic list of memory blocks |