Console node tree based config file parser. More...

#include <senf/Utils/Console/ConfigFile.hh>

Inheritance diagram for senf::console::ConfigFile:

Public Member Functions

void ignoreMissing ()
 Call to ignore missing files. More...
 
- Public Member Functions inherited from senf::console::detail::BundleMixin
 BundleMixin ()
 
 BundleMixin (DirectoryNode &root)
 
void parse ()
 Parse config file. More...
 
void parse (DirectoryNode &restrict)
 Parse config file under restrict. More...
 
bool complete () const
 true, if all nodes have been parsed More...
 
bool parsed (GenericNode &node) const
 true. if node has been parsed More...
 
void reset ()
 Reset node parse info state. More...
 

Related Functions

(Note that these are not member functions.)

void parseFile (std::string const &filename, DirectoryNode &root=senf::console::root())
 Read configuration file. More...
 
detail::ConfigFileSource::ptr FileConfig (std::string const &filename)
 ConfigBundle source reading a configuration file. More...
 

Structors and default members

 ConfigFile (std::string const &filename, DirectoryNode &root=senf::console::root())
 Create ConfigFile object for filename. More...
 

Additional Inherited Members

- Protected Member Functions inherited from senf::console::detail::BundleMixin
template<class Source >
Source & add (boost::intrusive_ptr< Source > source)
 

Detailed Description

Console node tree based config file parser.

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 51 of file ConfigFile.hh.

Constructor & Destructor Documentation

◆ ConfigFile()

senf::console::ConfigFile::ConfigFile ( std::string const &  filename,
DirectoryNode root = senf::console::root() 
)
explicit

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.

Member Function Documentation

◆ ignoreMissing()

void senf::console::ConfigFile::ignoreMissing ( )

Call to ignore missing files.

Friends And Related Function Documentation

◆ FileConfig()

detail::ConfigFileSource::ptr FileConfig ( std::string const &  filename)
related

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.

◆ parseFile()

void parseFile ( std::string const &  filename,
DirectoryNode root = senf::console::root() 
)
related

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.


The documentation for this class was generated from the following file: