| 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.68.1"> |
|---|
| 8 | <link rel="start" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> |
|---|
| 9 | <link rel="up" href="../../reference.html" title="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 C++ Libraries" 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="id2060398"></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 | |
|---|
| 60 | <p>The behavior of functions in BoostBook is documenting using a |
|---|
| 61 | style similar to that of the C++ standard, with clauses describing |
|---|
| 62 | the requirements, effects, postconditions, exception behavior, and |
|---|
| 63 | return values of functions.</p> |
|---|
| 64 | |
|---|
| 65 | <p>The following example illustrates some constructors and a |
|---|
| 66 | destructor for <code class="computeroutput"><a href="../../boost/any.html" title="Class any">boost::any</a></code>. Note that one of |
|---|
| 67 | the constructors takes a single parameter whose name is "other" and |
|---|
| 68 | whose type, <code class="computeroutput">const any&</code> is contained in the |
|---|
| 69 | <paramtype> element; any number of parameters may be specified |
|---|
| 70 | in this way.</p> |
|---|
| 71 | |
|---|
| 72 | <pre class="programlisting"><class name="any"> |
|---|
| 73 | <constructor> |
|---|
| 74 | <postconditions><para><this->empty()></para></postconditions> |
|---|
| 75 | </constructor> |
|---|
| 76 | |
|---|
| 77 | <constructor> |
|---|
| 78 | <parameter name="other"> |
|---|
| 79 | <paramtype>const <classname>any</classname>&amp;</paramtype> |
|---|
| 80 | </parameter> |
|---|
| 81 | |
|---|
| 82 | <effects> |
|---|
| 83 | <simpara> Copy constructor that copies |
|---|
| 84 | content of <code>other</code> into the new instance, |
|---|
| 85 | so that any content is equivalent in both type and value to the |
|---|
| 86 | content of <code>other</code>, or empty if |
|---|
| 87 | <code>other</code> is |
|---|
| 88 | empty. |
|---|
| 89 | </simpara> |
|---|
| 90 | </effects> |
|---|
| 91 | |
|---|
| 92 | <throws> |
|---|
| 93 | <simpara>May fail with a |
|---|
| 94 | <classname>std::bad_alloc</classname> exception or any |
|---|
| 95 | exceptions arising from the copy constructor of the |
|---|
| 96 | contained type. |
|---|
| 97 | </simpara> |
|---|
| 98 | </throws> |
|---|
| 99 | </constructor> |
|---|
| 100 | |
|---|
| 101 | <destructor> |
|---|
| 102 | <effects><simpara>Releases any and all resources used in |
|---|
| 103 | management of instance.</simpara></effects> |
|---|
| 104 | |
|---|
| 105 | <throws><simpara>Nothing.</simpara></throws> |
|---|
| 106 | </destructor> |
|---|
| 107 | </class></pre> |
|---|
| 108 | </div> |
|---|
| 109 | <div class="refsection" lang="en"> |
|---|
| 110 | <a name="id2060453"></a> |
|---|
| 111 | <h2>Attributes</h2> |
|---|
| 112 | <div class="informaltable"><table class="table"> |
|---|
| 113 | <colgroup> |
|---|
| 114 | <col> |
|---|
| 115 | <col> |
|---|
| 116 | <col> |
|---|
| 117 | <col> |
|---|
| 118 | </colgroup> |
|---|
| 119 | <thead><tr> |
|---|
| 120 | <th>Name</th> |
|---|
| 121 | <th>Type</th> |
|---|
| 122 | <th>Value</th> |
|---|
| 123 | <th>Purpose</th> |
|---|
| 124 | </tr></thead> |
|---|
| 125 | <tbody> |
|---|
| 126 | <tr> |
|---|
| 127 | <td>last-revision</td> |
|---|
| 128 | <td>#IMPLIED</td> |
|---|
| 129 | <td>CDATA</td> |
|---|
| 130 | <td>Set to $Date: 2006/11/03 19:39:44 $ to keep "last revised" information in sync with CVS changes</td> |
|---|
| 131 | </tr> |
|---|
| 132 | <tr> |
|---|
| 133 | <td>specifiers</td> |
|---|
| 134 | <td>#IMPLIED</td> |
|---|
| 135 | <td>CDATA</td> |
|---|
| 136 | <td>The specifiers for this function, e.g., inline, static, etc.</td> |
|---|
| 137 | </tr> |
|---|
| 138 | <tr> |
|---|
| 139 | <td>name</td> |
|---|
| 140 | <td>#REQUIRED</td> |
|---|
| 141 | <td>CDATA</td> |
|---|
| 142 | <td>The name of the element being declared to referenced</td> |
|---|
| 143 | </tr> |
|---|
| 144 | <tr> |
|---|
| 145 | <td>id</td> |
|---|
| 146 | <td>#IMPLIED</td> |
|---|
| 147 | <td>CDATA</td> |
|---|
| 148 | <td>A global identifier for this element</td> |
|---|
| 149 | </tr> |
|---|
| 150 | <tr> |
|---|
| 151 | <td>xml:base</td> |
|---|
| 152 | <td>#IMPLIED</td> |
|---|
| 153 | <td>CDATA</td> |
|---|
| 154 | <td>Implementation detail used by XIncludes</td> |
|---|
| 155 | </tr> |
|---|
| 156 | </tbody> |
|---|
| 157 | </table></div> |
|---|
| 158 | </div> |
|---|
| 159 | </div> |
|---|
| 160 | <table width="100%"><tr> |
|---|
| 161 | <td align="left"></td> |
|---|
| 162 | <td align="right"><small>Copyright © 2003-2005 Douglas Gregor</small></td> |
|---|
| 163 | </tr></table> |
|---|
| 164 | <hr> |
|---|
| 165 | <div class="spirit-nav"> |
|---|
| 166 | <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> |
|---|
| 167 | </div> |
|---|
| 168 | </body> |
|---|
| 169 | </html> |
|---|