Skip to content

TBoldList

Unit: BoldSystem

Declaration

TBoldList = class(TBoldMember)

Hierarchy

  1. TObject
  2. TBoldMemoryManagedObject
  3. TBoldFlaggedObject
  4. TBoldSubscribableObject
  5. TBoldElement
  6. TBoldDomainElement
  7. TBoldMember
  8. TBoldList
  9. Direct subclasses
  10. TBoldElementList
  11. TBoldMemberList
  12. TBoldObjectList
  13. TBoldTypeList

Properties

Name Summary Notes
CanCreateNew If CreateNew is allowed read-only
Count Number of elements in the list. read-only
DuplicateMode When an element that is already in the list is added, DuplicateMode determines how the list will behave.
Elements
ListController protected

CanCreateNew

property CanCreateNew: Boolean;

Returns True if CreateNew is allowed. Reasons for it not being allowed includes: The type of the elements is unknown, or abstract; the list is read-only.

Count

property Count: Integer;

Number of elements in the list.

DuplicateMode

property DuplicateMode: TBoldListDupMode;

When an element that is already in the list is added, DuplicateMode determines how the list will behave.

  • bldmAllow - The list allows elements to appear in the list more than once
  • bldmMerge - Nothing will happen when adding an element that is already in the list
  • bldmError - It is an error to add an element that is already in the list

Elements

property Elements[index:Integer]: TBoldElement;

The default property of the list.

ListController

property ListController: TBoldListController;

Methods

Name Summary Notes
Add Adds an element to the list.
AddElement Internal method for adding an element to the list, implemented by subclasses. protected, abstract
AddList Adds all the elements in List to self. virtual
AddNew Creates an adds an element to the list.
AddToStrings Adds the contents of the list to a TStrings.
AllocateData Bold-internal protected, virtual
CanClear Indicates if it is allowed to clear the list.
CanInsert Indicates if inserting the element is allowed. virtual
CanMove Indicates f moving an element is allowed. virtual
CanRemove Indicates if removing an element is allowed. virtual
CanSet Indicates if replacing the element at a given position is allowed. virtual
Clear Empties the list
CreateNew Bold-internal protected, virtual
DefaultSubscribe Overrides TBoldElement.DefaultSubscribe. override
Destroy Destructor override
DuplicateControl Bold-internal convenience method protected
EnsureCanCreateNew Bold-internal convenience method protected
EnsureRange Optimized EnsureCurrent virtual
FreeData Bold-internal protected, abstract
GetAsList Overrides TBoldElement.GetAsList override
GetCanCreateNew protected, virtual
GetCount Get-method for the Count property. protected, abstract
GetElement Get-method for the Element property protected, abstract
GetStringRepresentation Overrides TBoldElement.GetStringRepresentation protected, override
Includes True if Element is in the list
IncludesElement Internal method for testing if an element is in the list, implmented by subclasses. protected, abstract
IndexOf Return the position of Item in the list.
IndexOfElement Internal method for getting the index of an element in the list, implemented by subclasses. protected, abstract
InitializeMember Overrides TBoldMember.InitializeMember protected, override
Insert Inserts element in a given position in the list.
InsertElement Internal method for inserting an element, implemented by subclasses. protected, abstract
InsertNew Creates a new element and inserts it into the list abstract
InternalAddNew Internal method for adding a new element to the list, implemented by subclasses. protected, abstract
InternalClear protected, abstract
MakeContentsImmutable
Move Changes the position of an element in the list. abstract
Remove Removes the element from the list virtual
RemoveByIndex Removes the element at a given position from the list. abstract
SetElement Set-method for the Elements property. protected, abstract
Sort Sorts the list
ToStrings Makes the TStrings S contain the elements in the list and their string representations Representation.
ToStringsWithNil Same as ToStrings, except that it adds a nil element, with NilString, as the first element in S .

Add

procedure Add(Element: TBoldElement);

Elements will be added at the end of the list

AddElement

procedure AddElement(Element: TBoldElement); virtual; abstract;

Internal method for adding an element to the list, implemented by subclasses.

AddList

procedure AddList(List: TBoldList); virtual;

Adds all the elements in List to self.

If the list is immutable, the call will fail with an exception.

AddNew

function AddNew: TBoldElement;

If the list allows adding new elements, an element of the list's type will be created and added to the list.

If adding an element is not allowed an exception and a BoldFailure will be raised.

Reasons for failure includes that the list is immutable or the type of the requested element is abstract.

AddToStrings

procedure AddToStrings(Representation: TBoldRepresentation; S: TStrings);

Will add the elements and their string representations to the TStrings S.

AllocateData

procedure AllocateData; virtual;

Bold-internal

CanClear

function CanClear(Subscriber: TBoldSubscriber): Boolean;

You can make MayClear return false, and thus prohibit Clear on a TBoldList, by subscribing to the bqMayClear query and returning false.

CanInsert

function CanInsert(index: Integer; Element: TBoldElement; Subscriber: TBoldSubscriber): Boolean; virtual;

Returns True if Element may be inserted in position **index** in the list. A programmer can disallow Insert by subscribing to the bqMayInsert query. If a Subscriber is passed to the function, subscriptions will be placed to notify when the result of MayInsert may have changed.

CanMove

function CanMove(CurIndex, NewIndex: Integer; Subscriber: TBoldSubscriber = nil): Boolean; virtual;

Returns True if the element in position CurIndex may be moved to position NewIndex in the list. A programmer can disallow Move by subscribing to the bqMayMove query. If a Subscriber is passed to the function, subscriptions will be placed to notify when the result of MayMove may have changed.

CanRemove

function CanRemove(index: Integer; Subscriber: TBoldSubscriber): Boolean; virtual;

Returns True if the element in position **index** may be removed from the list. A programmer can disallow Remove by subscribing to the bqMayRemove query. If a Subscriber is passed to the function, subscriptions will be placed to notify when the result of MayRemove may have changed.

CanSet

function CanSet(index: Integer; Item: TBoldElement; Subscriber: TBoldSubscriber): Boolean; virtual;

Returns True if the element in position **index** in the list may be replaced by Item. This corresponds to assigning to the Elements array property. A programmer can disallow this by subscribing to the bqMayReplace query. If a Subscriber is passed to the function, subscriptions will be placed to notify when the result of MayReplace may have changed.

Clear

procedure Clear;

Clear removes all elements from the list.

CreateNew

function CreateNew: TBoldElement; virtual;

Bold-internal. Used by AddNew.

DefaultSubscribe

procedure DefaultSubscribe(Subscriber: TBoldSubscriber; RequestedEvent: TBoldEvent = breReEvaluate); override; See also Ancestor Method

DefaultSubscribe on TBoldList will subscribe to the events beItemAdded, beItemDeleted, beItemReplaced and beOrderChanged.

See Also

  • Subscriptions

Destroy

destructor Destroy; override; See also Ancestor Method

Destructor

DuplicateControl

function DuplicateControl: Boolean;

Bold-internal convenience method

EnsureCanCreateNew

procedure EnsureCanCreateNew;

Bold-internal convenience method

EnsureRange

procedure EnsureRange(FromIndex: integer; ToIndex: integer); virtual;

If some of the elements in the range are invalid, they will be made current. This is efficient, as it will fetch all objects at once, rather than one at a time.

FreeData

procedure FreeData; virtual; abstract;

Bold-internal

GetAsList

procedure GetAsList(ResultList: TBoldIndirectElement); override; See also Ancestor Method

ResultList's value will be the list.

GetCanCreateNew

function GetCanCreateNew: Boolean; virtual;

private

GetCount

function GetCount: Integer; virtual; abstract;

Get-method for the Count property.

GetElement

function GetElement(index: Integer): TBoldElement; virtual; abstract;

Get-method for the Element property. Implemented by subclasses.

GetStringRepresentation

function GetStringRepresentation(Representation: TBoldRepresentation): string; override; See also Ancestor Method

Overrides GetStringRepresentation.

Includes

function Includes(Item: TBoldElement): Boolean;

This function returns true if Elementis a member of the list. Includes may be considerably faster than checking IndexOf<> -1 as it can make smarter use of existing indexes.

IncludesElement

function IncludesElement(Item: TBoldElement): Boolean; virtual; abstract;

Internal method for testing if an element is in the list, implmented by subclasses.

IndexOf

function IndexOf(Item: TBoldElement): Integer;

Return the position of Item in the list, or -1 if item is not in the list. If there are multiple occurences of Item, IndexOf will return the index of the first occurence.

IndexOfElement

function IndexOfElement(Item: TBoldElement): Integer; virtual; abstract;

Internal method for getting the index of an element in the list, implemented by subclasses.

InitializeMember

procedure InitializeMember(AOwningElement: TBoldDomainElement; ElementTypeInfo: TBoldElementTypeInfo); override; See also Ancestor Method

Overrides InitializeMember

Insert

procedure Insert(index: Integer; Element: TBoldElement);

Inserts element in a position **index**in the list.

InsertElement

procedure InsertElement(index: Integer; Element: TBoldElement); virtual; abstract;

Internal method for inserting an element, implemented by subclasses.

InsertNew

procedure InsertNew(index: Integer); virtual; abstract;

If the list type's element type is a concrete type, an element of this type will be created and inserted in the list.

InternalAddNew

function InternalAddNew: TBoldElement; virtual; abstract;

Internal method for adding a new element to the list, implemented by subclasses.

InternalClear

procedure InternalClear; virtual; abstract;

MakeContentsImmutable

procedure MakeContentsImmutable;

Move

procedure Move(CurIndex, NewIndex: Integer); virtual; abstract;

Moves the element with index CurIndex to the position NewIndex in the list. Elements between CurIndex and NewIndex will have their index shifted by one.

Remove

procedure Remove(Item: TBoldElement); virtual;

Element is removed from the list. If Element is not a member of the list an exception is raised.

RemoveByIndex

procedure RemoveByIndex(index: Integer); virtual; abstract;

Removes the element at position **Index** from the list. If **Index** is outside the list the result is undefined.

SetElement

procedure SetElement(index: Integer; Value: TBoldElement); virtual; abstract;

Set-method for the Elements property. Implemented by subclasses.

Sort

procedure Sort(CompareFunc: TBoldElementCompare);

Sorts the elements in the list according to CompareFunc.

Note
For an ordered association, this actually changes the internal order between the objects. So, for display purposes, make a copy of the list and sort and display the copy instead.

ToStrings

procedure ToStrings(Representation: TBoldRepresentation; S: TStrings);

Makes the TStrings S contain the elements in the list and their string representations Representation. The difference between this method and AddToStrings is that it will remove any existing data in S.

ToStringsWithNil

procedure ToStringsWithNil(Representation: TBoldRepresentation; S: TStrings; nilString: string);

Same as ToStrings, except that it adds a nil element, with NilString, as the first element in S.


Generated from the Bold 4.0 help (Help/BfD.chm) by Tools/chm2mkdocs.py; member lists reflect Bold 4.0, see the source for members added since.