00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _OPENRAW_EXCEPTION_H_
00024 #define _OPENRAW_EXCEPTION_H_
00025
00026 #include <exception>
00027 #include <string>
00028 #include <typeinfo>
00029
00030 namespace OpenRaw {
00031 namespace Internals {
00032
00034 class Exception
00035 : public std::exception
00036 {
00037 protected:
00038 std::string m_what;
00039 public:
00040 Exception()
00041 : std::exception(),
00042 m_what()
00043 {}
00044 Exception(const std::string &w)
00045 : std::exception(),
00046 m_what(w)
00047 {}
00048 virtual ~Exception() throw()
00049 {}
00050 const char *what() const throw()
00051 {
00052 if(m_what.empty()) {
00053 return typeid(this).name();
00054 }
00055 return m_what.c_str();
00056 }
00057 };
00058
00060 class IOException
00061 : public Exception
00062 {
00063 public:
00064 IOException(const std::string &w)
00065 : Exception(w)
00066 {}
00067 };
00068
00069
00071 class BadTypeException
00072 : public Exception
00073 {
00074
00075 };
00076
00078 class TooBigException
00079 : public Exception
00080 {
00081 };
00082
00083 class OutOfRangeException
00084 : public Exception
00085 {
00086 };
00087
00088 class DecodingException
00089 : public Exception
00090 {
00091 public:
00092 DecodingException(const std::string &w)
00093 : Exception(w)
00094 {}
00095 };
00096
00097 }
00098 }
00099
00100 #endif