1 | <html> |
---|
2 | <head> |
---|
3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
---|
4 | <title> |
---|
5 | BoostBook element function</title> |
---|
6 | <link rel="stylesheet" href="../../boostbook.css" type="text/css"> |
---|
7 | <meta name="generator" content="DocBook XSL Stylesheets V1.69.1"> |
---|
8 | <link rel="start" href="../../index.html" title="The Boost C++ Libraries"> |
---|
9 | <link rel="up" href="../../reference.html" title="Chapter 20. Reference"> |
---|
10 | <link rel="prev" href="source.html" title=" |
---|
11 | BoostBook element source"> |
---|
12 | <link rel="next" href="postconditions.html" title=" |
---|
13 | BoostBook element postconditions"> |
---|
14 | </head> |
---|
15 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
---|
16 | <table cellpadding="2" width="100%"> |
---|
17 | <td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../../../boost.png"></td> |
---|
18 | <td align="center"><a href="../../../../index.htm">Home</a></td> |
---|
19 | <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> |
---|
20 | <td align="center"><a href="../../../../people/people.htm">People</a></td> |
---|
21 | <td align="center"><a href="../../../../more/faq.htm">FAQ</a></td> |
---|
22 | <td align="center"><a href="../../../../more/index.htm">More</a></td> |
---|
23 | </table> |
---|
24 | <hr> |
---|
25 | <div class="spirit-nav"> |
---|
26 | <a accesskey="p" href="source.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="postconditions.html"><img src="../../images/next.png" alt="Next"></a> |
---|
27 | </div> |
---|
28 | <div class="refentry" lang="en"> |
---|
29 | <a name="boostbook.dtd.function"></a><div class="titlepage"></div> |
---|
30 | <div class="refnamediv"> |
---|
31 | <h2><span class="refentrytitle"> |
---|
32 | BoostBook element <code class="sgmltag-element">function</code></span></h2> |
---|
33 | <p>function — Declares a function</p> |
---|
34 | </div> |
---|
35 | <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> |
---|
36 | <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv">function ::= |
---|
37 | (<a href="template.html" title=" |
---|
38 | BoostBook element template">template</a>?, <a href="type.html" title=" |
---|
39 | BoostBook element type">type</a>, <a href="parameter.html" title=" |
---|
40 | BoostBook element parameter">parameter</a>*, <a href="purpose.html" title=" |
---|
41 | BoostBook element purpose">purpose</a>?, <a href="description.html" title=" |
---|
42 | BoostBook element description">description</a>?, <a href="requires.html" title=" |
---|
43 | BoostBook element requires">requires</a>?, <a href="effects.html" title=" |
---|
44 | BoostBook element effects">effects</a>?, <a href="postconditions.html" title=" |
---|
45 | BoostBook element postconditions">postconditions</a>?, <a href="returns.html" title=" |
---|
46 | BoostBook element returns">returns</a>?, <a href="throws.html" title=" |
---|
47 | BoostBook element throws">throws</a>?, <a href="complexity.html" title=" |
---|
48 | BoostBook element complexity">complexity</a>?, <a href="notes.html" title=" |
---|
49 | BoostBook element notes">notes</a>?, <a href="rationale.html" title=" |
---|
50 | BoostBook element rationale">rationale</a>?) |
---|
51 | </div> |
---|
52 | <div class="refsection" lang="en"> |
---|
53 | <a name="id2846870"></a><h2>Description</h2> |
---|
54 | <p>BoostBook functions are documented by specifying the |
---|
55 | function's interface (e.g., its C++ signature) and its |
---|
56 | behavior. Constructors, destructors, member functions, and free |
---|
57 | functions all use the same documentation method, although the |
---|
58 | top-level tags differ.</p> |
---|
59 | <p>The behavior of functions in BoostBook is documenting using a |
---|
60 | style similar to that of the C++ standard, with clauses describing |
---|
61 | the requirements, effects, postconditions, exception behavior, and |
---|
62 | return values of functions.</p> |
---|
63 | <p>The following example illustrates some constructors and a |
---|
64 | destructor for <code class="computeroutput"><a href="../../boost/any.html" title="Class any">boost::any</a></code>. Note that one of |
---|
65 | the constructors takes a single parameter whose name is "other" and |
---|
66 | whose type, <code class="computeroutput">const any&</code> is contained in the |
---|
67 | <paramtype> element; any number of parameters may be specified |
---|
68 | in this way.</p> |
---|
69 | <pre class="programlisting"><class name="any"> |
---|
70 | <constructor> |
---|
71 | <postconditions><para><this->empty()></para></postconditions> |
---|
72 | </constructor> |
---|
73 | |
---|
74 | <constructor> |
---|
75 | <parameter name="other"> |
---|
76 | <paramtype>const <classname>any</classname>&amp;</paramtype> |
---|
77 | </parameter> |
---|
78 | |
---|
79 | <effects> |
---|
80 | <simpara> Copy constructor that copies |
---|
81 | content of <code>other</code> into the new instance, |
---|
82 | so that any content is equivalent in both type and value to the |
---|
83 | content of <code>other</code>, or empty if |
---|
84 | <code>other</code> is |
---|
85 | empty. |
---|
86 | </simpara> |
---|
87 | </effects> |
---|
88 | |
---|
89 | <throws> |
---|
90 | <simpara>May fail with a |
---|
91 | <classname>std::bad_alloc</classname> exception or any |
---|
92 | exceptions arising from the copy constructor of the |
---|
93 | contained type. |
---|
94 | </simpara> |
---|
95 | </throws> |
---|
96 | </constructor> |
---|
97 | |
---|
98 | <destructor> |
---|
99 | <effects><simpara>Releases any and all resources used in |
---|
100 | management of instance.</simpara></effects> |
---|
101 | |
---|
102 | <throws><simpara>Nothing.</simpara></throws> |
---|
103 | </destructor> |
---|
104 | </class></pre> |
---|
105 | </div> |
---|
106 | <div class="refsection" lang="en"> |
---|
107 | <a name="id2846949"></a><h2>Attributes</h2> |
---|
108 | <div class="informaltable"><table class="table"> |
---|
109 | <colgroup> |
---|
110 | <col> |
---|
111 | <col> |
---|
112 | <col> |
---|
113 | <col> |
---|
114 | </colgroup> |
---|
115 | <thead><tr> |
---|
116 | <th>Name</th> |
---|
117 | <th>Type</th> |
---|
118 | <th>Value</th> |
---|
119 | <th>Purpose</th> |
---|
120 | </tr></thead> |
---|
121 | <tbody> |
---|
122 | <tr> |
---|
123 | <td>last-revision</td> |
---|
124 | <td>#IMPLIED</td> |
---|
125 | <td>CDATA</td> |
---|
126 | <td>Set to $Date: 2005/12/04 17:26:48 $ to keep "last revised" information in sync with CVS changes</td> |
---|
127 | </tr> |
---|
128 | <tr> |
---|
129 | <td>specifiers</td> |
---|
130 | <td>#IMPLIED</td> |
---|
131 | <td>CDATA</td> |
---|
132 | <td>The specifiers for this function, e.g., inline, static, etc.</td> |
---|
133 | </tr> |
---|
134 | <tr> |
---|
135 | <td>name</td> |
---|
136 | <td>#REQUIRED</td> |
---|
137 | <td>CDATA</td> |
---|
138 | <td>The name of the element being declared to referenced</td> |
---|
139 | </tr> |
---|
140 | <tr> |
---|
141 | <td>id</td> |
---|
142 | <td>#IMPLIED</td> |
---|
143 | <td>CDATA</td> |
---|
144 | <td>A global identifier for this element</td> |
---|
145 | </tr> |
---|
146 | <tr> |
---|
147 | <td>xml:base</td> |
---|
148 | <td>#IMPLIED</td> |
---|
149 | <td>CDATA</td> |
---|
150 | <td>Implementation detail used by XIncludes</td> |
---|
151 | </tr> |
---|
152 | </tbody> |
---|
153 | </table></div> |
---|
154 | </div> |
---|
155 | </div> |
---|
156 | <table width="100%"><tr> |
---|
157 | <td align="left"></td> |
---|
158 | <td align="right"><small>Copyright © 2003-2005 Douglas Gregor</small></td> |
---|
159 | </tr></table> |
---|
160 | <hr> |
---|
161 | <div class="spirit-nav"> |
---|
162 | <a accesskey="p" href="source.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="postconditions.html"><img src="../../images/next.png" alt="Next"></a> |
---|
163 | </div> |
---|
164 | </body> |
---|
165 | </html> |
---|