Provides functionality to read from an xml configuration file. More...
#include <Config.h>
Classes | |
| class | ConfigEntry |
Public Member Functions | |
| void | addModule (std::string name) |
| void | clear () |
| Config () | |
| Config (const Config &c2) | |
| std::string | getActiveProfileName () const |
| std::string | getAllProfileNames () |
| std::vector< std::string > | getAllVars () const |
| const std::string & | getFilename () const |
| const std::vector< std::string > & | getModuleList () const |
| bool | loadFromFile (const std::string &fileName, const std::vector< std::string > &profiles) |
| Config & | operator= (const Config &c2) |
| template<class T > | |
| void | set (const std::string &id, T f) |
| std::string | toText () |
| ~Config () | |
Static Public Member Functions | |
| static bool | getBool (const std::string &id) |
| static float | getFloat (const std::string &id) |
| static bool | getFloatMinMax (const std::string &id, std::pair< float, float > &minmax) |
| static Config * | getInstance () |
| static int | getInt (const std::string &id) |
| static bool | getIntMinMax (const std::string &id, std::pair< int, int > &minmax) |
| static std::string | getString (const std::string &id) |
| static void | loadConfig (const std::vector< std::string > files, const std::vector< std::string > profiles, const std::string &prepend_path=".") |
| allows to load various config files and profiles besides config/default.xml and profile default | |
| static void | setInstance (Config *newInst) |
Static Public Attributes | |
| static Mutex | m_AccessMutex = Mutex () |
Private Member Functions | |
| std::vector< std::string > | explode (const std::string &text, const std::string &separators, bool keepSeparators=false) |
| template<class T > | |
| T | get (const std::string &id) const |
| template<class T > | |
| bool | getMinMax (const std::string &id, std::pair< T, T > &minmax) const |
| bool | parseDocument (const std::string &fileName, const std::vector< std::string > &profiles) |
| void | parseModules (TiXmlNode *root) |
| bool | parseProfile (TiXmlNode *root) |
| bool | parseValue (TiXmlElement *el, class ConfigEntry &newEntry, std::string &name) const |
| bool | parseValues (const std::string &level, TiXmlNode *root) |
| void | saveValue (const std::string &name, const ConfigEntry &entry, TiXmlElement *allProfValues, TiXmlElement *values) const |
Private Attributes | |
| std::string | m_activeProfile |
| std::string | m_allProfileNames |
| class TiXmlDocument * | m_doc |
| std::string | m_fileName |
| std::set< std::string > | m_loadedProfileNames |
| std::vector< std::string > | m_moduleList |
| std::map< std::string, ConfigEntry > | m_values |
Static Private Attributes | |
| static Config * | m_inst = 0 |
Provides functionality to read from an xml configuration file.
| Config::Config | ( | ) |
Definition at line 26 of file Config.cpp.
| Config::Config | ( | const Config & | c2 | ) |
Definition at line 36 of file Config.cpp.
| Config::~Config | ( | ) |
Definition at line 31 of file Config.cpp.
| void Config::addModule | ( | std::string | name | ) |
Definition at line 266 of file Config.cpp.
| void Config::clear | ( | ) |
Definition at line 161 of file Config.cpp.
| std::vector< std::string > Config::explode | ( | const std::string & | text, |
| const std::string & | separators, | ||
| bool | keepSeparators = false |
||
| ) | [private] |
helper function to parse string lists
Definition at line 582 of file Config.cpp.
| std::string Config::get | ( | const std::string & | id | ) | const [inline, private] |
| std::string Config::getActiveProfileName | ( | ) | const [inline] |
| std::string Config::getAllProfileNames | ( | ) | [inline] |
| std::vector< std::string > Config::getAllVars | ( | ) | const |
Definition at line 565 of file Config.cpp.
| bool Config::getBool | ( | const std::string & | id | ) | [static] |
Definition at line 135 of file Config.cpp.
| const std::string & Config::getFilename | ( | ) | const [inline] |
| float Config::getFloat | ( | const std::string & | id | ) | [static] |
Definition at line 145 of file Config.cpp.
| bool Config::getFloatMinMax | ( | const std::string & | id, |
| std::pair< float, float > & | minmax | ||
| ) | [static] |
Definition at line 150 of file Config.cpp.
| Config * Config::getInstance | ( | ) | [static] |
Definition at line 62 of file Config.cpp.
| int Config::getInt | ( | const std::string & | id | ) | [static] |
Definition at line 130 of file Config.cpp.
| bool Config::getIntMinMax | ( | const std::string & | id, |
| std::pair< int, int > & | minmax | ||
| ) | [static] |
Definition at line 155 of file Config.cpp.
| bool Config::getMinMax | ( | const std::string & | id, |
| std::pair< T, T > & | minmax | ||
| ) | const [private] |
| const std::vector< std::string > & Config::getModuleList | ( | ) | const |
Definition at line 575 of file Config.cpp.
| std::string Config::getString | ( | const std::string & | id | ) | [static] |
Definition at line 140 of file Config.cpp.
| void Config::loadConfig | ( | const std::vector< std::string > | files, |
| const std::vector< std::string > | profiles, | ||
| const std::string & | prepend_path = "." |
||
| ) | [static] |
allows to load various config files and profiles besides config/default.xml and profile default
| files | List of files that are loaded additionally |
| profiles | List of profiles that are loaded additionally |
Definition at line 79 of file Config.cpp.
| bool Config::loadFromFile | ( | const std::string & | fileName, |
| const std::vector< std::string > & | profiles | ||
| ) |
Definition at line 420 of file Config.cpp.
Definition at line 49 of file Config.cpp.
| bool Config::parseDocument | ( | const std::string & | fileName, |
| const std::vector< std::string > & | profiles | ||
| ) | [private] |
Definition at line 354 of file Config.cpp.
| void Config::parseModules | ( | TiXmlNode * | root | ) | [private] |
Definition at line 286 of file Config.cpp.
| bool Config::parseProfile | ( | TiXmlNode * | root | ) | [private] |
Definition at line 306 of file Config.cpp.
| bool Config::parseValue | ( | TiXmlElement * | el, |
| class ConfigEntry & | newEntry, | ||
| std::string & | name | ||
| ) | const [private] |
Definition at line 168 of file Config.cpp.
| bool Config::parseValues | ( | const std::string & | level, |
| TiXmlNode * | root | ||
| ) | [private] |
Definition at line 234 of file Config.cpp.
| void Config::saveValue | ( | const std::string & | name, |
| const ConfigEntry & | entry, | ||
| TiXmlElement * | allProfValues, | ||
| TiXmlElement * | values | ||
| ) | const [private] |
Definition at line 434 of file Config.cpp.
| void Config::set | ( | const std::string & | id, |
| T | f | ||
| ) |
| static void Config::setInstance | ( | Config * | newInst | ) | [inline, static] |
| std::string Config::toText | ( | ) |
Mutex Config::m_AccessMutex = Mutex () [static] |
std::string Config::m_activeProfile [private] |
std::string Config::m_allProfileNames [private] |
class TiXmlDocument* Config::m_doc [private] |
std::string Config::m_fileName [private] |
Config * Config::m_inst = 0 [static, private] |
std::set<std::string> Config::m_loadedProfileNames [private] |
std::vector<std::string> Config::m_moduleList [private] |
std::map<std::string, ConfigEntry> Config::m_values [private] |