#include <config_file.h>
Public Member Functions | |
common_config_file_iterator (const std::set< std::string > &in_allowed_options, bool allow_unregistered) | |
void | get () |
Protected Member Functions | |
virtual bool | getline (std::string &) |
Private Member Functions | |
void | add_option (const char *name) |
bool | allowed_option (const std::string &s) const |
Private Attributes | |
std::set< std::string > | allowed_options |
std::set< std::string > | allowed_prefixes |
std::string | m_prefix |
bool | m_allow_unregistered |
Standalone parser for config files in ini-line format. The parser is a model of single-pass lvalue iterator, and default constructor creates past-the-end-iterator. The typical usage is: config_file_iterator i(is, ... set of options ...), e; for(; i !=e; ++i) { *i; }
Syntax conventions:
The actual option name is constructed by combining current section name and specified option 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
will result in option "gui.accessibility.visual_bell" with value "yes" been returned.
Definition at line 212 of file config_file.h.
|
inlineprivate |
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.
Definition at line 313 of file config_file.h.