00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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