MCPcopy Create free account
hub / github.com/boostorg/asio / prepare

Function prepare

include/boost/asio/buffer.hpp:1944–1958  ·  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

1942 * output sequence.
1943 */
1944 mutable_buffers_type prepare(std::size_t n)
1945 {
1946 if (size() > max_size() || max_size() - size() < n)
1947 {
1948 std::length_error ex("dynamic_string_buffer too long");
1949 boost::asio::detail::throw_exception(ex);
1950 }
1951
1952 if (size_ == (std::numeric_limits<std::size_t>::max)())
1953 size_ = string_.size(); // Enable v1 behaviour.
1954
1955 string_.resize(size_ + n);
1956
1957 return boost::asio::buffer(boost::asio::buffer(string_) + size_, n);
1958 }
1959
1960 /// @b DynamicBuffer_v1: Move bytes from the output sequence to the input
1961 /// sequence.

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected