// $Id$ // // Copyright (C) 2006 Stefan Bund // // The contents of this file are subject to the Fraunhofer FOKUS Public License // Version 1.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // http://senf.berlios.de/license.html // // The Fraunhofer FOKUS Public License Version 1.0 is based on, // but modifies the Mozilla Public License Version 1.1. // See the full license text for the amendments. // // Software distributed under the License is distributed on an "AS IS" basis, // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License // for the specific language governing rights and limitations under the License. // // The Original Code is Fraunhofer FOKUS code. // // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. // (registered association), Hansastraße 27 c, 80686 Munich, Germany. // All Rights Reserved. // // Contributor(s): /** \file \brief Exception inline non-template implementation */ // Custom includes #include #include #define prefix_ inline //-///////////////////////////////////////////////////////////////////////////////////////////////// //-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::ExceptionMixin prefix_ senf::ExceptionMixin::ExceptionMixin(std::string const & description) : what_(description) { #ifdef SENF_BACKTRACE addBacktrace(); #endif } prefix_ std::string senf::ExceptionMixin::message() const { #ifdef SENF_DEBUG return what_.substr(excLen_); #else return what_; #endif } prefix_ std::string senf::ExceptionMixin::backtrace() const { #ifdef SENF_DEBUG return what_.substr(0,excLen_-4); #else return ""; #endif } prefix_ void senf::ExceptionMixin::append(std::string text) { what_ += text; } //-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::Exception prefix_ senf::Exception::Exception(std::string const & description) : ExceptionMixin(description) {} //-///////////////////////////////////////////////////////////////////////////////////////////////// // senf::SystemException prefix_ senf::SystemException::SystemException(std::string const & descr _SENF_EXC_DEBUG_ARGS_ND) { init(descr, errno _SENF_EXC_DEBUG_ARGS_P); } prefix_ senf::SystemException::SystemException(int code _SENF_EXC_DEBUG_ARGS_ND) { init("", code _SENF_EXC_DEBUG_ARGS_P); } prefix_ senf::SystemException::SystemException(std::string const & descr, int code _SENF_EXC_DEBUG_ARGS_ND) { init(descr, code _SENF_EXC_DEBUG_ARGS_P); } prefix_ int senf::SystemException::errorNumber() const { return code_; } prefix_ char const * senf::SystemException::errorString() const { return std::strerror(code_); } 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) const { 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() throw() {} //-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_ // Local Variables: // mode: c++ // fill-column: 100 // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" // compile-command: "scons -u test" // comment-column: 40 // End: