X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=boost%2Fgeometry%2Fio%2Fdsv%2Fwrite.hpp;h=f39a2489ad4695066516dd781b76bf71f6edabc2;hb=08c1e93fa36a49f49325a07fe91ff92c964c2b6c;hp=62929f80733459cad466a31c7261480fed49c731;hpb=bb4dd8289b351fae6b55e303f189127a394a1edd;p=platform%2Fupstream%2Fboost.git diff --git a/boost/geometry/io/dsv/write.hpp b/boost/geometry/io/dsv/write.hpp index 62929f8..f39a248 100644 --- a/boost/geometry/io/dsv/write.hpp +++ b/boost/geometry/io/dsv/write.hpp @@ -3,6 +3,7 @@ // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. +// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. @@ -20,12 +21,14 @@ #include #include -#include + +#include #include #include #include #include +#include #include @@ -209,9 +212,10 @@ struct dsv_poly dsv_range::apply(os, exterior_ring(poly), settings); - typename interior_return_type::type rings - = interior_rings(poly); - for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it) + typename interior_return_type::type + rings = interior_rings(poly); + for (typename detail::interior_iterator::type + it = boost::begin(rings); it != boost::end(rings); ++it) { os << settings.list_separator; dsv_range::apply(os, *it, settings); @@ -339,9 +343,61 @@ private: dsv_settings m_settings; }; + +template +struct dsv_multi +{ + typedef dispatch::dsv + < + typename single_tag_of + < + typename tag::type + >::type, + typename boost::range_value::type + > dispatch_one; + + typedef typename boost::range_iterator + < + MultiGeometry const + >::type iterator; + + + template + static inline void apply(std::basic_ostream& os, + MultiGeometry const& multi, + dsv_settings const& settings) + { + os << settings.list_open; + + bool first = true; + for(iterator it = boost::begin(multi); + it != boost::end(multi); + ++it, first = false) + { + os << (first ? "" : settings.list_separator); + dispatch_one::apply(os, *it, settings); + } + os << settings.list_close; + } +}; + }} // namespace detail::dsv #endif // DOXYGEN_NO_DETAIL +// TODO: The alternative to this could be a forward declaration of dispatch::dsv<> +// or braking the code into the interface and implementation part +#ifndef DOXYGEN_NO_DISPATCH +namespace dispatch +{ + +template +struct dsv + : detail::dsv::dsv_multi +{}; + +} // namespace dispatch +#endif // DOXYGEN_NO_DISPATCH + /*! \brief Main DSV-streaming function \details DSV stands for Delimiter Separated Values. Geometries can be streamed