Inherited by VoicemanConfigFile.
Public Member Functions | |
void | checkParams () const |
Checks read 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 | { ANY_VALUE = -1, INVALID_VALUE = 0, BOOLEAN_VALUE = 1, STRING_VALUE = 2, INT_VALUE = 3, UINT_VALUE = 4, DOUBLE_VALUE = 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 will be 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 |
[in] | name | The name of a section to return |
const ConfigFileSection & ConfigFile::getSection | ( | ConfigFileSectionVector::size_type | index | ) | const |
[in] | index | The index of a section to return |
bool ConfigFile::hasSection | ( | const std::string & | name | ) | const |
[in] | name | The name of a section to check |
void ConfigFile::load | ( | const std::string & | fileName | ) |
This method saves processed data in the internal structures inside of this class. Any data can be retrieved later. On any error this method throws ConfigFileException. This method does not perform any value type checking. You should explicitly call checkParams() method to do it. This method saves processed data in the internal structures inside of the class. Any required information can be retrieved later through corresponding methods. On any error this method throws ConfigFileException. None of the data types checking is performed by this method. You should explicitly call checkParams() method to do it.
[in] | fileName | The name of a file to read data from |