mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
Exception ctor in cpp to reduce codesize
This commit is contained in:
parent
0ff62c6549
commit
648794b0bb
@ -18,6 +18,26 @@
|
|||||||
|
|
||||||
namespace ngcore
|
namespace ngcore
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
Exception :: Exception(const std::string& s)
|
||||||
|
: m_what(s) {}
|
||||||
|
|
||||||
|
Exception :: Exception(const char* s)
|
||||||
|
: m_what(s) {}
|
||||||
|
|
||||||
|
|
||||||
|
void ThrowException(const std::string & s)
|
||||||
|
{
|
||||||
|
throw Exception (s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ThrowException(const char * s)
|
||||||
|
{
|
||||||
|
throw Exception (s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
static int exec(std::string cmd, std::string & out) {
|
static int exec(std::string cmd, std::string & out) {
|
||||||
|
@ -31,8 +31,8 @@ namespace ngcore
|
|||||||
Exception() = default;
|
Exception() = default;
|
||||||
Exception(const Exception&) = default;
|
Exception(const Exception&) = default;
|
||||||
Exception(Exception&&) = default;
|
Exception(Exception&&) = default;
|
||||||
Exception(const std::string& s) : m_what(s) {}
|
Exception(const std::string& s); // : m_what(s) {}
|
||||||
Exception(const char* s) : m_what(s) {}
|
Exception(const char* s); // : m_what(s) {}
|
||||||
~Exception() override = default;
|
~Exception() override = default;
|
||||||
|
|
||||||
Exception& operator =(const Exception&) = default;
|
Exception& operator =(const Exception&) = default;
|
||||||
@ -49,7 +49,10 @@ namespace ngcore
|
|||||||
/// implement virtual function of std::exception
|
/// implement virtual function of std::exception
|
||||||
const char* what() const noexcept override { return m_what.c_str(); }
|
const char* what() const noexcept override { return m_what.c_str(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NGCORE_API void ThrowException(const std::string & s);
|
||||||
|
NGCORE_API void ThrowException(const char * s);
|
||||||
|
|
||||||
// Out of Range exception
|
// Out of Range exception
|
||||||
class NGCORE_API RangeException : public Exception
|
class NGCORE_API RangeException : public Exception
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user