NDS3
1.0.0
API reference manual
|
Parses an INI file and stores all the found sections and keys for future retrieval via getString().
#include <iniFileParser.h>
Public Member Functions | |
IniFileParser (std::istream &inputStream) | |
Parses the INI file in the input stream and stores all the found sections and keys with the corresponding values. More... | |
const std::string & | getString (const std::string §ion, const std::string &key, const std::string &defaultValue) const |
Retrieve the value for a specific key in the parsed INI file. More... | |
bool | keyExists (const std::string §ion, const std::string &key) const |
Return true if the requested key exists and has a value (even an empty one), false otherwise. More... | |
nds::IniFileParser::IniFileParser | ( | std::istream & | inputStream | ) |
Parses the INI file in the input stream and stores all the found sections and keys with the corresponding values.
inputStream | the stream to parse |
const std::string& nds::IniFileParser::getString | ( | const std::string & | section, |
const std::string & | key, | ||
const std::string & | defaultValue | ||
) | const |
Retrieve the value for a specific key in the parsed INI file.
Throws INIParserMissingSection if the specified section cannot be found.
section | the section to which the key belongs |
key | the key to retrieve |
defaultValue | the default value to return in the case that the key cannot be found |
bool nds::IniFileParser::keyExists | ( | const std::string & | section, |
const std::string & | key | ||
) | const |
Return true if the requested key exists and has a value (even an empty one), false otherwise.
Throws INIParserMissingSection if the specified section cannot be found.
section | the section to which the key belongs |
key | the key |