X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FException.cci;h=efe49618d6ec26100f7739dee85eb0ce4a63ea98;hb=f37ed4b85a6949cbe72ccb2d2ac098aebed57eaa;hp=fd3e78f6d6b93df938927c65dd1bd1b99357950b;hpb=85ab07d100a382467a42e19d741d403a7a96c951;p=senf.git diff --git a/Utils/Exception.cci b/Utils/Exception.cci index fd3e78f..efe4961 100644 --- a/Utils/Exception.cci +++ b/Utils/Exception.cci @@ -21,20 +21,61 @@ \brief Exception inline non-template implementation */ // Custom includes +#include +#include #define prefix_ inline ///////////////////////////////cci.p/////////////////////////////////////// -prefix_ senf::SystemException::SystemException(int err_) - : where(0), err(err_) +/////////////////////////////////////////////////////////////////////////// +// senf::Exception +prefix_ senf::Exception::Exception(std::string const & description) + : message_(description) +{} + +/////////////////////////////////////////////////////////////////////////// + +prefix_ senf::SystemException::SystemException(std::string const & where) +{ + init(where, errno); +} + +prefix_ senf::SystemException::SystemException(int code) +{ + init("", code); +} + +prefix_ senf::SystemException::SystemException(std::string const & where, int code) +{ + init(where, code); +} + +prefix_ int senf::SystemException::errorNumber() + const +{ + return code_; +} + +prefix_ char const * senf::SystemException::description() + const { - init(); + return std::strerror(code_); } -prefix_ senf::SystemException::SystemException(char const * where_, int err_) - : where(where_), err(err_) +prefix_ bool senf::SystemException::anyOf(int c0, int c1, int c2, int c3, int c4, int c5, + int c6, int c7, int c8, int c9) { - init(); + return + (c0 && code_ == c0) || + (c1 && code_ == c1) || + (c2 && code_ == c2) || + (c3 && code_ == c3) || + (c4 && code_ == c4) || + (c5 && code_ == c5) || + (c6 && code_ == c6) || + (c7 && code_ == c7) || + (c8 && code_ == c8) || + (c9 && code_ == c9); } prefix_ senf::SystemException::~SystemException() @@ -51,4 +92,6 @@ prefix_ senf::SystemException::~SystemException() // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// comment-column: 40 // End: