Jack2 1.9.6

JackException.h

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 <stdexcept>
00024 #include <iostream>
00025 #include <string>
00026 #include "JackCompilerDeps.h"
00027 #include "JackError.h"
00028 
00029 namespace Jack
00030 {
00031 
00036 class SERVER_EXPORT JackException : public std::runtime_error {
00037 
00038     public:
00039 
00040         JackException(const std::string& msg) : std::runtime_error(msg)
00041         {}
00042         JackException(char* msg) : std::runtime_error(msg)
00043         {}
00044         JackException(const char* msg) : std::runtime_error(msg)
00045         {}
00046 
00047         std::string Message()
00048         {
00049             return what();
00050         }
00051 
00052         void PrintMessage()
00053         {
00054             std::string str = what();
00055             if (str != "")
00056                 jack_info(str.c_str());
00057         }
00058 };
00059 
00064 class SERVER_EXPORT JackTemporaryException : public JackException {
00065     
00066     public:
00067         
00068         JackTemporaryException(const std::string& msg) : JackException(msg)
00069         {}
00070         JackTemporaryException(char* msg) : JackException(msg)
00071         {}
00072         JackTemporaryException(const char* msg) : JackException(msg)
00073         {}
00074         JackTemporaryException() : JackException("")
00075         {}
00076 };
00077     
00082 class SERVER_EXPORT JackQuitException : public JackException {
00083     
00084     public:
00085         
00086         JackQuitException(const std::string& msg) : JackException(msg)
00087         {}
00088         JackQuitException(char* msg) : JackException(msg)
00089         {}
00090         JackQuitException(const char* msg) : JackException(msg)
00091         {}
00092         JackQuitException() : JackException("")
00093         {}
00094 };
00095     
00100 class SERVER_EXPORT JackNetException : public JackException {
00101 
00102     public:
00103 
00104         JackNetException(const std::string& msg) : JackException(msg)
00105         {}
00106         JackNetException(char* msg) : JackException(msg)
00107         {}
00108         JackNetException(const char* msg) : JackException(msg)
00109         {}
00110         JackNetException() : JackException("")
00111         {}
00112 };
00113 
00114 }
00115 
00116 #endif