Salome HOME
updated copyright message
[modules/shaper.git] / src / CollectionPlugin / CollectionPlugin_Group.cpp
index 2a083360ea5270ebf1b52a2b4591e70f49068dca..bba5dc1e00c83597a2e2463386e57ceea366f543 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -49,12 +49,12 @@ void CollectionPlugin_Group::execute()
 }
 
 // returns name with suffix, not existing in the existing set
-static std::string findName(
-  const std::string theOrigin, int& theSuffix, std::set<std::string>& theExisting)
+static std::wstring findName(
+  const std::wstring theOrigin, int& theSuffix, std::set<std::wstring>& theExisting)
 {
-  std::string aRes;
+  std::wstring aRes;
   do {
-    std::ostringstream aName;
+    std::wostringstream aName;
     aName<<theOrigin<<"_"<<theSuffix;
     aRes = aName.str();
     theSuffix++;
@@ -82,7 +82,7 @@ bool CollectionPlugin_Group::customAction(const std::string& theActionId)
   if (theActionId == "split") {
     DocumentPtr aDoc = document();
     // collect all existing names of features to give unique names
-    std::set<std::string> aFeatNames, aResNames;
+    std::set<std::wstring> aFeatNames, aResNames;
     std::list<FeaturePtr> allFeat = aDoc->allFeatures();
     std::list<FeaturePtr>::iterator allFeatIter = allFeat.begin();
     for(; allFeatIter != allFeat.end(); allFeatIter++) {
@@ -142,9 +142,9 @@ bool CollectionPlugin_Group::customAction(const std::string& theActionId)
           }
         }
       }
-      if (aFatherGroup.size() < aList->size() && aFatherGroup.size() != 1)  // already good
+      if (aFatherGroup.size() < (size_t)aList->size() && aFatherGroup.size() != 1)  // already good
         break;
-      if (aFatherGroup.size() == aList->size()) // no sence to iterate further
+      if (aFatherGroup.size() == (size_t)aList->size()) // no sence to iterate further
         break;
       if (aFatherGroup.size() == 1 && aList->size() > 1 && aCurrentDepth == aMinDepth)
         aSplitAnyway = true;  // split anyway, better that just move
@@ -152,7 +152,6 @@ bool CollectionPlugin_Group::customAction(const std::string& theActionId)
 
     std::set<int> aRemoved;
     bool aStay = false; // to indicate that the good attribute found stays in the list
-    int anIndex = 1; // index of the name assigned to group-feature and result
     // added in the order: 3 2 1 orig=0, so, keep the results to give names later
     std::list<FeaturePtr> aResults;
     for(int aNext = aList->size() - 1; aNext >= 0; aNext--) {
@@ -171,7 +170,7 @@ bool CollectionPlugin_Group::customAction(const std::string& theActionId)
 
       aRemoved.insert(aNext);
       FeaturePtr aNew;
-      if (aSplitAnyway || aFGroup > aResults.size()) {
+      if (aSplitAnyway || aFGroup > (int)aResults.size()) {
         aNew = aDoc->addFeature(ID(), false);
         aResults.push_front(aNew); // to keep the order
       } else { // appending in already created new result
@@ -197,7 +196,7 @@ bool CollectionPlugin_Group::customAction(const std::string& theActionId)
         aFeat->data()->setName(findName(name(), aSuffix, aFeatNames));
         if (!aFeat->results().empty() && !results().empty()) {
           int aResSuf = aSuffix - 1;
-          std::string aResName = findName(firstResult()->data()->name(), aResSuf, aResNames);
+          std::wstring aResName = findName(firstResult()->data()->name(), aResSuf, aResNames);
           aFeat->firstResult()->data()->setName(aResName);
           ModelAPI_Tools::copyVisualizationAttrs(firstResult(), aFeat->firstResult());
         }