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 #endif
00027
00028 namespace geos {
00029 namespace util {
00030
00038 class GEOS_DLL GEOSException: public std::exception {
00039
00040 std::string _msg;
00041
00042 public:
00043
00044 GEOSException()
00045 :
00046 _msg("Unknown error")
00047 {}
00048
00049 GEOSException(std::string const& msg)
00050 :
00051 _msg(msg)
00052 {}
00053
00054 GEOSException(std::string const& name, std::string const& msg)
00055 :
00056 _msg(name+": "+msg)
00057 {}
00058
00059 virtual ~GEOSException() throw()
00060 {}
00061
00062 const char* what() const throw()
00063 {
00064 return _msg.c_str();
00065 }
00066
00067 };
00068
00069 }
00070 }
00071
00072 #ifdef _MSC_VER
00073 #pragma warning(pop)
00074 #endif
00075
00076 #endif // GEOS_UTIL_GEOSEXCEPTION_H