Loading src/csg/CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ add_library(csg levelset_3d.cpp matrix_functions.cpp parser.cpp exception.cpp ) target_link_libraries(csg PRIVATE Loading src/csg/exception.cpp 0 → 100644 +27 −0 Original line number Diff line number Diff line #include <csg_exception.hpp> #include <sstream> #include <string> namespace csg { Exception::Exception() : m_msg(make_message("No Source", "No message")) {} Exception::Exception(const std::string &message) : m_msg(make_message("No Source", message)) {} Exception::Exception(const std::string &source, const std::string &message) : m_msg(make_message(source, message)) {} const char *Exception::what() const noexcept { return m_msg.c_str(); } std::string Exception::make_message(const std::string &source, const std::string &message) { std::stringstream s; s << "Exception Data:" << std::endl; s << "Source : " << source << std::endl; s << "Message : " << message << std::endl; return s.str(); } } // namespace csg src/csg/meson.build +1 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ lib_csg_parser = static_library('csg-parser', 'levelset_3d.cpp', 'matrix_functions.cpp', 'parser.cpp', 'exception.cpp', include_directories: parser_inc, dependencies: [pegtl, cgal], install : true) Loading src/csg_exception.hpp 0 → 100644 +24 −0 Original line number Diff line number Diff line #ifndef CSG_EXCEPTION_H_ #define CSG_EXCEPTION_H #include <stdexcept> #include <string> namespace csg { class Exception : public std::exception { public: Exception(); explicit Exception(const std::string &message); Exception(const std::string &source, const std::string &message); const char *what() const noexcept; private: std::string make_message(const std::string &source, const std::string &message); std::string m_msg; }; } // namespace csg #endif Loading
src/csg/CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ add_library(csg levelset_3d.cpp matrix_functions.cpp parser.cpp exception.cpp ) target_link_libraries(csg PRIVATE Loading
src/csg/exception.cpp 0 → 100644 +27 −0 Original line number Diff line number Diff line #include <csg_exception.hpp> #include <sstream> #include <string> namespace csg { Exception::Exception() : m_msg(make_message("No Source", "No message")) {} Exception::Exception(const std::string &message) : m_msg(make_message("No Source", message)) {} Exception::Exception(const std::string &source, const std::string &message) : m_msg(make_message(source, message)) {} const char *Exception::what() const noexcept { return m_msg.c_str(); } std::string Exception::make_message(const std::string &source, const std::string &message) { std::stringstream s; s << "Exception Data:" << std::endl; s << "Source : " << source << std::endl; s << "Message : " << message << std::endl; return s.str(); } } // namespace csg
src/csg/meson.build +1 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ lib_csg_parser = static_library('csg-parser', 'levelset_3d.cpp', 'matrix_functions.cpp', 'parser.cpp', 'exception.cpp', include_directories: parser_inc, dependencies: [pegtl, cgal], install : true) Loading
src/csg_exception.hpp 0 → 100644 +24 −0 Original line number Diff line number Diff line #ifndef CSG_EXCEPTION_H_ #define CSG_EXCEPTION_H #include <stdexcept> #include <string> namespace csg { class Exception : public std::exception { public: Exception(); explicit Exception(const std::string &message); Exception(const std::string &source, const std::string &message); const char *what() const noexcept; private: std::string make_message(const std::string &source, const std::string &message); std::string m_msg; }; } // namespace csg #endif