00001 #include "Stiostream.h"
00002 #include <string>
00003 #include <typeinfo>
00004
00005 #ifndef StExceptions_hh
00006 #define StExceptions_hh
00007
00008 class StException {
00009 private:
00010 string mName;
00011 string mMessage;
00012 public:
00013 StException(const char* c="unknown", const char* m="") : mName(c),mMessage(m) { }
00014 virtual ~StException() {}
00015 virtual string name() {return mName;}
00016 virtual string message() {return mMessage; }
00017 virtual void print() { cout << "*** StException * " << name() << " *** " << message() << endl; }
00018 };
00019
00020 class StExceptionNullPointer : public StException {
00021 private:
00022 public:
00023 StExceptionNullPointer(const char* message="") : StException("nullPointer",message) { }
00024 virtual ~StExceptionNullPointer() {}
00025 };
00026
00027 class StExceptionBadFlag : public StException {
00028 private:
00029 public:
00030 StExceptionBadFlag(const char* message="") : StException("badFlag",message) { }
00031 virtual ~StExceptionBadFlag() {}
00032 };
00033
00034 class StExceptionBadValue : public StException {
00035 private:
00036 float mValue;
00037 public:
00038 StExceptionBadValue(const char* message="", float value=0) : StException("badValue",message) , mValue(value) { }
00039 virtual ~StExceptionBadValue() {}
00040 virtual void print() { cout << "*** StException * " << name() << " *** " << message() << " " << mValue << endl; }
00041 };
00042
00043 class StExceptionEOF : public StException {
00044 private:
00045 public:
00046 StExceptionEOF(const char* message="") : StException("end of file",message) { }
00047 virtual ~StExceptionEOF() {}
00048 };
00049
00050 #endif
00051