exception.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
  4. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
  5. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  6. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  7. // Use, modification and distribution is subject to the Boost Software License,
  8. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. #ifndef BOOST_GEOMETRY_CORE_EXCEPTION_HPP
  11. #define BOOST_GEOMETRY_CORE_EXCEPTION_HPP
  12. #include <exception>
  13. namespace boost { namespace geometry
  14. {
  15. /*!
  16. \brief Base exception class for Boost.Geometry algorithms
  17. \ingroup core
  18. \details This class is never thrown. All exceptions thrown in Boost.Geometry
  19. are derived from exception, so it might be convenient to catch it.
  20. */
  21. class exception : public std::exception
  22. {};
  23. /*!
  24. \brief Empty Input Exception
  25. \ingroup core
  26. \details The empty_input_exception is thrown if free functions, e.g. distance,
  27. are called with empty geometries, e.g. a linestring
  28. without points, a polygon without points, an empty multi-geometry.
  29. \qbk{
  30. [heading See also]
  31. \* [link geometry.reference.algorithms.area the area function]
  32. \* [link geometry.reference.algorithms.distance the distance function]
  33. \* [link geometry.reference.algorithms.length the length function]
  34. }
  35. */
  36. class empty_input_exception : public geometry::exception
  37. {
  38. public:
  39. inline empty_input_exception() {}
  40. virtual char const* what() const throw()
  41. {
  42. return "Boost.Geometry Empty-Input exception";
  43. }
  44. };
  45. }} // namespace boost::geometry
  46. #endif // BOOST_GEOMETRY_CORE_EXCEPTION_HPP