Sign in Join
FPDoc Onlineexperiment

TList class

In unit Classes

Class to manage collections of pointers.

Declaration

pascal
TList = class(TObject)

Inheritance

  1. TList
  2. TObject

Descends from it: TClassList TIcnsList TImageCacheItems TIniFileKeyList TIniFileSectionList TListWithEvent TMenuItems TMonitorList TObjectList TPropertiesToSkip TRefCntObjList

Description

TList 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. It has an event notification mechanism which allows to notify of list changes. This slows down some of TList mechanisms, and if no notification is used, TFPList may be used instead.

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
Growprotected
Putprotected
Notifyprotected
SetCapacityprotected
GetCapacityprotected
SetCountprotected
GetCountprotected
GetListprotected
CreatepublicClass to manage collections of pointers.
DestroypublicDestroys the list and releases the memory used to store the list elements.
FPOAttachObserverpublicAdd an observer to the list of observers.
FPODetachObserverpublicRemove an observer from the list of observers.
FPONotifyObserverspublicNotify observers of changes in the list.
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.
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.
AssignpublicCopy the contents of other lists.
RemovepublicRemoves a value from the list.
PackpublicRemoves Nil pointers from the list and frees unused memory.
SortpublicSorts the pointers in the list.

Inherited

From TObject (40)

AfterConstruction BeforeDestruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance 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.