Inherited by VoicemanConfigFile.
Public Member Functions | |
void | checkParams () const |
Checks values type matching. | |
ConfigFile () | |
The default constructor. | |
const ConfigFileSection & | findSection (const std::string &name) const |
Returns the reference to the section object by the section name. | |
const ConfigFileSection & | getSection (ConfigFileSectionVector::size_type index) const |
Returns the reference to the section object by the section index. | |
ConfigFileSectionVector::size_type | getSectionCount () const |
Returns the number of read sections. | |
bool | hasSection (const std::string &name) const |
Checks if the specified section is accessible. | |
void | load (const std::string &fileName) |
Loads configuration file content. | |
virtual | ~ConfigFile () |
The destructor. | |
Protected Types | |
enum | { AnyValue = -1, InvalidValue = 0, BooleanValue = 1, StringValue = 2, IntValue = 3, UintValue = 4, DoubleValue = 5 } |
Protected Member Functions | |
virtual int | params (const std::string §ion, const std::string ¶m) const =0 |
void ConfigFile::checkParams | ( | ) | const |
This method looks through read values and checks its types. If error is found the ConfigFileValueTypeException is thrown. Checking is performed by the data provided by params() method. You should override this method in your child classe. There are predefined macroses to define data types table.
const ConfigFileSection & ConfigFile::findSection | ( | const std::string & | name | ) | const |
This method looks through stored sections vector and finds U corresponding by section name. You must be strongly sure the required section exists. This method does not have any way to notify about an error.
[in] | name | The name of a section to return |
const ConfigFileSection & ConfigFile::getSection | ( | ConfigFileSectionVector::size_type | index | ) | const |
Use this method to get desired section object.
[in] | index | The index of a section to return |
ConfigFileSectionVector::size_type ConfigFile::getSectionCount | ( | ) | const |
Use this method to get number of parsed sections.
bool ConfigFile::hasSection | ( | const std::string & | name | ) | const |
Use this method to be sure the desired section exists.
[in] | name | The name of a section to check |
void ConfigFile::load | ( | const std::string & | fileName | ) |
This method reads configuration file and saves processed data in the internal structures inside of this class. Any data can be retrieved later. On any error it throws ConfigFileException. This method does not perform any value type checking. You should explicitly call checkParams() method to do it.
[in] | fileName | The name of a file to read data from |