-// Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-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
using namespace XAO;
-const std::string XaoUtils::intToString(const int& value)
+std::string XaoUtils::intToString(int value)
{
std::ostringstream str;
str << value;
return str.str();
}
-const int XaoUtils::stringToInt(const std::string& value)
-throw(XAO_Exception)
+int XaoUtils::stringToInt(const std::string& value)
{
int res;
std::istringstream convert(value);
return res;
}
-const std::string XaoUtils::doubleToString(const double& value)
+std::string XaoUtils::doubleToString(double value)
{
std::ostringstream str;
str << value;
return str.str();
}
-const double XaoUtils::stringToDouble(const std::string& value)
-throw(XAO_Exception)
+double XaoUtils::stringToDouble(const std::string& value)
{
double res;
std::istringstream convert(value);
return res;
}
-const std::string XaoUtils::booleanToString(const bool& value)
+std::string XaoUtils::booleanToString(bool value)
{
- if (value)
- return "true";
- return "false";
+ return value ? "true" : "false";
}
-const bool XaoUtils::stringToBoolean(const std::string& value)
-throw(XAO_Exception)
+bool XaoUtils::stringToBoolean(const std::string& value)
{
if (value == "true" || value == "1")
return true;
throw XAO_Exception(MsgBuilder() << "Invalid boolean value: " << value);
}
-const std::string XaoUtils::dimensionToString(const XAO::Dimension& dimension)
-throw(XAO_Exception)
+std::string XaoUtils::dimensionToString(XAO::Dimension dimension)
{
if (dimension == XAO::VERTEX)
return "vertex";
throw XAO_Exception(MsgBuilder() << "Bad dimension: " << dimension);
}
-const XAO::Dimension XaoUtils::stringToDimension(const std::string& dimension)
-throw(XAO_Exception)
+XAO::Dimension XaoUtils::stringToDimension(const std::string& dimension)
{
if (dimension == "vertex")
return XAO::VERTEX;
return XAO::FACE;
if (dimension == "solid")
return XAO::SOLID;
- if (dimension == "part")
+ if (dimension == "whole")
return XAO::WHOLE;
throw XAO_Exception(MsgBuilder() << "Bad dimension: " << dimension);
}
-const std::string XaoUtils::fieldTypeToString(const XAO::Type& type)
-throw(XAO_Exception)
+std::string XaoUtils::fieldTypeToString(XAO::Type type)
{
if (type ==XAO:: BOOLEAN)
return "boolean";
throw XAO_Exception(MsgBuilder() << "Bad type: " << type);
}
-const XAO::Type XaoUtils::stringToFieldType(const std::string& type)
-throw(XAO_Exception)
+XAO::Type XaoUtils::stringToFieldType(const std::string& type)
{
if (type == "boolean")
return XAO::BOOLEAN;
throw XAO_Exception(MsgBuilder() << "Bad type: " << type);
}
-const std::string XaoUtils::shapeFormatToString(const XAO::Format& format)
-throw(XAO_Exception)
+std::string XaoUtils::shapeFormatToString(XAO::Format format)
{
if (format == XAO::BREP)
return "BREP";
throw XAO_Exception(MsgBuilder() << "Bad format: " << format);
}
-const XAO::Format XaoUtils::stringToShapeFormat(const std::string& format)
-throw(XAO_Exception)
+XAO::Format XaoUtils::stringToShapeFormat(const std::string& format)
{
if (format == "BREP")
return XAO::BREP;