10 #ifndef BOOST_BEAST_HTTP_SPAN_BODY_HPP 11 #define BOOST_BEAST_HTTP_SPAN_BODY_HPP 17 #include <boost/optional.hpp> 38 static_assert(std::is_pod<T>::value,
39 "POD requirements not met");
66 #if BOOST_BEAST_DOXYGEN 67 using reader = implementation_defined;
75 boost::asio::const_buffers_1;
77 template<
bool isRequest,
class Fields>
88 ec.assign(0, ec.category());
91 boost::optional<std::pair<const_buffers_type, bool>>
94 ec.assign(0, ec.category());
97 body_.
size() *
sizeof(
typename 108 #if BOOST_BEAST_DOXYGEN 109 using writer = implementation_defined;
116 template<
bool isRequest,
class Fields>
128 if(length && *length > body_.
size())
133 ec.assign(0, ec.category());
136 template<
class ConstBufferSequence>
141 using boost::asio::buffer_size;
142 using boost::asio::buffer_copy;
143 auto const n = buffer_size(buffers);
144 auto const len = body_.
size();
150 ec.assign(0, ec.category());
151 buffer_copy(boost::asio::buffer(
152 body_.
data(), n), buffers);
154 body_.
data() + n, body_.
size() - n};
161 ec.assign(0, ec.category());
BufferSequence< boost::asio::const_buffer > ConstBufferSequence
Definition: type_traits.hpp:280
boost::asio::const_buffers_1 const_buffers_type
Definition: span_body.hpp:75
Definition: async_result.hpp:20
T * data() const
Returns a pointer to the beginning of the span.
Definition: span.hpp:171
Definition: type_traits.hpp:25
detail::buffers_helper< ConstBufferSequence > buffers(ConstBufferSequence const &b)
Definition: ostream.hpp:50
void init(boost::optional< std::uint64_t > const &length, error_code &ec)
Definition: span_body.hpp:125
Definition: beast_common.hpp:6
typename std::remove_const< T >::type value_type
The type of value of each span element.
Definition: span.hpp:42
Definition: span_body.hpp:35
boost::system::error_code error_code
The type of error code used by the library.
Definition: error.hpp:21
std::size_t put(ConstBufferSequence const &buffers, error_code &ec)
Definition: span_body.hpp:138
Definition: span_body.hpp:111
std::size_t size() const
Returns the number of elements in the span.
Definition: span.hpp:178
writer(message< isRequest, span_body, Fields > &m)
Definition: span_body.hpp:118
reader(message< isRequest, span_body, Fields > const &msg)
Definition: span_body.hpp:79
void init(error_code &ec)
Definition: span_body.hpp:86
Definition: span_body.hpp:69
static std::uint64_t size(value_type const &body)
Definition: span_body.hpp:57
void finish(error_code &ec)
Definition: span_body.hpp:159