diff options
Diffstat (limited to 'src/configuration.cpp')
-rw-r--r-- | src/configuration.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp index 6755e0a4f..04acbce28 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -196,6 +196,30 @@ int Configuration::getIntValue(const std::string &key) const return defaultValue; } +int Configuration::resetIntValue(const std::string &key) +{ + GETLOG(); + int defaultValue = 0; + if (mDefaultsData) + { + DefaultsData::const_iterator itdef = mDefaultsData->find(key); + + if (itdef != mDefaultsData->end() && itdef->second + && itdef->second->getType() == Mana::VariableData::DATA_INT) + { + defaultValue = (static_cast<Mana::IntData*>( + itdef->second))->getData(); + } + else + { + logger->log("%s: No integer value in registry for key %s", + mConfigPath.c_str(), key.c_str()); + } + } + setValue(key, defaultValue); + return defaultValue; +} + std::string Configuration::getStringValue(const std::string &key) const { GETLOG(); @@ -291,6 +315,31 @@ bool Configuration::getBoolValue(const std::string &key) const return defaultValue; } +bool Configuration::resetBoolValue(const std::string &key) +{ + GETLOG(); + bool defaultValue = false; + if (mDefaultsData) + { + DefaultsData::const_iterator itdef = mDefaultsData->find(key); + + if (itdef != mDefaultsData->end() && itdef->second + && itdef->second->getType() == Mana::VariableData::DATA_BOOL) + { + defaultValue = (static_cast<Mana::BoolData*>( + itdef->second))->getData(); + } + else + { + logger->log("%s: No boolean value in registry for key %s", + mConfigPath.c_str(), key.c_str()); + } + } + + setValue(key, defaultValue); + return defaultValue; +} + void ConfigurationObject::initFromXML(xmlNodePtr parent_node) { clear(); |