|
inicpp
C++ parser of INI files with schema validation.
|
#include <config.h>
Public Types | |
| using | iterator = config_iterator< section > |
| using | const_iterator = config_iterator< const section > |
Public Member Functions | |
| config () | |
| config (const config &source) | |
| config & | operator= (const config &source) |
| config (config &&source) | |
| config & | operator= (config &&source) |
| void | add_section (const section §) |
| void | add_section (const std::string §ion_name) |
| void | remove_section (const std::string §ion_name) |
| void | add_option (const std::string §ion_name, const option &opt) |
| template<typename ValueType > | |
| void | add_option (const std::string §ion_name, const std::string &option_name, ValueType value) |
| void | remove_option (const std::string §ion_name, const std::string &option_name) |
| size_t | size () const |
| section & | operator[] (size_t index) |
| const section & | operator[] (size_t index) const |
| section & | operator[] (const std::string §ion_name) |
| const section & | operator[] (const std::string §ion_name) const |
| bool | contains (const std::string §ion_name) const |
| void | validate (const schema &schm, schema_mode mode) |
| bool | operator== (const config &other) const |
| bool | operator!= (const config &other) const |
| iterator | begin () |
| iterator | end () |
| const_iterator | begin () const |
| const_iterator | end () const |
| const_iterator | cbegin () const |
| const_iterator | cend () const |
Friends | |
| class | config_iterator< section > |
| class | config_iterator< const section > |
| INICPP_API friend std::ostream & | operator<< (std::ostream &os, const config &conf) |
Represents the base object of ini configuration. Contains list of sections in logical map structure. Can be constructed directly from string or stream.
| using inicpp::config::const_iterator = config_iterator<const section> |
| inicpp::config::config | ( | ) |
Default constructor.
Definition at line 5 of file config.cpp.
| inicpp::config::config | ( | const config & | source | ) |
Copy constructor.
Definition at line 9 of file config.cpp.
| inicpp::config::config | ( | config && | source | ) |
Move constructor.
Definition at line 34 of file config.cpp.
| void inicpp::config::add_option | ( | const std::string & | section_name, |
| const option & | opt | ||
| ) |
Add given option to specified section.
| section_name | should exist |
| opt | option which will be added to appropriate section |
| not_found_exception | if section with given name does not exist |
| ambiguity_exception | if option with specified name exists |
Definition at line 89 of file config.cpp.
|
inline |
Creates and add option to specified section.
| section_name | should exist in this config |
| option_name | name of newly created option |
| value | value which will be stored in new option |
| ambiguity_exception | if option with specified name exists |
| void inicpp::config::add_section | ( | const section & | sect | ) |
Add section to this ini configuration.
| sect | section which will be added |
| ambiguity_exception | if section with specified name exists |
Definition at line 48 of file config.cpp.
| void inicpp::config::add_section | ( | const std::string & | section_name | ) |
Create and add section with specified name.
| section_name | section with same name cannot exist in config |
| ambiguity_exception | if section with specified name exists |
Definition at line 60 of file config.cpp.
| config::iterator inicpp::config::begin | ( | ) |
Iterator pointing at the beginning of sections list.
Definition at line 184 of file config.cpp.
| config::const_iterator inicpp::config::begin | ( | ) | const |
Constant iterator pointing at the beginning of sections list.
Definition at line 194 of file config.cpp.
| config::const_iterator inicpp::config::cbegin | ( | ) | const |
Constant iterator pointing at the beginning of sections list.
Definition at line 204 of file config.cpp.
| config::const_iterator inicpp::config::cend | ( | ) | const |
Constant iterator pointing at the end of sections list.
Definition at line 209 of file config.cpp.
| bool inicpp::config::contains | ( | const std::string & | section_name | ) | const |
Tries to find section with specified name inside this config.
| section_name | name which is searched |
Definition at line 154 of file config.cpp.
| config::iterator inicpp::config::end | ( | ) |
Iterator pointing at the end of sections list.
Definition at line 189 of file config.cpp.
| config::const_iterator inicpp::config::end | ( | ) | const |
Constant iterator pointing at the end of sections list.
Definition at line 199 of file config.cpp.
| bool inicpp::config::operator!= | ( | const config & | other | ) | const |
Copy assignment.
Definition at line 23 of file config.cpp.
Move assignment.
Definition at line 39 of file config.cpp.
| bool inicpp::config::operator== | ( | const config & | other | ) | const |
| section & inicpp::config::operator[] | ( | size_t | index | ) |
Access section on specified index.
| index | index of requested value |
| not_found_exception | if index is out of range |
Definition at line 114 of file config.cpp.
| const section & inicpp::config::operator[] | ( | size_t | index | ) | const |
Access constant reference on section on specified index.
| index | index of requested value |
| not_found_exception | if index is out of range |
Definition at line 123 of file config.cpp.
| section & inicpp::config::operator[] | ( | const std::string & | section_name | ) |
Access section with specified name.
| section_name | name of requested section |
| not_found_exception | if section with given name does not exist |
Definition at line 132 of file config.cpp.
| const section & inicpp::config::operator[] | ( | const std::string & | section_name | ) | const |
Access constant reference on section with specified name.
| section_name | name of requested section |
| not_found_exception | if section with given name does not exist |
Definition at line 143 of file config.cpp.
| void inicpp::config::remove_option | ( | const std::string & | section_name, |
| const std::string & | option_name | ||
| ) |
Removes option with given name from given section.
| section_name | index to section list |
| option_name | option with this name will be removed |
| not_found_exception | if section or option with given name does not exist |
| not_found_exception | if section or option with given name does not exist |
Definition at line 99 of file config.cpp.
| void inicpp::config::remove_section | ( | const std::string & | section_name | ) |
Remove section from internal sections list.
| section_name | name should exist in section list |
| not_found_exception | if section with given name does not exist |
Definition at line 72 of file config.cpp.
| size_t inicpp::config::size | ( | ) | const |
| void inicpp::config::validate | ( | const schema & | schm, |
| schema_mode | mode | ||
| ) |
Validates this config agains given schema.
| schm | specifies how this config should look like |
| mode | validation mode |
| validation_exception | if error occured |
Definition at line 164 of file config.cpp.
|
friend |
Classic stream operator for printing this instance to output stream.
| os | output stream |
| conf | reference to loaded configuration |
Definition at line 214 of file config.cpp.