Update concepts branch to revision 131834
[official-gcc.git] / libstdc++-v3 / doc / html / manual / bk01apas04.html
blob1ca6ed93900f8aceaa99c454ec24622b6e45de7d
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Documentation Style</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="&#10; ISO C++&#10; , &#10; library&#10; " /><link rel="start" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="appendix_contributing.html" title="Appendix A. Contributing" /><link rel="prev" href="bk01apas03.html" title="Coding Style" /><link rel="next" href="bk01apas05.html" title="Design Notes" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Documentation Style</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01apas03.html">Prev</a> </td><th width="60%" align="center">Appendix A. Contributing</th><td width="20%" align="right"> <a accesskey="n" href="bk01apas05.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="contrib.doc_style"></a>Documentation Style</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="doc_style.doxygen"></a>Doxygen</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="doxygen.prereq"></a>Prerequisites</h4></div></div></div><p>
4 Prerequisite tools are Bash 2.x,
5 <a class="ulink" href="http://www.doxygen.org/" target="_top">Doxygen</a>, and
6 the <a class="ulink" href="http://www.gnu.org/software/coreutils/" target="_top">GNU
7 coreutils</a>. (GNU versions of find, xargs, and possibly
8 sed and grep are used, just because the GNU versions make
9 things very easy.)
10 </p><p>
11 To generate the pretty pictures and hierarchy
12 graphs, the
13 <a class="ulink" href="http://www.research.att.com/sw/tools/graphviz/download.html" target="_top">Graphviz</a>
14 package will need to be installed.
15 </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="doxygen.rules"></a>Generating the Doxygen Files</h4></div></div></div><p>
16 The Makefile rules
17 </p><pre class="screen"><strong class="userinput"><code>make doc-html-doxygen</code></strong></pre><p>
18 and
19 </p><pre class="screen"><strong class="userinput"><code>make doc-xml-doxygen</code></strong></pre><p>
20 and
21 </p><pre class="screen"><strong class="userinput"><code>make doc-man-doxygen</code></strong></pre><p>
22 in the libstdc++ build directory generate the HTML docs, the
23 XML docs, and the man pages.
24 </p><p>
25 Careful observers will see that the Makefile rules simply call
26 a script from the source tree, <code class="filename">run_doxygen</code>, which
27 does the actual work of running Doxygen and then (most
28 importantly) massaging the output files. If for some reason
29 you prefer to not go through the Makefile, you can call this
30 script directly. (Start by passing <code class="literal">--help</code>.)
31 </p><p>
32 If you wish to tweak the Doxygen settings, do so by editing
33 <code class="filename">doc/doxygen/user.cfg.in</code>. Notes to fellow
34 library hackers are written in triple-# comments.
35 </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="doxygen.markup"></a>Markup</h4></div></div></div><p>
36 In general, libstdc++ files should be formatted according to
37 the rules found in the
38 <a class="link" href="bk01apas03.html" title="Coding Style">Coding Standard</a>. Before
39 any doxygen-specific formatting tweaks are made, please try to
40 make sure that the initial formatting is sound.
41 </p><p>
42 Adding Doxygen markup to a file (informally called
43 <span class="quote">doxygenating</span>”) is very simple. The Doxygen manual can be
44 found
45 <a class="ulink" href="http://www.stack.nl/~dimitri/doxygen/download.html#latestman" target="_top">here</a>.
46 We try to use a very-recent version of Doxygen.
47 </p><p>
48 For classes, use
49 <code class="classname">deque</code>/<code class="classname">vector</code>/<code class="classname">list</code>
50 and <code class="classname">std::pair</code> as examples. For
51 functions, see their member functions, and the free functions
52 in <code class="filename">stl_algobase.h</code>. Member functions of
53 other container-like types should read similarly to these
54 member functions.
55 </p><p>
56 These points accompany the first list in section 3.1 of the
57 Doxygen manual:
58 </p><div class="orderedlist"><ol type="1"><li><p>Use the Javadoc style...</p></li><li><p>
59 ...not the Qt style. The intermediate *'s are preferred.
60 </p></li><li><p>
61 Use the triple-slash style only for one-line comments (the
62 <span class="quote">brief</span>” mode). Very recent versions of Doxygen permit
63 full-mode comments in triple-slash blocks, but the
64 formatting still comes out wonky.
65 </p></li><li><p>
66 This is disgusting. Don't do this.
67 </p></li></ol></div><p>
68 Use the @-style of commands, not the !-style. Please be
69 careful about whitespace in your markup comments. Most of the
70 time it doesn't matter; doxygen absorbs most whitespace, and
71 both HTML and *roff are agnostic about whitespace. However,
72 in &lt;pre&gt; blocks and @code/@endcode sections, spacing can
73 have “<span class="quote">interesting</span>” effects.
74 </p><p>
75 Use either kind of grouping, as
76 appropriate. <code class="filename">doxygroups.cc</code> exists for this
77 purpose. See <code class="filename">stl_iterator.h</code> for a good example
78 of the “<span class="quote">other</span>” kind of grouping.
79 </p><p>
80 Please use markup tags like @p and @a when referring to things
81 such as the names of function parameters. Use @e for emphasis
82 when necessary. Use @c to refer to other standard names.
83 (Examples of all these abound in the present code.)
84 </p></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="doc_style.docbook"></a>Docbook</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="docbook.prereq"></a>Prerequisites</h4></div></div></div><p>
85 Editing the DocBook sources requires an XML editor. Many
86 exist: some notable options
87 include <span class="command"><strong>emacs</strong></span>, <span class="application">Kate</span>,
88 or <span class="application">Conglomerate</span>.
89 </p><p>
90 Some editors support special “<span class="quote">XML Validation</span>
91 modes that can validate the file as it is
92 produced. Recommended is the <span class="command"><strong>nXML Mode</strong></span>
93 for <span class="command"><strong>emacs</strong></span>.
94 </p><p>
95 Besides an editor, additional DocBook files and XML tools are
96 also required.
97 </p><p>
98 Access to the DocBook stylesheets and DTD is required. The
99 stylesheets are usually packaged by vendor, in something
100 like <code class="filename">docbook-style-xsl</code>. The installation
101 directory for this package corresponds to
102 the <code class="literal">XSL_STYLE_DIR</code>
103 in <code class="filename">doc/Makefile.am</code> and defaults
104 to <code class="filename">/usr/share/sgml/docbook/xsl-stylesheets</code>.
105 </p><p>
106 For processing XML, an XML processor and some style
107 sheets are necessary. Defaults are <span class="command"><strong>xsltproc</strong></span>
108 provided by <code class="filename">libxslt</code>.
109 </p><p>
110 For validating the XML document, you'll need
111 something like <span class="command"><strong>xmllint</strong></span> and access to the
112 DocBook DTD. These are provided
113 by a vendor package like <code class="filename">lixml2</code>.
114 </p><p>
115 For PDF output, something that transforms valid XML to PDF is
116 required. Possible solutions include <span class="command"><strong>xmlto</strong></span>,
117 <a class="ulink" href="http://xmlgraphics.apache.org/fop/" target="_top">Apache
118 FOP</a>, or <span class="command"><strong>prince</strong></span>. Other options are
119 listed on the DocBook web <a class="ulink" href="http://wiki.docbook.org/topic/DocBookPublishingTools" target="_top">pages</a>. Please
120 consult the <code class="email">&lt;<a class="email" href="mailto:libstdc++@gcc.gnu.org">libstdc++@gcc.gnu.org</a>&gt;</code> list when
121 preparing printed manuals for current best practice and suggestions.
122 </p><p>
123 Make sure that the XML documentation and markup is valid for
124 any change. This can be done easily, with the validation rules
125 in the <code class="filename">Makefile</code>, which is equivalent to doing:
126 </p><pre class="screen">
127 <strong class="userinput"><code>
128 xmllint --noout --valid <code class="filename">xml/index.xml</code>
129 </code></strong>
130 </pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="docbook.rules"></a>Generating the DocBook Files</h4></div></div></div><p>
131 The Makefile rules
132 </p><pre class="screen"><strong class="userinput"><code>make doc-html</code></strong></pre><p>
133 and
134 </p><pre class="screen"><strong class="userinput"><code>make doc-pdf</code></strong></pre><p>
135 and
136 </p><pre class="screen"><strong class="userinput"><code>make doc-xml-single</code></strong></pre><p>
137 and
138 </p><pre class="screen"><strong class="userinput"><code>make doc-xml-validate</code></strong></pre><p>
139 in the libstdc++ build directory result respectively in the
140 following: the generation of an HTML version of all the
141 documentation, a PDF version of the same, a single XML
142 document, and the results of validating the XML document.
143 </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="docbook.examples"></a>File Organization and Basics</h4></div></div></div><div class="literallayout"><p><br />
144       <span class="emphasis"><em>Which files are important</em></span><br />
145 <br />
146       All Docbook files are in the directory<br />
147       libstdc++-v3/doc/xml<br />
148 <br />
149       Inside this directory, the files of importance:<br />
150       spine.xml   - index to documentation set<br />
151       manual/spine.xml  - index to manual<br />
152       manual/*.xml   - individual chapters and sections of the manual<br />
153       faq.xml   - index to FAQ<br />
154       api.xml   - index to source level / API <br />
155 <br />
156       All *.txml files are template xml files, i.e., otherwise empty files with<br />
157       the correct structure, suitable for filling in with new information.<br />
158 <br />
159       <span class="emphasis"><em>Canonical Writing Style</em></span><br />
160 <br />
161       class template<br />
162       function template<br />
163       member function template<br />
164       (via C++ Templates, Vandevoorde)<br />
165 <br />
166       class in namespace std: allocator, not std::allocator<br />
167 <br />
168       header file: iostream, not &lt;iostream&gt;<br />
169 <br />
170 <br />
171       <span class="emphasis"><em>General structure</em></span><br />
172 <br />
173       &lt;set&gt;<br />
174       &lt;book&gt;<br />
175       &lt;/book&gt;<br />
176 <br />
177       &lt;book&gt;<br />
178       &lt;chapter&gt;<br />
179       &lt;/chapter&gt;<br />
180       &lt;/book&gt;<br />
181 <br />
182       &lt;book&gt; <br />
183       &lt;part&gt;<br />
184       &lt;chapter&gt;<br />
185       &lt;section&gt;<br />
186       &lt;/section&gt;<br />
187 <br />
188       &lt;sect1&gt;<br />
189       &lt;/sect1&gt;<br />
190 <br />
191       &lt;sect1&gt;<br />
192       &lt;sect2&gt;<br />
193       &lt;/sect2&gt;<br />
194       &lt;/sect1&gt;<br />
195       &lt;/chapter&gt;<br />
196 <br />
197       &lt;chapter&gt;<br />
198       &lt;/chapter&gt;<br />
199       &lt;/part&gt;  <br />
200       &lt;/book&gt;<br />
201 <br />
202       &lt;/set&gt;<br />
203     </p></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="docbook.markup"></a>Markup By Example</h4></div></div></div><div class="literallayout"><p><br />
204       HTML to XML rough equivalents<br />
205 <br />
206       &lt;p&gt; &lt;para&gt;<br />
207 <br />
208       &lt;pre&gt; &lt;computeroutput&gt;<br />
209       &lt;pre&gt; &lt;programlisting&gt;<br />
210       &lt;pre&gt; &lt;literallayout&gt;<br />
211 <br />
212       &lt;ul&gt; &lt;itemizedlist&gt;<br />
213       &lt;ol&gt; &lt;orderedlist&gt;<br />
214       &lt;il&gt; &lt;listitem&gt;<br />
215 <br />
216       &lt;dl&gt; &lt;variablelist&gt;<br />
217 <br />
218       &lt;varlistentry&gt;<br />
219       &lt;dt&gt;    &lt;term&gt;<br />
220       &lt;/dt&gt;   &lt;/term&gt;<br />
221       &lt;dd&gt;     &lt;listitem&gt;<br />
222       &lt;/dt&gt;   &lt;/listitem&gt;<br />
223       &lt;/varlistentry&gt;<br />
224 <br />
225       &lt;a href &lt;ulink url<br />
226       &lt;code&gt; &lt;literal&gt;<br />
227       &lt;code&gt; &lt;programlisting&gt;<br />
228 <br />
229       &lt;strong&gt; &lt;emphasis&gt;<br />
230       &lt;em&gt; &lt;emphasis&gt;<br />
231       " &lt;quote&gt;<br />
232 <br />
233       ctype.h &lt;filename class="headerfile"&gt;&lt;/filename&gt;<br />
234 <br />
235       <br />
236       build_dir    &lt;filename class="directory"&gt;path_to_build_dir&lt;/filename&gt;<br />
237 <br />
238       Finer gradations of &lt;code&gt;<br />
239 <br />
240       &lt;classname&gt; &lt;classname&gt;string&lt;/classname&gt;<br />
241       &lt;classname&gt;vector&lt;&gt;&lt;/classname&gt; <br />
242       &lt;function&gt;fs.clear()&lt;/function&gt;<br />
243 <br />
244       &lt;structname&gt;<br />
245 <br />
246       &lt;function&gt; &lt;function&gt;clear()&lt;/function&gt;<br />
247 <br />
248       &lt;type&gt; &lt;type&gt;long long&lt;/type&gt;<br />
249 <br />
250       &lt;varname&gt; &lt;varname&gt;fs&lt;/varname&gt;<br />
251 <br />
252       &lt;literal&gt; &lt;literal&gt;-Weffc++&lt;/literal&gt; <br />
253       &lt;literal&gt;rel_ops&lt;/literal&gt;<br />
254 <br />
255       &lt;constant&gt; &lt;constant&gt;_GNU_SOURCE&lt;/constant&gt;<br />
256       &lt;constant&gt;3.0&lt;/constant&gt;<br />
257 <br />
258       &lt;filename&gt;<br />
259 <br />
260       &lt;command&gt; &lt;command&gt;g++&lt;/command&gt;<br />
261 <br />
262       &lt;errortext&gt; &lt;errortext&gt;foo Concept &lt;/errortext&gt;<br />
263 </p></div></div></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01apas03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="appendix_contributing.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01apas05.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Coding Style </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Design Notes</td></tr></table></div></body></html>