MCPcopy Create free account
hub / github.com/alibaba/async_simple / prepare

Function prepare

demo_example/asio/asio/buffer.hpp:1714–1728  ·  view source on GitHub ↗

@b DynamicBuffer_v1: Get a list of buffers that represents the output sequence, with the given size. * Ensures that the output sequence can accommodate @c n bytes, resizing the * basic_string object as necessary. * * @returns An object of type @c mutable_buffers_type that satisfies * MutableBufferSequence requirements, representing basic_string memory * at the start of the output se

Source from the content-addressed store, hash-verified

1712 * output sequence.
1713 */
1714 mutable_buffers_type prepare(std::size_t n)
1715 {
1716 if (size() > max_size() || max_size() - size() < n)
1717 {
1718 std::length_error ex("dynamic_string_buffer too long");
1719 asio::detail::throw_exception(ex);
1720 }
1721
1722 if (size_ == (std::numeric_limits<std::size_t>::max)())
1723 size_ = string_.size(); // Enable v1 behaviour.
1724
1725 string_.resize(size_ + n);
1726
1727 return asio::buffer(asio::buffer(string_) + size_, n);
1728 }
1729
1730 /// @b DynamicBuffer_v1: Move bytes from the output sequence to the input
1731 /// sequence.

Callers

nothing calls this directly

Calls 6

sizeFunction · 0.85
throw_exceptionFunction · 0.85
max_sizeFunction · 0.70
bufferFunction · 0.70
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected