SPH
|
Represents a single node in the hierarchy written into config file. More...
#include <Config.h>
Public Member Functions | |
template<typename Type > | |
void | set (const std::string &name, const Type &value) |
Adds a new value into the node. More... | |
template<typename Type > | |
Type | get (const std::string &name) |
Returns a value stored in the node. More... | |
template<typename Type > | |
Optional< Type > | tryGet (const std::string &name) |
Tries to return a value stored in the node. More... | |
bool | contains (const std::string &name) |
Checks if the node contains an entry of given name. More... | |
Size | size () const |
Returns the number of entries stored in the node. More... | |
SharedPtr< ConfigNode > | addChild (const std::string &name) |
Adds a new child node to this node. More... | |
SharedPtr< ConfigNode > | getChild (const std::string &name) |
Returns a child node. More... | |
void | enumerateChildren (Function< void(std::string name, ConfigNode &node)> func) |
Calls the provided functor for each child node. More... | |
Friends | |
class | Config |
Represents a single node in the hierarchy written into config file.
Each node can store an arbitrary number of entries (as key-value pairs) and also a number of child nodes. Values are internally stored as strings, so it is necessary to specify the type of the value to read it.
SharedPtr< ConfigNode > ConfigNode::addChild | ( | const std::string & | name | ) |
Adds a new child node to this node.
Definition at line 21 of file Config.cpp.
|
inline |
void ConfigNode::enumerateChildren | ( | Function< void(std::string name, ConfigNode &node)> | func | ) |
Calls the provided functor for each child node.
Definition at line 36 of file Config.cpp.
|
inline |
SharedPtr< ConfigNode > ConfigNode::getChild | ( | const std::string & | name | ) |
Returns a child node.
ConfigException | if no such node exists. |
Definition at line 25 of file Config.cpp.
|
inline |
Size ConfigNode::size | ( | ) | const |
Returns the number of entries stored in the node.
Definition at line 32 of file Config.cpp.
|
inline |