X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FException.cc;h=5e692773f0a7725353e5c8837a8c032527148630;hb=1d247d12d1759ffd77f456efe3a52f03dd289994;hp=06d531c0269a69d93f96e8a53abace26d408b9e7;hpb=445c71d8d242f4ce3d23d8db8d1faf909943cfec;p=senf.git diff --git a/Utils/Exception.cc b/Utils/Exception.cc index 06d531c..5e69277 100644 --- a/Utils/Exception.cc +++ b/Utils/Exception.cc @@ -31,38 +31,17 @@ #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// -prefix_ void senf::throwErrno(std::string const & where, int code) -{ -#ifndef SENF_NO_ERRNOEXC - switch (code) { - - // BOOST_PP_REPEAT is limited to 256 repetitions. The max errno value I found in any header file - // was somewhere around 530 or so. I assume going to 1024 will be good enough. This explicit - // code will be optimized into a jump table by g++ (which is more efficient than trying to do - // the table oneself) - -# define ExceptionCase(z, n, data) case n: throw ErrnoException(where); - BOOST_PP_REPEAT(256, ExceptionCase, _) ; -# undef ExceptionCase +/////////////////////////////////////////////////////////////////////////// +// senf::Exception -# define ExceptionCase(z, n, data) case 256+n: throw ErrnoException<256+n>(where); - BOOST_PP_REPEAT(256, ExceptionCase, _) ; -# undef ExceptionCase +prefix_ senf::Exception::~Exception() + throw() +{} -# define ExceptionCase(z, n, data) case 512+n: throw ErrnoException<512+n>(where); - BOOST_PP_REPEAT(256, ExceptionCase, _) ; -# undef ExceptionCase - -# define ExceptionCase(z, n, data) case 768+n: throw ErrnoException<768+n>(where); - BOOST_PP_REPEAT(256, ExceptionCase, _) ; -# undef ExceptionCase - - default: - throw SystemException(where, code); - } -#else - throw SystemException(where, code); -#endif +prefix_ char const * senf::Exception::what() + const throw() +{ + return message_.c_str(); } ///////////////////////////////cc.e////////////////////////////////////////