#include <senf/Utils/Console/ConfigFile.hh>
A ConfigFile instance allows flexible parsing of a config file against the console node tree. If you just want to parse a file completely, the senf::console::readConfig() function will do that. ConfigFile however allows to incrementally parse only a subdirectory of the complete configuration file.
senf::console::ConfigFile cf ("/my/config/file") // Parse only statements under the directory of some object. The object 'ob' // must have been registered somewhere in the node tree cf.parse(ob.dir); // Parse rest of the config file cf.parse();
If your application uses multiple configuration sources, use a ConfigBundle and FileConfig
Definition at line 60 of file ConfigFile.hh.
Public Member Functions |
|
void | ignoreMissing () |
Call to ignore missing files. |
|
Related Functions |
|
(Note that these are not member functions.) |
|
void | parseFile (std::string const &filename, DirectoryNode &root=root()) |
Read configuration file. |
|
detail::ConfigFileSource::ptr | FileConfig (std::string const &filename) |
ConfigBundle source reading a configuration file. |
|
Structors and default members |
|
ConfigFile (std::string const &filename, DirectoryNode &root=root()) | |
Create ConfigFile object for filename. |
senf::console::ConfigFile:: | ||||
ConfigFile | ( | std::string const & | filename, | |
DirectoryNode & |
root = root()
|
) | ||
Create ConfigFile object for filename.
The filename configuration file will be parsed using parse() calls. All configuration statements will be interpreted relative to root as root node.
Definition at line 58 of file ConfigFile.cci.
void senf::console::ConfigFile:: | ||||
ignoreMissing | () | |||
Call to ignore missing files.
Definition at line 63 of file ConfigFile.cci.
detail::ConfigFileSource::ptr | ||||
FileConfig | ( | std::string const & | filename | ) |
ConfigBundle source reading a configuration file.
This constructor is used to create a config source parsing the given configuration file to add to a ConfigBundle.
void | ||||
parseFile | ( | std::string const & | filename, | |
DirectoryNode & |
root = root()
|
) | ||
Read configuration file.
The configuration file filename will be loaded, interpreting all node's relative to root as root node.
This function uses a local ConfigFile object to perform the parsing.