X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConfig%2FConfig_PropManager.cpp;h=82ec43f5871c82fba052e124ee830189943d53ef;hb=60e95a5502a6940c6c27ce5d561b3c684b0b0a4f;hp=c296cc864772f6b0c66a95cc8bd7b8d07f47898d;hpb=8dc74f82810d5f597b78633b457efb0ef4f89f9f;p=modules%2Fshaper.git diff --git a/src/Config/Config_PropManager.cpp b/src/Config/Config_PropManager.cpp index c296cc864..82ec43f58 100644 --- a/src/Config/Config_PropManager.cpp +++ b/src/Config/Config_PropManager.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: Config_PropManager.cpp // Created: 13 Aug 2014 // Author: Vitaly SMETANNIKOV @@ -10,22 +12,29 @@ double stringToDouble(const std::string& theDouble); Config_Properties Config_PropManager::myProps; -bool Config_PropManager::registerProp(const std::string& theSection, const std::string& theName, - const std::string& theTitle, Config_Prop::PropType theType, - const std::string& theValue) +Config_Prop* Config_PropManager::registerProp(const std::string& theSection, const std::string& theName, + const std::string& theTitle, Config_Prop::PropType theType, + const std::string& theDefaultValue) { Config_Prop* aProp = findProp(theSection, theName); + if (aProp) { + if (aProp->value() == "") { + aProp->setValue(theDefaultValue); + } + if (aProp->defaultValue() == "") { + aProp->setDefaultValue(theDefaultValue); + } if (aProp->type() == Config_Prop::Disabled) { aProp->setType(theType); aProp->setTitle(theTitle); - return true; } - return false; } - aProp = new Config_Prop(theSection, theName, theTitle, theType, theValue); - myProps.push_back(aProp); - return true; + else { + aProp = new Config_Prop(theSection, theName, theTitle, theType, theDefaultValue); + myProps.push_back(aProp); + } + return aProp; } Config_Prop* Config_PropManager::findProp(const std::string& theSection, const std::string& theName)