TBoldList¶
Unit: BoldSystem
Declaration¶
Hierarchy¶
- TObject
TBoldMemoryManagedObjectTBoldFlaggedObject- TBoldSubscribableObject
- TBoldElement
- TBoldDomainElement
- TBoldMember
- TBoldList
- Direct subclasses
TBoldElementList- TBoldMemberList
- TBoldObjectList
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¶
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¶
Number of elements in the list.
DuplicateMode¶
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 oncebldmMerge- Nothing will happen when adding an element that is already in the listbldmError- It is an error to add an element that is already in the list
Elements¶
The default property of the list.
ListController¶
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¶
Elements will be added at the end of the list
AddElement¶
Internal method for adding an element to the list, implemented by subclasses.
AddList¶
Adds all the elements in List to self.
If the list is immutable, the call will fail with an exception.
AddNew¶
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¶
Will add the elements and their string representations to the TStrings S.
AllocateData¶
Bold-internal
CanClear¶
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¶
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¶
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¶
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¶
Clear removes all elements from the list.
CreateNew¶
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
DuplicateControl¶
Bold-internal convenience method
EnsureCanCreateNew¶
Bold-internal convenience method
EnsureRange¶
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¶
Bold-internal
GetAsList¶
ResultList's value will be the list.
GetCanCreateNew¶
private
GetCount¶
Get-method for the Count property.
GetElement¶
Get-method for the Element property. Implemented by subclasses.
GetStringRepresentation¶
function GetStringRepresentation(Representation: TBoldRepresentation): string; override; See also Ancestor Method
Overrides GetStringRepresentation.
Includes¶
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¶
Internal method for testing if an element is in the list, implmented by subclasses.
IndexOf¶
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¶
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¶
Inserts element in a position **index**in the list.
InsertElement¶
Internal method for inserting an element, implemented by subclasses.
InsertNew¶
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¶
Internal method for adding a new element to the list, implemented by subclasses.
InternalClear¶
MakeContentsImmutable¶
Move¶
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¶
Element is removed from the list. If Element is not a member of the list an exception is raised.
RemoveByIndex¶
Removes the element at position **Index** from the list. If **Index** is outside the list the result is undefined.
SetElement¶
Set-method for the Elements property. Implemented by subclasses.
Sort¶
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¶
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¶
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.