1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Tool reporting Implementation Support Status in QBK or plain text format
4 // Copyright (c) 2011-2012 Bruno Lalande, Paris, France.
5 // Copyright (c) 2011-2012 Barend Gehrels, 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)
11 #ifndef BOOST_GEOMETRY_SUPPORT_STATUS_QBK_OUTPUTTER_HPP
12 #define BOOST_GEOMETRY_SUPPORT_STATUS_QBK_OUTPUTTER_HPP
15 template <typename Tag> struct qbk_geometry_name { static inline std::string name() { return "Range"; } }; // TODO / make general
16 template <> struct qbk_geometry_name<boost::geometry::point_tag> { static inline std::string name() { return "Point"; } };
17 template <> struct qbk_geometry_name<boost::geometry::segment_tag> { static inline std::string name() { return "Segment"; } };
18 template <> struct qbk_geometry_name<boost::geometry::box_tag> { static inline std::string name() { return "Box"; } };
19 template <> struct qbk_geometry_name<boost::geometry::linestring_tag> { static inline std::string name() { return "Linestring"; } };
20 template <> struct qbk_geometry_name<boost::geometry::ring_tag> { static inline std::string name() { return "Ring"; } };
21 template <> struct qbk_geometry_name<boost::geometry::polygon_tag> { static inline std::string name() { return "Polygon"; } };
22 template <> struct qbk_geometry_name<boost::geometry::multi_point_tag> { static inline std::string name() { return "MultiPoint"; } };
23 template <> struct qbk_geometry_name<boost::geometry::multi_linestring_tag> { static inline std::string name() { return "MultiLinestring"; } };
24 template <> struct qbk_geometry_name<boost::geometry::multi_polygon_tag> { static inline std::string name() { return "MultiPolygon"; } };
27 struct qbk_table_row_header
31 qbk_table_row_header(std::ofstream& out)
42 typename boost::geometry::tag<G>::type
52 std::string filename(std::string const& name)
54 std::ostringstream out;
55 out << "../../../../generated/" << name << "_status.qbk";
59 explicit qbk_outputter(std::string const& name)
60 : m_out(filename(name).c_str())
64 inline void ok() { m_out << "[ [$img/ok.png] ]"; }
65 inline void nyi() { m_out << "[ [$img/nyi.png] ]"; }
67 inline void header(std::string const& )
69 m_out << "[heading Supported geometries]" << std::endl;
72 template <typename Types>
73 inline void table_header()
75 m_out << "[table" << std::endl << "[[ ]";
76 boost::mpl::for_each<Types>(qbk_table_row_header(m_out));
77 m_out << "]" << std::endl;
79 inline void table_header()
81 m_out << "[table" << std::endl << "[[Geometry][Status]]" << std::endl;
84 inline void table_footer()
86 m_out << "]" << std::endl;
90 inline void begin_row()
96 typename boost::geometry::tag<G>::type
102 inline void end_row()
104 m_out << "]" << std::endl;
110 #endif // BOOST_GEOMETRY_SUPPORT_STATUS_QBK_OUTPUTTER_HPP