• 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_until (8 of 24 overloads)</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="../../../boost_asio.html" title="Boost.Asio">
8<link rel="up" href="../read_until.html" title="read_until">
9<link rel="prev" href="overload7.html" title="read_until (7 of 24 overloads)">
10<link rel="next" href="overload9.html" title="read_until (9 of 24 overloads)">
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="overload7.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../read_until.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="overload9.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="boost_asio.reference.read_until.overload8"></a><a class="link" href="overload8.html" title="read_until (8 of 24 overloads)">read_until
28        (8 of 24 overloads)</a>
29</h4></div></div></div>
30<p>
31          Read data into a dynamic buffer sequence until a function object indicates
32          a match.
33        </p>
34<pre class="programlisting">template&lt;
35    typename <a class="link" href="../SyncReadStream.html" title="Buffer-oriented synchronous read stream requirements">SyncReadStream</a>,
36    typename <a class="link" href="../DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">DynamicBuffer_v1</a>,
37    typename MatchCondition&gt;
38std::size_t read_until(
39    SyncReadStream &amp; s,
40    DynamicBuffer_v1 &amp;&amp; buffers,
41    MatchCondition match_condition,
42    boost::system::error_code &amp; ec,
43    typename enable_if&lt; is_match_condition&lt; MatchCondition &gt;::value &amp;&amp;is_dynamic_buffer_v1&lt; typename decay&lt; DynamicBuffer_v1 &gt;::type &gt;::value &amp;&amp;!is_dynamic_buffer_v2&lt; typename decay&lt; DynamicBuffer_v1 &gt;::type &gt;::value &gt;::type *  = 0);
44</pre>
45<p>
46          This function is used to read data into the specified dynamic buffer sequence
47          until a user-defined match condition function object, when applied to the
48          data contained in the dynamic buffer sequence, indicates a successful match.
49          The call will block until one of the following conditions is true:
50        </p>
51<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
52<li class="listitem">
53              The match condition function object returns a std::pair where the second
54              element evaluates to true.
55            </li>
56<li class="listitem">
57              An error occurred.
58            </li>
59</ul></div>
60<p>
61          This operation is implemented in terms of zero or more calls to the stream's
62          read_some function. If the match condition function object already indicates
63          a match, the function returns immediately.
64        </p>
65<h6>
66<a name="boost_asio.reference.read_until.overload8.h0"></a>
67          <span class="phrase"><a name="boost_asio.reference.read_until.overload8.parameters"></a></span><a class="link" href="overload8.html#boost_asio.reference.read_until.overload8.parameters">Parameters</a>
68        </h6>
69<div class="variablelist">
70<p class="title"><b></b></p>
71<dl class="variablelist">
72<dt><span class="term">s</span></dt>
73<dd><p>
74                The stream from which the data is to be read. The type must support
75                the SyncReadStream concept.
76              </p></dd>
77<dt><span class="term">buffers</span></dt>
78<dd><p>
79                A dynamic buffer sequence into which the data will be read.
80              </p></dd>
81<dt><span class="term">match_condition</span></dt>
82<dd>
83<p>
84                The function object to be called to determine whether a match exists.
85                The signature of the function object must be:
86</p>
87<pre class="programlisting">pair&lt;iterator, bool&gt; match_condition(iterator begin, iterator end);
88</pre>
89<p>
90                where <code class="computeroutput">iterator</code> represents the type:
91</p>
92<pre class="programlisting">buffers_iterator&lt;DynamicBuffer_v1::const_buffers_type&gt;
93</pre>
94<p>
95                The iterator parameters <code class="computeroutput">begin</code> and <code class="computeroutput">end</code> define
96                the range of bytes to be scanned to determine whether there is a
97                match. The <code class="computeroutput">first</code> member of the return value is an iterator
98                marking one-past-the-end of the bytes that have been consumed by
99                the match function. This iterator is used to calculate the <code class="computeroutput">begin</code>
100                parameter for any subsequent invocation of the match condition. The
101                <code class="computeroutput">second</code> member of the return value is true if a match
102                has been found, false otherwise.
103              </p>
104</dd>
105<dt><span class="term">ec</span></dt>
106<dd><p>
107                Set to indicate what error occurred, if any.
108              </p></dd>
109</dl>
110</div>
111<h6>
112<a name="boost_asio.reference.read_until.overload8.h1"></a>
113          <span class="phrase"><a name="boost_asio.reference.read_until.overload8.return_value"></a></span><a class="link" href="overload8.html#boost_asio.reference.read_until.overload8.return_value">Return
114          Value</a>
115        </h6>
116<p>
117          The number of bytes in the dynamic buffer sequence's get area that have
118          been fully consumed by the match function. Returns 0 if an error occurred.
119        </p>
120<h6>
121<a name="boost_asio.reference.read_until.overload8.h2"></a>
122          <span class="phrase"><a name="boost_asio.reference.read_until.overload8.remarks"></a></span><a class="link" href="overload8.html#boost_asio.reference.read_until.overload8.remarks">Remarks</a>
123        </h6>
124<p>
125          After a successful read_until operation, the dynamic buffer sequence may
126          contain additional data beyond that which matched the function object.
127          An application will typically leave that data in the dynamic buffer sequence
128          for a subsequent read_until operation to examine.
129        </p>
130<p>
131          The default implementation of the <code class="computeroutput">is_match_condition</code> type
132          trait evaluates to true for function pointers and function objects with
133          a <code class="computeroutput">result_type</code> typedef. It must be specialised for other user-defined
134          function objects.
135        </p>
136</div>
137<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
138<td align="left"></td>
139<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
140      Kohlhoff<p>
141        Distributed under the Boost Software License, Version 1.0. (See accompanying
142        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>)
143      </p>
144</div></td>
145</tr></table>
146<hr>
147<div class="spirit-nav">
148<a accesskey="p" href="overload7.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../read_until.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="overload9.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
149</div>
150</body>
151</html>
152