]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModelHighAPI/ModelHighAPI_Dumper.cpp
Salome HOME
Support of wide string
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Dumper.cpp
index cf359fc6559acb4db1150315cb56120237fd05cc..ea695b89cbaf53ffb0d1114f0f0b7d0cb8503697 100644 (file)
@@ -314,8 +314,8 @@ void ModelHighAPI_Dumper::DumpStorage::write(const AttributeSelectionPtr& theAtt
   getShapeAndContext(theAttrSelect, aShape, aContext);
 
   if (aShape.get()) {
-    myDumpBuffer << "\"" << aShape->shapeTypeStr() << "\", \""
-                 << theAttrSelect->namingName() << "\"";
+    //TODO: vsv myDumpBuffer << "\"" << aShape->shapeTypeStr() << "\", \""
+    //             << theAttrSelect->namingName() << "\"";
   }
 
   myDumpBuffer << ")";
@@ -495,8 +495,8 @@ void ModelHighAPI_Dumper::DumpStorageWeak::write(const AttributeSelectionPtr& th
     GeomAlgoAPI_NExplode aNExplode(aContext->shape(), aShape->shapeType());
     int anIndex = aNExplode.index(aShape);
     if (anIndex != 0) { // found a week-naming index, so, export it
-      myDumpBuffer << "model.selection(\"" << aShape->shapeTypeStr() << "\", \""
-                   << theAttrSelect->contextName(aContext) << "\", " << anIndex << ")";
+      //TODO: vsv myDumpBuffer << "model.selection(\"" << aShape->shapeTypeStr() << "\", \""
+      //             << theAttrSelect->contextName(aContext) << "\", " << anIndex << ")";
       aStandardDump = false;
     }
   }
@@ -580,18 +580,19 @@ const std::string& ModelHighAPI_Dumper::name(const EntityPtr& theEntity,
     return aFound->second.myCurrentName;
   }
   // entity is not found, store it
-  std::string aName, aKind;
+  std::string aName;
+  std::string aKind;
   bool isDefaultName = false;
   bool isSaveNotDumped = theSaveNotDumped;
   std::ostringstream aDefaultName;
   FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theEntity);
   if (aFeature) {
-    aName = aFeature->name();
+    aName = ModelAPI_Tools::toString(aFeature->name());
     aKind = aFeature->getKind();
   } else {
     FolderPtr aFolder = std::dynamic_pointer_cast<ModelAPI_Folder>(theEntity);
     if (aFolder) {
-      aName = aFolder->data()->name();
+      aName = ModelAPI_Tools::toString(aFolder->data()->name());
       aKind = ModelAPI_Folder::ID();
       isSaveNotDumped = false;
     }
@@ -684,9 +685,9 @@ void ModelHighAPI_Dumper::saveResultNames(const FeaturePtr& theFeature)
   std::list<ResultPtr> allRes;
   ModelAPI_Tools::allResults(theFeature, allRes);
   for(std::list<ResultPtr>::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) {
-    std::pair<std::string, bool> aName = ModelAPI_Tools::getDefaultName(*aRes);
-    std::string aDefaultName = aName.first;
-    std::string aResName = (*aRes)->data()->name();
+    std::pair<std::wstring, bool> aName = ModelAPI_Tools::getDefaultName(*aRes);
+    std::string aDefaultName = ModelAPI_Tools::toString(aName.first);
+    std::string aResName = ModelAPI_Tools::toString((*aRes)->data()->name());
     bool isUserDefined = !(isFeatureDefaultName && aDefaultName == aResName);
     myNames[*aRes] =
       EntityName(aResName, (isUserDefined ? aResName : std::string()), !isUserDefined);
@@ -870,14 +871,15 @@ void ModelHighAPI_Dumper::dumpSubFeatureNameAndColor(const std::string theSubFea
                                                      const FeaturePtr& theSubFeature)
 {
   name(theSubFeature, false);
-  myNames[theSubFeature] = EntityName(theSubFeatureGet, theSubFeature->name(), false);
+  myNames[theSubFeature] =
+    EntityName(theSubFeatureGet, ModelAPI_Tools::toString(theSubFeature->name()), false);
 
   // store results if they have user-defined names or colors
   std::list<ResultPtr> aResultsWithNameOrColor;
   const std::list<ResultPtr>& aResults = theSubFeature->results();
   std::list<ResultPtr>::const_iterator aResIt = aResults.begin();
   for (; aResIt != aResults.end(); ++aResIt) {
-    std::string aResName = (*aResIt)->data()->name();
+    std::string aResName = ModelAPI_Tools::toString((*aResIt)->data()->name());
     myNames[*aResIt] = EntityName(aResName, aResName, false);
     aResultsWithNameOrColor.push_back(*aResIt);
   }
@@ -1088,6 +1090,12 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const std::string& theStrin
   return *this;
 }
 
+ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const std::wstring& theString)
+{
+  *myDumpStorage << ModelAPI_Tools::toString(theString);
+  return *this;
+}
+
 ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const bool theValue)
 {
   *myDumpStorage << (theValue ? "True" : "False");