Salome HOME
updated copyright message
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_SketchCopy.cpp
index 4439c1067e27b8344d4086958959d81ec1beaa1a..12f9a0c6c31543656975b3c8863620be7b6d2bff 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020  CEA/DEN, EDF R&D
+// Copyright (C) 2020-2023  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
@@ -226,8 +226,8 @@ static void renameByParent(FeaturePtr theOld, FeaturePtr theNew)
 
   AttributeReferencePtr aNewParentRef = theNew->reference(SketchPlugin_SketchEntity::PARENT_ID());
 
-  std::string anOldName = anOldParentRef->value()->data()->name();
-  std::string aNewName = aNewParentRef->value()->data()->name();
+  std::wstring anOldName = anOldParentRef->value()->data()->name();
+  std::wstring aNewName = aNewParentRef->value()->data()->name();
 
   // substitute name of old parent by the new one
   theNew->data()->setName(theOld->name());
@@ -280,14 +280,14 @@ static void copyFeature(const FeaturePtr theFeature,
   renameByParent(theFeature, aNewFeature);
 }
 
-static int index(const std::string& theName, const std::string& thePrefix)
+static int index(const std::wstring& theName, const std::wstring& thePrefix)
 {
   int anIndex = -1;
   if (theName.find(thePrefix) == 0) {
     anIndex = 0;
     if (theName[thePrefix.size()] == '_') {
-      std::string anIndexStr = theName.substr(thePrefix.size() + 1);
-      anIndex = std::atoi(anIndexStr.c_str());
+      std::wstring anIndexStr = theName.substr(thePrefix.size() + 1);
+      anIndex = std::stoi(anIndexStr);
     }
   }
   return anIndex;
@@ -324,8 +324,8 @@ void SketchPlugin_SketchCopy::execute()
   aNewSketch->execute();
 
   // check number of copies of the selected sketch before name the new sketch
-  static const std::string SKETCH_NAME_SUFFIX("_Copy");
-  std::string aSketchName = aBaseSketch->name() + SKETCH_NAME_SUFFIX;
+  static const std::wstring SKETCH_NAME_SUFFIX(L"_Copy");
+  std::wstring aSketchName = aBaseSketch->name() + SKETCH_NAME_SUFFIX;
   int aNewSketchIndex = 0;
   std::list<FeaturePtr> aFeatures = document()->allFeatures();
   for (std::list<FeaturePtr>::iterator aFIt = aFeatures.begin(); aFIt != aFeatures.end(); ++aFIt) {
@@ -338,7 +338,7 @@ void SketchPlugin_SketchCopy::execute()
     if (anIndex >= aNewSketchIndex)
       aNewSketchIndex = anIndex + 1;
   }
-  std::ostringstream aNameStream;
+  std::wostringstream aNameStream;
   aNameStream << aSketchName;
   if (aNewSketchIndex > 0)
     aNameStream << '_' << aNewSketchIndex;