Class CTable#
Defined in File parser_node_toml.h
Inheritance Relationships#
Base Type#
public CNodeCollection
(Class CNodeCollection)
Derived Types#
public CInlineTable
(Class CInlineTable)public CNormalTable
(Class CNormalTable)
Class Documentation#
-
class CTable : public CNodeCollection#
A dynamic table structure that allows mixed data in form of key value pairs.
Subclassed by CInlineTable, CNormalTable
Public Functions
-
virtual sdv::toml::ENodeType GetType() const override#
Get the node type. Overload of sdv::toml::INodeInfo::GetType.
- Returns:
Type of the node.
-
virtual std::shared_ptr<CNode> GetDirect(const std::string &rssPath) const override#
Accesses a node by its key in the parse tree. Overload of CNode::GetDirect.
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:
rssPath – [in] The path of the node to searched for.
- Returns:
Returns a shared pointer to the wanted Node if it was found or a node with invalid content if it was not found.
-
virtual std::string CreateTOMLText(const std::string &rssParent, std::string &rssLastPrintedTable, bool bFirst, bool bEmbedded, bool bAssignment, bool bRoot) const override#
Get the TOML text based on the content. Overload of CNode::CreateTOMLText.
- Parameters:
rssParent – [in] When present, uses the parent node into the TOML text generation.
rssLastPrintedTable – [in] Reference to the string containing the last printed table. This might be necessary in case a different table was printed in between.
bFirst – [in] When set, this is the first entry in an array or table.
bEmbedded – [in] When set, this is an embedded definition in an array or table.
bAssignment – [in] When set, this is a table assignment.
bRoot – [in] Only for table entries, when set this is the root entry (suppress the table name).
- Returns:
The string containing the TOML text.
Adds a given node to a given path in the tree. Overload of CNode::Add.
- Parameters:
rssPath – [in] Reference to the path in the tree where the new node is to be added
rptrNode – [in] Reference to the smart pointer holding the node.
bDefinedExplicitly – [in] If a table that is created to create the path of the node to be added is defined explicitly
- Throws:
XInvalidAccessException – Throws an XInvalidAccessException if a ancestor node is not open to add children
XDuplicateNameException – Throws a XDuplicateNameException if a node with the same path as the node to be added is already defined explicitly
-
virtual std::shared_ptr<CNode> Find(const std::string &rssPath) const override#
Searches the subtree of the node for a node at the given location using the provided path. Overload of CNode::Find.
Remark
The path elements of arrays and tables are separated by a dot.
- Parameters:
rssPath – [in] Reference to the path in the tree where the new node is to be added
- Returns:
Returns a shared pointer to the wanted Node if it is found or an error-Node if it is not
Public Members
-
bool m_bOpenToAddChildren = true#
If internal table, the table can be extended until the table is closed.
Protected Functions
-
CTable(const std::string &rssName)#
Constructor.
- Parameters:
rssName – [in] Reference to the name of the node.
-
virtual sdv::toml::ENodeType GetType() const override#