Imported Upstream version 1.57.0
[platform/upstream/boost.git] / doc / html / boost_asio / reference / const_buffer.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>const_buffer</title>
5 <link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
7 <link rel="home" href="../../boost_asio.html" title="Boost.Asio">
8 <link rel="up" href="../reference.html" title="Reference">
9 <link rel="prev" href="connect/overload8.html" title="connect (8 of 8 overloads)">
10 <link rel="next" href="const_buffer/const_buffer.html" title="const_buffer::const_buffer">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
15 <td align="center"><a href="../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="connect/overload8.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="const_buffer/const_buffer.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h3 class="title">
27 <a name="boost_asio.reference.const_buffer"></a><a class="link" href="const_buffer.html" title="const_buffer">const_buffer</a>
28 </h3></div></div></div>
29 <p>
30         Holds a buffer that cannot be modified.
31       </p>
32 <pre class="programlisting"><span class="keyword">class</span> <span class="identifier">const_buffer</span>
33 </pre>
34 <h5>
35 <a name="boost_asio.reference.const_buffer.h0"></a>
36         <span class="phrase"><a name="boost_asio.reference.const_buffer.member_functions"></a></span><a class="link" href="const_buffer.html#boost_asio.reference.const_buffer.member_functions">Member
37         Functions</a>
38       </h5>
39 <div class="informaltable"><table class="table">
40 <colgroup>
41 <col>
42 <col>
43 </colgroup>
44 <thead><tr>
45 <th>
46                 <p>
47                   Name
48                 </p>
49               </th>
50 <th>
51                 <p>
52                   Description
53                 </p>
54               </th>
55 </tr></thead>
56 <tbody><tr>
57 <td>
58                 <p>
59                   <a class="link" href="const_buffer/const_buffer.html" title="const_buffer::const_buffer"><span class="bold"><strong>const_buffer</strong></span></a>
60                 </p>
61               </td>
62 <td>
63                 <p>
64                   Construct an empty buffer.
65                 </p>
66                 <p>
67                   Construct a buffer to represent a given memory range.
68                 </p>
69                 <p>
70                   Construct a non-modifiable buffer from a modifiable one.
71                 </p>
72               </td>
73 </tr></tbody>
74 </table></div>
75 <h5>
76 <a name="boost_asio.reference.const_buffer.h1"></a>
77         <span class="phrase"><a name="boost_asio.reference.const_buffer.related_functions"></a></span><a class="link" href="const_buffer.html#boost_asio.reference.const_buffer.related_functions">Related
78         Functions</a>
79       </h5>
80 <div class="informaltable"><table class="table">
81 <colgroup>
82 <col>
83 <col>
84 </colgroup>
85 <thead><tr>
86 <th>
87                 <p>
88                   Name
89                 </p>
90               </th>
91 <th>
92                 <p>
93                   Description
94                 </p>
95               </th>
96 </tr></thead>
97 <tbody><tr>
98 <td>
99                 <p>
100                   <a class="link" href="const_buffer/operator_plus_.html" title="const_buffer::operator+"><span class="bold"><strong>operator+</strong></span></a>
101                 </p>
102               </td>
103 <td>
104                 <p>
105                   Create a new non-modifiable buffer that is offset from the start
106                   of another.
107                 </p>
108               </td>
109 </tr></tbody>
110 </table></div>
111 <p>
112         The <a class="link" href="const_buffer.html" title="const_buffer"><code class="computeroutput"><span class="identifier">const_buffer</span></code></a>
113         class provides a safe representation of a buffer that cannot be modified.
114         It does not own the underlying data, and so is cheap to copy or assign.
115       </p>
116 <h5>
117 <a name="boost_asio.reference.const_buffer.h2"></a>
118         <span class="phrase"><a name="boost_asio.reference.const_buffer.accessing_buffer_contents"></a></span><a class="link" href="const_buffer.html#boost_asio.reference.const_buffer.accessing_buffer_contents">Accessing
119         Buffer Contents</a>
120       </h5>
121 <p>
122         The contents of a buffer may be accessed using the <a class="link" href="buffer_size.html" title="buffer_size"><code class="computeroutput"><span class="identifier">buffer_size</span></code></a> and <a class="link" href="buffer_cast.html" title="buffer_cast"><code class="computeroutput"><span class="identifier">buffer_cast</span></code></a> functions:
123       </p>
124 <pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">const_buffer</span> <span class="identifier">b1</span> <span class="special">=</span> <span class="special">...;</span>
125 <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">s1</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer_size</span><span class="special">(</span><span class="identifier">b1</span><span class="special">);</span>
126 <span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">p1</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer_cast</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="keyword">unsigned</span> <span class="keyword">char</span><span class="special">*&gt;(</span><span class="identifier">b1</span><span class="special">);</span>
127 </pre>
128 <p>
129         The <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">buffer_cast</span></code> function permits violations
130         of type safety, so uses of it in application code should be carefully considered.
131       </p>
132 <h5>
133 <a name="boost_asio.reference.const_buffer.h3"></a>
134         <span class="phrase"><a name="boost_asio.reference.const_buffer.requirements"></a></span><a class="link" href="const_buffer.html#boost_asio.reference.const_buffer.requirements">Requirements</a>
135       </h5>
136 <p>
137         <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/buffer.hpp</code>
138       </p>
139 <p>
140         <span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio.hpp</code>
141       </p>
142 </div>
143 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
144 <td align="left"></td>
145 <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2014 Christopher M. Kohlhoff<p>
146         Distributed under the Boost Software License, Version 1.0. (See accompanying
147         file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
148       </p>
149 </div></td>
150 </tr></table>
151 <hr>
152 <div class="spirit-nav">
153 <a accesskey="p" href="connect/overload8.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="const_buffer/const_buffer.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
154 </div>
155 </body>
156 </html>