• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>read_size_or_throw</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__read_size.html" title="read_size">
10<link rel="next" href="boost__beast__operator_plus_.html" title="operator+">
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="boost__beast__read_size.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_plus_.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h4 class="title">
27<a name="beast.ref.boost__beast__read_size_or_throw"></a><a class="link" href="boost__beast__read_size_or_throw.html" title="read_size_or_throw">read_size_or_throw</a>
28</h4></div></div></div>
29<p>
30        <a class="indexterm" name="idm46057512596928"></a>
31      </p>
32<p>
33        Returns a natural read size or throw if the buffer is full.
34      </p>
35<h5>
36<a name="beast.ref.boost__beast__read_size_or_throw.h0"></a>
37        <span class="phrase"><a name="beast.ref.boost__beast__read_size_or_throw.synopsis"></a></span><a class="link" href="boost__beast__read_size_or_throw.html#beast.ref.boost__beast__read_size_or_throw.synopsis">Synopsis</a>
38      </h5>
39<p>
40        Defined in header <code class="literal">&lt;<a href="../../../../../../boost/beast/core/read_size.hpp" target="_top">boost/beast/core/read_size.hpp</a>&gt;</code>
41      </p>
42<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span>
43    <span class="keyword">class</span> <a class="link" href="../concepts/DynamicBuffer.html" title="DynamicBuffer"><span class="emphasis"><em>DynamicBuffer</em></span></a><span class="special">&gt;</span>
44<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span>
45<span class="identifier">read_size_or_throw</span><span class="special">(</span>
46    <span class="identifier">DynamicBuffer</span><span class="special">&amp;</span> <span class="identifier">buffer</span><span class="special">,</span>
47    <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">max_size</span><span class="special">);</span>
48</pre>
49<h5>
50<a name="beast.ref.boost__beast__read_size_or_throw.h1"></a>
51        <span class="phrase"><a name="beast.ref.boost__beast__read_size_or_throw.description"></a></span><a class="link" href="boost__beast__read_size_or_throw.html#beast.ref.boost__beast__read_size_or_throw.description">Description</a>
52      </h5>
53<p>
54        This function inspects the capacity, size, and maximum size of the dynamic
55        buffer. Then it computes a natural read size given the passed-in upper limit.
56        It favors a read size that does not require a reallocation, subject to a
57        reasonable minimum to avoid tiny reads.
58      </p>
59<h5>
60<a name="beast.ref.boost__beast__read_size_or_throw.h2"></a>
61        <span class="phrase"><a name="beast.ref.boost__beast__read_size_or_throw.parameters"></a></span><a class="link" href="boost__beast__read_size_or_throw.html#beast.ref.boost__beast__read_size_or_throw.parameters">Parameters</a>
62      </h5>
63<div class="informaltable"><table class="table">
64<colgroup>
65<col>
66<col>
67</colgroup>
68<thead><tr>
69<th>
70                <p>
71                  Name
72                </p>
73              </th>
74<th>
75                <p>
76                  Description
77                </p>
78              </th>
79</tr></thead>
80<tbody>
81<tr>
82<td>
83                <p>
84                  <code class="computeroutput"><span class="identifier">buffer</span></code>
85                </p>
86              </td>
87<td>
88                <p>
89                  The dynamic buffer to inspect.
90                </p>
91              </td>
92</tr>
93<tr>
94<td>
95                <p>
96                  <code class="computeroutput"><span class="identifier">max_size</span></code>
97                </p>
98              </td>
99<td>
100                <p>
101                  An upper limit on the returned value.
102                </p>
103              </td>
104</tr>
105</tbody>
106</table></div>
107<h5>
108<a name="beast.ref.boost__beast__read_size_or_throw.h3"></a>
109        <span class="phrase"><a name="beast.ref.boost__beast__read_size_or_throw.exceptions"></a></span><a class="link" href="boost__beast__read_size_or_throw.html#beast.ref.boost__beast__read_size_or_throw.exceptions">Exceptions</a>
110      </h5>
111<div class="informaltable"><table class="table">
112<colgroup>
113<col>
114<col>
115</colgroup>
116<thead><tr>
117<th>
118                <p>
119                  Type
120                </p>
121              </th>
122<th>
123                <p>
124                  Thrown On
125                </p>
126              </th>
127</tr></thead>
128<tbody><tr>
129<td>
130                <p>
131                  <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">length_error</span></code>
132                </p>
133              </td>
134<td>
135                <p>
136                  if <code class="computeroutput"><span class="identifier">max_size</span> <span class="special">&gt;</span>
137                  <span class="number">0</span></code> and the buffer is full.
138                </p>
139              </td>
140</tr></tbody>
141</table></div>
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 © 2016-2019 Vinnie
146      Falco<p>
147        Distributed under the Boost Software License, Version 1.0. (See accompanying
148        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>)
149      </p>
150</div></td>
151</tr></table>
152<hr>
153<div class="spirit-nav">
154<a accesskey="p" href="boost__beast__read_size.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_plus_.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
155</div>
156</body>
157</html>
158