00001 /* *\ 00002 ** Copyright (C) 2009-2010 ** 00003 ** Dominik Charousset < Dominik.Charousset (at) haw-hamburg.de > ** 00004 ** ** 00005 ** MMM MMMMMM MMMMMMMMM MMMMMMM MMM MMM ** 00006 ** MMMMM MMMMMMMM MMMMMMMMM MMMMMMMM MMM MMMMM ** 00007 ** MMM MMM MMM MMMM MMM MMM MMM MMM MMM ** 00008 ** MMM MMM MMM MMMMMMMMM MMM MMM MMM MMM MMM ** 00009 ** MMMMMMMMMMM MMMM MMM MMMM MMM MMM MMM MMMMMMMMMMM ** 00010 ** MMM MMM MMMMMMMM MMMMMMMMM MMMMMMMM MMM MMM MMM ** 00011 ** MMM MMM MMMMMM MMMMMMMMM MMMMMMM MMM MMM MMM ** 00012 ** ** 00013 ** ** 00014 ** This file is part of the acedia library. ** 00015 ** ** 00016 ** This library is free software: you can redistribute it and/or modify ** 00017 ** it under the terms of the GNU Lesser General Public License as published ** 00018 ** by the Free Software Foundation, either version 3 of the License, or ** 00019 ** (at your option) any later version. ** 00020 ** ** 00021 ** This library is distributed in the hope that it will be useful, ** 00022 ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** 00023 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** 00024 ** GNU Lesser General Public License for more details. ** 00025 ** ** 00026 ** You should have received a copy of the GNU Lesser General Public License ** 00027 ** along with acedia. If not, see <http://www.gnu.org/licenses/>. ** 00028 \* */ 00029 00030 #ifndef ACEDIA_EXCEPTIONS_H_ 00031 #define ACEDIA_EXCEPTIONS_H_ 00032 00033 #include "acedia_config.hpp" 00034 00035 #include <exception> 00036 #include <boost/cstdint.hpp> 00037 00038 #include "metaclass.hpp" 00039 00040 namespace acedia 00041 { 00042 00046 class Exception : public std::exception 00047 { 00048 00049 protected: 00050 00051 const char *msg; 00052 00053 public: 00054 00055 inline Exception(const char *errmsg) throw() : msg(errmsg) { } 00056 00060 virtual const char *what() const throw(); 00061 }; 00062 00067 struct NullPointerException : public Exception 00068 { 00069 NullPointerException(const char *msg) throw(); 00070 }; 00071 00076 class ClassCastException : public Exception 00077 { 00078 MetaClass *m_from, *m_to; 00079 mutable char *m_onDemandWhat; 00080 00081 public: 00082 00083 ClassCastException(const char *msg, MetaClass *from, MetaClass *to) throw(); 00084 virtual const char *what() const throw(); 00085 virtual ~ClassCastException() throw(); 00086 }; 00087 00091 struct NotDeserializableException : public Exception 00092 { 00093 NotDeserializableException(const char *msg) throw(); 00094 }; 00095 00099 struct IndexOutOfBoundsException : public Exception 00100 { 00101 IndexOutOfBoundsException(const char *msg) throw(); 00102 }; 00103 00107 class ActorKilledException : public Exception 00108 { 00109 boost::int32_t m_reason; 00110 public: 00111 ActorKilledException(boost::int32_t reason) throw(); 00112 inline boost::int32_t reason() const throw() { return m_reason; } 00113 }; 00114 00118 struct IOException : public Exception 00119 { 00120 IOException(const char *msg) throw(); 00121 }; 00122 00127 struct WSAStartupFailedException : public Exception 00128 { 00129 WSAStartupFailedException(const char *msg) throw(); 00130 }; 00131 00132 } // namespace acedia 00133 00134 #endif