24 #ifndef CONFIGURATION_H
25 #define CONFIGURATION_H
47 template <
class T,
class CONT>
66 *const obj) const = 0;
103 virtual void setValue(
const std::string &key,
104 const std::string &value);
114 std::string
getValue(
const std::string &key,
117 int getValue(
const std::string &key,
126 unsigned getValue(
const std::string &key,
129 double getValue(
const std::string &key,
145 template <
class IT,
class T,
class CONT>
146 void setList(
const std::string &name, IT begin, IT end,
156 for (IT it = begin; it != end; it++)
163 list->push_back(wrobj);
181 template<
class T,
class CONT>
186 CONT container =
empty;
191 for (ConfigurationList::const_iterator it = list->begin();
202 void enableKeyLogging()
205 void setIsMain(
bool b)
212 virtual void initFromXML(XmlNodeConstPtrConst parentNode);
213 virtual void writeToXML(XmlTextWriterPtr writer);
217 typedef std::map<std::string, std::string>
Options;
229 #define valTest(num) mStatsRe##num
251 void init(
const std::string &filename,
284 const char *
const file,
285 const unsigned line);
288 void setValue(
const std::string &key,
289 const std::string &value)
override;
291 void incValue(
const std::string &key);
294 const std::string &value);
297 const char *
const value)
298 {
if (value !=
nullptr)
setValue(key, std::string(value)); }
301 const char *
const value)
302 {
if (value !=
nullptr)
setSilent(key, std::string(value)); }
321 const unsigned value)
326 {
setValue(key, value ?
"1" :
"0"); }
virtual CONT readConfigItem(const ConfigurationObject *const obj, CONT container) const =0
ConfigurationListManager()
virtual ConfigurationObject * writeConfigItem(const T &value, ConfigurationObject *const obj) const =0
virtual void initFromXML(const xmlNode *const parentNode)
int getValueInt(const std::string &key, const int deflt) const
std::string getValue(const std::string &key, const std::string &deflt) const
virtual ~ConfigurationObject()
bool getValueBool(const std::string &key, const bool deflt) const
void deleteList(const std::string &name)
void setList(const std::string &name, IT begin, IT end, ConfigurationListManager< T, CONT > *manager)
std::map< std::string, std::string > Options
virtual void writeToXML(const xmlTextWriterPtr writer)
std::list< ConfigurationObject * > ConfigurationList
void deleteKey(const std::string &key)
virtual void setValue(const std::string &key, const std::string &value)
std::map< std::string, ConfigurationList > mContainerOptions
CONT getList(const std::string &name, CONT empty, ConfigurationListManager< T, CONT > *manager)
bool getBoolValue(const std::string &key) const
std::string getStringValue(const std::string &key) const
float getFloatValue(const std::string &key) const
void addListener(const std::string &key, ConfigListener *const listener)
const std::string & getConfigPath() const
void setSilent(const std::string &key, const bool value)
std::map< std::string, Listeners > ListenerMap
void setValue(const std::string &key, const char *const value)
void setValue(const std::string &key, const std::string &value)
bool resetBoolValue(const std::string &key)
DefaultsData & getDefaultValues()
void incValue(const std::string &key)
void setValue(const std::string &key, const unsigned value)
Listeners::iterator ListenerIterator
std::string getFileName() const
ListenerMap::iterator ListenerMapIterator
void removeListener(const std::string &key, ConfigListener *const listener)
void setValueInt(const std::string &key, const int value)
int resetIntValue(const std::string &key)
std::list< ConfigListener * > Listeners
void setSilent(const std::string &key, const std::string &value)
void setValue(const std::string &key, const bool value)
void setValue(const std::string &key, const int value)
void setSilent(const std::string &key, const char *const value)
void setValue(const std::string &key, const float value)
void removeListeners(ConfigListener *const listener)
void init(const std::string &filename, const UseVirtFs useResManager, const SkipError skipError)
DefaultsData mDefaultsData
Defaults of value for a given key.
std::string getDirectory() const
int getIntValue(const std::string &key) const
void setValue(const std::string &key, const double value)
Configuration serverConfig
std::map< std::string, VariableData * > DefaultsData
#define A_DELETE_COPY(func)
#define A_WARN_UNUSED_NON_TESTS
std::string toString(T const &value)
converts any type to a string