Units
Classes, Interfaces, Objects
Types
Variables
Constants
Functions, Procedures
Identifiers

Class TExList

Unit

rjExLists

Declaration

type TExList = class(TExContainer)

Description

Base class for doubly-linked list containers.

Hierarchy

TExContainer > TErrorObject

Fields

NameDescription
FPFirstNode  
FPLastNode  

Methods

Overview

destructor Destroy; override;
procedure Clear; virtual;
procedure Delete(const PItem: Pointer);
procedure DeleteFirst;
procedure DeleteLast;
function Exists(const PExtraData: Pointer; const Same: TExSameItemsFunc): Boolean;
function ExistsBack(const PExtraData: Pointer; const Same: TExSameItemsFunc): Boolean;
function ExistsBackFrom(const PStartItem, PExtraData: Pointer; const Same: TExSameItemsFunc): Boolean;
function ExistsFrom(const PStartItem, PExtraData: Pointer; const Same: TExSameItemsFunc): Boolean;
function InsertItemAfter(const PItem: Pointer): Pointer;
function InsertItemBefore(const PItem: Pointer): Pointer;
function InsertItemFirst: Pointer;
function InsertItemLast: Pointer;
procedure InternalConnectNodeAfter(const PNode: PListNode; PDestinationNode: PListNode);
procedure InternalConnectNodeBefore(const PNode: PListNode; PDestinationNode: PListNode);
procedure InternalConnectNodeFirst(const PNode: PListNode);
procedure InternalConnectNodeLast(const PNode: PListNode);
procedure InternalDisconnectNode(const PNode: PListNode);
procedure InternalRemove(const StartNode: PListNode; const PExtraData: Pointer; const Same: TExSameItemsFunc);
procedure InternalRemoveBack(const StartNode: PListNode; const PExtraData: Pointer; const Same: TExSameItemsFunc);
function Iterate(const PStartItem, PExtraData: Pointer; const CallBack: TExIterateProc): Pointer;
function IterateBack(const PStartItem, PExtraData: Pointer; const CallBack: TExIterateProc): Pointer;
function LoadFromFile(const FileName: AnsiString): Boolean;
function LoadFromStream(const Stream: TStream): Boolean; virtual;
procedure MoveAfter(const PSourceItem, PTargetItem: Pointer);
procedure MoveBefore(const PSourceItem, PTargetItem: Pointer);
procedure MoveFirst(const PItem: Pointer);
procedure MoveLast(const PItem: Pointer);
function PFirstItem: Pointer;
function PItemBackFromOf(const PStartItem, PExtraData: Pointer; const Same: TExSameItemsFunc): Pointer;
function PItemBackOf(const PExtraData: Pointer; const Same: TExSameItemsFunc): Pointer;
function PItemFromOf(const PStartItem, PExtraData: Pointer; const Same: TExSameItemsFunc): Pointer;
function PItemOf(const PExtraData: Pointer; const Same: TExSameItemsFunc): Pointer;
function PLastItem: Pointer;
class function PNextItem(const PItem: Pointer): Pointer;
class function PPreviousItem(const PItem: Pointer): Pointer;
procedure RemoveAll(const PExtraData: Pointer; const Same: TExSameItemsFunc);
procedure RemoveBackAll(const PExtraData: Pointer; const Same: TExSameItemsFunc);
procedure RemoveBackFromAll(const PStartItem, PExtraData: Pointer; const Same: TExSameItemsFunc);
procedure RemoveFromAll(const PStartItem, PExtraData: Pointer; const Same: TExSameItemsFunc);
procedure SaveToFile(const FileName: AnsiString);
procedure SaveToStream(const Stream: TStream); virtual;
procedure Sort(const Compare: TExCompareItemsFunc);
procedure SortDesc(const Compare: TExCompareItemsFunc);

Description

destructor Destroy; override;

Destroys an instance of TExList.

procedure Clear; virtual;

Deletes all Items from a list container.

If OnFreeItem is assigned, it will be called for each Item starting with the first and all Items will be freed / finalized accordingly.

procedure Delete(const PItem: Pointer);

Removes the Item pointed to by the Item parameter from the container.

Call Delete to remove a single Item from the vector. If the OnFreeItem procedure is assigned, it will be called for the Item and the Item will be freed / finalized accordingly.

Item must no be nil and must point to an Item in the container. If Item is nil or the container is empty, i.e. Count is zero, an exception will be raised if the rjExContainer Library was compiled with the directive "RangeChecking" defined (default).

See also:

procedure DeleteFirst;

Removes the container's first Item from the container.

Call DeleteFirst to remove the first Item from the container. If the OnFreeItem procedure is assigned, it will be called for the Item and the Item will be freed / finalized accordingly. DeleteFirst corresponds to a call of MyContainer.Delete(MyContainer.First).

The container must not be empty, i.e. Count must not be zero. An exception will be raised if the container is empty and the rjExContainer Library was compiled with the directive "RangeChecking" defined (default).

See also:

procedure DeleteLast;

Removes the container's last Item from the container.

Call DeleteLast to remove the last Item from the container. If the OnFreeItem procedure is assigned, it will be called for the Item and the Item will be freed / finalized accordingly. DeleteLast corresponds to a call of MyContainer.Delete(MyContainer.Last).

The container must not be empty, i.e. Count must not be zero. An exception will be raised if the container is empty and the rjExContainer Library was compiled with the directive "RangeChecking" defined (default).

See also:

function Exists(const PExtraData: Pointer; const Same: TExSameItemsFunc): Boolean;

 

function ExistsBack(const PExtraData: Pointer; const Same: TExSameItemsFunc): Boolean;

 

function ExistsBackFrom(const PStartItem, PExtraData: Pointer; const Same: TExSameItemsFunc): Boolean;

 

function ExistsFrom(const PStartItem, PExtraData: Pointer; const Same: TExSameItemsFunc): Boolean;

 

function InsertItemAfter(const PItem: Pointer): Pointer;

 

function InsertItemBefore(const PItem: Pointer): Pointer;

 

function InsertItemFirst: Pointer;

 

function InsertItemLast: Pointer;

 

procedure InternalConnectNodeAfter(const PNode: PListNode; PDestinationNode: PListNode);

Connects PNode in after PDestinationNode. If PDestinationNode is nil, PNode will be connected as the last node in the list.

This is an internal procedure: No rangechecking takes place, PNode must not be nil and PDestinationNode must be a node of this list.

procedure InternalConnectNodeBefore(const PNode: PListNode; PDestinationNode: PListNode);

Connects PNode in front of PDestinationNode. If PDestinationNode is nil, PNode will be connected as the first node in the list.

This is an internal procedure: No rangechecking takes place, PNode must not be nil and PDestinationNode must be a node of this list.

procedure InternalConnectNodeFirst(const PNode: PListNode);

Connects PNode as the first node in the list.

This is an internal procedure: No rangechecking takes place, PNode must not be nil.

procedure InternalConnectNodeLast(const PNode: PListNode);

Connects PNode as the last node in the list.

This is an internal procedure: No rangechecking takes place, PNode must not be nil.

procedure InternalDisconnectNode(const PNode: PListNode);

Disconnects PNode from its previous and next nodes.

This is an internal procedure: No rangechecking takes place and PNode must not be nil.

procedure InternalRemove(const StartNode: PListNode; const PExtraData: Pointer; const Same: TExSameItemsFunc);

 

procedure InternalRemoveBack(const StartNode: PListNode; const PExtraData: Pointer; const Same: TExSameItemsFunc);

 

function Iterate(const PStartItem, PExtraData: Pointer; const CallBack: TExIterateProc): Pointer;

 

function IterateBack(const PStartItem, PExtraData: Pointer; const CallBack: TExIterateProc): Pointer;

 

function LoadFromFile(const FileName: AnsiString): Boolean;

 

function LoadFromStream(const Stream: TStream): Boolean; virtual;

 

procedure MoveAfter(const PSourceItem, PTargetItem: Pointer);

Moves the Item pointed to by PSourceItem after the Item pointed to by PTargetItem.

procedure MoveBefore(const PSourceItem, PTargetItem: Pointer);

Moves the Item pointed to by PSourceItem before the Item pointed to by PTargetItem.

procedure MoveFirst(const PItem: Pointer);

Moves the Item pointed to by Item to the front of all Items in the container, i.e. makes it the first Item in the container.

procedure MoveLast(const PItem: Pointer);

Moves the Item pointed to by Item to the end of all Items in the container, i.e. makes it the last Item in the container.

function PFirstItem: Pointer;

Returns a pointer to the first Item in the container. If there is no first Item (i.e. the container is empty), the result is nil.

function PItemBackFromOf(const PStartItem, PExtraData: Pointer; const Same: TExSameItemsFunc): Pointer;

 

function PItemBackOf(const PExtraData: Pointer; const Same: TExSameItemsFunc): Pointer;

 

function PItemFromOf(const PStartItem, PExtraData: Pointer; const Same: TExSameItemsFunc): Pointer;

 

function PItemOf(const PExtraData: Pointer; const Same: TExSameItemsFunc): Pointer;

 

function PLastItem: Pointer;

Returns a pointer to the last Item in the container. If there is no last Item (i.e. the container is empty), the result is nil.

class function PNextItem(const PItem: Pointer): Pointer;

Returns a pointer to the Item after the Item pointed to by Item. If there is no next Item (i.e. Item is the last Item in the container), the result is nil.

class function PPreviousItem(const PItem: Pointer): Pointer;

Returns a pointer to the Item before the Item pointed to by Item. If there is no previous Item (i.e. Item is the first Item in the container), the result is nil.

procedure RemoveAll(const PExtraData: Pointer; const Same: TExSameItemsFunc);

 

procedure RemoveBackAll(const PExtraData: Pointer; const Same: TExSameItemsFunc);

 

procedure RemoveBackFromAll(const PStartItem, PExtraData: Pointer; const Same: TExSameItemsFunc);

 

procedure RemoveFromAll(const PStartItem, PExtraData: Pointer; const Same: TExSameItemsFunc);

 

procedure SaveToFile(const FileName: AnsiString);

 

procedure SaveToStream(const Stream: TStream); virtual;

 

procedure Sort(const Compare: TExCompareItemsFunc);

 

procedure SortDesc(const Compare: TExCompareItemsFunc);

 

Properties

None.


rjExContainer Library Version 0.1
Copyright Ralf Junker 2000-2001
http://www.zeitungsjunge.de/delphi/