The namespace 'config' contains routines for interacting with the global configuration file parser. More...
Enumerations | |
enum | SourceFormat { SOURCE_FORMAT_JSON , SOURCE_FORMAT_XML } |
Functions | |
bool | hasArraySupport (SourceFormat format) |
bool | hasRootSection (SourceFormat format) |
void | read (config::SourceFormat format, const std::string &content, bool append) |
void | read (const std::string &filename, bool append) |
void | reset () |
void | reset (const std::string &rootName) |
void | reset (const std::string &rootName, int version) |
void | reset (const std::string &rootName, int version, bool multiSections) |
void | write (config::SourceFormat format, std::string *content) |
void | write (const std::string &filename) |
Variables | |
GlobalConfigParser & | root = GlobalConfigParser::parser() |
Detailed Description
The namespace 'config' contains routines for interacting with the global configuration file parser.
Enumeration Type Documentation
◆ SourceFormat
enum bitpit::config::SourceFormat |
Definition at line 31 of file configuration_common.hpp.
Function Documentation
◆ hasArraySupport()
bool bitpit::config::hasArraySupport | ( | SourceFormat | format | ) |
Check if the specified source format supports arrays.
- Parameters
-
format is the format of the source
- Returns
- Return true if the specified source format support arrays, false otherwise.
Definition at line 52 of file configuration_common.cpp.
◆ hasRootSection()
bool bitpit::config::hasRootSection | ( | SourceFormat | format | ) |
Check if the specified source format has a root section.
- Parameters
-
format is the format of the source
- Returns
- Return true if the specified source format has a root section, false otherwise.
Definition at line 37 of file configuration_common.cpp.
◆ read() [1/2]
void bitpit::config::read | ( | config::SourceFormat | format, |
const std::string & | content, | ||
bool | append ) |
Read the specified configuration file.
Configuration file can be either XML or JSON files (if JSON support was found at compile time).
- Parameters
-
format is the format of the content content is the content that will be read append controls if the configuration file will be appended to the current configuration or if the current configuration will be overwritten with the contents of the configuration file.
Definition at line 418 of file configuration.cpp.
◆ read() [2/2]
void bitpit::config::read | ( | const std::string & | filename, |
bool | append ) |
Read the specified configuration file.
Configuration can be read either from XML or JSON files.
- Parameters
-
filename is the filename of the configuration file append controls if the configuration file will be appended to the current configuration or if the current configuration will be overwritten with the contents of the configuration file.
- Examples
- POD_application_example_00001.cpp.
Definition at line 401 of file configuration.cpp.
◆ reset() [1/3]
void bitpit::config::reset | ( | const std::string & | rootName | ) |
Resets to custom root element name, all other options are forcefully reset to default. MultiSection property remains unaffected by the reset
- Parameters
-
rootName is the name of the root element
Definition at line 361 of file configuration.cpp.
◆ reset() [2/3]
void bitpit::config::reset | ( | const std::string & | rootName, |
int | version ) |
Resets to custom root element name and version. , all other options are forcefully reset to default. MultiSection property remains unaffected by the reset.
- Parameters
-
rootName is the name of the root element version is the version
Definition at line 374 of file configuration.cpp.
◆ reset() [3/3]
void bitpit::config::reset | ( | const std::string & | rootName, |
int | version, | ||
bool | multiSections ) |
Resets to custom root element name, version and multiSections property
- Parameters
-
rootName is the name of the root element version is the version multiSections boolean to control multiSections property of Config tree
Definition at line 386 of file configuration.cpp.
◆ write() [1/2]
void bitpit::config::write | ( | config::SourceFormat | format, |
std::string * | content ) |
Write the configuration to the specified string.
Configuration can be written either in XML or JSON format.
- Parameters
-
format is the format that will be used to write the configuration content on output will contain the configuration in the specified format
Definition at line 443 of file configuration.cpp.
◆ write() [2/2]
void bitpit::config::write | ( | const std::string & | filename | ) |
Write the configuration to the specified file.
Configuration can be written either to XML or JSON files.
- Parameters
-
filename is the filename where the configuration will be written to
Definition at line 430 of file configuration.cpp.
Variable Documentation
◆ root
BITPIT_PUBLIC_API GlobalConfigParser & bitpit::config::root = GlobalConfigParser::parser() |
Global instance of the configuration file parser.
Definition at line 353 of file configuration.cpp.
