paludis  Version 2.6.0
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 
27 namespace paludis
28 {
29  namespace args
30  {
31  class DocWriter;
32 
33  /**
34  * Write docs to an ostream.
35  *
36  * \ingroup grplibpaludisargs
37  */
38  void generate_doc(DocWriter & dw, const ArgsHandler * const h) PALUDIS_VISIBLE;
39 
40  /**
41  * Write docs from args classes in a particular format.
42  *
43  * \ingroup grplibpaludisargs
44  * \nosubgrouping
45  */
46  class PALUDIS_VISIBLE DocWriter
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();
119  ///\}
120 
121  void heading(const std::string & name, const std::string & section,
122  const std::string & synopis);
123  void start_usage_lines();
124  void usage_line(const std::string & name, const std::string & line);
125 
126  void start_description(const std::string & description);
127  void extra_description(const std::string & description);
128  void end_description();
129 
130  void start_options(const std::string & s);
131  void start_arg_group(const std::string & name, const std::string & description);
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);
134  void start_extra_arg();
135  void extra_arg_enum(const AllowedEnumArg &, const std::string & default_arg);
136  void extra_arg_string_set(const std::string & first, const std::string & second);
137  void end_extra_arg();
138  void end_arg_group();
139  void end_options();
140 
141  void start_environment();
142  void environment_line(const std::string & first, const std::string & second);
143  void end_environment();
144 
145  void start_examples();
146  void example(const std::string &, const std::string &);
147  void end_examples();
148 
149  void start_notes();
150  void note(const std::string &);
151  void end_notes();
152 
153  void section(const std::string & title);
154  void subsection(const std::string & title);
155  void paragraph(const std::string & text);
156 
157  void start_see_alsos();
158  void see_also(const std::string &, const int, const bool first);
159  void end_see_alsos();
160  };
161  }
162 }
163 
164 #endif
Definition: about_metadata-fwd.hh:23
Definition: args_option.hh:529
Definition: man.hh:108
Definition: man.hh:46
void generate_doc(DocWriter &dw, const ArgsHandler *const h) PALUDIS_VISIBLE
#define PALUDIS_VISIBLE
Definition: attributes.hh:59