Struct SNode#
Defined in File simple_toml.h
Struct Documentation#
-
struct SNode#
Main variant structure holding the configuration tree data.
Public Functions
-
inline operator bool() const noexcept#
Helper checking if node is valid.
- Returns:
Returns whether the node is valid (is not unknown).
-
inline bool IsValid() const noexcept#
Helper checking if node is valid.
- Returns:
Returns whether the node is valid (is not unknown).
-
inline bool IsTable() const noexcept#
Helper checking if node is a table.
- Returns:
Returns whether the node is a table.
-
inline bool IsArray() const noexcept#
Helper checking if node is an array.
- Returns:
Returns whether the node is an array.
-
inline bool IsValue() const noexcept#
Helper checking if node is a scalar value.
- Returns:
Returns whether the node is a value node.
-
inline ENodeType GetType() const noexcept#
Access function returning the type.
- Returns:
The type of the node.
-
inline const std::string &GetName() const noexcept#
Access function returning the key name.
- Returns:
Reference to the string containing the key name (if not an array member) or an empty string when there is no key name.
-
inline const std::string &GetValue() const noexcept#
Returns the raw value.
- Returns:
Reference to the string containing the raw value of the node. Or returns an empty string when the node is not a value node or doesn’t contain a value.
-
template<typename TType>
inline TType GetValue() const# Return the value converted to the provided type.
- Template Parameters:
TType – Type to convert to. Supported are integral types, bool, floating point types and std::string.
- Returns:
The result from the conversion or an empty result if the conversion could not be done.
-
inline const TTableMap &GetTable() const noexcept#
Returns the table map.
- Returns:
If the node is a table, returns a reference to the table map. Or returns an empty map if the node is not a table or doesn’t contain child nodes.
-
inline const TNodeArray &GetArray() const noexcept#
Return the array vector.
- Returns:
If the node is an array, returns a reference to the array vector. Or returns an empty vector if the node is not an array or doesn’t contain any elements.
-
inline const SNode GetDirect(std::string_view svPath) const noexcept#
Safe, non-recursive direct lookup using dot and array notation (e.g., “table.array[1].key”)
- Parameters:
svPath – [in] String containing the value path to look for.
- Returns:
Returns a safe, read-only reference to the node of an empty node when not found.
Public Members
-
ENodeType eType = ENodeType::node_unknown#
Enumeration Type.
-
std::string ssKey#
Name of the value key.
-
std::string ssValueRaw = ""#
String raw value.
-
TNodeArray vecArray = {}#
Vector Array.
-
bool bIsInline = false#
Locked if defined via inline {…} syntax.
-
bool bIsExplicitlyHeadered = false#
Set to true when defined via [header] syntax.
-
inline operator bool() const noexcept#