Sign in Join
FPDoc Onlineexperiment

TFPList class

In unit Classes

Class to manage collections of pointers.

Declaration

pascal
TFPList = class(TObject)

Inheritance

  1. TFPList
  2. TObject

Descends from it: TNamedItemList

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

Properties

CapacitypublicCurrent capacity (i.e. number of pointers that can be stored) of the list.
CountpublicCurrent number of pointers in the list.
ItemspublicProvides access to the pointers in the list.
ListpublicMemory array where pointers are stored.

Methods

Getprotected
Putprotected
SetCapacityprotected
SetCountprotected
RaiseIndexErrorprotected
CheckIndexprotected
DestroypublicDestroys the list and releases the memory used to store the list elements.
AddListpublicAdd all pointers from another list.
AddpublicAdds a new pointer to the list.
ClearpublicClears the pointer list.
DeletepublicRemoves a pointer from the list.
ErrorpublicRaises an exception.
ExchangepublicExchanges two pointers in the list.
ExpandpublicIncreases the capacity of the list if needed.
ExtractpublicRemove the first occurrence of a pointer from the list.
FirstpublicReturns the first non-nil pointer in the list.
GetEnumeratorpublicCreate an IEnumerator instance.
Containspublic
IndexOfpublicReturns the index of a given pointer.
IndexOfItempublicSearch an item in the list.
InsertpublicInserts a new pointer in the list at a given position.
LastpublicReturns the last non-nil pointer in the list.
MovepublicMoves a pointer from one position in the list to another.
AssignpublicAssign performs the given operation on the list.
RemovepublicRemoves a value from the list.
PackpublicRemoves Nil pointers from the list and frees unused memory.
SortpublicSorts the pointers in the list.
ForEachCallpublicCall a procedure or method for each pointer in the list.

Types and constants

TDirectionpublicSearch direction for IndexOfItem.

Inherited

From TObject (41)

AfterConstruction BeforeDestruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance Create DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName SafeCallException StringMessageTable SystemHasExtendedRTTI ToString UnitName

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.