• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
6 
7 // This file was modified by Oracle on 2015, 2017.
8 // Modifications copyright (c) 2015-2017 Oracle and/or its affiliates.
9 
10 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
11 
12 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
13 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
14 
15 // Use, modification and distribution is subject to the Boost Software License,
16 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
17 // http://www.boost.org/LICENSE_1_0.txt)
18 
19 #ifndef BOOST_GEOMETRY_CORE_EXCEPTION_HPP
20 #define BOOST_GEOMETRY_CORE_EXCEPTION_HPP
21 
22 #include <exception>
23 
24 namespace boost { namespace geometry
25 {
26 
27 /*!
28 \brief Base exception class for Boost.Geometry algorithms
29 \ingroup core
30 \details This class is never thrown. All exceptions thrown in Boost.Geometry
31     are derived from exception, so it might be convenient to catch it.
32 */
33 class exception : public std::exception
34 {
35 public:
what() const36     virtual char const* what() const throw()
37     {
38         return "Boost.Geometry exception";
39     }
40 };
41 
42 /*!
43 \brief Invalid Input Exception
44 \ingroup core
45 \details The invalid_input_exception is thrown if an invalid attribute
46          is passed into a function, e.g. a DE-9IM mask string code containing
47          invalid characters passed into a de9im::mask constructor.
48  */
49 class invalid_input_exception : public geometry::exception
50 {
51 public:
52 
invalid_input_exception()53     inline invalid_input_exception() {}
54 
what() const55     virtual char const* what() const throw()
56     {
57         return "Boost.Geometry Invalid-Input exception";
58     }
59 };
60 
61 /*!
62 \brief Empty Input Exception
63 \ingroup core
64 \details The empty_input_exception is thrown if free functions, e.g. distance,
65     are called with empty geometries, e.g. a linestring
66     without points, a polygon without points, an empty multi-geometry.
67 \qbk{
68 [heading See also]
69 \* [link geometry.reference.algorithms.area the area function]
70 \* [link geometry.reference.algorithms.distance the distance function]
71 \* [link geometry.reference.algorithms.length the length function]
72 }
73  */
74 class empty_input_exception : public geometry::invalid_input_exception
75 {
76 public:
77 
empty_input_exception()78     inline empty_input_exception() {}
79 
what() const80     virtual char const* what() const throw()
81     {
82         return "Boost.Geometry Empty-Input exception";
83     }
84 };
85 
86 /*!
87 \brief Invalid Output Exception
88 \ingroup core
89 \details The invalid_output_exception is thrown if valid output cannot be
90          generated by a function even if arguments are valid, e.g. union of
91          geographic polygons covering more than half of the area of the globe.
92  */
93 class invalid_output_exception : public geometry::exception
94 {
95 public:
96 
invalid_output_exception()97     inline invalid_output_exception() {}
98 
what() const99     virtual char const* what() const throw()
100     {
101         return "Boost.Geometry Invalid-Output exception";
102     }
103 };
104 
105 
106 }} // namespace boost::geometry
107 
108 #endif // BOOST_GEOMETRY_CORE_EXCEPTION_HPP
109