update boost

This commit is contained in:
2023-11-24 12:56:13 -06:00
parent cfc99971af
commit 19d727037a
9260 changed files with 849256 additions and 299957 deletions

View File

@@ -2,7 +2,7 @@
// read.hpp
// ~~~~~~~~
//
// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -19,6 +19,7 @@
#include <cstddef>
#include <boost/asio/async_result.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/asio/completion_condition.hpp>
#include <boost/asio/error.hpp>
#if !defined(BOOST_ASIO_NO_EXTENSIONS)
@@ -29,6 +30,15 @@
namespace boost {
namespace asio {
namespace detail {
template <typename> class initiate_async_read;
#if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1)
template <typename> class initiate_async_read_dynbuf_v1;
#endif // !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1)
template <typename> class initiate_async_read_dynbuf_v2;
} // namespace detail
/**
* @defgroup read boost::asio::read
@@ -76,9 +86,9 @@ namespace asio {
*/
template <typename SyncReadStream, typename MutableBufferSequence>
std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
typename enable_if<
typename constraint<
is_mutable_buffer_sequence<MutableBufferSequence>::value
>::type* = 0);
>::type = 0);
/// Attempt to read a certain amount of data from a stream before returning.
/**
@@ -119,9 +129,9 @@ std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
template <typename SyncReadStream, typename MutableBufferSequence>
std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
boost::system::error_code& ec,
typename enable_if<
typename constraint<
is_mutable_buffer_sequence<MutableBufferSequence>::value
>::type* = 0);
>::type = 0);
/// Attempt to read a certain amount of data from a stream before returning.
/**
@@ -173,9 +183,9 @@ template <typename SyncReadStream, typename MutableBufferSequence,
typename CompletionCondition>
std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
CompletionCondition completion_condition,
typename enable_if<
typename constraint<
is_mutable_buffer_sequence<MutableBufferSequence>::value
>::type* = 0);
>::type = 0);
/// Attempt to read a certain amount of data from a stream before returning.
/**
@@ -220,9 +230,9 @@ template <typename SyncReadStream, typename MutableBufferSequence,
typename CompletionCondition>
std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
CompletionCondition completion_condition, boost::system::error_code& ec,
typename enable_if<
typename constraint<
is_mutable_buffer_sequence<MutableBufferSequence>::value
>::type* = 0);
>::type = 0);
#if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1)
@@ -256,10 +266,12 @@ std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
template <typename SyncReadStream, typename DynamicBuffer_v1>
std::size_t read(SyncReadStream& s,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
typename enable_if<
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type* = 0);
>::type = 0,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0);
/// Attempt to read a certain amount of data from a stream before returning.
/**
@@ -291,10 +303,12 @@ template <typename SyncReadStream, typename DynamicBuffer_v1>
std::size_t read(SyncReadStream& s,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
boost::system::error_code& ec,
typename enable_if<
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type* = 0);
>::type = 0,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0);
/// Attempt to read a certain amount of data from a stream before returning.
/**
@@ -337,10 +351,12 @@ template <typename SyncReadStream, typename DynamicBuffer_v1,
std::size_t read(SyncReadStream& s,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
CompletionCondition completion_condition,
typename enable_if<
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type* = 0);
>::type = 0,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0);
/// Attempt to read a certain amount of data from a stream before returning.
/**
@@ -384,10 +400,12 @@ template <typename SyncReadStream, typename DynamicBuffer_v1,
std::size_t read(SyncReadStream& s,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
CompletionCondition completion_condition, boost::system::error_code& ec,
typename enable_if<
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type* = 0);
>::type = 0,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0);
#if !defined(BOOST_ASIO_NO_EXTENSIONS)
#if !defined(BOOST_ASIO_NO_IOSTREAM)
@@ -565,9 +583,9 @@ std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b,
*/
template <typename SyncReadStream, typename DynamicBuffer_v2>
std::size_t read(SyncReadStream& s, DynamicBuffer_v2 buffers,
typename enable_if<
typename constraint<
is_dynamic_buffer_v2<DynamicBuffer_v2>::value
>::type* = 0);
>::type = 0);
/// Attempt to read a certain amount of data from a stream before returning.
/**
@@ -598,9 +616,9 @@ std::size_t read(SyncReadStream& s, DynamicBuffer_v2 buffers,
template <typename SyncReadStream, typename DynamicBuffer_v2>
std::size_t read(SyncReadStream& s, DynamicBuffer_v2 buffers,
boost::system::error_code& ec,
typename enable_if<
typename constraint<
is_dynamic_buffer_v2<DynamicBuffer_v2>::value
>::type* = 0);
>::type = 0);
/// Attempt to read a certain amount of data from a stream before returning.
/**
@@ -642,9 +660,9 @@ template <typename SyncReadStream, typename DynamicBuffer_v2,
typename CompletionCondition>
std::size_t read(SyncReadStream& s, DynamicBuffer_v2 buffers,
CompletionCondition completion_condition,
typename enable_if<
typename constraint<
is_dynamic_buffer_v2<DynamicBuffer_v2>::value
>::type* = 0);
>::type = 0);
/// Attempt to read a certain amount of data from a stream before returning.
/**
@@ -687,9 +705,9 @@ template <typename SyncReadStream, typename DynamicBuffer_v2,
typename CompletionCondition>
std::size_t read(SyncReadStream& s, DynamicBuffer_v2 buffers,
CompletionCondition completion_condition, boost::system::error_code& ec,
typename enable_if<
typename constraint<
is_dynamic_buffer_v2<DynamicBuffer_v2>::value
>::type* = 0);
>::type = 0);
/*@}*/
/**
@@ -704,9 +722,9 @@ std::size_t read(SyncReadStream& s, DynamicBuffer_v2 buffers,
/// stream.
/**
* This function is used to asynchronously read a certain number of bytes of
* data from a stream. The function call always returns immediately. The
* asynchronous operation will continue until one of the following conditions is
* true:
* data from a stream. It is an initiating function for an @ref
* asynchronous_operation, and always returns immediately. The asynchronous
* operation will continue until one of the following conditions is true:
*
* @li The supplied buffers are full. That is, the bytes transferred is equal to
* the sum of the buffer sizes.
@@ -726,25 +744,30 @@ std::size_t read(SyncReadStream& s, DynamicBuffer_v2 buffers,
* of the buffer sizes indicates the maximum number of bytes to read from the
* stream. Although the buffers object may be copied as necessary, ownership of
* the underlying memory blocks is retained by the caller, which must guarantee
* that they remain valid until the handler is called.
* that they remain valid until the completion handler is called.
*
* @param handler The handler to be called when the read operation completes.
* Copies will be made of the handler as required. The function signature of the
* handler must be:
* @param token The @ref completion_token that will be used to produce a
* completion handler, which will be called when the read completes.
* Potential completion tokens include @ref use_future, @ref use_awaitable,
* @ref yield_context, or a function object with the correct completion
* signature. The function signature of the completion handler must be:
* @code void handler(
* const boost::system::error_code& error, // Result of operation.
* // Result of operation.
* const boost::system::error_code& error,
*
* std::size_t bytes_transferred // Number of bytes copied into the
* // buffers. If an error occurred,
* // this will be the number of
* // bytes successfully transferred
* // prior to the error.
* // Number of bytes copied into the buffers. If an error
* // occurred, this will be the number of bytes successfully
* // transferred prior to the error.
* std::size_t bytes_transferred
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. On
* immediate completion, invocation of the handler will be performed in a
* not, the completion handler will not be invoked from within this function.
* On immediate completion, invocation of the handler will be performed in a
* manner equivalent to using boost::asio::post().
*
* @par Completion Signature
* @code void(boost::system::error_code, std::size_t) @endcode
*
* @par Example
* To read into a single data buffer use the @ref buffer function as follows:
* @code
@@ -759,24 +782,45 @@ std::size_t read(SyncReadStream& s, DynamicBuffer_v2 buffers,
* s, buffers,
* boost::asio::transfer_all(),
* handler); @endcode
*
* @par Per-Operation Cancellation
* This asynchronous operation supports cancellation for the following
* boost::asio::cancellation_type values:
*
* @li @c cancellation_type::terminal
*
* @li @c cancellation_type::partial
*
* if they are also supported by the @c AsyncReadStream type's
* @c async_read_some operation.
*/
template <typename AsyncReadStream, typename MutableBufferSequence,
typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadToken
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
typename AsyncReadStream::executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken,
void (boost::system::error_code, std::size_t))
async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
typename enable_if<
BOOST_ASIO_MOVE_ARG(ReadToken) token
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(
typename AsyncReadStream::executor_type),
typename constraint<
is_mutable_buffer_sequence<MutableBufferSequence>::value
>::type* = 0);
>::type = 0)
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
async_initiate<ReadToken,
void (boost::system::error_code, std::size_t)>(
declval<detail::initiate_async_read<AsyncReadStream> >(),
token, buffers, transfer_all())));
/// Start an asynchronous operation to read a certain amount of data from a
/// stream.
/**
* This function is used to asynchronously read a certain number of bytes of
* data from a stream. The function call always returns immediately. The
* asynchronous operation will continue until one of the following conditions is
* true:
* data from a stream. It is an initiating function for an @ref
* asynchronous_operation, and always returns immediately. The asynchronous
* operation will continue until one of the following conditions is true:
*
* @li The supplied buffers are full. That is, the bytes transferred is equal to
* the sum of the buffer sizes.
@@ -790,7 +834,7 @@ async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
* of the buffer sizes indicates the maximum number of bytes to read from the
* stream. Although the buffers object may be copied as necessary, ownership of
* the underlying memory blocks is retained by the caller, which must guarantee
* that they remain valid until the handler is called.
* that they remain valid until the completion handler is called.
*
* @param completion_condition The function object to be called to determine
* whether the read operation is complete. The signature of the function object
@@ -806,23 +850,28 @@ async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
* return value indicates the maximum number of bytes to be read on the next
* call to the stream's async_read_some function.
*
* @param handler The handler to be called when the read operation completes.
* Copies will be made of the handler as required. The function signature of the
* handler must be:
* @param token The @ref completion_token that will be used to produce a
* completion handler, which will be called when the read completes.
* Potential completion tokens include @ref use_future, @ref use_awaitable,
* @ref yield_context, or a function object with the correct completion
* signature. The function signature of the completion handler must be:
* @code void handler(
* const boost::system::error_code& error, // Result of operation.
* // Result of operation.
* const boost::system::error_code& error,
*
* std::size_t bytes_transferred // Number of bytes copied into the
* // buffers. If an error occurred,
* // this will be the number of
* // bytes successfully transferred
* // prior to the error.
* // Number of bytes copied into the buffers. If an error
* // occurred, this will be the number of bytes successfully
* // transferred prior to the error.
* std::size_t bytes_transferred
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. On
* immediate completion, invocation of the handler will be performed in a
* not, the completion handler will not be invoked from within this function.
* On immediate completion, invocation of the handler will be performed in a
* manner equivalent to using boost::asio::post().
*
* @par Completion Signature
* @code void(boost::system::error_code, std::size_t) @endcode
*
* @par Example
* To read into a single data buffer use the @ref buffer function as follows:
* @code boost::asio::async_read(s,
@@ -832,17 +881,40 @@ async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
* See the @ref buffer documentation for information on reading into multiple
* buffers in one go, and how to use it with arrays, boost::array or
* std::vector.
*
* @par Per-Operation Cancellation
* This asynchronous operation supports cancellation for the following
* boost::asio::cancellation_type values:
*
* @li @c cancellation_type::terminal
*
* @li @c cancellation_type::partial
*
* if they are also supported by the @c AsyncReadStream type's
* @c async_read_some operation.
*/
template <typename AsyncReadStream, typename MutableBufferSequence,
typename CompletionCondition, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream,
typename MutableBufferSequence, typename CompletionCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadToken
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
typename AsyncReadStream::executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken,
void (boost::system::error_code, std::size_t))
async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
CompletionCondition completion_condition,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
typename enable_if<
BOOST_ASIO_MOVE_ARG(ReadToken) token
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(
typename AsyncReadStream::executor_type),
typename constraint<
is_mutable_buffer_sequence<MutableBufferSequence>::value
>::type* = 0);
>::type = 0)
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
async_initiate<ReadToken,
void (boost::system::error_code, std::size_t)>(
declval<detail::initiate_async_read<AsyncReadStream> >(),
token, buffers,
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition))));
#if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1)
@@ -850,9 +922,9 @@ async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
/// stream.
/**
* This function is used to asynchronously read a certain number of bytes of
* data from a stream. The function call always returns immediately. The
* asynchronous operation will continue until one of the following conditions is
* true:
* data from a stream. It is an initiating function for an @ref
* asynchronous_operation, and always returns immediately. The asynchronous
* operation will continue until one of the following conditions is true:
*
* @li The specified dynamic buffer sequence is full (that is, it has reached
* maximum size).
@@ -871,50 +943,79 @@ async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
* @param buffers The dynamic buffer sequence into which the data will be read.
* Although the buffers object may be copied as necessary, ownership of the
* underlying memory blocks is retained by the caller, which must guarantee
* that they remain valid until the handler is called.
* that they remain valid until the completion handler is called.
*
* @param handler The handler to be called when the read operation completes.
* Copies will be made of the handler as required. The function signature of the
* handler must be:
* @param token The @ref completion_token that will be used to produce a
* completion handler, which will be called when the read completes.
* Potential completion tokens include @ref use_future, @ref use_awaitable,
* @ref yield_context, or a function object with the correct completion
* signature. The function signature of the completion handler must be:
* @code void handler(
* const boost::system::error_code& error, // Result of operation.
* // Result of operation.
* const boost::system::error_code& error,
*
* std::size_t bytes_transferred // Number of bytes copied into the
* // buffers. If an error occurred,
* // this will be the number of
* // bytes successfully transferred
* // prior to the error.
* // Number of bytes copied into the buffers. If an error
* // occurred, this will be the number of bytes successfully
* // transferred prior to the error.
* std::size_t bytes_transferred
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. On
* immediate completion, invocation of the handler will be performed in a
* not, the completion handler will not be invoked from within this function.
* On immediate completion, invocation of the handler will be performed in a
* manner equivalent to using boost::asio::post().
*
* @par Completion Signature
* @code void(boost::system::error_code, std::size_t) @endcode
*
* @note This overload is equivalent to calling:
* @code boost::asio::async_read(
* s, buffers,
* boost::asio::transfer_all(),
* handler); @endcode
*
* @par Per-Operation Cancellation
* This asynchronous operation supports cancellation for the following
* boost::asio::cancellation_type values:
*
* @li @c cancellation_type::terminal
*
* @li @c cancellation_type::partial
*
* if they are also supported by the @c AsyncReadStream type's
* @c async_read_some operation.
*/
template <typename AsyncReadStream,
typename DynamicBuffer_v1, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream, typename DynamicBuffer_v1,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadToken
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
typename AsyncReadStream::executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken,
void (boost::system::error_code, std::size_t))
async_read(AsyncReadStream& s,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
typename enable_if<
BOOST_ASIO_MOVE_ARG(ReadToken) token
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(
typename AsyncReadStream::executor_type),
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type* = 0);
>::type = 0,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0)
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
async_initiate<ReadToken,
void (boost::system::error_code, std::size_t)>(
declval<detail::initiate_async_read_dynbuf_v1<AsyncReadStream> >(),
token, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
transfer_all())));
/// Start an asynchronous operation to read a certain amount of data from a
/// stream.
/**
* This function is used to asynchronously read a certain number of bytes of
* data from a stream. The function call always returns immediately. The
* asynchronous operation will continue until one of the following conditions is
* true:
* data from a stream. It is an initiating function for an @ref
* asynchronous_operation, and always returns immediately. The asynchronous
* operation will continue until one of the following conditions is true:
*
* @li The specified dynamic buffer sequence is full (that is, it has reached
* maximum size).
@@ -933,7 +1034,7 @@ async_read(AsyncReadStream& s,
* @param buffers The dynamic buffer sequence into which the data will be read.
* Although the buffers object may be copied as necessary, ownership of the
* underlying memory blocks is retained by the caller, which must guarantee
* that they remain valid until the handler is called.
* that they remain valid until the completion handler is called.
*
* @param completion_condition The function object to be called to determine
* whether the read operation is complete. The signature of the function object
@@ -949,35 +1050,65 @@ async_read(AsyncReadStream& s,
* return value indicates the maximum number of bytes to be read on the next
* call to the stream's async_read_some function.
*
* @param handler The handler to be called when the read operation completes.
* Copies will be made of the handler as required. The function signature of the
* handler must be:
* @param token The @ref completion_token that will be used to produce a
* completion handler, which will be called when the read completes.
* Potential completion tokens include @ref use_future, @ref use_awaitable,
* @ref yield_context, or a function object with the correct completion
* signature. The function signature of the completion handler must be:
* @code void handler(
* const boost::system::error_code& error, // Result of operation.
* // Result of operation.
* const boost::system::error_code& error,
*
* std::size_t bytes_transferred // Number of bytes copied into the
* // buffers. If an error occurred,
* // this will be the number of
* // bytes successfully transferred
* // prior to the error.
* // Number of bytes copied into the buffers. If an error
* // occurred, this will be the number of bytes successfully
* // transferred prior to the error.
* std::size_t bytes_transferred
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. On
* immediate completion, invocation of the handler will be performed in a
* not, the completion handler will not be invoked from within this function.
* On immediate completion, invocation of the handler will be performed in a
* manner equivalent to using boost::asio::post().
*
* @par Completion Signature
* @code void(boost::system::error_code, std::size_t) @endcode
*
* @par Per-Operation Cancellation
* This asynchronous operation supports cancellation for the following
* boost::asio::cancellation_type values:
*
* @li @c cancellation_type::terminal
*
* @li @c cancellation_type::partial
*
* if they are also supported by the @c AsyncReadStream type's
* @c async_read_some operation.
*/
template <typename AsyncReadStream, typename DynamicBuffer_v1,
typename CompletionCondition, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream,
typename DynamicBuffer_v1, typename CompletionCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadToken
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
typename AsyncReadStream::executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken,
void (boost::system::error_code, std::size_t))
async_read(AsyncReadStream& s,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
CompletionCondition completion_condition,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
typename enable_if<
BOOST_ASIO_MOVE_ARG(ReadToken) token
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(
typename AsyncReadStream::executor_type),
typename constraint<
is_dynamic_buffer_v1<typename decay<DynamicBuffer_v1>::type>::value
&& !is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type* = 0);
>::type = 0,
typename constraint<
!is_dynamic_buffer_v2<typename decay<DynamicBuffer_v1>::type>::value
>::type = 0)
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
async_initiate<ReadToken,
void (boost::system::error_code, std::size_t)>(
declval<detail::initiate_async_read_dynbuf_v1<AsyncReadStream> >(),
token, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition))));
#if !defined(BOOST_ASIO_NO_EXTENSIONS)
#if !defined(BOOST_ASIO_NO_IOSTREAM)
@@ -986,9 +1117,9 @@ async_read(AsyncReadStream& s,
/// stream.
/**
* This function is used to asynchronously read a certain number of bytes of
* data from a stream. The function call always returns immediately. The
* asynchronous operation will continue until one of the following conditions is
* true:
* data from a stream. It is an initiating function for an @ref
* asynchronous_operation, and always returns immediately. The asynchronous
* operation will continue until one of the following conditions is true:
*
* @li The supplied buffer is full (that is, it has reached maximum size).
*
@@ -1005,44 +1136,69 @@ async_read(AsyncReadStream& s,
*
* @param b A basic_streambuf object into which the data will be read. Ownership
* of the streambuf is retained by the caller, which must guarantee that it
* remains valid until the handler is called.
* remains valid until the completion handler is called.
*
* @param handler The handler to be called when the read operation completes.
* Copies will be made of the handler as required. The function signature of the
* handler must be:
* @param token The @ref completion_token that will be used to produce a
* completion handler, which will be called when the read completes.
* Potential completion tokens include @ref use_future, @ref use_awaitable,
* @ref yield_context, or a function object with the correct completion
* signature. The function signature of the completion handler must be:
* @code void handler(
* const boost::system::error_code& error, // Result of operation.
* // Result of operation.
* const boost::system::error_code& error,
*
* std::size_t bytes_transferred // Number of bytes copied into the
* // buffers. If an error occurred,
* // this will be the number of
* // bytes successfully transferred
* // prior to the error.
* // Number of bytes copied into the buffers. If an error
* // occurred, this will be the number of bytes successfully
* // transferred prior to the error.
* std::size_t bytes_transferred
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. On
* immediate completion, invocation of the handler will be performed in a
* not, the completion handler will not be invoked from within this function.
* On immediate completion, invocation of the handler will be performed in a
* manner equivalent to using boost::asio::post().
*
* @par Completion Signature
* @code void(boost::system::error_code, std::size_t) @endcode
*
* @note This overload is equivalent to calling:
* @code boost::asio::async_read(
* s, b,
* boost::asio::transfer_all(),
* handler); @endcode
*
* @par Per-Operation Cancellation
* This asynchronous operation supports cancellation for the following
* boost::asio::cancellation_type values:
*
* @li @c cancellation_type::terminal
*
* @li @c cancellation_type::partial
*
* if they are also supported by the @c AsyncReadStream type's
* @c async_read_some operation.
*/
template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream, typename Allocator,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadToken
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
typename AsyncReadStream::executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken,
void (boost::system::error_code, std::size_t))
async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
BOOST_ASIO_MOVE_ARG(ReadToken) token
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(
typename AsyncReadStream::executor_type))
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
async_read(s, basic_streambuf_ref<Allocator>(b),
BOOST_ASIO_MOVE_CAST(ReadToken)(token))));
/// Start an asynchronous operation to read a certain amount of data from a
/// stream.
/**
* This function is used to asynchronously read a certain number of bytes of
* data from a stream. The function call always returns immediately. The
* asynchronous operation will continue until one of the following conditions is
* true:
* data from a stream. It is an initiating function for an @ref
* asynchronous_operation, and always returns immediately. The asynchronous
* operation will continue until one of the following conditions is true:
*
* @li The supplied buffer is full (that is, it has reached maximum size).
*
@@ -1059,7 +1215,7 @@ async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
*
* @param b A basic_streambuf object into which the data will be read. Ownership
* of the streambuf is retained by the caller, which must guarantee that it
* remains valid until the handler is called.
* remains valid until the completion handler is called.
*
* @param completion_condition The function object to be called to determine
* whether the read operation is complete. The signature of the function object
@@ -1075,30 +1231,56 @@ async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
* return value indicates the maximum number of bytes to be read on the next
* call to the stream's async_read_some function.
*
* @param handler The handler to be called when the read operation completes.
* Copies will be made of the handler as required. The function signature of the
* handler must be:
* @param token The @ref completion_token that will be used to produce a
* completion handler, which will be called when the read completes.
* Potential completion tokens include @ref use_future, @ref use_awaitable,
* @ref yield_context, or a function object with the correct completion
* signature. The function signature of the completion handler must be:
* @code void handler(
* const boost::system::error_code& error, // Result of operation.
* // Result of operation.
* const boost::system::error_code& error,
*
* std::size_t bytes_transferred // Number of bytes copied into the
* // buffers. If an error occurred,
* // this will be the number of
* // bytes successfully transferred
* // prior to the error.
* // Number of bytes copied into the buffers. If an error
* // occurred, this will be the number of bytes successfully
* // transferred prior to the error.
* std::size_t bytes_transferred
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. On
* immediate completion, invocation of the handler will be performed in a
* not, the completion handler will not be invoked from within this function.
* On immediate completion, invocation of the handler will be performed in a
* manner equivalent to using boost::asio::post().
*
* @par Completion Signature
* @code void(boost::system::error_code, std::size_t) @endcode
*
* @par Per-Operation Cancellation
* This asynchronous operation supports cancellation for the following
* boost::asio::cancellation_type values:
*
* @li @c cancellation_type::terminal
*
* @li @c cancellation_type::partial
*
* if they are also supported by the @c AsyncReadStream type's
* @c async_read_some operation.
*/
template <typename AsyncReadStream, typename Allocator,
typename CompletionCondition, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream,
typename Allocator, typename CompletionCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadToken
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
typename AsyncReadStream::executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken,
void (boost::system::error_code, std::size_t))
async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
CompletionCondition completion_condition,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler);
BOOST_ASIO_MOVE_ARG(ReadToken) token
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(
typename AsyncReadStream::executor_type))
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
async_read(s, basic_streambuf_ref<Allocator>(b),
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition),
BOOST_ASIO_MOVE_CAST(ReadToken)(token))));
#endif // !defined(BOOST_ASIO_NO_IOSTREAM)
#endif // !defined(BOOST_ASIO_NO_EXTENSIONS)
@@ -1108,9 +1290,9 @@ async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
/// stream.
/**
* This function is used to asynchronously read a certain number of bytes of
* data from a stream. The function call always returns immediately. The
* asynchronous operation will continue until one of the following conditions is
* true:
* data from a stream. It is an initiating function for an @ref
* asynchronous_operation, and always returns immediately. The asynchronous
* operation will continue until one of the following conditions is true:
*
* @li The specified dynamic buffer sequence is full (that is, it has reached
* maximum size).
@@ -1129,48 +1311,75 @@ async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b,
* @param buffers The dynamic buffer sequence into which the data will be read.
* Although the buffers object may be copied as necessary, ownership of the
* underlying memory blocks is retained by the caller, which must guarantee
* that they remain valid until the handler is called.
* that they remain valid until the completion handler is called.
*
* @param handler The handler to be called when the read operation completes.
* Copies will be made of the handler as required. The function signature of the
* handler must be:
* @param token The @ref completion_token that will be used to produce a
* completion handler, which will be called when the read completes.
* Potential completion tokens include @ref use_future, @ref use_awaitable,
* @ref yield_context, or a function object with the correct completion
* signature. The function signature of the completion handler must be:
* @code void handler(
* const boost::system::error_code& error, // Result of operation.
* // Result of operation.
* const boost::system::error_code& error,
*
* std::size_t bytes_transferred // Number of bytes copied into the
* // buffers. If an error occurred,
* // this will be the number of
* // bytes successfully transferred
* // prior to the error.
* // Number of bytes copied into the buffers. If an error
* // occurred, this will be the number of bytes successfully
* // transferred prior to the error.
* std::size_t bytes_transferred
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. On
* immediate completion, invocation of the handler will be performed in a
* not, the completion handler will not be invoked from within this function.
* On immediate completion, invocation of the handler will be performed in a
* manner equivalent to using boost::asio::post().
*
* @par Completion Signature
* @code void(boost::system::error_code, std::size_t) @endcode
*
* @note This overload is equivalent to calling:
* @code boost::asio::async_read(
* s, buffers,
* boost::asio::transfer_all(),
* handler); @endcode
*
* @par Per-Operation Cancellation
* This asynchronous operation supports cancellation for the following
* boost::asio::cancellation_type values:
*
* @li @c cancellation_type::terminal
*
* @li @c cancellation_type::partial
*
* if they are also supported by the @c AsyncReadStream type's
* @c async_read_some operation.
*/
template <typename AsyncReadStream,
typename DynamicBuffer_v2, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream, typename DynamicBuffer_v2,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadToken
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
typename AsyncReadStream::executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken,
void (boost::system::error_code, std::size_t))
async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
typename enable_if<
BOOST_ASIO_MOVE_ARG(ReadToken) token
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(
typename AsyncReadStream::executor_type),
typename constraint<
is_dynamic_buffer_v2<DynamicBuffer_v2>::value
>::type* = 0);
>::type = 0)
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
async_initiate<ReadToken,
void (boost::system::error_code, std::size_t)>(
declval<detail::initiate_async_read_dynbuf_v2<AsyncReadStream> >(),
token, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
transfer_all())));
/// Start an asynchronous operation to read a certain amount of data from a
/// stream.
/**
* This function is used to asynchronously read a certain number of bytes of
* data from a stream. The function call always returns immediately. The
* asynchronous operation will continue until one of the following conditions is
* true:
* data from a stream. It is an initiating function for an @ref
* asynchronous_operation, and always returns immediately. The asynchronous
* operation will continue until one of the following conditions is true:
*
* @li The specified dynamic buffer sequence is full (that is, it has reached
* maximum size).
@@ -1189,7 +1398,7 @@ async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers,
* @param buffers The dynamic buffer sequence into which the data will be read.
* Although the buffers object may be copied as necessary, ownership of the
* underlying memory blocks is retained by the caller, which must guarantee
* that they remain valid until the handler is called.
* that they remain valid until the completion handler is called.
*
* @param completion_condition The function object to be called to determine
* whether the read operation is complete. The signature of the function object
@@ -1205,33 +1414,61 @@ async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers,
* return value indicates the maximum number of bytes to be read on the next
* call to the stream's async_read_some function.
*
* @param handler The handler to be called when the read operation completes.
* Copies will be made of the handler as required. The function signature of the
* handler must be:
* @param token The @ref completion_token that will be used to produce a
* completion handler, which will be called when the read completes.
* Potential completion tokens include @ref use_future, @ref use_awaitable,
* @ref yield_context, or a function object with the correct completion
* signature. The function signature of the completion handler must be:
* @code void handler(
* const boost::system::error_code& error, // Result of operation.
* // Result of operation.
* const boost::system::error_code& error,
*
* std::size_t bytes_transferred // Number of bytes copied into the
* // buffers. If an error occurred,
* // this will be the number of
* // bytes successfully transferred
* // prior to the error.
* // Number of bytes copied into the buffers. If an error
* // occurred, this will be the number of bytes successfully
* // transferred prior to the error.
* std::size_t bytes_transferred
* ); @endcode
* Regardless of whether the asynchronous operation completes immediately or
* not, the handler will not be invoked from within this function. On
* immediate completion, invocation of the handler will be performed in a
* not, the completion handler will not be invoked from within this function.
* On immediate completion, invocation of the handler will be performed in a
* manner equivalent to using boost::asio::post().
*
* @par Completion Signature
* @code void(boost::system::error_code, std::size_t) @endcode
*
* @par Per-Operation Cancellation
* This asynchronous operation supports cancellation for the following
* boost::asio::cancellation_type values:
*
* @li @c cancellation_type::terminal
*
* @li @c cancellation_type::partial
*
* if they are also supported by the @c AsyncReadStream type's
* @c async_read_some operation.
*/
template <typename AsyncReadStream, typename DynamicBuffer_v2,
typename CompletionCondition, typename ReadHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler,
template <typename AsyncReadStream,
typename DynamicBuffer_v2, typename CompletionCondition,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
std::size_t)) ReadToken
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(
typename AsyncReadStream::executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken,
void (boost::system::error_code, std::size_t))
async_read(AsyncReadStream& s, DynamicBuffer_v2 buffers,
CompletionCondition completion_condition,
BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
typename enable_if<
BOOST_ASIO_MOVE_ARG(ReadToken) token
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(
typename AsyncReadStream::executor_type),
typename constraint<
is_dynamic_buffer_v2<DynamicBuffer_v2>::value
>::type* = 0);
>::type = 0)
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
async_initiate<ReadToken,
void (boost::system::error_code, std::size_t)>(
declval<detail::initiate_async_read_dynbuf_v2<AsyncReadStream> >(),
token, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition))));
/*@}*/