Declaration¶
Source position: contnrs.pp line 82
type
TObjectList = class(TList)
public
constructor Create;
constructor Create(FreeObjects: Boolean);
function Add : Integer;
function Extract : TObject;
function Remove : Integer;
function IndexOf : Integer;
function FindInstanceOf : Integer;
procedure Insert;
function First : TObject;
function Last : TObject;
property OwnsObjects: Boolean; {rw}
property Items[Index : Integer]: TObject; {rw}
end;
Inheritance¶
Description¶
TObjectList is a TList descendent 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 TFPObjectList, TObjectList offers a notification mechanism of list change operations: insert, delete. This slows down bulk operations, so if the notifications are not needed, TFPObjectList may be more appropriate.
Properties¶
| Member | Visibility | Description |
|---|---|---|
| Items | public | Indexed access to the elements of the list. |
| OwnsObjects | public | Should the list free elements when they are removed. |
Methods¶
| Member | Visibility | Description |
|---|---|---|
| Add | public | Add an object to the list. |
| Create | public | Create a new object 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. |
| IndexOf | public | Search for an object in the list. |
| Insert | public | Insert an object in the list. |
| Last | public | Return the last non-nil object in the list. |
| Remove | public | Remove (and possibly free) an element from the list. |
See also¶
| Name | Description |
|---|---|
| #rtl.classes.TList | |
| TFPObjectList | TFPList descendent which manages objects. |
| TComponentList | List to manage component instances. |
| TClassList | List of classes. |