inicpp
C++ parser of INI files with schema validation.
|
#include <schema.h>
Public Member Functions | |
schema () | |
schema (const schema &source) | |
schema & | operator= (const schema &source) |
schema (schema &&source) | |
schema & | operator= (schema &&source) |
void | add_section (const section_schema §_schema) |
void | add_section (const section_schema_params &arguments) |
void | add_option (const std::string §ion_name, const option_schema &opt_schema) |
template<typename ArgType > | |
void | add_option (const std::string §ion_name, option_schema_params< ArgType > &arguments) |
size_t | size () const |
section_schema & | operator[] (size_t index) |
const section_schema & | operator[] (size_t index) const |
section_schema & | operator[] (const std::string §ion_name) |
const section_schema & | operator[] (const std::string §ion_name) const |
bool | contains (const std::string §ion_name) const |
void | validate_config (config &cfg, schema_mode mode) const |
Friends | |
INICPP_API friend std::ostream & | operator<< (std::ostream &os, const schema &schm) |
Represents base point of schema validation. Object of config class is validated against this one. Can contain schemes of sections and in them schemes for options.
inicpp::schema::schema | ( | ) |
Default constructor.
Definition at line 5 of file schema.cpp.
inicpp::schema::schema | ( | const schema & | source | ) |
Copy constructor.
Definition at line 9 of file schema.cpp.
inicpp::schema::schema | ( | schema && | source | ) |
Move constructor.
Definition at line 33 of file schema.cpp.
void inicpp::schema::add_option | ( | const std::string & | section_name, |
const option_schema & | opt_schema | ||
) |
Adds option to the section_schema with specified name.
section_name | name of existing section |
opt_schema | options_schema which will be added to section |
not_found_exception | if section_name does not exist |
ambiguity_exception | if option_schema with given name exists |
Definition at line 72 of file schema.cpp.
|
inline |
Creates option_schema from given arguments and adds it to specified section.
section_name | |
arguments | option_schema creation parameters |
not_found_exception | if section_name does not exist |
ambiguity_exception | if option_schema with given name exists |
void inicpp::schema::add_section | ( | const section_schema & | sect_schema | ) |
Adds section from given attribute to internal container.
sect_schema | constant reference to section_schema object |
ambiguity_exception | if section_schema with given name exists |
Definition at line 48 of file schema.cpp.
void inicpp::schema::add_section | ( | const section_schema_params & | arguments | ) |
From given section_schema_params structure section_schema is created and added to this scheme.
arguments | non-editable reference to input arguments |
ambiguity_exception | if section_schema with given name exists |
Definition at line 60 of file schema.cpp.
bool inicpp::schema::contains | ( | const std::string & | section_name | ) | const |
Tries to find section_schema with specified name inside this config.
section_name | name which is searched |
Definition at line 127 of file schema.cpp.
Copy assignment.
Definition at line 23 of file schema.cpp.
Move assignment.
Definition at line 38 of file schema.cpp.
section_schema & inicpp::schema::operator[] | ( | size_t | index | ) |
Access section_schema on specified index.
index | index of requested value |
not_found_exception | if index is out of range |
Definition at line 87 of file schema.cpp.
const section_schema & inicpp::schema::operator[] | ( | size_t | index | ) | const |
Access constant reference on section_schema on specified index.
index | index of requested value |
not_found_exception | if index is out of range |
Definition at line 96 of file schema.cpp.
section_schema & inicpp::schema::operator[] | ( | const std::string & | section_name | ) |
Access section_schema with specified name.
section_name | name of requested section_schema |
not_found_exception | if section_schema with given name does not exist |
Definition at line 105 of file schema.cpp.
const section_schema & inicpp::schema::operator[] | ( | const std::string & | section_name | ) | const |
Access constant reference on section_schema with specified name.
section_name | name of requested section_schema |
not_found_exception | if section_schema with given name does not exist |
Definition at line 116 of file schema.cpp.
size_t inicpp::schema::size | ( | ) | const |
Returns size of section schemas list
Definition at line 82 of file schema.cpp.
void inicpp::schema::validate_config | ( | config & | cfg, |
schema_mode | mode | ||
) | const |
Validate cfg against this schema in specified mode.
cfg | configuration which will be validated |
mode | validation mode |
validation_exception | if schema cannot be validated |
Definition at line 137 of file schema.cpp.
|
friend |
Classic stream operator for printing this instance to output stream.
os | output stream |
schm | reference to schema instance to be written |
Definition at line 184 of file schema.cpp.