Jack2 1.9.10
|
00001 /* 00002 Copyright (C) 2008 Grame 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 00018 */ 00019 00020 #ifndef __JackException__ 00021 #define __JackException__ 00022 00023 #include "JackCompilerDeps.h" 00024 00025 #include <stdexcept> 00026 #include <iostream> 00027 #include <string> 00028 00029 namespace Jack 00030 { 00031 00032 #define ThrowIf(inCondition, inException) \ 00033 if(inCondition) \ 00034 { \ 00035 throw(inException); \ 00036 } 00037 00038 00043 class SERVER_EXPORT JackException : public std::runtime_error { 00044 00045 public: 00046 00047 JackException(const std::string& msg) : std::runtime_error(msg) 00048 {} 00049 JackException(char* msg) : std::runtime_error(msg) 00050 {} 00051 JackException(const char* msg) : std::runtime_error(msg) 00052 {} 00053 00054 std::string Message() 00055 { 00056 return what(); 00057 } 00058 00059 void PrintMessage(); 00060 00061 }; 00062 00067 class SERVER_EXPORT JackTemporaryException : public JackException { 00068 00069 public: 00070 00071 JackTemporaryException(const std::string& msg) : JackException(msg) 00072 {} 00073 JackTemporaryException(char* msg) : JackException(msg) 00074 {} 00075 JackTemporaryException(const char* msg) : JackException(msg) 00076 {} 00077 JackTemporaryException() : JackException("") 00078 {} 00079 }; 00080 00085 class SERVER_EXPORT JackQuitException : public JackException { 00086 00087 public: 00088 00089 JackQuitException(const std::string& msg) : JackException(msg) 00090 {} 00091 JackQuitException(char* msg) : JackException(msg) 00092 {} 00093 JackQuitException(const char* msg) : JackException(msg) 00094 {} 00095 JackQuitException() : JackException("") 00096 {} 00097 }; 00098 00103 class SERVER_EXPORT JackNetException : public JackException { 00104 00105 public: 00106 00107 JackNetException(const std::string& msg) : JackException(msg) 00108 {} 00109 JackNetException(char* msg) : JackException(msg) 00110 {} 00111 JackNetException(const char* msg) : JackException(msg) 00112 {} 00113 JackNetException() : JackException("") 00114 {} 00115 }; 00116 00117 } 00118 00119 #endif