1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <ExchangePlugin_Tools.h>
24 std::list<std::string> ExchangePlugin_Tools::split(const std::string& theString, char theDelimiter)
26 std::list<std::string> theResult;
27 std::istringstream aStream(theString);
29 while (std::getline(aStream, aSection, theDelimiter))
30 theResult.push_back(aSection);
34 std::string ExchangePlugin_Tools::selectionType2xaoDimension(const std::string& theType)
36 if (theType == "Vertices" || theType == "vertex" || theType == "VERTEX")
38 else if (theType == "Edges" || theType == "edge" || theType == "EDGE")
40 else if (theType == "Faces" || theType == "face" || theType == "FACE")
42 else if (theType == "Solids" || theType == "solid" || theType == "SOLID")
44 else if (theType == "Part" || theType == "part" || theType == "PART")
50 std::string ExchangePlugin_Tools::xaoDimension2selectionType(const std::string& theDimension)
52 if (theDimension == "vertex")
54 else if (theDimension == "edge")
56 else if (theDimension == "face")
58 else if (theDimension == "solid")
65 std::string ExchangePlugin_Tools::valuesType2xaoType(
66 const ModelAPI_AttributeTables::ValueType& theType)
69 case ModelAPI_AttributeTables::BOOLEAN:
71 case ModelAPI_AttributeTables::INTEGER:
73 case ModelAPI_AttributeTables::DOUBLE:
75 case ModelAPI_AttributeTables::STRING:
81 ModelAPI_AttributeTables::ValueType ExchangePlugin_Tools::xaoType2valuesType(std::string theType)
83 if (theType == "boolean")
84 return ModelAPI_AttributeTables::BOOLEAN;
85 if (theType == "integer")
86 return ModelAPI_AttributeTables::INTEGER;
87 if (theType == "double")
88 return ModelAPI_AttributeTables::DOUBLE;
89 if (theType == "string")
90 return ModelAPI_AttributeTables::STRING;
91 return ModelAPI_AttributeTables::DOUBLE;