Unit 'Classes' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#rtl]

TFPList

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

Class to manage collections of pointers.

Declaration

Source position: classesh.inc line 504

type TFPList = class(TObject)

public

type

  TDirection = (

  

Search direction for IndexOfItem.

  FromBeginning,

  

Start search at the beginning.

  FromEnd

  

Start search at the end.

);

public

  destructor Destroy; override;

  

Destroys the list and releases the memory used to store the list elements.

  procedure AddList();

  

Add all pointers from another list.

  function Add();

  

Adds a new pointer to the list.

  procedure Clear;

  

Clears the pointer list.

  procedure Delete();

  

Removes a pointer from the list.

  class procedure Error();

  

Raises an EListError exception.

  procedure Exchange();

  

Exchanges two pointers in the list.

  function Expand;

  

Increases the capacity of the list if needed.

  function Extract();

  

Remove the first occurrence of a pointer from the list.

  function First;

  

Returns the first non-nil pointer in the list.

  function GetEnumerator;

  

Create an IEnumerator instance.

  function IndexOf();

  

Returns the index of a given pointer.

  function IndexOfItem();

  

Search an item in the list.

  procedure Insert();

  

Inserts a new pointer in the list at a given position.

  function Last;

  

Returns the last non-nil pointer in the list.

  procedure Move();

  

Moves a pointer from one position in the list to another.

  procedure Assign();

  

Assign performs the given operation on the list.

  function Remove();

  

Removes a value from the list.

  procedure Pack;

  

Removes Nil pointers from the list and frees unused memory.

  procedure Sort();

  

Sorts the pointers in the list.

  procedure ForEachCall();

  

Call a procedure or method for each pointer in the list.

  property Capacity: Integer; [rw]

  

Current capacity (i.e. number of pointers that can be stored) of the list.

  property Count: Integer; [rw]

  

Current number of pointers in the list.

  property Items []: Pointer; default; [rw]

  

Provides access to the pointers in the list.

  property List: PPointerList; [r]

  

Memory array where pointers are stored.

end;

Inheritance

TFPList

  

Class to manage collections of pointers.

|

TObject

  

Base class of all classes.

Description

TFPList is a class that can be used to manage collections of pointers. It introduces methods and properties to store the pointers, search in the list of pointers, sort them. It manages its memory by itself, no intervention for that is needed. Contrary to TList, TFPList has no notification mechanism. If no notification mechanism is used, it is better to use TFPList instead of TList, as the performance of TFPList is much higher.

To manage collections of strings, it is better to use a TStrings descendant such as TStringList. To manage general objects, a TCollection class exists, from which a descendant can be made to manage collections of various kinds.

See also

TStrings

  

Class to manage arrays or collections of strings.

TCollection

  

Base class to manage collections of named objects.


Documentation generated on: Oct 27 2024