X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSelector%2FSelector_Intersect.cpp;h=7af473b271be1dacb53cc38cc574fa02360e5d22;hb=06e7f5859095193fc7f498bd89a7d28009794f53;hp=a104911deff98d68d6263feda3a8c64bfd91f018;hpb=a48a3b574fbf6f526fbeebfd637e1f5d9f4f6ea9;p=modules%2Fshaper.git diff --git a/src/Selector/Selector_Intersect.cpp b/src/Selector/Selector_Intersect.cpp index a104911de..7af473b27 100644 --- a/src/Selector/Selector_Intersect.cpp +++ b/src/Selector/Selector_Intersect.cpp @@ -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 @@ -22,6 +22,8 @@ #include #include +#include + #include #include #include @@ -168,7 +170,6 @@ bool Selector_Intersect::restore() return false; myShapeType = TopAbs_ShapeEnum(aShapeTypeAttr->Get()); // restore sub-selectors - bool aSubResult = true; for(TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) { Selector_Algo* aSubSel = restoreByLab(aSub.Value(), baseDocument()); if (!append(aSubSel, false)) { @@ -182,29 +183,29 @@ bool Selector_Intersect::restore() return true; } -TDF_Label Selector_Intersect::restoreByName(std::string theName, +TDF_Label Selector_Intersect::restoreByName(std::wstring theName, const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) { myShapeType = theShapeType; TDF_Label aContext; - for(size_t aStart = 0; aStart != std::string::npos; aStart = theName.find('[', aStart + 1)) { - size_t anEndPos = theName.find(']', aStart + 1); - if (anEndPos != std::string::npos) { - std::string aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1); + for(size_t aStart = 0; aStart != std::wstring::npos; aStart = theName.find(L'[', aStart + 1)) { + size_t anEndPos = theName.find(L']', aStart + 1); + if (anEndPos != std::wstring::npos) { + std::wstring aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1); size_t aFoundOldWeak = aSubStr.find(oldWeakNameID()); - size_t aFoundNewWeak = aFoundOldWeak != std::string::npos ? + size_t aFoundNewWeak = aFoundOldWeak != std::wstring::npos ? aSubStr.find(weakNameID()) : aFoundOldWeak; if (aFoundOldWeak == 0 || aFoundNewWeak == 0) { // weak name identifier - std::string aWeakIndex = aSubStr.substr(aFoundOldWeak + oldWeakNameID().size()); - myWeakIndex = atoi(aWeakIndex.c_str()); + std::wstring aWeakIndex = aSubStr.substr(aFoundOldWeak + oldWeakNameID().size()); + myWeakIndex = atoi(Locale::Convert::toString(aWeakIndex).c_str()); myRecomputeWeakIndex = aFoundOldWeak == 0; continue; } TopAbs_ShapeEnum aSubShapeType = TopAbs_FACE; - if (anEndPos != std::string::npos && anEndPos + 1 < theName.size()) { - char aShapeChar = theName[anEndPos + 1]; - if (theName[anEndPos + 1] != '[') { + if (anEndPos != std::wstring::npos && anEndPos + 1 < theName.size()) { + wchar_t aShapeChar = theName[anEndPos + 1]; + if (theName[anEndPos + 1] != L'[') { switch(aShapeChar) { case 'e': aSubShapeType = TopAbs_EDGE; break; case 'v': aSubShapeType = TopAbs_VERTEX; break; @@ -284,9 +285,9 @@ bool Selector_Intersect::solve(const TopoDS_Shape& theContext) return false; } -std::string Selector_Intersect::name(Selector_NameGenerator* theNameGenerator) +std::wstring Selector_Intersect::name(Selector_NameGenerator* theNameGenerator) { - std::string aResult; + std::wstring aResult; // add names of sub-components one by one in "[]" +optionally [weak_name_1] std::list::const_iterator aSubSel = list().cbegin(); for(; aSubSel != list().cend(); aSubSel++) { @@ -298,15 +299,15 @@ std::string Selector_Intersect::name(Selector_NameGenerator* theNameGenerator) TopAbs_ShapeEnum aSubType = aSubVal.ShapeType(); if (aSubType != TopAbs_FACE) { // in case the sub shape type must be stored switch(aSubType) { - case TopAbs_EDGE: aResult += "e"; break; - case TopAbs_VERTEX: aResult += "v"; break; + case TopAbs_EDGE: aResult += L"e"; break; + case TopAbs_VERTEX: aResult += L"v"; break; default:; } } } } if (myWeakIndex != -1) { - std::ostringstream aWeakStr; + std::wostringstream aWeakStr; aWeakStr<<"["<