10 #ifndef BOOST_BEAST_HTTP_VECTOR_BODY_HPP 11 #define BOOST_BEAST_HTTP_VECTOR_BODY_HPP 17 #include <boost/asio/buffer.hpp> 18 #include <boost/optional.hpp> 36 template<
class T,
class Allocator = std::allocator<T>>
40 static_assert(
sizeof(T) == 1 &&
41 std::is_integral<T>::value,
42 "T requirements not met");
69 #if BOOST_BEAST_DOXYGEN 70 using reader = implementation_defined;
78 boost::asio::const_buffers_1;
80 template<
bool isRequest,
class Fields>
91 ec.assign(0, ec.category());
94 boost::optional<std::pair<const_buffers_type, bool>>
97 ec.assign(0, ec.category());
99 body_.data(), body_.size()},
false}};
108 #if BOOST_BEAST_DOXYGEN 109 using writer = implementation_defined;
116 template<
bool isRequest,
class Fields>
131 std::numeric_limits<std::size_t>::max)())
139 static_cast<std::size_t>(*length));
141 catch(std::exception
const&)
147 ec.assign(0, ec.category());
150 template<
class ConstBufferSequence>
155 using boost::asio::buffer_size;
156 using boost::asio::buffer_copy;
157 auto const n = buffer_size(buffers);
158 auto const len = body_.size();
161 body_.resize(len + n);
163 catch(std::exception
const&)
168 ec.assign(0, ec.category());
169 return buffer_copy(boost::asio::buffer(
170 &body_[0] + len, n), buffers);
176 ec.assign(0, ec.category());
BufferSequence< boost::asio::const_buffer > ConstBufferSequence
Definition: type_traits.hpp:280
reader(message< isRequest, vector_body, Fields > const &msg)
Definition: vector_body.hpp:82
void init(boost::optional< std::uint64_t > const &length, error_code &ec)
Definition: vector_body.hpp:125
Definition: async_result.hpp:20
Definition: type_traits.hpp:25
detail::buffers_helper< ConstBufferSequence > buffers(ConstBufferSequence const &b)
Definition: ostream.hpp:50
Definition: beast_common.hpp:6
Definition: vector_body.hpp:37
void finish(error_code &ec)
Definition: vector_body.hpp:174
void init(error_code &ec)
Definition: vector_body.hpp:89
Definition: vector_body.hpp:72
boost::system::error_code error_code
The type of error code used by the library.
Definition: error.hpp:21
Definition: vector_body.hpp:111
std::vector< T, Allocator > value_type
Definition: vector_body.hpp:50
std::size_t put(ConstBufferSequence const &buffers, error_code &ec)
Definition: vector_body.hpp:152
static std::uint64_t size(value_type const &body)
Definition: vector_body.hpp:60
writer(message< isRequest, vector_body, Fields > &m)
Definition: vector_body.hpp:118
boost::asio::const_buffers_1 const_buffers_type
Definition: vector_body.hpp:78