mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 10:06:47 +00:00
4a85e5e7a5
* Preliminary MSYS2 + MinGW build scripts and instructions. * CMakeLists.txt: MinGW tweaks, enforce C++03, suppress warnings for now. * Fix some GCC warnings. * Fix unused parameter warnings coming from Ifc*.h. * Fix warning regarding unreachable code (++jt) on MSVC. * Add IfcParse_EXPORT for IfcInvalidTokenException * Fix potentially uninitialized pointer variables. * Note about OpenCASCADE cyclic dependencies fix. * GCC warning fix: don't generate 'current_enum' variable that is only set and not used for anything ever * Work around -Wmaybe-uninitialized warnings about boost::optional constructs. Also prevent passing of negative values for --bounds. * Remove unused variable. * CMakeLists.txt: ENABLE_BUILD_OPTIMIZATIONS for GCC (simply enforce -03)
79 lines
2.8 KiB
C++
79 lines
2.8 KiB
C++
/********************************************************************************
|
|
* *
|
|
* This file is part of IfcOpenShell. *
|
|
* *
|
|
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
* it under the terms of the Lesser GNU General Public License as published by *
|
|
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
* (at your option) any later version. *
|
|
* *
|
|
* IfcOpenShell is distributed in the hope that it will be useful, *
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
* Lesser GNU General Public License for more details. *
|
|
* *
|
|
* You should have received a copy of the Lesser GNU General Public License *
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
* *
|
|
********************************************************************************/
|
|
|
|
#ifndef IFCEXCEPTION_H
|
|
#define IFCEXCEPTION_H
|
|
|
|
#include "IfcParse_Export.h"
|
|
|
|
#include <boost/lexical_cast.hpp>
|
|
|
|
#include <exception>
|
|
#include <string>
|
|
|
|
#ifdef _MSC_VER
|
|
// "C4275 can be ignored in Visual C++ if you are deriving from a type in the Standard C++ Library",
|
|
// https://msdn.microsoft.com/en-us/library/3tdb471s.aspx
|
|
#pragma warning(push)
|
|
#pragma warning(disable : 4275)
|
|
#endif
|
|
|
|
namespace IfcParse {
|
|
class IfcParse_EXPORT IfcException : public std::exception {
|
|
private:
|
|
std::string message;
|
|
public:
|
|
IfcException(const std::string& m)
|
|
: message(m) {}
|
|
virtual ~IfcException () throw () {}
|
|
virtual const char* what() const throw() {
|
|
return message.c_str();
|
|
}
|
|
};
|
|
|
|
class IfcParse_EXPORT IfcAttributeOutOfRangeException : public IfcException {
|
|
public:
|
|
IfcAttributeOutOfRangeException(const std::string& e)
|
|
: IfcException(e) {}
|
|
~IfcAttributeOutOfRangeException () throw () {}
|
|
};
|
|
|
|
class IfcParse_EXPORT IfcInvalidTokenException : public IfcException {
|
|
public:
|
|
IfcInvalidTokenException(
|
|
int token_start,
|
|
const std::string& token_string,
|
|
const std::string& expected_type
|
|
)
|
|
: IfcException(
|
|
std::string("Token ") + token_string + " at " +
|
|
boost::lexical_cast<std::string>(token_start) +
|
|
" invalid " + expected_type
|
|
)
|
|
{}
|
|
~IfcInvalidTokenException() throw () {}
|
|
};
|
|
}
|
|
|
|
#ifdef _MSC_VER
|
|
#pragma warning(pop)
|
|
#endif
|
|
|
|
#endif
|