TCollection

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

Manage a collection of pointers of objects

Declaration

Source position: objects.pp line 430

Type
  TCollection = object (TObject)
    Items : PItemList;
    Count : Sw_Integer;
    Limit : Sw_Integer;
    Delta : Sw_Integer;
    constructor Init(ALimit: Sw_Integer; ADelta: Sw_Integer);
    constructor Load(var S: TStream);
    destructor Done;  Virtual;
    function At(Index: Sw_Integer) : Pointer;
    function IndexOf(Item: Pointer) : Sw_Integer;  Virtual;
    function GetItem(var S: TStream) : Pointer;  Virtual;
    function LastThat(Test: TCallbackFunBoolParam) : Pointer;
    function FirstThat(Test: TCallbackFunBoolParam) : Pointer;
    procedure Pack;
    procedure FreeAll;
    procedure DeleteAll;
    procedure Free(Item: Pointer);
    procedure Insert(Item: Pointer);  Virtual;
    procedure Delete(Item: Pointer);
    procedure AtFree(Index: Sw_Integer);
    procedure FreeItem(Item: Pointer);  Virtual;
    procedure AtDelete(Index: Sw_Integer);
    procedure ForEach(Action: TCallbackProcParam);
    procedure SetLimit(ALimit: Sw_Integer);  Virtual;
    procedure Error(Code: Integer; Info: Integer);  Virtual;
    procedure AtPut(Index: Sw_Integer; Item: Pointer);
    procedure AtInsert(Index: Sw_Integer; Item: Pointer);
    procedure Store(var S: TStream);
    procedure PutItem(var S: TStream; Item: Pointer);  Virtual;
  end
  ;

Description

The TCollection object manages a collection of pointers or objects. It also provides a series of methods to manipulate these pointers or objects.

Whether or not objects are used depends on the kind of calls you use. All kinds come in 2 flavors, one for objects, one for pointers.

Members

Member Type Visibility Description
At Method default Return the item at a certain index.
AtDelete Method default Delete item at certain position.
AtFree Method default Free an item at the indicates position, calling it's destructor.
AtInsert Method default Insert an element at a certain position in the collection.
AtPut Method default Set collection item, overwriting an existing value.
Count Field default Current count of items
Delete Method default Delete an item from the collection, but does not destroy it.
DeleteAll Method default Delete all elements from the collection. Objects are not destroyed.
Delta Field default Number of pointers to allocate when adding items.
Done Method default Clean up collection, release all memory.
Error Method default Set error code.
FirstThat Method default Return first item which matches a test.
ForEach Method default Execute procedure for each item in the list.
Free Method default Free item from collection, calling it's destructor.
FreeAll Method default Release all objects from the collection.
FreeItem Method default Destroy a non-nil item.
GetItem Method default Read one item off the stream.
IndexOf Method default Find the position of a certain item.
Init Method default Instantiate a new collection.
Insert Method default Insert a new item in the collection at the end.
Items Field default Pointer to list of items.
LastThat Method default Return last item which matches a test.
Limit Field default Max number of items
Load Method default Initialize a new collection and load collection from a stream.
Pack Method default Remove all >Nil pointers from the collection.
PutItem Method default Put one item on the stream
SetLimit Method default Set maximum number of elements in the collection.
Store Method default Write collection to a stream.

Inheritance

Class Description
TCollection Manage a collection of pointers of objects