Declaration¶
Source position: contnrs.pp line 39
type
TFPObjectList = class(TObject)
public
constructor Create;
constructor Create(FreeObjects: Boolean);
destructor Destroy;
procedure Clear;
function Add : Integer;
procedure Delete;
procedure Exchange;
function Expand : TFPObjectList;
function Extract : TObject;
function Remove : Integer;
function IndexOf : Integer;
function FindInstanceOf : Integer;
procedure Insert;
function First : TObject;
function Last : TObject;
procedure Move;
procedure Assign;
procedure Pack;
procedure Sort;
procedure ForEachCall(proc2call: TObjectListCallback; arg: pointer);
procedure ForEachCall(proc2call: TObjectListStaticCallback;
arg: pointer);
property Capacity: Integer; {rw}
property Count: Integer; {rw}
property OwnsObjects: Boolean; {rw}
property Items[Index : Integer]: TObject; {rw}
property List: TFPList; {r}
end;
Inheritance¶
Description¶
TFPObjectList is a TFPList based list which has as the default array property TObjects instead of pointers. By default it also manages the objects: when an object is deleted or removed from the list, it is automatically freed. This behaviour can be disabled when the list is created.
In difference with TObjectList, TFPObjectList offers no notification mechanism of list operations, allowing it to be faster than TObjectList. For the same reason, it is also not a descendent of TFPList (although it uses one internally).
Properties¶
| Member | Visibility | Description |
|---|---|---|
| Capacity | public | Capacity of the list. |
| Count | public | Number of elements in the list. |
| Items | public | Indexed access to the elements of the list. |
| List read only | public | Internal list used to keep the objects. |
| OwnsObjects | public | Should the list free elements when they are removed. |
Methods¶
| Member | Visibility | Description |
|---|---|---|
| Add | public | Add an object to the list. |
| Assign | public | Copy the contents of a list. |
| Clear | public | Clear all elements in the list. |
| Create | public | Create a new object list. |
| Delete | public | Delete an element from the list. |
| Destroy | public | Clears the list and destroys the list instance. |
| Exchange | public | Exchange the location of two objects. |
| Expand | public | Expand the capacity of the list. |
| Extract | public | Extract an object from the list. |
| FindInstanceOf | public | Search for an instance of a certain class. |
| First | public | Return the first non-nil object in the list. |
| ForEachCall | public | For each object in the list, call a method or procedure, passing it the object. |
| IndexOf | public | Search for an object in the list. |
| Insert | public | Insert a new object in the list. |
| Last | public | Return the last non-nil object in the list. |
| Move | public | Move an object to another location in the list. |
| Pack | public | Remove all Nil references from the list. |
| Remove | public | Remove an item from the list. |
| Sort | public | Sort the list of objects. |
See also¶
| Name | Description |
|---|---|
| #rtl.classes.TFPList | |
| TObjectList | List to manage object instances. |