Skip to content

TBoldIndirectElement

Reference to a TBoldElement

Unit: BoldElements

Declaration

TBoldIndirectElement = class(TBoldFlaggedObject)

Hierarchy

  1. TObject
  2. TBoldMemoryManagedObject
  3. TBoldFlaggedObject
  4. TBoldIndirectElement

Description

A TBoldIndirectElement may either own its Value, or refer to an existing TBoldElement that is owned by someone else. A common use of a TBoldIndirectElement is to use it for returning the result of evaluating an expression Evaluate A TBoldIndirectElement can be created by anyone. When destroyed, it might or might not cascade the destroy to its value depending on whether the value is owned or not (but this is somehting determined by the Evaluate-method, and not the creator of the indirect element.

Properties

Name Summary Notes
OwnsValue True if the indirect element owns the value it refers to. read-only
Value Referred element of the indirect element read-only

OwnsValue

property OwnsValue: Boolean;

The Value of a TBoldIndirectElement can either be an existing TBoldElement, or one that has been created solely for the purpose of some derivation. In the latter case, the indirect value owns the value, and will be responsible for freeing it.

Value

property Value: TBoldElement;

The purpose of an indirect element is to refer to a TBoldElement, that it either owns or not. The Value property holds that element.

Methods

Name Summary Notes
Destroy Destructor override
RelinquishValue Makes the indirect element give up ownership of its value.
SetOwnedValue Sets the value, and passes ownership.
SetReferenceValue Sets the value, without passing ownership.
TransferValue Transfers the value to another indirect element.

Destroy

destructor Destroy; override;

Destructor

RelinquishValue

function RelinquishValue: TBoldElement;

This function returns the value of the indirect element. It also passes the ownership of the element to the caller. After RelinquishValue the indirect element's Value property will be **nil**

SetOwnedValue

procedure SetOwnedValue(NewValue: TBoldElement);

This method will set the indirect element's Value property to NewValue, and OwnsValue to true. If the indirect element was already owning another element, that element will be freed.

SetReferenceValue

procedure SetReferenceValue(NewValue: TBoldElement);

This method will set the indirect element's Value property to NewValue, and OwnsValue to false. If the indirect element was owning another element, that element will be freed.

TransferValue

procedure TransferValue(Target: TBoldIndirectElement);

The Value element will be transferred to the Target. If the indirect element has ownership of the value, ownership will also be passed. After TransferValue, the Value property will be **nil**.


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.