From c635347f18378aea08ba48e991ddb8ff1010c27c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 1 Mar 2013 16:00:26 +0300 Subject: Fix code style. --- src/configuration.cpp | 57 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 23 deletions(-) (limited to 'src/configuration.cpp') diff --git a/src/configuration.cpp b/src/configuration.cpp index fa0d1dc18..34d301446 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -365,21 +365,22 @@ int Configuration::getIntValue(const std::string &key) const if (itdef != mDefaultsData->end() && itdef->second) { - VariableData *const data = itdef->second; + const VariableData *const data = itdef->second; const VariableData::DataType type = static_cast(data->getType()); if (type == VariableData::DATA_INT) { - defaultValue = (static_cast(data))->getData(); + defaultValue = (static_cast( + data))->getData(); } else if (type == VariableData::DATA_STRING) { - defaultValue = atoi((static_cast( + defaultValue = atoi((static_cast( data))->getData().c_str()); } else if (type == VariableData::DATA_BOOL) { - if ((static_cast(data))->getData()) + if ((static_cast(data))->getData()) defaultValue = 1; else defaultValue = 0; @@ -387,7 +388,7 @@ int Configuration::getIntValue(const std::string &key) const else if (type == VariableData::DATA_FLOAT) { defaultValue = static_cast( - (static_cast(data))->getData()); + (static_cast(data))->getData()); } } else @@ -411,11 +412,12 @@ int Configuration::resetIntValue(const std::string &key) if (mDefaultsData) { const DefaultsData::const_iterator itdef = mDefaultsData->find(key); - VariableData *const data = itdef->second; + const VariableData *const data = itdef->second; if (itdef != mDefaultsData->end() && data && data->getType() == VariableData::DATA_INT) { - defaultValue = (static_cast(data))->getData(); + defaultValue = (static_cast( + data))->getData(); } else { @@ -441,23 +443,24 @@ std::string Configuration::getStringValue(const std::string &key) const if (itdef != mDefaultsData->end() && itdef->second) { - VariableData *const data = itdef->second; + const VariableData *const data = itdef->second; const VariableData::DataType type = static_cast(data->getType()); if (type == VariableData::DATA_STRING) { - defaultValue = (static_cast(data))->getData(); + defaultValue = (static_cast( + data))->getData(); } else if (type == VariableData::DATA_BOOL) { - if ((static_cast(data))->getData()) + if ((static_cast(data))->getData()) defaultValue = "1"; else defaultValue = "0"; } else if (type == VariableData::DATA_INT) { - defaultValue = toString((static_cast( + defaultValue = toString((static_cast( data))->getData()); } } @@ -490,29 +493,31 @@ float Configuration::getFloatValue(const std::string &key) const if (itdef != mDefaultsData->end() && itdef->second) { - VariableData *const data = itdef->second; + const VariableData *const data = itdef->second; const VariableData::DataType type = static_cast< VariableData::DataType>(data->getType()); if (type == VariableData::DATA_FLOAT) { defaultValue = static_cast( - (static_cast(data))->getData()); + (static_cast(data))->getData()); } else if (type == VariableData::DATA_STRING) { defaultValue = static_cast(atof(( - static_cast(data))->getData().c_str())); + static_cast( + data))->getData().c_str())); } else if (type == VariableData::DATA_BOOL) { - if ((static_cast(data))->getData()) + if ((static_cast(data))->getData()) defaultValue = 1; else defaultValue = 0; } else if (type == VariableData::DATA_INT) { - defaultValue = static_cast((static_cast( + defaultValue = static_cast(( + static_cast( data))->getData()); } } @@ -544,30 +549,36 @@ bool Configuration::getBoolValue(const std::string &key) const if (itdef != mDefaultsData->end() && itdef->second) { - VariableData *const data = itdef->second; + const VariableData *const data = itdef->second; const VariableData::DataType type = static_cast< VariableData::DataType>(data->getType()); if (type == VariableData::DATA_BOOL) { - defaultValue = (static_cast(data))->getData(); + defaultValue = (static_cast( + data))->getData(); } else if (type == VariableData::DATA_INT) { - if ((static_cast(data))->getData() != 0) + if ((static_cast(data))->getData() != 0) defaultValue = true; else defaultValue = false; } else if (type == VariableData::DATA_STRING) { - if ((static_cast(data))->getData() != "0") + if ((static_cast( + data))->getData() != "0") + { defaultValue = true; + } else + { defaultValue = false; + } } if (type == VariableData::DATA_FLOAT) { - if (static_cast((static_cast( + if (static_cast((static_cast( data))->getData()) != 0) { defaultValue = true; @@ -600,12 +611,12 @@ bool Configuration::resetBoolValue(const std::string &key) if (mDefaultsData) { const DefaultsData::const_iterator itdef = mDefaultsData->find(key); - VariableData *const data = itdef->second; + const VariableData *const data = itdef->second; if (itdef != mDefaultsData->end() && data && data->getType() == VariableData::DATA_BOOL) { - defaultValue = (static_cast(data))->getData(); + defaultValue = (static_cast(data))->getData(); } else { -- cgit v1.2.3-60-g2f50