exception.hpp 3.0 KB

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