X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParametersPlugin%2FParametersPlugin_Parameter.cpp;h=37285770e770f9b887a91e4e5385c9a31043ba3f;hb=a0dd2d01c33873491ab947f44789d39006f605cf;hp=b49507befdee9afa4efdd78ace80d44682e8c243;hpb=f14192492e36f4febc93b2ad7ab7f866cbbdf71b;p=modules%2Fshaper.git diff --git a/src/ParametersPlugin/ParametersPlugin_Parameter.cpp b/src/ParametersPlugin/ParametersPlugin_Parameter.cpp index b49507bef..37285770e 100644 --- a/src/ParametersPlugin/ParametersPlugin_Parameter.cpp +++ b/src/ParametersPlugin/ParametersPlugin_Parameter.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2022 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -21,6 +21,8 @@ #include "ParametersPlugin_Parameter.h" +#include + #include #include #include @@ -73,12 +75,14 @@ void ParametersPlugin_Parameter::attributeChanged(const std::string& theID) void ParametersPlugin_Parameter::updateName() { - std::string aName = string(VARIABLE_ID())->value(); - data()->setName(ModelAPI_Tools::toWString(aName)); + std::wstring aName = string(VARIABLE_ID())->isUValue() ? + Locale::Convert::toWString(string(VARIABLE_ID())->valueU()) : + Locale::Convert::toWString(string(VARIABLE_ID())->value()); + data()->setName(aName); ResultParameterPtr aParam = document()->createParameter(data()); - std::string anOldName = ModelAPI_Tools::toString(aParam->data()->name()); - aParam->data()->setName(ModelAPI_Tools::toWString(aName)); + std::wstring anOldName = aParam->data()->name(); + aParam->data()->setName(aName); setResult(aParam); @@ -86,12 +90,12 @@ void ParametersPlugin_Parameter::updateName() // update the depended expressions DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument(); if (aParam->document() != aRootDoc) { - std::list aNames; // collect names in the root document that must be checked + std::list aNames; // collect names in the root document that must be checked aNames.push_back(aName); if (anOldName != aName) { aNames.push_back(anOldName); } - std::list::iterator aNIter = aNames.begin(); + std::list::iterator aNIter = aNames.begin(); for (; aNIter != aNames.end(); aNIter++) { double aValue; ResultParameterPtr aRootParam; @@ -113,7 +117,9 @@ void ParametersPlugin_Parameter::updateName() bool ParametersPlugin_Parameter::updateExpression() { - std::string anExpression = string(EXPRESSION_ID())->value(); + std::wstring anExpression = string(EXPRESSION_ID())->isUValue() ? + Locale::Convert::toWString(string(EXPRESSION_ID())->valueU()) : + Locale::Convert::toWString(string(EXPRESSION_ID())->value()); std::string outErrorMessage; double aValue = evaluate(anExpression, outErrorMessage); @@ -137,7 +143,8 @@ void ParametersPlugin_Parameter::execute() setError("Expression error.", false); } -double ParametersPlugin_Parameter::evaluate(const std::string& theExpression, std::string& theError) +double ParametersPlugin_Parameter::evaluate(const std::wstring& /*theExpression*/, + std::string& theError) { FeaturePtr aMyPtr = std::dynamic_pointer_cast(data()->owner()); std::shared_ptr aProcessMessage = @@ -150,7 +157,7 @@ double ParametersPlugin_Parameter::evaluate(const std::string& theExpression, st theError = aProcessMessage->error(); // compare the list of parameters to store if changed AttributeRefListPtr aParams = reflist(ARGUMENTS_ID()); - bool aDifferent = aParams->size() != aParamsList.size(); + bool aDifferent = aParams->size() != (int)aParamsList.size(); if (!aDifferent) { std::list::const_iterator aNewIter = aParamsList.begin(); std::list anOldList = aParams->list();