Version: 9.16.0
XAO_XaoUtils.hxx
Go to the documentation of this file.
1// Copyright (C) 2013-2026 CEA, EDF, OPEN CASCADE
2//
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.
7//
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.
12//
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
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19// Author : Frederic Pons (OpenCascade)
20
21#ifndef __XAO_UTILS_HXX__
22#define __XAO_UTILS_HXX__
23
24#include <sstream>
25#include <string>
26#include <exception>
27
28#include "XAO.hxx"
29#include "XAO_Exception.hxx"
30
31#ifdef WIN32
32#pragma warning(disable:4290) // Warning Exception ...
33#endif
34
35namespace XAO
36{
40 enum Format
41 {
43 STEP
44 };
45
50 {
51 VERTEX = 0,
52 EDGE = 1,
53 FACE = 2,
54 SOLID = 3,
55 WHOLE = -1
56 };
57
61 enum Type
62 {
65 DOUBLE = 2,
66 STRING = 3
67 };
68
74 {
75 public:
81 static std::string intToString(int value);
82
89 static int stringToInt(const std::string& value);
90
96 static std::string doubleToString(double value);
103 static double stringToDouble(const std::string& value);
104
110 static std::string booleanToString(bool value);
118 static bool stringToBoolean(const std::string& value);
119
126 static std::string dimensionToString(XAO::Dimension dimension);
127
134 static XAO::Dimension stringToDimension(const std::string& dimension);
135
142 static std::string fieldTypeToString(XAO::Type type);
143
150 static XAO::Type stringToFieldType(const std::string& type);
151
158 static std::string shapeFormatToString(XAO::Format format);
159
166 static XAO::Format stringToShapeFormat(const std::string& format);
167 };
168
174 {
175 public:
180
181#ifndef SWIG
183 template <typename T>
185 {
186 m_stream << t;
187 return *this;
188 }
189
193 operator const char*() const { return m_stream.str().c_str(); }
194#endif
195
196 private :
197 std::stringstream m_stream;
198 };
199
200}
201
202
203
204#endif /* __XAO_UTILS_HXX__ */
#define XAO_EXPORT
Definition: XAO.hxx:31
MsgBuilder can be use to easily create messages.
Definition: XAO_XaoUtils.hxx:174
MsgBuilder()
Constructor.
Definition: XAO_XaoUtils.hxx:177
std::stringstream m_stream
Definition: XAO_XaoUtils.hxx:197
~MsgBuilder()
Destructor.
Definition: XAO_XaoUtils.hxx:179
MsgBuilder & operator<<(const T &t)
Stream operator.
Definition: XAO_XaoUtils.hxx:184
Utilities class to convert types.
Definition: XAO_XaoUtils.hxx:74
Definition: BrepGeometryTest.hxx:26
Dimension
Definition: XAO_XaoUtils.hxx:50
@ SOLID
SOLID.
Definition: XAO_XaoUtils.hxx:54
@ FACE
FACE.
Definition: XAO_XaoUtils.hxx:53
@ EDGE
EDGE.
Definition: XAO_XaoUtils.hxx:52
@ VERTEX
VERTEX.
Definition: XAO_XaoUtils.hxx:51
@ WHOLE
WHOLE.
Definition: XAO_XaoUtils.hxx:55
Format
Definition: XAO_XaoUtils.hxx:41
@ STEP
Definition: XAO_XaoUtils.hxx:43
@ BREP
Definition: XAO_XaoUtils.hxx:42
Type
Definition: XAO_XaoUtils.hxx:62
@ INTEGER
INTEGER.
Definition: XAO_XaoUtils.hxx:64
@ BOOLEAN
BOOLEAN.
Definition: XAO_XaoUtils.hxx:63
@ STRING
STRING.
Definition: XAO_XaoUtils.hxx:66
@ DOUBLE
DOUBLE.
Definition: XAO_XaoUtils.hxx:65