/usr/include/boost/beast/core/detail
NameSizeModeActions
impl/-0755rm
allocator.hpp9450644editdlrm
async_base.hpp9010644editdlrm
base64.hpp19420644editdlrm
base64.ipp61700644editdlrm
bind_continuation.hpp35040644editdlrm
bind_default_executor.hpp32430644editdlrm
bind_handler.hpp109590644editdlrm
buffer.hpp18250644editdlrm
buffers_pair.hpp26360644editdlrm
buffers_range_adaptor.hpp26510644editdlrm
buffers_ref.hpp16480644editdlrm
buffer_traits.hpp20950644editdlrm
chacha.hpp41670644editdlrm
char_buffer.hpp14070644editdlrm
clamp.hpp12290644editdlrm
config.hpp28840644editdlrm
cpu_info.hpp17870644editdlrm
flat_stream.hpp19190644editdlrm
get_io_context.hpp23380644editdlrm
is_invocable.hpp18880644editdlrm
ostream.hpp70040644editdlrm
pcg.hpp14640644editdlrm
read.hpp92170644editdlrm
remap_post_to_defer.hpp21520644editdlrm
service_base.hpp8500644editdlrm
sha1.hpp16240644editdlrm
sha1.ipp79980644editdlrm
static_const.hpp11540644editdlrm
static_ostream.hpp30300644editdlrm
static_string.hpp30300644editdlrm
stream_base.hpp26850644editdlrm
stream_traits.hpp27960644editdlrm
string.hpp8980644editdlrm
temporary_buffer.hpp16110644editdlrm
tuple.hpp21940644editdlrm
type_traits.hpp27790644editdlrm
variant.hpp48890644editdlrm
varint.hpp17120644editdlrm
win32_unicode_path.hpp21480644editdlrm
work_guard.hpp18510644editdlrm
Edit: /usr/include/boost/beast/core/detail/ostream.hpp (7004B)
// // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Official repository: https://github.com/boostorg/beast // #ifndef BOOST_BEAST_DETAIL_OSTREAM_HPP #define BOOST_BEAST_DETAIL_OSTREAM_HPP #include #include #include #include #include #include #include #include #include namespace boost { namespace beast { namespace detail { struct basic_streambuf_movable_helper : std::basic_streambuf> { basic_streambuf_movable_helper( basic_streambuf_movable_helper&&) = default; }; using basic_streambuf_movable = std::is_move_constructible; template class ostream_buffer; //------------------------------------------------------------------------------ template class ostream_buffer final : public std::basic_streambuf { using int_type = typename std::basic_streambuf::int_type; using traits_type = typename std::basic_streambuf::traits_type; DynamicBuffer& b_; public: ostream_buffer(ostream_buffer&&) = default; ostream_buffer(ostream_buffer const&) = delete; ~ostream_buffer() noexcept { sync(); } explicit ostream_buffer(DynamicBuffer& b) : b_(b) { b_.prepare(0); } int_type overflow(int_type ch) override { BOOST_ASSERT(! Traits::eq_int_type( ch, Traits::eof())); sync(); static std::size_t constexpr max_size = 65536; auto const max_prepare = std::min( std::max( 512, b_.capacity() - b_.size()), std::min( max_size, b_.max_size() - b_.size())); if(max_prepare == 0) return Traits::eof(); auto const bs = b_.prepare(max_prepare); auto const b = buffers_front(bs); auto const p = static_cast(b.data()); this->setp(p, p + b.size() / sizeof(CharT)); BOOST_ASSERT(b_.capacity() > b_.size()); return this->sputc( Traits::to_char_type(ch)); } int sync() override { b_.commit( (this->pptr() - this->pbase()) * sizeof(CharT)); this->setp(nullptr, nullptr); return 0; } }; //------------------------------------------------------------------------------ // This nonsense is all to work around a glitch in libstdc++ // where std::basic_streambuf copy constructor is private: // https://github.com/gcc-mirror/gcc/blob/gcc-4_8-branch/libstdc%2B%2B-v3/include/std/streambuf#L799 template class ostream_buffer : public std::basic_streambuf { using int_type = typename std::basic_streambuf::int_type; using traits_type = typename std::basic_streambuf::traits_type; DynamicBuffer& b_; public: ostream_buffer(ostream_buffer&&) = delete; ostream_buffer(ostream_buffer const&) = delete; ~ostream_buffer() noexcept { sync(); } explicit ostream_buffer(DynamicBuffer& b) : b_(b) { } int_type overflow(int_type ch) override { BOOST_ASSERT(! Traits::eq_int_type( ch, Traits::eof())); sync(); static std::size_t constexpr max_size = 65536; auto const max_prepare = std::min( std::max( 512, b_.capacity() - b_.size()), std::min( max_size, b_.max_size() - b_.size())); if(max_prepare == 0) return Traits::eof(); auto const bs = b_.prepare(max_prepare); auto const b = buffers_front(bs); auto const p = static_cast(b.data()); this->setp(p, p + b.size() / sizeof(CharT)); BOOST_ASSERT(b_.capacity() > b_.size()); return this->sputc( Traits::to_char_type(ch)); } int sync() override { b_.commit( (this->pptr() - this->pbase()) * sizeof(CharT)); this->setp(nullptr, nullptr); return 0; } }; //------------------------------------------------------------------------------ template class ostream_helper; template class ostream_helper< DynamicBuffer, CharT, Traits, true> : public std::basic_ostream { ostream_buffer< DynamicBuffer, CharT, Traits, true> osb_; public: explicit ostream_helper(DynamicBuffer& b); ostream_helper(ostream_helper&& other); }; template ostream_helper:: ostream_helper(DynamicBuffer& b) : std::basic_ostream(&this->osb_) , osb_(b) { } template ostream_helper:: ostream_helper(ostream_helper&& other) : std::basic_ostream(&osb_) , osb_(std::move(other.osb_)) { } // This work-around is for libstdc++ versions that // don't have a movable std::basic_streambuf template class ostream_helper_base { protected: std::unique_ptr member; ostream_helper_base( ostream_helper_base&&) = default; explicit ostream_helper_base(T* t) : member(t) { } }; template class ostream_helper< DynamicBuffer, CharT, Traits, false> : private ostream_helper_base> , public std::basic_ostream { public: explicit ostream_helper(DynamicBuffer& b) : ostream_helper_base>( new ostream_buffer(b)) , std::basic_ostream( this->member.get()) { } ostream_helper(ostream_helper&& other) : ostream_helper_base>( std::move(other)) , std::basic_ostream( this->member.get()) { } }; } // detail } // beast } // boost #endif