3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>multi_buffer</title>
5 <link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../index.html" title="Chapter 1. Boost.Beast">
8 <link rel="up" href="../ref.html" title="This Page Intentionally Left Blank 2/2">
9 <link rel="prev" href="boost__beast__make_printable.html" title="make_printable">
10 <link rel="next" href="boost__beast__operator_not__eq_.html" title="operator!=">
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>
22 <div class="spirit-nav">
23 <a accesskey="p" href="boost__beast__make_printable.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost__beast__operator_not__eq_.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
26 <div class="titlepage"><div><div><h4 class="title">
27 <a name="beast.ref.boost__beast__multi_buffer"></a><a class="link" href="boost__beast__multi_buffer.html" title="multi_buffer">multi_buffer</a>
28 </h4></div></div></div>
30 <a class="indexterm" name="idm45873487254352"></a>
31 A typical multi buffer.
34 <a name="beast.ref.boost__beast__multi_buffer.h0"></a>
35 <span class="phrase"><a name="beast.ref.boost__beast__multi_buffer.synopsis"></a></span><a class="link" href="boost__beast__multi_buffer.html#beast.ref.boost__beast__multi_buffer.synopsis">Synopsis</a>
38 Defined in header <code class="literal"><<a href="../../../../../../boost/beast/core/multi_buffer.hpp" target="_top">boost/beast/core/multi_buffer.hpp</a>></code>
40 <pre class="programlisting"><span class="keyword">using</span> <span class="identifier">multi_buffer</span> <span class="special">=</span> <span class="identifier">basic_multi_buffer</span><span class="special"><</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special"><</span> <span class="keyword">char</span> <span class="special">></span> <span class="special">>;</span>
43 <a name="beast.ref.boost__beast__multi_buffer.h1"></a>
44 <span class="phrase"><a name="beast.ref.boost__beast__multi_buffer.types"></a></span><a class="link" href="boost__beast__multi_buffer.html#beast.ref.boost__beast__multi_buffer.types">Types</a>
46 <div class="informaltable"><table class="table">
67 <a class="link" href="boost__beast__basic_multi_buffer/allocator_type.html" title="basic_multi_buffer::allocator_type"><span class="bold"><strong>allocator_type</strong></span></a>
72 The type of allocator used.
79 <a class="link" href="boost__beast__basic_multi_buffer/const_buffers_type.html" title="basic_multi_buffer::const_buffers_type"><span class="bold"><strong>const_buffers_type</strong></span></a>
84 The ConstBufferSequence used to represent the readable bytes.
91 <a class="link" href="boost__beast__basic_multi_buffer/mutable_buffers_type.html" title="basic_multi_buffer::mutable_buffers_type"><span class="bold"><strong>mutable_buffers_type</strong></span></a>
96 The MutableBufferSequence used to represent the writable bytes.
103 <a class="link" href="boost__beast__basic_multi_buffer/mutable_data_type.html" title="basic_multi_buffer::mutable_data_type"><span class="bold"><strong>mutable_data_type</strong></span></a>
108 The MutableBufferSequence used to represent the readable bytes.
115 <a name="beast.ref.boost__beast__multi_buffer.h2"></a>
116 <span class="phrase"><a name="beast.ref.boost__beast__multi_buffer.member_functions"></a></span><a class="link" href="boost__beast__multi_buffer.html#beast.ref.boost__beast__multi_buffer.member_functions">Member Functions</a>
118 <div class="informaltable"><table class="table">
139 <a class="link" href="boost__beast__basic_multi_buffer/basic_multi_buffer.html" title="basic_multi_buffer::basic_multi_buffer"><span class="bold"><strong>basic_multi_buffer</strong></span></a>
157 <a class="link" href="boost__beast__basic_multi_buffer/capacity.html" title="basic_multi_buffer::capacity"><span class="bold"><strong>capacity</strong></span></a>
162 Return the maximum number of bytes, both readable and writable,
163 that can be held without requiring an allocation.
170 <a class="link" href="boost__beast__basic_multi_buffer/cdata.html" title="basic_multi_buffer::cdata"><span class="bold"><strong>cdata</strong></span></a>
175 Returns a constant buffer sequence representing the readable bytes.
182 <a class="link" href="boost__beast__basic_multi_buffer/clear.html" title="basic_multi_buffer::clear"><span class="bold"><strong>clear</strong></span></a>
187 Set the size of the readable and writable bytes to zero.
194 <a class="link" href="boost__beast__basic_multi_buffer/commit.html" title="basic_multi_buffer::commit"><span class="bold"><strong>commit</strong></span></a>
199 Append writable bytes to the readable bytes.
206 <a class="link" href="boost__beast__basic_multi_buffer/consume.html" title="basic_multi_buffer::consume"><span class="bold"><strong>consume</strong></span></a>
211 Remove bytes from beginning of the readable bytes.
218 <a class="link" href="boost__beast__basic_multi_buffer/data.html" title="basic_multi_buffer::data"><span class="bold"><strong>data</strong></span></a>
223 Returns a constant buffer sequence representing the readable bytes.
226 Returns a mutable buffer sequence representing the readable bytes.
233 <a class="link" href="boost__beast__basic_multi_buffer/get_allocator.html" title="basic_multi_buffer::get_allocator"><span class="bold"><strong>get_allocator</strong></span></a>
238 Returns a copy of the allocator used.
245 <a class="link" href="boost__beast__basic_multi_buffer/max_size.html" title="basic_multi_buffer::max_size"><span class="bold"><strong>max_size</strong></span></a>
250 Set the maximum allowed capacity.
253 Return the maximum number of bytes, both readable and writable,
254 that can ever be held.
261 <a class="link" href="boost__beast__basic_multi_buffer/operator_eq_.html" title="basic_multi_buffer::operator="><span class="bold"><strong>operator=</strong></span></a>
276 <a class="link" href="boost__beast__basic_multi_buffer/prepare.html" title="basic_multi_buffer::prepare"><span class="bold"><strong>prepare</strong></span></a>
281 Returns a mutable buffer sequence representing writable bytes.
288 <a class="link" href="boost__beast__basic_multi_buffer/reserve.html" title="basic_multi_buffer::reserve"><span class="bold"><strong>reserve</strong></span></a>
293 Guarantee a minimum capacity.
300 <a class="link" href="boost__beast__basic_multi_buffer/shrink_to_fit.html" title="basic_multi_buffer::shrink_to_fit"><span class="bold"><strong>shrink_to_fit</strong></span></a>
305 Reallocate the buffer to fit the readable bytes exactly.
312 <a class="link" href="boost__beast__basic_multi_buffer/size.html" title="basic_multi_buffer::size"><span class="bold"><strong>size</strong></span></a>
317 Returns the number of readable bytes.
324 <a class="link" href="boost__beast__basic_multi_buffer/basic_multi_buffer_dtor_.html" title="basic_multi_buffer::~basic_multi_buffer"><span class="bold"><strong>~basic_multi_buffer</strong></span></a>
336 <a name="beast.ref.boost__beast__multi_buffer.h3"></a>
337 <span class="phrase"><a name="beast.ref.boost__beast__multi_buffer.friends"></a></span><a class="link" href="boost__beast__multi_buffer.html#beast.ref.boost__beast__multi_buffer.friends">Friends</a>
339 <div class="informaltable"><table class="table">
359 <a class="link" href="boost__beast__basic_multi_buffer/swap.html" title="basic_multi_buffer::swap"><span class="bold"><strong>swap</strong></span></a>
364 Exchange two dynamic buffers.
370 A dynamic buffer encapsulates memory storage that may be automatically resized
371 as required, where the memory is divided into two regions: readable bytes
372 followed by writable bytes. These memory regions are internal to the dynamic
373 buffer, but direct access to the elements is provided to permit them to be
374 efficiently used with I/O operations. The implementation uses a sequence
375 of one or more byte arrays of varying sizes to represent the readable and
376 writable bytes. Additional byte array objects are appended to the sequence
377 to accommodate changes in the desired size. The behavior and implementation
378 of this container is most similar to <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">deque</span></code>.
379 Objects of this type meet the requirements of <span class="emphasis"><em>DynamicBuffer</em></span>
380 and have the following additional properties:
382 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
383 <li class="listitem">
384 A mutable buffer sequence representing the readable bytes is returned
385 by <a class="link" href="boost__beast__basic_multi_buffer/data.html" title="basic_multi_buffer::data"><code class="computeroutput"><span class="identifier">basic_multi_buffer</span><span class="special">::</span><span class="identifier">data</span></code></a> when <code class="computeroutput"><span class="keyword">this</span></code>
388 <li class="listitem">
389 Buffer sequences representing the readable and writable bytes, returned
390 by <a class="link" href="boost__beast__basic_multi_buffer/data.html" title="basic_multi_buffer::data"><code class="computeroutput"><span class="identifier">basic_multi_buffer</span><span class="special">::</span><span class="identifier">data</span></code></a> and <a class="link" href="boost__beast__basic_multi_buffer/prepare.html" title="basic_multi_buffer::prepare"><code class="computeroutput"><span class="identifier">basic_multi_buffer</span><span class="special">::</span><span class="identifier">prepare</span></code></a>, may have length greater
393 <li class="listitem">
394 A configurable maximum size may be set upon construction and adjusted
395 afterwards. Calls to <a class="link" href="boost__beast__basic_multi_buffer/prepare.html" title="basic_multi_buffer::prepare"><code class="computeroutput"><span class="identifier">basic_multi_buffer</span><span class="special">::</span><span class="identifier">prepare</span></code></a> that would exceed this
396 size will throw <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">length_error</span></code>.
398 <li class="listitem">
399 Sequences previously obtained using <a class="link" href="boost__beast__basic_multi_buffer/data.html" title="basic_multi_buffer::data"><code class="computeroutput"><span class="identifier">basic_multi_buffer</span><span class="special">::</span><span class="identifier">data</span></code></a> remain valid after calls
400 to <a class="link" href="boost__beast__basic_multi_buffer/prepare.html" title="basic_multi_buffer::prepare"><code class="computeroutput"><span class="identifier">basic_multi_buffer</span><span class="special">::</span><span class="identifier">prepare</span></code></a> or <a class="link" href="boost__beast__basic_multi_buffer/commit.html" title="basic_multi_buffer::commit"><code class="computeroutput"><span class="identifier">basic_multi_buffer</span><span class="special">::</span><span class="identifier">commit</span></code></a>.
404 <a name="beast.ref.boost__beast__multi_buffer.h4"></a>
405 <span class="phrase"><a name="beast.ref.boost__beast__multi_buffer.template_parameters"></a></span><a class="link" href="boost__beast__multi_buffer.html#beast.ref.boost__beast__multi_buffer.template_parameters">Template
408 <div class="informaltable"><table class="table">
428 <code class="computeroutput"><span class="identifier">Allocator</span></code>
433 The allocator to use for managing memory.
439 <a name="beast.ref.boost__beast__multi_buffer.h5"></a>
440 <span class="phrase"><a name="beast.ref.boost__beast__multi_buffer.description"></a></span><a class="link" href="boost__beast__multi_buffer.html#beast.ref.boost__beast__multi_buffer.description">Description</a>
443 Convenience header <code class="literal"><<a href="../../../../../../boost/beast/core.hpp" target="_top">boost/beast/core.hpp</a>></code>
446 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
447 <td align="left"></td>
448 <td align="right"><div class="copyright-footer">Copyright © 2016-2019 Vinnie
450 Distributed under the Boost Software License, Version 1.0. (See accompanying
451 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>)
456 <div class="spirit-nav">
457 <a accesskey="p" href="boost__beast__make_printable.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost__beast__operator_not__eq_.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>