10 #ifndef BOOST_BEAST_HTTP_DETAIL_CHUNK_ENCODE_HPP 11 #define BOOST_BEAST_HTTP_DETAIL_CHUNK_ENCODE_HPP 15 #include <boost/asio/buffer.hpp> 28 virtual boost::asio::const_buffers_1
str() = 0;
31 template<
class ChunkExtensions>
46 boost::asio::const_buffers_1
49 auto const s = ext_.str();
50 return {s.data(), s.size()};
54 template<
class T,
class =
void>
59 std::declval<string_view&>() = std::declval<T&>().str(),
60 (void)0)>> : std::true_type
77 char buf_[1 + 2 *
sizeof(std::size_t)];
79 template<
class =
void>
81 prepare(std::size_t n);
83 template<
class OutIter>
86 to_hex(OutIter last, std::size_t n)
95 *--last =
"0123456789abcdef"[n&0xf];
102 boost::asio::const_buffer()
const 105 buf_ +
sizeof(buf_) - buf_[0],
106 static_cast<unsigned>(buf_[0])};
143 prepare(std::size_t n)
145 auto const last = &buf_[
sizeof(buf_)];
146 auto it = to_hex(last, n);
147 buf_[0] =
static_cast<char>(last - it);
154 boost::asio::const_buffers_1
162 boost::asio::const_buffers_1
170 template<
class =
void>
175 char const s[2] = {
'\r',
'\n'};
181 boost::asio::const_buffer()
const 183 return {s,
sizeof(s)};
197 template<
class =
void>
202 char const s[3] = {
'0',
'\r',
'\n'};
208 boost::asio::const_buffer()
const 210 return {s,
sizeof(s)};
247 using type =
typename 248 T::reader::const_buffers_type;
Definition: chunk_encode.hpp:32
chunk_extensions_impl(ChunkExtensions const &ext)
Definition: chunk_encode.hpp:41
Definition: chunk_encode.hpp:245
Definition: async_result.hpp:20
const_iterator end() const
Definition: chunk_encode.hpp:130
boost::asio::const_buffers_1 str() override
Definition: chunk_encode.hpp:47
Definition: chunk_encode.hpp:198
const_iterator end() const
Definition: chunk_encode.hpp:235
Definition: beast_common.hpp:6
Definition: chunk_encode.hpp:173
Definition: chunk_encode.hpp:171
Definition: chunk_encode.hpp:222
chunk_size(std::size_t n)
Definition: chunk_encode.hpp:118
Definition: chunk_encode.hpp:25
Definition: chunk_encode.hpp:200
typename make_void< Ts... >::type void_t
Definition: type_traits.hpp:62
ChunkExtensions ext_
Definition: chunk_encode.hpp:34
virtual ~chunk_extensions()=default
boost::asio::const_buffers_1 chunk_last()
Returns a buffer sequence holding a final chunk header.
Definition: chunk_encode.hpp:163
chunk_extensions_impl(ChunkExtensions &&ext)
Definition: chunk_encode.hpp:36
T type
Definition: chunk_encode.hpp:254
Definition: chunk_encode.hpp:72
static value_type value
Definition: chunk_encode.hpp:213
typename detail::is_fields_helper< T >::type is_fields
Definition: type_traits.hpp:178
const_iterator begin() const
Definition: chunk_encode.hpp:124
const_iterator begin() const
Definition: chunk_encode.hpp:229
boost::asio::const_buffers_1 chunk_crlf()
Returns a buffer sequence holding a CRLF for chunk encoding.
Definition: chunk_encode.hpp:155
static value_type value
Definition: chunk_encode.hpp:186
value_type const * const_iterator
Definition: chunk_encode.hpp:110
virtual boost::asio::const_buffers_1 str()=0
typename T::reader::const_buffers_type type
Definition: chunk_encode.hpp:248
Definition: chunk_encode.hpp:55
value_type const * const_iterator
Definition: chunk_encode.hpp:226
Definition: chunk_encode.hpp:68