3 // Copyright (C) 2006 Stefan Bund <g0dil@senf.berlios.de>
5 // The contents of this file are subject to the Fraunhofer FOKUS Public License
6 // Version 1.0 (the "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 // http://senf.berlios.de/license.html
10 // The Fraunhofer FOKUS Public License Version 1.0 is based on,
11 // but modifies the Mozilla Public License Version 1.1.
12 // See the full license text for the amendments.
14 // Software distributed under the License is distributed on an "AS IS" basis,
15 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
16 // for the specific language governing rights and limitations under the License.
18 // The Original Code is Fraunhofer FOKUS code.
20 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
21 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
22 // All Rights Reserved.
27 \brief Exception inline non-template implementation */
33 #define prefix_ inline
34 //-/////////////////////////////////////////////////////////////////////////////////////////////////
36 //-/////////////////////////////////////////////////////////////////////////////////////////////////
37 // senf::ExceptionMixin
39 prefix_ senf::ExceptionMixin::ExceptionMixin(std::string const & description)
47 prefix_ std::string senf::ExceptionMixin::message()
51 return what_.substr(excLen_);
57 prefix_ std::string senf::ExceptionMixin::backtrace()
61 return what_.substr(0,excLen_-4);
67 prefix_ void senf::ExceptionMixin::append(std::string text)
72 //-/////////////////////////////////////////////////////////////////////////////////////////////////
75 prefix_ senf::Exception::Exception(std::string const & description)
76 : ExceptionMixin(description)
79 //-/////////////////////////////////////////////////////////////////////////////////////////////////
80 // senf::SystemException
82 prefix_ senf::SystemException::SystemException(std::string const & descr _SENF_EXC_DEBUG_ARGS_ND)
84 init(descr, errno _SENF_EXC_DEBUG_ARGS_P);
87 prefix_ senf::SystemException::SystemException(int code _SENF_EXC_DEBUG_ARGS_ND)
89 init("", code _SENF_EXC_DEBUG_ARGS_P);
92 prefix_ senf::SystemException::SystemException(std::string const & descr, int code
93 _SENF_EXC_DEBUG_ARGS_ND)
95 init(descr, code _SENF_EXC_DEBUG_ARGS_P);
98 prefix_ int senf::SystemException::errorNumber()
104 prefix_ char const * senf::SystemException::errorString()
107 return std::strerror(code_);
110 prefix_ bool senf::SystemException::anyOf(int c0, int c1, int c2, int c3, int c4, int c5,
111 int c6, int c7, int c8, int c9)
115 (c0 && code_ == c0) ||
116 (c1 && code_ == c1) ||
117 (c2 && code_ == c2) ||
118 (c3 && code_ == c3) ||
119 (c4 && code_ == c4) ||
120 (c5 && code_ == c5) ||
121 (c6 && code_ == c6) ||
122 (c7 && code_ == c7) ||
123 (c8 && code_ == c8) ||
127 prefix_ senf::SystemException::~SystemException()
131 //-/////////////////////////////////////////////////////////////////////////////////////////////////
138 // c-file-style: "senf"
139 // indent-tabs-mode: nil
140 // ispell-local-dictionary: "american"
141 // compile-command: "scons -u test"
142 // comment-column: 40