Class CTable#
Defined in File parser_node_toml.h
Inheritance Relationships#
Base Type#
public toml_parser::CNodeCollection(Class CNodeCollection)
Derived Type#
public toml_parser::CRootTable(Class CRootTable)
Class Documentation#
-
class CTable : public toml_parser::CNodeCollection#
A dynamic table structure that allows mixed data in form of key value pairs.
A table can be explicit and inline. One version of the explicit table exists. Two versions of the inline table exist: the assignment version and the embedded in-an-array-version. Explicit table:
Not embedded in an array, but inline:<whitespace>[<whitespace]KEY<whitespace>]<whitespace> ^ ^ ^ ^ pre-node pre_key_ws post_key_ws post_node
Embedded in an array:<whitespace>KEY<whitespace>.<whitespace>KEY<whitespace>=<whitespace>{ZERO_OR_MORE_VALUES}<whitespace> ^ ^ ^ ^ ^ ^ pre-node post_key_ws pre_key_ws post_key_ws pre_value_ws post-node
The pre- and post-node whitespace areas are covered by the UpdateNodeCode function of the CNode base class. Multiple optional pre- and post-separator whitespace areas can be defined.<whitespace>{ZERO_OR_MORE_VALUES}<whitespace> ^ ^ pre-node post-node
Subclassed by toml_parser::CRootTable
Public Functions
-
CTable(CParser &rparser, const std::string &rssName, const std::string &rssRawName, bool bDefaultInline, bool bExplicit = true)#
Constructor.
- Parameters:
rparser – [in] Reference to the TOML parser.
rssName – [in] Reference to the name of the node.
rssRawName – [in] Reference to the raw name of the node.
bDefaultInline – [in] The default value for the inline flag.
bExplicit – [in] When set, the table is defined explicit. Otherwise the table is an implicit table and allows additional elements to be added.
-
virtual sdv::toml::ENodeType GetType() const override#
Get the node type. Overload of sdv::toml::INodeInfo::GetType.
- Returns:
Type of the node.
-
virtual std::string GenerateTOML(const CGenContext &rContext = CGenContext()) const override#
Create the TOML text based on the content using an optional prefix node. Overload of CNode::GenerateTOML.
- Parameters:
rContext – [in] Reference to the context class to use during TOML code generation.
- Returns:
The TOML text string.
-
virtual void UpdateNodeCode(const CNodeTokenRange &rNodeRange) override#
Update the node with TOML code information. Overload of CNode::UpdateNodeCode.
- Parameters:
rNodeRange – [in] Reference to the node range information containing the tokens for the code snippets.
-
virtual bool Inline() const override#
The derived class from the node collection can be inline or not. Overload of CNodeCollection::Inline.
- Returns:
Returns whether the node is an inline node.
-
virtual bool Inline(bool bInline) override#
Switch between inline and explicit table definition. Overload of CNodeCollection::Inline.
Remark
Additional node composition information will be removed and the order within the parent node might be changed.
- Attention
It is not possible to switch to an explicit table definition if the table is part of an array, since the table doesn’t have a name.
- Parameters:
bInline – [in] When set, try to switch to inline. Otherwise try to switch to normal.
- Returns:
Returns whether the switch was successful. A switch to the same type (normal to normal or inline to inline is always successful). When returning false, the switching might not be supported for this type.
-
virtual bool ExplicitlyDefined() const override#
Checks whether the table was explicitly defined. Overload of CNodeCollection::ExplicitlyDefined.
- Returns:
Returns the explicit definition flag.
-
virtual void MakeExplicit() override#
If the table was an implicit definition, make it explicit. Overload of CNodeCollection::MakeExplicit.
-
CTable(CParser &rparser, const std::string &rssName, const std::string &rssRawName, bool bDefaultInline, bool bExplicit = true)#