Online Help TEDIObjectList

Unit JclEDI

Types

TEDIObjectList

   The TEDIObjectList object manages a linked list of TEDIObjectListItem objects. By default this object will free any TEDIObjects that this list contains when it is destroyed.

   The TEDIObjectList objects are typically used by TEDIDataObjectGroup type objects.

 Function

function CreateListItem(PriorItem: TEDIObjectListItem;
  EDIObject: TEDIObject = nil): TEDIObjectListItem; virtual;

   Override CreateListItem in descendent classes to create the TEDIObjectListItem type object required for descendent TEDIObjectList types.

 Function

function GetItem(Index: Integer): TEDIObjectListItem;

   This function is used internally by TEDIObjectList and will get the item in the list by index. If the current item index is equal to the search index, then the current item will be returned. If the current item index is not equal to the search index, then the search will begin from the current item and progress to the beginning or the end of the list depending on the value of search index compared with the current index.

 Procedures and Functions

procedure Add(EDIObject: TEDIObject; Name: string = '');
function Extract(EDIObject: TEDIObject): TEDIObject; virtual;
procedure Remove(EDIObject: TEDIObject);
function IndexOf(EDIObject: TEDIObject): Integer;
procedure Clear;
procedure UpdateCount;

   Item management functions and procedures.

 Functions

function First(Index: Integer = 0): TEDIObjectListItem; virtual;
function Next: TEDIObjectListItem; virtual;
function Prior: TEDIObjectListItem; virtual;
function Last: TEDIObjectListItem; virtual;

   The navigation functions can be overridden to accommodate different TEDIObjectList descendent types without having to typecast.

 Functions

function FindItemByName(Name: string;
  StartItem: TEDIObjectListItem = nil): TEDIObjectListItem; virtual;
function ReturnListItemsByName(Name: string): TEDIObjectList; virtual;

   FindItemByName will return the first item matching the name parameter. Optionally start item can be specified to start searching from another position in the list.

   ReturnListItemsByName will return all items matching the name parameter. The TEDIObjectList that is returned does not own the objects contained in the original list.

 Procedures

procedure Insert(InsertIndex: Integer; EDIObject: TEDIObject);
procedure Delete(Index: Integer); overload;
procedure Delete(EDIObject: TEDIObject); overload;

   These procedures are used for dynamic array emulation. The EDI objects originally used dynamic arrays which were later replaced by the TEDIObjectList implementation. Existing code needed to remain compatible so these procedures help maintain compatibility with older code.

 Type, Property, and Procedure

TEDIDataObjectListOptions = set of (loAutoUpdateIndexes);
property Options: TEDIDataObjectListOptions read FOptions write FOptions;
procedure UpdateIndexes(StartItem: TEDIObjectListItem = nil);

   The loAutoUpdateIndexes flag is used with the dynamic array emulation routines. Normally the flag is set, however if many Insert or Delete operations need to be performed then the flag can be turned off to prevent UpdateIndexes from being repeatedly called. If the flag is turned off, it must be turned it back on after any mass inserts or deletes, and a call to UpdateIndexes will need to made.

 Properties

property Item[Index: Integer]: TEDIObjectListItem read GetItem;
property EDIObject[Index: Integer]: TEDIObject read GetEDIObject
  write SetEDIObject; default;

   Use the Item property to get the TEDIObjectListItem and use the EDIObject property to get only the TEDIObject for the item at the index.

Usage

Notes & Examples

< Under Construction >