diff options
Diffstat (limited to '3rdParty/Boost/src/boost/asio/read.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/read.hpp | 92 |
1 files changed, 87 insertions, 5 deletions
diff --git a/3rdParty/Boost/src/boost/asio/read.hpp b/3rdParty/Boost/src/boost/asio/read.hpp index fd13e75..937dccd 100644 --- a/3rdParty/Boost/src/boost/asio/read.hpp +++ b/3rdParty/Boost/src/boost/asio/read.hpp @@ -2,7 +2,7 @@ // read.hpp // ~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 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) @@ -80,6 +80,46 @@ std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers); * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the stream's + * read_some function. + * + * @param s The stream from which the data is to be read. The type must support + * the SyncReadStream concept. + * + * @param buffers One or more buffers into which the data will be read. The sum + * of the buffer sizes indicates the maximum number of bytes to read from the + * stream. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @par Example + * To read into a single data buffer use the @ref buffer function as follows: + * @code boost::asio::read(s, boost::asio::buffer(data, size), ec); @endcode + * 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. + * + * @note This overload is equivalent to calling: + * @code boost::asio::read( + * s, buffers, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncReadStream, typename MutableBufferSequence> +std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, + boost::system::error_code& ec); + +/// Attempt to read a certain amount of data from a stream before returning. +/** + * This function is used to read a certain number of bytes of data from a + * stream. The call will block 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. + * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's @@ -174,6 +214,8 @@ std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * + * @li The supplied buffer is full (that is, it has reached maximum size). + * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's @@ -201,6 +243,38 @@ std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b); * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * + * @li The supplied buffer is full (that is, it has reached maximum size). + * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the stream's + * read_some function. + * + * @param s The stream from which the data is to be read. The type must support + * the SyncReadStream concept. + * + * @param b The basic_streambuf object into which the data will be read. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @note This overload is equivalent to calling: + * @code boost::asio::read( + * s, b, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncReadStream, typename Allocator> +std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b, + boost::system::error_code& ec); + +/// Attempt to read a certain amount of data from a stream before returning. +/** + * This function is used to read a certain number of bytes of data from a + * stream. The call will block until one of the following conditions is true: + * + * @li The supplied buffer is full (that is, it has reached maximum size). + * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's @@ -239,6 +313,8 @@ std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b, * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * + * @li The supplied buffer is full (that is, it has reached maximum size). + * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's @@ -347,7 +423,7 @@ std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b, template <typename AsyncReadStream, typename MutableBufferSequence, typename ReadHandler> void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, - ReadHandler handler); + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); /// Start an asynchronous operation to read a certain amount of data from a /// stream. @@ -415,7 +491,8 @@ void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, template <typename AsyncReadStream, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, ReadHandler handler); + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); #if !defined(BOOST_NO_IOSTREAM) @@ -427,6 +504,8 @@ void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, * 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). + * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's @@ -467,7 +546,7 @@ void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, */ template <typename AsyncReadStream, typename Allocator, typename ReadHandler> void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, - ReadHandler handler); + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); /// Start an asynchronous operation to read a certain amount of data from a /// stream. @@ -477,6 +556,8 @@ void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, * 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). + * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's @@ -526,7 +607,8 @@ void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, template <typename AsyncReadStream, typename Allocator, typename CompletionCondition, typename ReadHandler> void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, ReadHandler handler); + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); #endif // !defined(BOOST_NO_IOSTREAM) |