Simpact Cyan
Population based event driven simulation using mNRM
|
A helper class to read config files. More...
#include <configreader.h>
Public Member Functions | |
bool_t | read (const std::string &fileName) |
Reads the config file specified by fileName . More... | |
void | getKeys (std::vector< std::string > &keys) const |
Stores all keys found in the config file in keys . More... | |
bool_t | getKeyValue (const std::string &key, std::string &value) const |
For the key specified by the key parameter, the corresponding value will be stored in value . More... | |
void | printAll () const |
Prints all key/value pairs to the standard output. More... | |
void | clear () |
Clears the stored key/value pairs. More... | |
A helper class to read config files.
The config files should contain lines like this:
Everything to the left of the first '=' sign is considered to be the key and everything to the right of the same '=' sign is considered to be the value. Leading and trailing spaces/tabs are ignored for both key and value.
This class just stores the key/value pairs as strings, it does not attempt to interpret values in any way.
void ConfigReader::clear | ( | ) |
Clears the stored key/value pairs.
void ConfigReader::getKeys | ( | std::vector< std::string > & | keys | ) | const |
Stores all keys found in the config file in keys
.
bool_t ConfigReader::getKeyValue | ( | const std::string & | key, |
std::string & | value | ||
) | const |
For the key specified by the key
parameter, the corresponding value will be stored in value
.
void ConfigReader::printAll | ( | ) | const |
Prints all key/value pairs to the standard output.
bool_t ConfigReader::read | ( | const std::string & | fileName | ) |
Reads the config file specified by fileName
.