Chris@16: // Boost.Geometry (aka GGL, Generic Geometry Library) Chris@16: Chris@16: // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. Chris@16: // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. Chris@16: // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. Chris@16: Chris@16: // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library Chris@16: // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. Chris@16: Chris@16: // Use, modification and distribution is subject to the Boost Software License, Chris@16: // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_GEOMETRY_VIEWS_CLOSEABLE_VIEW_HPP Chris@16: #define BOOST_GEOMETRY_VIEWS_CLOSEABLE_VIEW_HPP Chris@16: Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost { namespace geometry Chris@16: { Chris@16: Chris@16: // Silence warning C4512: assignment operator could not be generated Chris@16: #if defined(_MSC_VER) Chris@101: #pragma warning(push) Chris@16: #pragma warning(disable : 4512) Chris@16: #endif Chris@16: Chris@16: #ifndef DOXYGEN_NO_DETAIL Chris@16: Chris@16: namespace detail Chris@16: { Chris@16: Chris@16: template Chris@16: struct closing_view Chris@16: { Chris@16: // Keep this explicit, important for nested views/ranges Chris@16: explicit inline closing_view(Range& r) Chris@16: : m_range(r) Chris@16: {} Chris@16: Chris@16: typedef closing_iterator iterator; Chris@16: typedef closing_iterator const_iterator; Chris@16: Chris@16: inline const_iterator begin() const { return const_iterator(m_range); } Chris@16: inline const_iterator end() const { return const_iterator(m_range, true); } Chris@16: Chris@16: inline iterator begin() { return iterator(m_range); } Chris@16: inline iterator end() { return iterator(m_range, true); } Chris@16: private : Chris@16: Range& m_range; Chris@16: }; Chris@16: Chris@16: } Chris@16: Chris@16: #endif // DOXYGEN_NO_DETAIL Chris@16: Chris@16: Chris@16: /*! Chris@16: \brief View on a range, either closing it or leaving it as it is Chris@16: \details The closeable_view is used internally by the library to handle all rings, Chris@101: either closed or open, the same way. The default method is closed, all Chris@16: algorithms process rings as if they are closed. Therefore, if they are opened, Chris@16: a view is created which closes them. Chris@16: The closeable_view might be used by library users, but its main purpose is Chris@16: internally. Chris@16: \tparam Range Original range Chris@16: \tparam Close Specifies if it the range is closed, if so, nothing will happen. Chris@16: If it is open, it will iterate the first point after the last point. Chris@16: \ingroup views Chris@16: */ Chris@16: template Chris@16: struct closeable_view {}; Chris@16: Chris@16: Chris@16: #ifndef DOXYGEN_NO_SPECIALIZATIONS Chris@16: Chris@16: template Chris@16: struct closeable_view Chris@16: { Chris@16: typedef identity_view type; Chris@16: }; Chris@16: Chris@16: Chris@16: template Chris@16: struct closeable_view Chris@16: { Chris@16: typedef detail::closing_view type; Chris@16: }; Chris@16: Chris@16: #endif // DOXYGEN_NO_SPECIALIZATIONS Chris@16: Chris@16: Chris@16: #if defined(_MSC_VER) Chris@16: #pragma warning(pop) Chris@16: #endif Chris@16: Chris@16: }} // namespace boost::geometry Chris@16: Chris@16: Chris@16: #endif // BOOST_GEOMETRY_VIEWS_CLOSEABLE_VIEW_HPP