Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/doc/html/boostbook/dtd/function.html @ 12

Last change on this file since 12 was 12, checked in by landauf, 18 years ago

added boost

File size: 6.9 KB
Line 
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 &#8212; 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&amp;</code> is contained in the
67  &lt;paramtype&gt; element; any number of parameters may be specified
68  in this way.</p>
69<pre class="programlisting">&lt;class name="any"&gt;
70  &lt;constructor&gt;
71    &lt;postconditions&gt;&lt;para&gt;&lt;this-&gt;empty()&gt;&lt;/para&gt;&lt;/postconditions&gt;
72  &lt;/constructor&gt;
73
74  &lt;constructor&gt;
75    &lt;parameter name="other"&gt;
76      &lt;paramtype&gt;const &lt;classname&gt;any&lt;/classname&gt;&amp;amp;&lt;/paramtype&gt;
77    &lt;/parameter&gt;
78
79    &lt;effects&gt;
80      &lt;simpara&gt; Copy constructor that copies
81        content of &lt;code&gt;other&lt;/code&gt; into the new instance,
82        so that any content is equivalent in both type and value to the
83        content of &lt;code&gt;other&lt;/code&gt;, or empty if
84        &lt;code&gt;other&lt;/code&gt; is
85        empty.
86      &lt;/simpara&gt;
87    &lt;/effects&gt;
88
89    &lt;throws&gt;
90      &lt;simpara&gt;May fail with a
91        &lt;classname&gt;std::bad_alloc&lt;/classname&gt; exception or any
92        exceptions arising from the copy constructor of the
93        contained type.
94      &lt;/simpara&gt;
95    &lt;/throws&gt;
96  &lt;/constructor&gt;
97
98  &lt;destructor&gt;
99     &lt;effects&gt;&lt;simpara&gt;Releases any and all resources used in
100     management of instance.&lt;/simpara&gt;&lt;/effects&gt;
101
102     &lt;throws&gt;&lt;simpara&gt;Nothing.&lt;/simpara&gt;&lt;/throws&gt;
103  &lt;/destructor&gt;
104&lt;/class&gt;</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>
Note: See TracBrowser for help on using the repository browser.