diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-08-26 02:48:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-08-26 02:48:32 +0300 |
commit | ab596ef3f4215f792feaa9ca1dfe5acb74c67328 (patch) | |
tree | ac5a4f31e2fa9c784d7de8d817654d47e21ccac2 /src/configuration.h | |
parent | 399f264360f6e8dfa31d0c3ff7d72aad8033888d (diff) | |
download | manaplus-ab596ef3f4215f792feaa9ca1dfe5acb74c67328.tar.gz manaplus-ab596ef3f4215f792feaa9ca1dfe5acb74c67328.tar.bz2 manaplus-ab596ef3f4215f792feaa9ca1dfe5acb74c67328.tar.xz manaplus-ab596ef3f4215f792feaa9ca1dfe5acb74c67328.zip |
Add const to some classes.
Diffstat (limited to 'src/configuration.h')
-rw-r--r-- | src/configuration.h | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/src/configuration.h b/src/configuration.h index 79fa9b5ba..7435f8596 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -104,15 +104,15 @@ class ConfigurationObject std::string getValue(const std::string &key, const std::string &deflt) const; - int getValue(const std::string &key, int deflt) const; + int getValue(const std::string &key, const int deflt) const; - int getValueInt(const std::string &key, int deflt) const; + int getValueInt(const std::string &key, const int deflt) const; - bool getValueBool(const std::string &key, bool deflt) const; + bool getValueBool(const std::string &key, const bool deflt) const; - unsigned getValue(const std::string &key, unsigned deflt) const; + unsigned getValue(const std::string &key, const unsigned deflt) const; - double getValue(const std::string &key, double deflt) const; + double getValue(const std::string &key, const double deflt) const; /** * Re-sets all data in the configuration @@ -201,8 +201,8 @@ class ConfigurationObject #endif protected: - virtual void initFromXML(XmlNodePtr node); - virtual void writeToXML(XmlTextWriterPtr writer); + virtual void initFromXML(const XmlNodePtr parent_node); + virtual void writeToXML(const XmlTextWriterPtr writer); void deleteList(const std::string &name); @@ -236,14 +236,15 @@ class Configuration : public ConfigurationObject * @param filename path to config file * @param useResManager Make use of the resource manager. */ - void init(const std::string &filename, bool useResManager = false); + void init(const std::string &filename, + const bool useResManager = false); /** * Set the default values for each keys. * * @param defaultsData data used as defaults. */ - void setDefaultValues(DefaultsData *defaultsData); + void setDefaultValues(DefaultsData *const defaultsData); /** * Writes the current settings back to the config file. @@ -253,45 +254,47 @@ class Configuration : public ConfigurationObject /** * Adds a listener to the listen list of the specified config option. */ - void addListener(const std::string &key, ConfigListener *listener); + void addListener(const std::string &key, + ConfigListener *const listener); /** * Removes a listener from the listen list of the specified config * option. */ - void removeListener(const std::string &key, ConfigListener *listener); + void removeListener(const std::string &key, + ConfigListener *const listener); - void removeListeners(ConfigListener *listener); + void removeListeners(ConfigListener *const listener); void setValue(const std::string &key, const std::string &value); void setSilent(const std::string &key, const std::string &value); - inline void setValue(const std::string &key, const char *value) + inline void setValue(const std::string &key, const char *const value) { if (value) setValue(key, std::string(value)); } - inline void setSilent(const std::string &key, const char *value) + inline void setSilent(const std::string &key, const char *const value) { if (value) setSilent(key, std::string(value)); } - inline void setValue(const std::string &key, float value) + inline void setValue(const std::string &key, const float value) { setValue(key, toString(value)); } - inline void setValue(const std::string &key, double value) + inline void setValue(const std::string &key, const double value) { setValue(key, toString(value)); } - inline void setValue(const std::string &key, int value) + inline void setValue(const std::string &key, const int value) { setValue(key, toString(value)); } - inline void setValueInt(const std::string &key, int value) + inline void setValueInt(const std::string &key, const int value) { setValue(key, toString(value)); } - inline void setValue(const std::string &key, unsigned value) + inline void setValue(const std::string &key, const unsigned value) { setValue(key, toString(value)); } - inline void setValue(const std::string &key, bool value) + inline void setValue(const std::string &key, const bool value) { setValue(key, value ? "1" : "0"); } - inline void setSilent(const std::string &key, bool value) + inline void setSilent(const std::string &key, const bool value) { setSilent(key, value ? "1" : "0"); } int resetIntValue(const std::string &key); |