GEOS 3.4.2

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

GEOSException.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2001-2002 Vivid Solutions Inc.
7 * Copyright (C) 2006 Refractions Research Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************/
15
16 #ifndef GEOS_UTIL_GEOSEXCEPTION_H
17 #define GEOS_UTIL_GEOSEXCEPTION_H
18
19 #include <geos/export.h>
20 #include <stdexcept>
21 #include <string>
22
23 #ifdef _MSC_VER
24 #pragma warning(push)
25 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
26 #endif
27
28 namespace geos {
29 namespace util { // geos.util
30
38 class GEOS_DLL GEOSException: public std::exception {
39
40 std::string _msg;
41
42 public:
43
44 GEOSException()
45 :
46 _msg("Unknown error")
47 {}
48
49 GEOSException(std::string const& msg)
50 :
51 _msg(msg)
52 {}
53
54 GEOSException(std::string const& name, std::string const& msg)
55 :
56 _msg(name+": "+msg)
57 {}
58
59 virtual ~GEOSException() throw()
60 {}
61
62 const char* what() const throw()
63 {
64 return _msg.c_str();
65 }
66
67 };
68
69 } // namespace geos.util
70 } // namespace geos
71
72 #ifdef _MSC_VER
73 #pragma warning(pop)
74 #endif
75
76 #endif // GEOS_UTIL_GEOSEXCEPTION_H