-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2020 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
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "Model_Expression.h"
+#include <Locale_Convert.h>
+
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
}
}
-void Model_Expression::setText(const std::string& theValue)
+void Model_Expression::setText(const std::wstring& theValue)
{
if (text() != theValue) {
myText->Set(TCollection_ExtendedString(theValue.c_str()));
setError(text().empty() ? "" : "Not a double value.");
}
-std::string Model_Expression::text() const
+std::wstring Model_Expression::text() const
{
- return TCollection_AsciiString(myText->Get()).ToCString();
+ return Locale::Convert::toWString(myText->Get().ToExtString());
}
void Model_Expression::setError(const std::string& theError)
return TCollection_AsciiString(myError->Get()).ToCString();
}
-void Model_Expression::setUsedParameters(const std::set<std::string>& theUsedParameters)
+void Model_Expression::setUsedParameters(const std::set<std::wstring>& theUsedParameters)
{
myUsedParameters->Clear();
- std::set<std::string>::const_iterator anIt = theUsedParameters.begin();
+ std::set<std::wstring>::const_iterator anIt = theUsedParameters.begin();
for (; anIt != theUsedParameters.end(); ++anIt)
myUsedParameters->Append(TCollection_ExtendedString(anIt->c_str()));
}
-std::set<std::string> Model_Expression::usedParameters() const
+std::set<std::wstring> Model_Expression::usedParameters() const
{
- std::set<std::string> aResult;
+ std::set<std::wstring> aResult;
TDataStd_ListIteratorOfListOfExtendedString aIt;
for (aIt.Initialize(myUsedParameters->List()); aIt.More(); aIt.Next())
- aResult.insert(TCollection_AsciiString(aIt.Value()).ToCString());
+ aResult.insert(Locale::Convert::toWString(aIt.Value().ToExtString()));
return aResult;
}
double Model_ExpressionDouble::value()
{
- if (myIsInitialized)
+ if (myIsInitialized && !myReal.IsNull())
return myReal->Get();
return std::numeric_limits<double>::max(); // error
}
int Model_ExpressionInteger::value()
{
- if (myIsInitialized)
+ if (myIsInitialized && !myInteger.IsNull())
return myInteger->Get();
return std::numeric_limits<int>::max(); // error
}