00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GEOS_UTIL_GEOSEXCEPTION_H
00017 #define GEOS_UTIL_GEOSEXCEPTION_H
00018
00019 #include <geos/export.h>
00020 #include <stdexcept>
00021 #include <string>
00022
00023 #ifdef _MSC_VER
00024 #pragma warning(push)
00025 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00026 #pragma warning(disable: 4275) // warning C4275: non-DLL-interface std::exception used as base for DLL-interface GEOSException
00027 #endif
00028
00029 namespace geos {
00030 namespace util {
00031
00039 class GEOS_DLL GEOSException: public std::exception {
00040
00041 std::string _msg;
00042
00043 public:
00044
00045 GEOSException()
00046 :
00047 _msg("Unknown error")
00048 {}
00049
00050 GEOSException(std::string const& msg)
00051 :
00052 _msg(msg)
00053 {}
00054
00055 GEOSException(std::string const& name, std::string const& msg)
00056 :
00057 _msg(name+": "+msg)
00058 {}
00059
00060 virtual ~GEOSException() throw()
00061 {}
00062
00063 const char* what() const throw()
00064 {
00065 return _msg.c_str();
00066 }
00067
00068 };
00069
00070 }
00071 }
00072
00073 #ifdef _MSC_VER
00074 #pragma warning(pop)
00075 #endif
00076
00077 #endif // GEOS_UTIL_GEOSEXCEPTION_H