00001 #ifndef s11n_net_s11n_v1_1_EXCEPTION_HPP_INCLUDED
00002 #define s11n_net_s11n_v1_1_EXCEPTION_HPP_INCLUDED 1
00003
00004 #include <string>
00005 #include <exception>
00006
00007 namespace s11n {
00008
00009
00010
00011
00012
00013 struct s11n_exception : public std::exception
00014 {
00015 public:
00016 virtual ~s11n_exception() throw() {}
00017 explicit s11n_exception( const std::string & What );
00018
00019
00020
00021
00022
00023 s11n_exception( const std::string & What, const std::string & file, unsigned int linenum );
00024 virtual const char * what() const throw();
00025 private:
00026 std::string m_what;
00027 };
00028
00029
00030
00031
00032
00033
00034
00035 struct factory_exception : public s11n_exception
00036 {
00037 public:
00038 virtual ~factory_exception() throw() {}
00039 explicit factory_exception( const std::string & What ) : s11n_exception( What ) {}
00040 factory_exception( const std::string & What, const std::string & file, unsigned int line ) : s11n_exception( What,file,line ) {}
00041 };
00042
00043
00044
00045
00046
00047
00048 struct io_exception : public s11n_exception
00049 {
00050 public:
00051 virtual ~io_exception() throw() {}
00052 explicit io_exception( const std::string & What ) : s11n_exception( What ) {}
00053 io_exception( const std::string & What, const std::string & file, unsigned int line ) : s11n_exception( What,file,line ) {}
00054 };
00055
00056
00057 }
00058
00059
00060
00061
00062 #define S11N_THROW(WHAT) throw ::s11n::s11n_exception(WHAT,__FILE__,__LINE__)
00063
00064 #endif // s11n_net_s11n_v1_1_EXCEPTION_HPP_INCLUDED