]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/doc/src/docutils/tools/support_status/qbk_outputter.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / doc / src / docutils / tools / support_status / qbk_outputter.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2// Tool reporting Implementation Support Status in QBK or plain text format
3
4// Copyright (c) 2011-2012 Bruno Lalande, Paris, France.
5// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
6
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
11#ifndef BOOST_GEOMETRY_SUPPORT_STATUS_QBK_OUTPUTTER_HPP
12#define BOOST_GEOMETRY_SUPPORT_STATUS_QBK_OUTPUTTER_HPP
13
14
15template <typename Tag> struct qbk_geometry_name { static inline std::string name() { return "Range"; } }; // TODO / make general
16template <> struct qbk_geometry_name<boost::geometry::point_tag> { static inline std::string name() { return "Point"; } };
17template <> struct qbk_geometry_name<boost::geometry::segment_tag> { static inline std::string name() { return "Segment"; } };
18template <> struct qbk_geometry_name<boost::geometry::box_tag> { static inline std::string name() { return "Box"; } };
19template <> struct qbk_geometry_name<boost::geometry::linestring_tag> { static inline std::string name() { return "Linestring"; } };
20template <> struct qbk_geometry_name<boost::geometry::ring_tag> { static inline std::string name() { return "Ring"; } };
21template <> struct qbk_geometry_name<boost::geometry::polygon_tag> { static inline std::string name() { return "Polygon"; } };
22template <> struct qbk_geometry_name<boost::geometry::multi_point_tag> { static inline std::string name() { return "MultiPoint"; } };
23template <> struct qbk_geometry_name<boost::geometry::multi_linestring_tag> { static inline std::string name() { return "MultiLinestring"; } };
24template <> struct qbk_geometry_name<boost::geometry::multi_polygon_tag> { static inline std::string name() { return "MultiPolygon"; } };
25
26
27struct qbk_table_row_header
28{
29 std::ofstream& m_out;
30
31 qbk_table_row_header(std::ofstream& out)
32 : m_out(out)
33 {}
34
35 template <typename G>
36 void operator()(G)
37 {
38 m_out
39 << "["
40 << qbk_geometry_name
41 <
42 typename boost::geometry::tag<G>::type
43 >::name()
44 << "]";
45 }
46};
47
48struct qbk_outputter
49{
50 std::ofstream m_out;
51
52 std::string filename(std::string const& name)
53 {
54 std::ostringstream out;
55 out << "../../../../generated/" << name << "_status.qbk";
56 return out.str();
57 }
58
59 explicit qbk_outputter(std::string const& name)
60 : m_out(filename(name).c_str())
61 {
62 }
63
64 inline void ok() { m_out << "[ [$img/ok.png] ]"; }
65 inline void nyi() { m_out << "[ [$img/nyi.png] ]"; }
66
67 inline void header(std::string const& )
68 {
69 m_out << "[heading Supported geometries]" << std::endl;
70 }
71
72 template <typename Types>
73 inline void table_header()
74 {
75 m_out << "[table" << std::endl << "[[ ]";
76 boost::mpl::for_each<Types>(qbk_table_row_header(m_out));
77 m_out << "]" << std::endl;
78 }
79 inline void table_header()
80 {
81 m_out << "[table" << std::endl << "[[Geometry][Status]]" << std::endl;
82 }
83
84 inline void table_footer()
85 {
86 m_out << "]" << std::endl;
87 }
88
89 template <typename G>
90 inline void begin_row()
91 {
92 m_out
93 << "[["
94 << qbk_geometry_name
95 <
96 typename boost::geometry::tag<G>::type
97 >::name()
98 << "]"
99 ;
100 }
101
102 inline void end_row()
103 {
104 m_out << "]" << std::endl;
105 }
106
107};
108
109
110#endif // BOOST_GEOMETRY_SUPPORT_STATUS_QBK_OUTPUTTER_HPP