paludis Version 3.0.2
The one true package mangler
man.hh
1/* vim: set sw=4 sts=4 et foldmethod=syntax : */
2
3/*
4 * Copyright (c) 2006, 2007, 2009, 2010, 2011 Ciaran McCreesh
5 * Copyright (c) 2011 Ingmar Vanhassel
6 *
7 * This file is part of the Paludis package manager. Paludis is free software;
8 * you can redistribute it and/or modify it under the terms of the GNU General
9 * Public License version 2, as published by the Free Software Foundation.
10 *
11 * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 * details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
18 * Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef PALUDIS_GUARD_PALUDIS_ARGS_MAN_HH
22#define PALUDIS_GUARD_PALUDIS_ARGS_MAN_HH 1
23
25#include <iosfwd>
26
27namespace paludis
28{
29 namespace args
30 {
31 class DocWriter;
32
33 /**
34 * Write docs to an ostream.
35 *
36 * \ingroup grplibpaludisargs
37 */
39
40 /**
41 * Write docs from args classes in a particular format.
42 *
43 * \ingroup grplibpaludisargs
44 * \nosubgrouping
45 */
47 {
48 public:
49 ///\name Basic operations
50 ///\{
51
52 virtual ~DocWriter() = 0;
53
54 ///\}
55
56 ///\name Output routines
57 ///\{
58
59 virtual void heading(const std::string & name, const std::string & section,
60 const std::string & synopsis) = 0;
61 virtual void start_usage_lines() = 0;
62 virtual void usage_line(const std::string & name, const std::string & line) = 0;
63
64 virtual void start_description(const std::string & description) = 0;
65 virtual void extra_description(const std::string & description) = 0;
66 virtual void end_description() = 0;
67
68 virtual void start_options(const std::string &) = 0;
69 virtual void start_arg_group(const std::string & name, const std::string & description) = 0;
70 virtual void arg_group_item(const char & short_name, const std::string & long_name,
71 const std::string & negated_long_name, const std::string & description) = 0;
72 virtual void start_extra_arg() = 0;
73 virtual void extra_arg_enum(const AllowedEnumArg &, const std::string & default_arg) = 0;
74 virtual void extra_arg_string_set(const std::string & first, const std::string & second) = 0;
75 virtual void end_extra_arg() = 0;
76 virtual void end_arg_group() = 0;
77 virtual void end_options() = 0;
78
79 virtual void start_environment() = 0;
80 virtual void environment_line(const std::string & first, const std::string & second) = 0;
81 virtual void end_environment() = 0;
82
83 virtual void start_examples() = 0;
84 virtual void example(const std::string &, const std::string &) = 0;
85 virtual void end_examples() = 0;
86
87 virtual void start_notes() = 0;
88 virtual void note(const std::string &) = 0;
89 virtual void end_notes() = 0;
90
91 virtual void section(const std::string & title) = 0;
92 virtual void subsection(const std::string & title) = 0;
93 virtual void paragraph(const std::string & text) = 0;
94
95 virtual void start_see_alsos() = 0;
96 virtual void see_also(const std::string &, const int, const bool first) = 0;
97 virtual void end_see_alsos() = 0;
98
99 ///\}
100 };
101
102 /**
103 * Create Asciidoc documentation from args classes.
104 *
105 * \ingroup grplibpaludisargs
106 * \nosubgrouping
107 */
108 class PALUDIS_VISIBLE AsciidocWriter :
109 public DocWriter
110 {
111 private:
112 std::ostream & _os;
113
114 public:
115 ///\name Basic operations
116 ///\{
117 AsciidocWriter(std::ostream & os);
118 ~AsciidocWriter() override = default;
119 ///\}
120
121 void heading(const std::string & name, const std::string & section,
122 const std::string & synopis) override;
123 void start_usage_lines() override;
124 void usage_line(const std::string & name, const std::string & line) override;
125
126 void start_description(const std::string & description) override;
127 void extra_description(const std::string & description) override;
128 void end_description() override;
129
130 void start_options(const std::string & s) override;
131 void start_arg_group(const std::string & name, const std::string & description) override;
132 void arg_group_item(const char & short_name, const std::string & long_name,
133 const std::string & negated_long_name, const std::string & description) override;
134 void start_extra_arg() override;
135 void extra_arg_enum(const AllowedEnumArg &, const std::string & default_arg) override;
136 void extra_arg_string_set(const std::string & first, const std::string & second) override;
137 void end_extra_arg() override;
138 void end_arg_group() override;
139 void end_options() override;
140
141 void start_environment() override;
142 void environment_line(const std::string & first, const std::string & second) override;
143 void end_environment() override;
144
145 void start_examples() override;
146 void example(const std::string &, const std::string &) override;
147 void end_examples() override;
148
149 void start_notes() override;
150 void note(const std::string &) override;
151 void end_notes() override;
152
153 void section(const std::string & title) override;
154 void subsection(const std::string & title) override;
155 void paragraph(const std::string & text) override;
156
157 void start_see_alsos() override;
158 void see_also(const std::string &, const int, const bool first) override;
159 void end_see_alsos() override;
160 };
161 }
162}
163
164#endif
Definition args_handler.hh:60
Definition man.hh:47
#define PALUDIS_VISIBLE
Definition attributes.hh:59
Definition args_dumper.hh:39
void generate_doc(DocWriter &dw, const ArgsHandler *const h) PALUDIS_VISIBLE
Definition about_metadata-fwd.hh:24
Definition args_option.hh:533