Class CNodeCollection#

Inheritance Relationships#

Base Types#

Derived Types#

Class Documentation#

class CNodeCollection : public CNode, public sdv::toml::INodeCollection#

Base structure for arrays and tables.

Subclassed by CArray, CTable

Public Functions

virtual uint32_t GetCount() const override#

Returns the amount of nodes. Overload of sdv::toml::INodeCollection::GetCount.

Returns:

The amount of nodes.

virtual IInterfaceAccess *GetNode(uint32_t uiIndex) const override#

Get the node. Overload of sdv::toml::INodeCollection::GetNode.

Parameters:

uiIndex[in] Index of the node to get.

Returns:

Interface to the node object.

std::shared_ptr<CNode> Get(uint32_t uiIndex) const#

Get the node.

Parameters:

uiIndex[in] Index of the node to get.

Returns:

Smart pointer to the node object.

virtual sdv::IInterfaceAccess *GetNodeDirect(const sdv::u8string &ssPath) const override#

Searches a node by its key in the parse tree.

Elements of tables can be accessed and traversed by using ‘.’ to separated the parent name from child name. E.g. ‘parent.child’ would access the ‘child’ element of the ‘parent’ table. Elements of arrays can be accessed and traversed by using the index number in brackets. E.g. ‘array[3]’ would access the fourth element of the array ‘array’. These access conventions can also be chained like ‘table.array[2][1].subtable.integerElement’.

Attention

Array indexing starts with 0!

Parameters:

ssPath[in] The path of the node to searched for.

Returns:

Returns an interface the requested node if available.

bool AddElement(const std::shared_ptr<CNode> &rptrNode, bool bUnique = false)#

Add an element to the collection.

Parameters:
  • rptrNode[in] Reference to the node element smart pointer.

  • bUnique[in] When set, check prevents adding an element with the same name.

Returns:

Returns whether the element addition was successful.

Public Members

bool m_bDefinedExplicitly = true#

WHen set, the array/table is defined explicitly (not internal).

Protected Functions

CNodeCollection(const std::string &rssName)#

Constructor.

Parameters:

rssName[in] Reference to the name of the node.