Skip to content

TCollection

Manage a collection of pointers of objects.

Declaration

Source position: objects.pp line 444

type

  TCollection = object(TObject)
    Items: PItemList = ^TItemList;
    Count: Sw_Integer = LongInt;
    Limit: Sw_Integer = LongInt;
    Delta: Sw_Integer = LongInt;
    constructor Init;
    constructor Load;
    destructor Done;
    function At : Pointer;
    function IndexOf : Sw_Integer;
    function GetItem : Pointer;
    function LastThat : Pointer;
    function FirstThat : Pointer;
    procedure Pack;
    procedure FreeAll;
    procedure DeleteAll;
    procedure Free;
    procedure Insert;
    procedure Delete;
    procedure AtFree;
    procedure FreeItem;
    procedure AtDelete;
    procedure ForEach;
    procedure SetLimit;
    procedure Error;
    procedure AtPut;
    procedure AtInsert;
    procedure Store;
    procedure PutItem;
  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.

Methods

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

Fieldss

Member Visibility Description
Count default Current count of items.
Delta default Number of pointers to allocate when adding items.
Items default Pointer to list of items.
Limit default Max number of items.
See all Fieldss