Salome HOME
Merge remote-tracking branch 'remotes/origin/EDF_2020_Lot2'
[modules/shaper.git] / src / Selector / Selector_WeakName.cpp
index 813fa0b4e48ba80c9ea4acbfdb32d80b683361d6..559071b9c461e8f088a681c1a5de86c3bdcbfdba 100644 (file)
@@ -22,6 +22,8 @@
 #include <Selector_NameGenerator.h>
 #include <Selector_NExplode.h>
 
+#include <Locale_Convert.h>
+
 #include <TNaming_Tool.hxx>
 #include <TNaming_SameShapeIterator.hxx>
 #include <TNaming_Iterator.hxx>
@@ -85,18 +87,18 @@ bool Selector_WeakName::restore()
   return restoreBaseArray(anEmptyRefList, myContext);
 }
 
-TDF_Label Selector_WeakName::restoreByName(std::string theName,
+TDF_Label Selector_WeakName::restoreByName(std::wstring theName,
   const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
 {
   size_t aFoundWeak = theName.find(oldPureWeakNameID());
-  std::string aWeakIndex = theName.substr(aFoundWeak + oldPureWeakNameID().size());
-  std::size_t aContextPosition = aWeakIndex.find("_");
-  myWeakIndex = atoi(aWeakIndex.c_str());
+  std::wstring aWeakIndex = theName.substr(aFoundWeak + oldPureWeakNameID().size());
+  std::size_t aContextPosition = aWeakIndex.find(L"_");
+  myWeakIndex = atoi(Locale::Convert::toString(aWeakIndex).c_str());
   myRecomputeWeakIndex = aFoundWeak == 0;
   myShapeType = theShapeType;
   TDF_Label aContext;
-  if (aContextPosition != std::string::npos) { // context is also defined
-    std::string aContextName = aWeakIndex.substr(aContextPosition + 1);
+  if (aContextPosition != std::wstring::npos) { // context is also defined
+    std::wstring aContextName = aWeakIndex.substr(aContextPosition + 1);
     if (theNameGenerator->restoreContext(aContextName, aContext, myContext)) {
       if (myContext.IsNull())
         aContext.Nullify();
@@ -129,13 +131,13 @@ bool Selector_WeakName::solve(const TopoDS_Shape& theContext)
   return false;
 }
 
-std::string Selector_WeakName::name(Selector_NameGenerator* theNameGenerator)
+std::wstring Selector_WeakName::name(Selector_NameGenerator* theNameGenerator)
 {
   // _weak_naming_1_Context
-  std::ostringstream aWeakStr;
+  std::wostringstream aWeakStr;
   aWeakStr<<pureWeakNameID()<<myWeakIndex;
-  std::string aResult = aWeakStr.str();
+  std::wstring aResult = aWeakStr.str();
   if (!myContext.IsNull())
-    aResult += "_" + theNameGenerator->contextName(myContext);
+    aResult += L"_" + theNameGenerator->contextName(myContext);
   return aResult;
 }