11 #ifndef ASIO_IMPL_BUFFERED_READ_STREAM_HPP 12 #define ASIO_IMPL_BUFFERED_READ_STREAM_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 27 template <
typename Stream>
31 resize_guard(storage_);
32 std::size_t previous_size = storage_.size();
33 storage_.resize(storage_.capacity());
34 storage_.resize(previous_size + next_layer_.read_some(
buffer(
35 storage_.data() + previous_size,
36 storage_.size() - previous_size)));
38 return storage_.size() - previous_size;
41 template <
typename Stream>
45 resize_guard(storage_);
46 std::size_t previous_size = storage_.size();
47 storage_.resize(storage_.capacity());
48 storage_.resize(previous_size + next_layer_.read_some(
buffer(
49 storage_.data() + previous_size,
50 storage_.size() - previous_size),
53 return storage_.size() - previous_size;
58 template <
typename ReadHandler>
63 std::size_t previous_size, ReadHandler& handler)
70 #if defined(ASIO_HAS_MOVE) 84 #endif // defined(ASIO_HAS_MOVE) 87 const std::size_t bytes_transferred)
99 template <
typename ReadHandler>
107 template <
typename ReadHandler>
112 pointer, size, this_handler->
handler_);
115 template <
typename ReadHandler>
123 template <
typename Function,
typename ReadHandler>
131 template <
typename Function,
typename ReadHandler>
140 template <
typename Stream>
141 template <
typename ReadHandler>
157 next_layer_.async_read_some(
168 template <
typename Stream>
169 template <
typename MutableBufferSequence>
171 const MutableBufferSequence&
buffers)
179 return this->copy(buffers);
182 template <
typename Stream>
183 template <
typename MutableBufferSequence>
195 return this->copy(buffers);
200 template <
typename MutableBufferSequence,
typename ReadHandler>
205 const MutableBufferSequence&
buffers, ReadHandler& handler)
212 #if defined(ASIO_HAS_MOVE) 226 #endif // defined(ASIO_HAS_MOVE) 232 const std::size_t length = 0;
250 template <
typename MutableBufferSequence,
typename ReadHandler>
253 MutableBufferSequence, ReadHandler>* this_handler)
256 size, this_handler->handler_);
259 template <
typename MutableBufferSequence,
typename ReadHandler>
262 MutableBufferSequence, ReadHandler>* this_handler)
265 pointer, size, this_handler->handler_);
268 template <
typename MutableBufferSequence,
typename ReadHandler>
271 MutableBufferSequence, ReadHandler>* this_handler)
274 this_handler->handler_);
277 template <
typename Function,
typename MutableBufferSequence,
278 typename ReadHandler>
281 MutableBufferSequence, ReadHandler>* this_handler)
284 function, this_handler->handler_);
287 template <
typename Function,
typename MutableBufferSequence,
288 typename ReadHandler>
291 MutableBufferSequence, ReadHandler>* this_handler)
294 function, this_handler->handler_);
298 template <
typename Stream>
299 template <
typename MutableBufferSequence,
typename ReadHandler>
303 const MutableBufferSequence&
buffers,
333 template <
typename Stream>
334 template <
typename MutableBufferSequence>
336 const MutableBufferSequence&
buffers)
340 return this->peek_copy(buffers);
343 template <
typename Stream>
344 template <
typename MutableBufferSequence>
351 return this->peek_copy(buffers);
358 #endif // ASIO_IMPL_BUFFERED_READ_STREAM_HPP void asio_handler_deallocate(void *pointer, std::size_t size, binder1< Handler, Arg1 > *this_handler)
void * asio_handler_allocate(std::size_t size, binder1< Handler, Arg1 > *this_handler)
asio::basic_streambuf< Allocator > MatchCondition enable_if< is_match_condition< MatchCondition >::value >::type *detail::async_result_init< ReadHandler, void(asio::error_code, std::size_t)> init(ASIO_MOVE_CAST(ReadHandler)(handler))
#define ASIO_HANDLER_TYPE(h, sig)
mutable_buffers_1 buffer(const mutable_buffer &b)
Create a new modifiable buffer from an existing buffer.
void resize(size_type length)
detail::buffered_stream_storage & storage_
MutableBufferSequence buffers_
ASIO_INITFN_RESULT_TYPE(ComposedConnectHandler, void(asio::error_code, Iterator)) async_connect(basic_socket< Protocol
std::size_t buffer_size(const mutable_buffer &b)
Get the number of bytes in a modifiable buffer.
void invoke(Function &function, Context &context)
void operator()(const asio::error_code &ec, std::size_t)
const MutableBufferSequence & buffers
#define ASIO_READ_HANDLER_CHECK(handler_type, handler)
void operator()(const asio::error_code &ec, const std::size_t bytes_transferred)
buffered_fill_handler(detail::buffered_stream_storage &storage, std::size_t previous_size, ReadHandler &handler)
buffered_read_some_handler(detail::buffered_stream_storage &storage, const MutableBufferSequence &buffers, ReadHandler &handler)
void asio_handler_invoke(Function &function, binder1< Handler, Arg1 > *this_handler)
std::size_t peek(const MutableBufferSequence &buffers)
Adds buffering to the read-related operations of a stream.
asio::basic_streambuf< Allocator > CompletionCondition ASIO_MOVE_ARG(ReadHandler) handler)
bool is_continuation(Context &context)
void consume(size_type count)
Class to represent an error code value.
void deallocate(void *p, std::size_t s, Handler &h)
size_type capacity() const
detail::buffered_stream_storage & storage_
void * allocate(std::size_t s, Handler &h)
handler_type< Handler, Signature >::type handler
std::size_t previous_size_
#define ASIO_MOVE_CAST(type)
std::size_t read_some(const MutableBufferSequence &buffers)
async_result< typename handler_type< Handler, Signature >::type > result
bool asio_handler_is_continuation(binder1< Handler, Arg1 > *this_handler)
std::size_t buffer_copy(const mutable_buffer &target, const const_buffer &source)
Copies bytes from a source buffer to a target buffer.