exception.h

00001 00002 /* 00003 $Id: exception_8h-source.html,v 1.1 2004/10/05 21:12:01 mentat Exp $ 00004 00005 GNU Messenger - The secure instant messenger 00006 00007 Copyright (C) 2003-2004 Jesse Lovelace <jesse at aslogicsys dot com> 00008 00009 This program is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; either version 2 of the License, or 00012 (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 */ 00023 #ifndef GM_EXCEPTION_H 00024 #define GM_EXCEPTION_H 00025 00026 #include <string> 00027 #include <exception> 00028 00029 namespace GNUMessenger 00030 { 00031 using namespace std; 00032 00037 class Exception : public exception 00038 { 00039 public: 00040 explicit Exception(const string &s) : m_what(s) {} 00041 virtual ~Exception() throw() {} 00042 const char *what() const throw() {return (m_what.c_str());} 00043 const string &GetWhat() const {return m_what;} 00044 void SetWhat(const string &s) {m_what = s;} 00045 00046 private: 00047 string m_what; 00048 }; 00049 00051 class MemoryError: public Exception 00052 { 00053 public: 00054 MemoryError(const string& error):Exception(error) {} 00055 }; 00056 00058 class PointerError: public Exception 00059 { 00060 public: 00061 PointerError(const string& error): Exception(error) {} 00062 }; 00063 00065 class UnknownException: public Exception 00066 { 00067 public: 00068 UnknownException(const string& msg): Exception(msg) {} 00069 }; 00070 00071 class ArrayOutOfBounds: public Exception 00072 { 00073 public: 00074 ArrayOutOfBounds(const string& msg): Exception(msg) {} 00075 }; 00076 00077 #ifdef _DEBUG 00078 00079 class AssertException: public Exception 00080 { 00081 public: 00082 AssertException(const string& what): Exception(what) {} 00083 }; 00084 #endif 00085 00086 } 00087 00088 #endif

Generated on Tue Oct 5 14:41:47 2004 for GNU Messenger by doxygen 1.3.8