10 #ifndef BOOST_BEAST_DETAIL_OSTREAM_HPP 11 #define BOOST_BEAST_DETAIL_OSTREAM_HPP 13 #include <boost/asio/buffer.hpp> 18 #include <type_traits> 25 template<
class Buffers>
44 template<
class Buffers>
49 using boost::asio::buffer_cast;
50 using boost::asio::buffer_size;
51 for(boost::asio::const_buffer b : v.b_)
52 os.write(buffer_cast<char const*>(b),
60 std::basic_streambuf<char, std::char_traits<char>>
67 std::is_move_constructible<basic_streambuf_movable_helper>;
71 template<
class DynamicBuffer,
72 class CharT,
class Traits,
bool isMovable>
75 template<
class DynamicBuffer,
class CharT,
class Traits>
77 <DynamicBuffer, CharT, Traits, true>
78 :
public std::basic_streambuf<CharT, Traits>
80 using int_type =
typename 81 std::basic_streambuf<CharT, Traits>::int_type;
83 using traits_type =
typename 84 std::basic_streambuf<CharT, Traits>::traits_type;
86 static std::size_t constexpr max_size = 512;
109 if(! Traits::eq_int_type(ch, Traits::eof()))
111 Traits::assign(*this->pptr(),
112 static_cast<CharT>(ch));
118 return traits_type::eof();
133 using boost::asio::buffer_cast;
134 using boost::asio::buffer_size;
135 auto mbs = buf_.prepare(
137 auto const mb = *mbs.begin();
138 auto const p = buffer_cast<CharT*>(mb);
140 p + buffer_size(mb) /
sizeof(CharT) - 1);
147 (this->pptr() - this->pbase() + extra) *
156 template<
class DynamicBuffer,
class CharT,
class Traits>
158 <DynamicBuffer, CharT, Traits, false>
159 :
public std::basic_streambuf<CharT, Traits>
161 using int_type =
typename 162 std::basic_streambuf<CharT, Traits>::int_type;
164 using traits_type =
typename 165 std::basic_streambuf<CharT, Traits>::traits_type;
167 static std::size_t constexpr max_size = 512;
190 if(! Traits::eq_int_type(ch, Traits::eof()))
192 Traits::assign(*this->pptr(),
193 static_cast<CharT>(ch));
199 return traits_type::eof();
214 using boost::asio::buffer_cast;
215 using boost::asio::buffer_size;
216 auto mbs = buf_.prepare(
218 auto const mb = *mbs.begin();
219 auto const p = buffer_cast<CharT*>(mb);
221 p + buffer_size(mb) /
sizeof(CharT) - 1);
228 (this->pptr() - this->pbase() + extra) *
235 template<
class DynamicBuffer,
236 class CharT,
class Traits,
bool isMovable>
239 template<
class DynamicBuffer,
class CharT,
class Traits>
241 DynamicBuffer, CharT, Traits, true>
242 :
public std::basic_ostream<CharT, Traits>
245 DynamicBuffer, CharT, Traits,
true> osb_;
254 template<
class DynamicBuffer,
class CharT,
class Traits>
257 : std::basic_ostream<CharT, Traits>(
263 template<
class DynamicBuffer,
class CharT,
class Traits>
267 : std::basic_ostream<CharT, Traits>(&osb_)
268 , osb_(std::move(other.osb_))
291 template<
class DynamicBuffer,
class CharT,
class Traits>
293 DynamicBuffer, CharT, Traits, false>
295 DynamicBuffer, CharT, Traits, false>>
296 ,
public std::basic_ostream<CharT, Traits>
302 DynamicBuffer, CharT, Traits, false>>(
304 CharT, Traits, false>(buf))
305 ,
std::basic_ostream<CharT, Traits>(this->member.get())
311 DynamicBuffer, CharT, Traits, false>>(
313 ,
std::basic_ostream<CharT, Traits>(this->member.get())
std::is_move_constructible< basic_streambuf_movable_helper > basic_streambuf_movable
Definition: ostream.hpp:67
Definition: async_result.hpp:20
int sync() override
Definition: ostream.hpp:203
detail::ostream_helper< DynamicBuffer, char, std::char_traits< char >, detail::basic_streambuf_movable::value > ostream(DynamicBuffer &buffer)
Definition: ostream.hpp:91
buffers_helper(Buffers const &b)
Definition: ostream.hpp:32
Definition: ostream.hpp:276
ostream_helper(DynamicBuffer &buf)
Definition: ostream.hpp:300
~ostream_buffer() noexcept
Definition: ostream.hpp:175
ostream_buffer(DynamicBuffer &buf)
Definition: ostream.hpp:100
Definition: ostream.hpp:59
~ostream_buffer() noexcept
Definition: ostream.hpp:94
Definition: ostream.hpp:26
std::unique_ptr< T > member
Definition: ostream.hpp:279
int sync() override
Definition: ostream.hpp:122
friend std::ostream & operator<<(std::ostream &os, buffers_helper< B > const &v)
ostream_helper_base(T *t)
Definition: ostream.hpp:285
std::size_t read_size_or_throw(DynamicBuffer &buffer, std::size_t max_size)
Definition: read_size.ipp:66
int_type overflow(int_type ch) override
Definition: ostream.hpp:188
int_type overflow(int_type ch) override
Definition: ostream.hpp:107
Definition: ostream.hpp:237
ostream_helper(ostream_helper &&other)
Definition: ostream.hpp:309
Definition: ostream.hpp:73
ostream_buffer(DynamicBuffer &buf)
Definition: ostream.hpp:181