Class CArrayValueNode#

Inheritance Relationships#

Base Type#

Class Documentation#

class CArrayValueNode : public CEntityValueNode#

Entity array value (containing an array of value pointers).

Remark

When the array contains non-allocated value pointers, the array has been declared, but the values haven’t been assigned.

Unnamed Group

const CValueNodePtr &operator[](size_t nIndex) const#

Element access of the array.

Parameters:

nIndex[in] The index of the element. For dynamic arrays, only an index of 0 is allowed.

Returns:

Returns a reference to the element.

CValueNodePtr &operator[](size_t nIndex)#

Element access of the array.

Parameters:

nIndex[in] The index of the element. For dynamic arrays, only an index of 0 is allowed.

Returns:

Returns a reference to the element.

Public Functions

CArrayValueNode(CEntityPtr ptrEntity, const CValueNodePtr ptrParent)#

Constructor.

Parameters:
  • ptrEntity[in] Smart pointer to the entity implementing the type. Cannot be nullptr.

  • ptrParent[in] Smart pointer to the parent value. Cannot be nullptr.

CArrayValueNode(const CArrayValueNode &rValueNode, CEntityPtr ptrEntity, const CValueNodePtr ptrParent)#

Copy constructor with new parent and entity.

Parameters:
  • rValueNode[in] Reference to the value node to copy from.

  • ptrEntity[in] Smart pointer to the entity implementing the type. Cannot be nullptr.

  • ptrParent[in] Smart pointer to the parent value. Cannot be nullptr.

virtual ~CArrayValueNode() override = default#

Default destructor.

Remark

This constructor needs to be virtual to allow derived classes to be destroyed correctly.

virtual CValueNodePtr CreateCopy(CEntityPtr ptrEntity, const CValueNodePtr ptrParent) const override#

Create a copy of the value. Overload of CEntityValueNode::CreateCopy.

Parameters:
  • ptrEntity[in] Smart pointer to the entity receiving the copy of the value node.

  • ptrParent[in] Smart pointer to the parent value. Cannot be nullptr.

Returns:

Returns a smart pointer of the copy of the value.

virtual void ProcessValueAssignment(const CTokenList &rlstExpression) override#

Process the assignment. Overload of CEntityValueNode::ProcessValueAssignment.

Parameters:

rlstExpression[in] Reference to the expression token list.

virtual void ProcessChildNodes(const CTokenList &rlstExpression) override#

Process the child nodes. Overload of CEntityValueNode::ProcessChildNodes.

Parameters:

rlstExpression[in] Reference to the expression token list.

void ProcessStringNode(const CToken &rToken)#

Process the string nodes. This is an array processing function based on a string as character array.

Parameters:

rToken[in] Reference to the string literal token.

void SetFixedSize(size_t nSize, const CTokenList &rlstExpression)#

Set the fixed size of the array when available during declaration.

Attention

Must not be called after the value has been set to dynamic or set to a delayed fixed size.

Parameters:
  • nSize[in] The calculated size of the array.

  • rlstExpression[in] Reference to the expression list used to calculate the value.

void SetDynamicSize(size_t nSize, const CTokenList &rlstExpression)#

Set the array to a dynamic size based on a variable declaration. This is only allowed for entities that are not declared as const entity (where all the parent values are not defined as const).

Attention

Must not be called after the value has been set to a fixed size (delayed or not).

Parameters:
  • nSize[in] The calculated size of the array.

  • rlstExpression[in] Reference to the expression list used to calculate the size.

void SetFixedSizeUnbound()#

Set the array to a fixed size through its value assignment. This is only allowed for entities that are declared as const entity (where one of the parents was defined as const).

Attention

Must not be called after the value has been set to a fixed size (not delayed) or a dynamic size.

size_t GetSize() const#

Get the size of the array.

Returns:

The size of the array.

virtual bool IsArray() const override#

This is an array entity.

Returns:

Returns ‘true’.

virtual bool IsUnbound() const override#

Is the size of the array defined through the assignment?

Returns:

Returns ‘true’ when the size of the array has to be defined through the assignment.

std::string GetSizeExpression() const#

Get the size expression.

Returns:

The size expression string.

virtual std::string GetDeclTypeStr(bool bResolveTypedef) const override#

Get the declaration type build from the value chain. Overload of CEntityValueNode::GetDeclTypeStr.

The declaration type consists of “<base type> <type identifier> <arrays>”.

Parameters:

bResolveTypedef[in] When set, resolve the typedef type into the base type.

Returns:

Returns a string with entity type.