GEOS
3.4.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00007 * Copyright (C) 2006 Refractions Research Inc. 00008 * 00009 * This is free software; you can redistribute and/or modify it under 00010 * the terms of the GNU Lesser General Public Licence as published 00011 * by the Free Software Foundation. 00012 * See the COPYING file for more information. 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 { // geos.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 } // namespace geos.util 00070 } // namespace geos 00071 00072 #ifdef _MSC_VER 00073 #pragma warning(pop) 00074 #endif 00075 00076 #endif // GEOS_UTIL_GEOSEXCEPTION_H