diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fe0f0d2..e3def1c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ API Changes: * Rename to multi_buffer, basic_multi_buffer * Rename to flat_buffer, basic_flat_buffer * Rename to static_buffer, static_buffer_n +* Rename to buffered_read_stream -------------------------------------------------------------------------------- diff --git a/doc/quickref.xml b/doc/quickref.xml index 54806eda..7c126f81 100644 --- a/doc/quickref.xml +++ b/doc/quickref.xml @@ -156,7 +156,7 @@ basic_multi_buffer buffers_adapter consuming_buffers - dynabuf_readstream + buffered_read_stream errc error_category error_code diff --git a/include/beast/core.hpp b/include/beast/core.hpp index 989db240..5f9e9cf7 100644 --- a/include/beast/core.hpp +++ b/include/beast/core.hpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/beast/core/dynabuf_readstream.hpp b/include/beast/core/buffered_read_stream.hpp similarity index 95% rename from include/beast/core/dynabuf_readstream.hpp rename to include/beast/core/buffered_read_stream.hpp index eb34c01c..7fc9c69e 100644 --- a/include/beast/core/dynabuf_readstream.hpp +++ b/include/beast/core/buffered_read_stream.hpp @@ -5,8 +5,8 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_DYNABUF_READSTREAM_HPP -#define BEAST_DYNABUF_READSTREAM_HPP +#ifndef BEAST_BUFFERED_READ_STREAM_HPP +#define BEAST_BUFFERED_READ_STREAM_HPP #include #include @@ -22,9 +22,9 @@ namespace beast { -/** A @b `Stream` with attached @b `DynamicBuffer` to buffer reads. +/** A @b Stream with attached @b DynamicBuffer to buffer reads. - This wraps a @b `Stream` implementation so that calls to write are + This wraps a @b Stream implementation so that calls to write are passed through to the underlying stream, while calls to read will first consume the input sequence stored in a @b `DynamicBuffer` which is part of the object. @@ -52,7 +52,7 @@ namespace beast { // template void process_http_message( - dynabuf_readstream& stream) + buffered_read_stream& stream) { // Read up to and including the end of the HTTP // header, leaving the sequence in the stream's @@ -88,7 +88,7 @@ namespace beast { @tparam DynamicBuffer The type of stream buffer to use. */ template -class dynabuf_readstream +class buffered_read_stream { static_assert(is_DynamicBuffer::value, "DynamicBuffer requirements not met"); @@ -102,7 +102,7 @@ class dynabuf_readstream public: /// The type of the internal buffer - using dynabuf_type = DynamicBuffer; + using buffer_type = DynamicBuffer; /// The type of the next layer. using next_layer_type = @@ -122,14 +122,14 @@ public: @note The behavior of move assignment on or from streams with active or pending operations is undefined. */ - dynabuf_readstream(dynabuf_readstream&&) = default; + buffered_read_stream(buffered_read_stream&&) = default; /** Move assignment. @note The behavior of move assignment on or from streams with active or pending operations is undefined. */ - dynabuf_readstream& operator=(dynabuf_readstream&&) = default; + buffered_read_stream& operator=(buffered_read_stream&&) = default; /** Construct the wrapping stream. @@ -137,7 +137,7 @@ public: */ template explicit - dynabuf_readstream(Args&&... args); + buffered_read_stream(Args&&... args); /// Get a reference to the next layer. next_layer_type& @@ -358,6 +358,6 @@ public: } // beast -#include +#include #endif diff --git a/include/beast/core/impl/dynabuf_readstream.ipp b/include/beast/core/impl/buffered_read_stream.ipp similarity index 92% rename from include/beast/core/impl/dynabuf_readstream.ipp rename to include/beast/core/impl/buffered_read_stream.ipp index 5a0815ba..63a234cb 100644 --- a/include/beast/core/impl/dynabuf_readstream.ipp +++ b/include/beast/core/impl/buffered_read_stream.ipp @@ -5,8 +5,8 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_IMPL_DYNABUF_READSTREAM_HPP -#define BEAST_IMPL_DYNABUF_READSTREAM_HPP +#ifndef BEAST_IMPL_BUFFERED_READ_STREAM_IPP +#define BEAST_IMPL_BUFFERED_READ_STREAM_IPP #include #include @@ -18,17 +18,17 @@ namespace beast { template template -class dynabuf_readstream< +class buffered_read_stream< Stream, DynamicBuffer>::read_some_op { // VFALCO What about bool cont for is_continuation? struct data { - dynabuf_readstream& srs; + buffered_read_stream& srs; MutableBufferSequence bs; int state = 0; - data(Handler&, dynabuf_readstream& srs_, + data(Handler&, buffered_read_stream& srs_, MutableBufferSequence const& bs_) : srs(srs_) , bs(bs_) @@ -44,7 +44,7 @@ public: template read_some_op(DeducedHandler&& h, - dynabuf_readstream& srs, Args&&... args) + buffered_read_stream& srs, Args&&... args) : d_(std::forward(h), srs, std::forward(args)...) { @@ -90,7 +90,7 @@ public: template template void -dynabuf_readstream:: +buffered_read_stream:: read_some_op::operator()( error_code const& ec, std::size_t bytes_transferred) { @@ -150,8 +150,8 @@ read_some_op::operator()( template template -dynabuf_readstream:: -dynabuf_readstream(Args&&... args) +buffered_read_stream:: +buffered_read_stream(Args&&... args) : next_layer_(std::forward(args)...) { } @@ -159,7 +159,7 @@ dynabuf_readstream(Args&&... args) template template auto -dynabuf_readstream:: +buffered_read_stream:: async_write_some(ConstBufferSequence const& buffers, WriteHandler&& handler) -> typename async_completion< @@ -180,7 +180,7 @@ async_write_some(ConstBufferSequence const& buffers, template template std::size_t -dynabuf_readstream:: +buffered_read_stream:: read_some( MutableBufferSequence const& buffers) { @@ -199,7 +199,7 @@ read_some( template template std::size_t -dynabuf_readstream:: +buffered_read_stream:: read_some(MutableBufferSequence const& buffers, error_code& ec) { @@ -228,7 +228,7 @@ read_some(MutableBufferSequence const& buffers, template template auto -dynabuf_readstream:: +buffered_read_stream:: async_read_some( MutableBufferSequence const& buffers, ReadHandler&& handler) -> diff --git a/include/beast/websocket/stream.hpp b/include/beast/websocket/stream.hpp index f03e8e3a..04ba0799 100644 --- a/include/beast/websocket/stream.hpp +++ b/include/beast/websocket/stream.hpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include @@ -98,7 +98,7 @@ class stream : public detail::stream_base { friend class stream_test; - dynabuf_readstream stream_; + buffered_read_stream stream_; public: /// The type of the next layer. diff --git a/test/Jamfile b/test/Jamfile index b8f3c0d7..67e980a3 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -20,10 +20,10 @@ unit-test core-tests : core/bind_handler.cpp core/buffer_cat.cpp core/buffer_concepts.cpp + core/buffered_read_stream.cpp core/buffers_adapter.cpp core/clamp.cpp core/consuming_buffers.cpp - core/dynabuf_readstream.cpp core/error.cpp core/flat_buffer.cpp core/handler_alloc.cpp diff --git a/test/core/CMakeLists.txt b/test/core/CMakeLists.txt index 6286ad97..41d137aa 100644 --- a/test/core/CMakeLists.txt +++ b/test/core/CMakeLists.txt @@ -16,7 +16,7 @@ add_executable (core-tests buffers_adapter.cpp clamp.cpp consuming_buffers.cpp - dynabuf_readstream.cpp + buffered_read_stream.cpp error.cpp flat_buffer.cpp handler_alloc.cpp diff --git a/test/core/dynabuf_readstream.cpp b/test/core/buffered_read_stream.cpp similarity index 85% rename from test/core/dynabuf_readstream.cpp rename to test/core/buffered_read_stream.cpp index 54327522..e36b73a7 100644 --- a/test/core/dynabuf_readstream.cpp +++ b/test/core/buffered_read_stream.cpp @@ -6,7 +6,7 @@ // // Test that header file is self-contained. -#include +#include #include #include @@ -17,11 +17,11 @@ namespace beast { -class dynabuf_readstream_test +class buffered_read_stream_test : public unit_test::suite , public test::enable_yield_to { - using self = dynabuf_readstream_test; + using self = buffered_read_stream_test; public: void testSpecialMembers() @@ -29,16 +29,16 @@ public: using socket_type = boost::asio::ip::tcp::socket; boost::asio::io_service ios; { - dynabuf_readstream srs(ios); - dynabuf_readstream srs2(std::move(srs)); + buffered_read_stream srs(ios); + buffered_read_stream srs2(std::move(srs)); srs = std::move(srs2); BEAST_EXPECT(&srs.get_io_service() == &ios); BEAST_EXPECT(&srs.get_io_service() == &srs2.get_io_service()); } { socket_type sock(ios); - dynabuf_readstream srs(sock); - dynabuf_readstream srs2(std::move(srs)); + buffered_read_stream srs(sock); + buffered_read_stream srs2(std::move(srs)); } } @@ -55,7 +55,7 @@ public: { test::fail_stream< test::string_istream> fs(n, ios_, ", world!"); - dynabuf_readstream< + buffered_read_stream< decltype(fs)&, multi_buffer> srs(fs); srs.buffer().commit(buffer_copy( srs.buffer().prepare(5), buffer("Hello", 5))); @@ -73,7 +73,7 @@ public: { test::fail_stream< test::string_istream> fs(n, ios_, ", world!"); - dynabuf_readstream< + buffered_read_stream< decltype(fs)&, multi_buffer> srs(fs); srs.capacity(3); srs.buffer().commit(buffer_copy( @@ -92,7 +92,7 @@ public: { test::fail_stream< test::string_istream> fs(n, ios_, ", world!"); - dynabuf_readstream< + buffered_read_stream< decltype(fs)&, multi_buffer> srs(fs); srs.buffer().commit(buffer_copy( srs.buffer().prepare(5), buffer("Hello", 5))); @@ -111,7 +111,7 @@ public: { test::fail_stream< test::string_istream> fs(n, ios_, ", world!"); - dynabuf_readstream< + buffered_read_stream< decltype(fs)&, multi_buffer> srs(fs); srs.capacity(3); srs.buffer().commit(buffer_copy( @@ -136,7 +136,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(dynabuf_readstream,core,beast); +BEAST_DEFINE_TESTSUITE(buffered_read_stream,core,beast); } // beast