3 // Copyright (C) 2006 Stefan Bund <g0dil@senf.berlios.de>
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the
17 // Free Software Foundation, Inc.,
18 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 \brief Exception inline non-template implementation */
27 #define prefix_ inline
28 ///////////////////////////////cci.p///////////////////////////////////////
30 ///////////////////////////////////////////////////////////////////////////
31 // senf::ExceptionMixin
33 prefix_ senf::ExceptionMixin::ExceptionMixin(std::string const & description)
41 prefix_ std::string senf::ExceptionMixin::message()
45 return what_.substr(excLen_);
51 prefix_ std::string senf::ExceptionMixin::backtrace()
55 return what_.substr(0,excLen_-4);
61 prefix_ void senf::ExceptionMixin::append(std::string text)
66 ///////////////////////////////////////////////////////////////////////////
69 prefix_ senf::Exception::Exception(std::string const & description)
70 : ExceptionMixin(description)
73 ///////////////////////////////////////////////////////////////////////////
74 // senf::SystemException
76 prefix_ senf::SystemException::SystemException(std::string const & descr _SENF_EXC_DEBUG_ARGS_ND)
78 init(descr, errno _SENF_EXC_DEBUG_ARGS_P);
81 prefix_ senf::SystemException::SystemException(int code _SENF_EXC_DEBUG_ARGS_ND)
83 init("", code _SENF_EXC_DEBUG_ARGS_P);
86 prefix_ senf::SystemException::SystemException(std::string const & descr, int code
87 _SENF_EXC_DEBUG_ARGS_ND)
89 init(descr, code _SENF_EXC_DEBUG_ARGS_P);
92 prefix_ int senf::SystemException::errorNumber()
98 prefix_ char const * senf::SystemException::errorString()
101 return std::strerror(code_);
104 prefix_ bool senf::SystemException::anyOf(int c0, int c1, int c2, int c3, int c4, int c5,
105 int c6, int c7, int c8, int c9)
108 (c0 && code_ == c0) ||
109 (c1 && code_ == c1) ||
110 (c2 && code_ == c2) ||
111 (c3 && code_ == c3) ||
112 (c4 && code_ == c4) ||
113 (c5 && code_ == c5) ||
114 (c6 && code_ == c6) ||
115 (c7 && code_ == c7) ||
116 (c8 && code_ == c8) ||
120 prefix_ senf::SystemException::~SystemException()
124 ///////////////////////////////cci.e///////////////////////////////////////
131 // c-file-style: "senf"
132 // indent-tabs-mode: nil
133 // ispell-local-dictionary: "american"
134 // compile-command: "scons -u test"
135 // comment-column: 40