#include <config_file.hpp>
Public Member Functions | |
config_file (std::istream &is, bool validate=true) | |
Creates a config file parser for the specified stream. | |
config_file (const std::string &filename, bool validate=true) | |
Creates a config file parser for the specified file. | |
void | add_option (const char *name) |
Adds another allowed option. | |
operator bool () const | |
Returns true if there's another option to extract, i.e. | |
config_file & | operator++ () |
Moves to the next option assignment in this file. | |
const std::string & | name () const |
Returns the option name for the current assignment. | |
const std::string & | value () const |
Return the value for the current assignment. |
Config file can not contain arguments.
The actuall variable name is constructed by combining current section name and variable name, with dot between. If section_name already contains dot at the end, new dot is not inserted. For example:
[gui.accessibility] visual_bell=yes
|
Creates a config file parser for the specified stream. If 'validate' is set to false, allows all options. |
|
Creates a config file parser for the specified file.
|
|
Adds another allowed option. If the 'name' ends with '*', then all options with the same prefix are allowed. For example, if 'name' is 'foo*', then 'foo1' and 'foo_bar' are allowed. |
|
Returns true if there's another option to extract, i.e. if name() and value() are valid. Is false immediately after construction -- call operator++ to obtain the first value. |
|
Moves to the next option assignment in this file. When called for the first time, moves to the first assignment.
|
|
Returns the option name for the current assignment.
|
|
Return the value for the current assignment.
|