inicpp
C++ parser of INI files with schema validation.
inicpp::parser Class Reference

#include <parser.h>

Public Member Functions

 parser ()=delete
 
 parser (const parser &source)=delete
 
parseroperator= (const parser &source)=delete
 
 parser (parser &&source)=delete
 
parseroperator= (parser &&source)=delete
 

Static Public Member Functions

static config load (const std::string &str)
 
static config load (const std::string &str, const schema &schm, schema_mode mode)
 
static config load (std::istream &str)
 
static config load (std::istream &str, const schema &schm, schema_mode mode)
 
static config load_file (const std::string &file)
 
static config load_file (const std::string &file, const schema &schm, schema_mode mode)
 
static void save (const config &cfg, const std::string &file)
 
static void save (const config &cfg, std::ostream &str)
 
static void save (const config &cfg, const schema &schm, const std::string &file)
 
static void save (const config &cfg, const schema &schm, std::ostream &str)
 
static void save (const schema &schm, const std::string &file)
 
static void save (const schema &schm, std::ostream &str)
 

Detailed Description

Parser is not constructable class which contains methods which can be used to load or store ini configuration.

Definition at line 23 of file parser.h.

Constructor & Destructor Documentation

inicpp::parser::parser ( )
delete

Deleted default constructor.

inicpp::parser::parser ( const parser source)
delete

Deleted copy constructor.

inicpp::parser::parser ( parser &&  source)
delete

Deleted move constructor.

Member Function Documentation

config inicpp::parser::load ( const std::string &  str)
static

Load ini configuration from given string and return it.

Parameters
strini configuration description
Returns
newly created config class
Exceptions
parser_exceptionif ini configuration is wrong

Definition at line 305 of file parser.cpp.

config inicpp::parser::load ( const std::string &  str,
const schema schm,
schema_mode  mode 
)
static

Load ini configuration from given string and validate it through schema.

Parameters
strini configuration description
schmvalidation schema
modevalidation mode
Returns
constructed config class which comply given schema
Exceptions
parser_exceptionif ini configuration is wrong
validation_exceptionif configuration does not comply schema

Definition at line 311 of file parser.cpp.

config inicpp::parser::load ( std::istream &  str)
static

Load ini configuration from given stream and return it.

Parameters
strini configuration description
Returns
newly created config class
Exceptions
parser_exceptionif ini configuration is wrong

Definition at line 319 of file parser.cpp.

config inicpp::parser::load ( std::istream &  str,
const schema schm,
schema_mode  mode 
)
static

Load ini configuration from given stream and validate it through schema.

Parameters
strini configuration description
schmvalidation schema
modevalidation mode
Returns
constructed config class which comply given schema
Exceptions
parser_exceptionif ini configuration is wrong
validation_exceptionif configuration does not comply schema

Definition at line 324 of file parser.cpp.

config inicpp::parser::load_file ( const std::string &  file)
static

Load ini configuration from file with specified name.

Parameters
filename of file which contains ini configuration
Returns
new instance of config class
Exceptions
parser_exceptionif ini configuration is wrong

Definition at line 331 of file parser.cpp.

config inicpp::parser::load_file ( const std::string &  file,
const schema schm,
schema_mode  mode 
)
static

Load ini configuration from file with specified name and validate it against given schema.

Parameters
filename of file with ini configuration
schmvalidation schema
modevalidation mode
Returns
new instance of config class
Exceptions
parser_exceptionif ini configuration is wrong
validation_exceptionif configuration does not comply schema

Definition at line 341 of file parser.cpp.

parser& inicpp::parser::operator= ( const parser source)
delete

Deleted copy assignment.

parser& inicpp::parser::operator= ( parser &&  source)
delete

Deleted move assignment.

void inicpp::parser::save ( const config cfg,
const std::string &  file 
)
static

Save given configuration to file.

Parameters
cfgconfiguration which will be saved
filename of output file

Definition at line 353 of file parser.cpp.

void inicpp::parser::save ( const config cfg,
std::ostream &  str 
)
static

Save configuration to output stream.

Parameters
cfgconfiguration which will be saved
stroutput stream

Definition at line 360 of file parser.cpp.

void inicpp::parser::save ( const config cfg,
const schema schm,
const std::string &  file 
)
static

Save given configuration (could be only partial) to a file. Options which are not specified will be substitued by default values from schema.

Parameters
cfgconfiguration which will be saved
schmschema which will be saved
filename of output file

Definition at line 365 of file parser.cpp.

void inicpp::parser::save ( const config cfg,
const schema schm,
std::ostream &  str 
)
static

Save given configuration (could be only partial) to output stream. Options which are not specified will be substitued by default values from schema.

Parameters
cfgconfiguration which will be saved
schmschema which will be saved
stroutput stream

Definition at line 372 of file parser.cpp.

void inicpp::parser::save ( const schema schm,
const std::string &  file 
)
static

Save validation schema to file.

Parameters
schmschema which will be saved
filename of output file

Definition at line 377 of file parser.cpp.

void inicpp::parser::save ( const schema schm,
std::ostream &  str 
)
static

Save given validation schema to output stream.

Parameters
schmschema which will be saved
stroutput stream

Definition at line 384 of file parser.cpp.


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