1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #include <ExchangePlugin_Tools.h>
25 std::list<std::string> ExchangePlugin_Tools::split(const std::string& theString, char theDelimiter)
27 std::list<std::string> theResult;
28 std::istringstream aStream(theString);
30 while (std::getline(aStream, aSection, theDelimiter))
31 theResult.push_back(aSection);
35 std::string ExchangePlugin_Tools::selectionType2xaoDimension(const std::string& theType)
37 if (theType == "Vertices" || theType == "vertex" || theType == "VERTEX")
39 else if (theType == "Edges" || theType == "edge" || theType == "EDGE")
41 else if (theType == "Faces" || theType == "face" || theType == "FACE")
43 else if (theType == "Solids" || theType == "solid" || theType == "SOLID")
45 else if (theType == "Part" || theType == "part" || theType == "PART")
51 std::string ExchangePlugin_Tools::xaoDimension2selectionType(const std::string& theDimension)
53 if (theDimension == "vertex")
55 else if (theDimension == "edge")
57 else if (theDimension == "face")
59 else if (theDimension == "solid")
66 std::string ExchangePlugin_Tools::valuesType2xaoType(
67 const ModelAPI_AttributeTables::ValueType& theType)
70 case ModelAPI_AttributeTables::BOOLEAN:
72 case ModelAPI_AttributeTables::INTEGER:
74 case ModelAPI_AttributeTables::DOUBLE:
76 case ModelAPI_AttributeTables::STRING:
82 ModelAPI_AttributeTables::ValueType ExchangePlugin_Tools::xaoType2valuesType(std::string theType)
84 if (theType == "boolean")
85 return ModelAPI_AttributeTables::BOOLEAN;
86 if (theType == "integer")
87 return ModelAPI_AttributeTables::INTEGER;
88 if (theType == "double")
89 return ModelAPI_AttributeTables::DOUBLE;
90 if (theType == "string")
91 return ModelAPI_AttributeTables::STRING;
92 return ModelAPI_AttributeTables::DOUBLE;