Rename to buffer_cat_view (API Change)

fix #408
This commit is contained in:
Vinnie Falco
2017-06-03 07:10:11 -07:00
parent 2141fabcf9
commit 982d20001f
7 changed files with 46 additions and 46 deletions

View File

@@ -3,6 +3,7 @@ Version 48
API Changes: API Changes:
* Tidy up chunk decorator * Tidy up chunk decorator
* Rename to buffer_cat_view
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@@ -307,26 +307,25 @@ caller; ownership is not transferred.
[[ [[
[link beast.ref.buffer_cat `buffer_cat`] [link beast.ref.buffer_cat `buffer_cat`]
][ ][
The functions returns a new buffer sequence which, when iterated, This functions returns a new buffer sequence which, when iterated,
traverses the sequence which would be formed if all of the input buffer traverses the sequence which would be formed if all of the input buffer
sequences were concatenated. This powerful function allows multiple calls sequences were concatenated. With this routine, multiple calls to a
to a stream's `write_some` function to be combined into one, eliminating stream's `write_some` function may be combined into one, eliminating
expensive system calls. expensive system calls.
]] ]]
[[ [[
[link beast.ref.buffer_prefix `buffer_prefix`] [link beast.ref.buffer_cat_view `buffer_cat_view`]
][
This function returns a new buffer or buffer sequence which wraps the
underlying memory of an existing buffer sequence, but with a smaller size.
This lets callers work with a prefix of a buffer sequence.
]]
[[
[link beast.ref.buffer_cat `buffers_view`]
][ ][
This class represents the buffer sequence formed by concatenating This class represents the buffer sequence formed by concatenating
two or more buffer sequences. This is type of object returned by two or more buffer sequences. This is type of object returned by
[link beast.ref.buffer_cat `buffer_cat`]. [link beast.ref.buffer_cat `buffer_cat`].
]] ]]
[[
[link beast.ref.buffer_prefix `buffer_prefix`]
][
This function returns a new buffer or buffer sequence which represents
a prefix of the original buffers.
]]
[[ [[
[link beast.ref.consuming_buffers `consuming_buffers`] [link beast.ref.consuming_buffers `consuming_buffers`]
][ ][

View File

@@ -167,8 +167,8 @@
<member><link linkend="beast.ref.basic_flat_buffer">basic_flat_buffer</link></member> <member><link linkend="beast.ref.basic_flat_buffer">basic_flat_buffer</link></member>
<member><link linkend="beast.ref.basic_multi_buffer">basic_multi_buffer</link></member> <member><link linkend="beast.ref.basic_multi_buffer">basic_multi_buffer</link></member>
<member><link linkend="beast.ref.buffers_adapter">buffers_adapter</link></member> <member><link linkend="beast.ref.buffers_adapter">buffers_adapter</link></member>
<member><link linkend="beast.ref.buffers_view">buffers_view</link></member>
<member><link linkend="beast.ref.consuming_buffers">consuming_buffers</link></member> <member><link linkend="beast.ref.consuming_buffers">consuming_buffers</link></member>
<member><link linkend="beast.ref.buffer_cat_view">buffer_cat_view</link></member>
<member><link linkend="beast.ref.buffered_read_stream">buffered_read_stream</link></member> <member><link linkend="beast.ref.buffered_read_stream">buffered_read_stream</link></member>
<member><link linkend="beast.ref.error_category">error_category</link></member> <member><link linkend="beast.ref.error_category">error_category</link></member>
<member><link linkend="beast.ref.error_code">error_code</link></member> <member><link linkend="beast.ref.error_code">error_code</link></member>

View File

@@ -19,7 +19,7 @@ namespace beast {
@see @ref buffer_cat @see @ref buffer_cat
*/ */
template<class... Buffers> template<class... Buffers>
class buffers_view class buffer_cat_view
{ {
std::tuple<Buffers...> bn_; std::tuple<Buffers...> bn_;
@@ -41,16 +41,16 @@ public:
class const_iterator; class const_iterator;
/// Move constructor /// Move constructor
buffers_view(buffers_view&&) = default; buffer_cat_view(buffer_cat_view&&) = default;
/// Copy constructor /// Copy constructor
buffers_view(buffers_view const&) = default; buffer_cat_view(buffer_cat_view const&) = default;
/// Move assignment /// Move assignment
buffers_view& operator=(buffers_view&&) = default; buffer_cat_view& operator=(buffer_cat_view&&) = default;
// Copy assignment // Copy assignment
buffers_view& operator=(buffers_view const&) = default; buffer_cat_view& operator=(buffer_cat_view const&) = default;
/** Constructor /** Constructor
@@ -59,7 +59,7 @@ public:
of memory is not transferred. of memory is not transferred.
*/ */
explicit explicit
buffers_view(Buffers const&... buffers); buffer_cat_view(Buffers const&... buffers);
/// Return an iterator to the beginning of the concatenated sequence. /// Return an iterator to the beginning of the concatenated sequence.
const_iterator const_iterator
@@ -87,23 +87,23 @@ public:
also a @b MutableBufferSequence; otherwise the returned buffer also a @b MutableBufferSequence; otherwise the returned buffer
sequence will be a @b ConstBufferSequence. sequence will be a @b ConstBufferSequence.
@see @ref buffers_view @see @ref buffer_cat_view
*/ */
#if BEAST_DOXYGEN #if BEAST_DOXYGEN
template<class... BufferSequence> template<class... BufferSequence>
buffers_view<BufferSequence...> buffer_cat_view<BufferSequence...>
buffer_cat(BufferSequence const&... buffers) buffer_cat(BufferSequence const&... buffers)
#else #else
template<class B1, class B2, class... Bn> template<class B1, class B2, class... Bn>
inline inline
buffers_view<B1, B2, Bn...> buffer_cat_view<B1, B2, Bn...>
buffer_cat(B1 const& b1, B2 const& b2, Bn const&... bn) buffer_cat(B1 const& b1, B2 const& b2, Bn const&... bn)
#endif #endif
{ {
static_assert( static_assert(
detail::is_all_const_buffer_sequence<B1, B2, Bn...>::value, detail::is_all_const_buffer_sequence<B1, B2, Bn...>::value,
"BufferSequence requirements not met"); "BufferSequence requirements not met");
return buffers_view<B1, B2, Bn...>{b1, b2, bn...}; return buffer_cat_view<B1, B2, Bn...>{b1, b2, bn...};
} }
} // beast } // beast

View File

@@ -22,14 +22,14 @@
namespace beast { namespace beast {
template<class... Bn> template<class... Bn>
class buffers_view<Bn...>::const_iterator class buffer_cat_view<Bn...>::const_iterator
{ {
std::size_t n_; std::size_t n_;
std::tuple<Bn...> const* bn_; std::tuple<Bn...> const* bn_;
std::array<char, detail::max_sizeof< std::array<char, detail::max_sizeof<
typename Bn::const_iterator...>()> buf_; typename Bn::const_iterator...>()> buf_;
friend class buffers_view<Bn...>; friend class buffer_cat_view<Bn...>;
template<std::size_t I> template<std::size_t I>
using C = std::integral_constant<std::size_t, I>; using C = std::integral_constant<std::size_t, I>;
@@ -319,14 +319,14 @@ private:
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template<class... Bn> template<class... Bn>
buffers_view<Bn...>:: buffer_cat_view<Bn...>::
const_iterator::~const_iterator() const_iterator::~const_iterator()
{ {
destroy(C<0>{}); destroy(C<0>{});
} }
template<class... Bn> template<class... Bn>
buffers_view<Bn...>:: buffer_cat_view<Bn...>::
const_iterator::const_iterator() const_iterator::const_iterator()
: n_(sizeof...(Bn)) : n_(sizeof...(Bn))
, bn_(nullptr) , bn_(nullptr)
@@ -334,7 +334,7 @@ const_iterator::const_iterator()
} }
template<class... Bn> template<class... Bn>
buffers_view<Bn...>:: buffer_cat_view<Bn...>::
const_iterator::const_iterator( const_iterator::const_iterator(
std::tuple<Bn...> const& bn, bool at_end) std::tuple<Bn...> const& bn, bool at_end)
: bn_(&bn) : bn_(&bn)
@@ -346,7 +346,7 @@ const_iterator::const_iterator(
} }
template<class... Bn> template<class... Bn>
buffers_view<Bn...>:: buffer_cat_view<Bn...>::
const_iterator::const_iterator(const_iterator&& other) const_iterator::const_iterator(const_iterator&& other)
: n_(other.n_) : n_(other.n_)
, bn_(other.bn_) , bn_(other.bn_)
@@ -355,7 +355,7 @@ const_iterator::const_iterator(const_iterator&& other)
} }
template<class... Bn> template<class... Bn>
buffers_view<Bn...>:: buffer_cat_view<Bn...>::
const_iterator::const_iterator(const_iterator const& other) const_iterator::const_iterator(const_iterator const& other)
: n_(other.n_) : n_(other.n_)
, bn_(other.bn_) , bn_(other.bn_)
@@ -365,7 +365,7 @@ const_iterator::const_iterator(const_iterator const& other)
template<class... Bn> template<class... Bn>
auto auto
buffers_view<Bn...>:: buffer_cat_view<Bn...>::
const_iterator::operator=(const_iterator&& other) -> const_iterator::operator=(const_iterator&& other) ->
const_iterator& const_iterator&
{ {
@@ -381,7 +381,7 @@ const_iterator::operator=(const_iterator&& other) ->
template<class... Bn> template<class... Bn>
auto auto
buffers_view<Bn...>:: buffer_cat_view<Bn...>::
const_iterator::operator=(const_iterator const& other) -> const_iterator::operator=(const_iterator const& other) ->
const_iterator& const_iterator&
{ {
@@ -397,7 +397,7 @@ const_iterator&
template<class... Bn> template<class... Bn>
bool bool
buffers_view<Bn...>:: buffer_cat_view<Bn...>::
const_iterator::operator==(const_iterator const& other) const const_iterator::operator==(const_iterator const& other) const
{ {
if(bn_ != other.bn_) if(bn_ != other.bn_)
@@ -409,7 +409,7 @@ const_iterator::operator==(const_iterator const& other) const
template<class... Bn> template<class... Bn>
auto auto
buffers_view<Bn...>:: buffer_cat_view<Bn...>::
const_iterator::operator*() const -> const_iterator::operator*() const ->
reference reference
{ {
@@ -418,7 +418,7 @@ const_iterator::operator*() const ->
template<class... Bn> template<class... Bn>
auto auto
buffers_view<Bn...>:: buffer_cat_view<Bn...>::
const_iterator::operator++() -> const_iterator::operator++() ->
const_iterator& const_iterator&
{ {
@@ -428,7 +428,7 @@ const_iterator::operator++() ->
template<class... Bn> template<class... Bn>
auto auto
buffers_view<Bn...>:: buffer_cat_view<Bn...>::
const_iterator::operator++(int) -> const_iterator::operator++(int) ->
const_iterator const_iterator
{ {
@@ -439,7 +439,7 @@ const_iterator::operator++(int) ->
template<class... Bn> template<class... Bn>
auto auto
buffers_view<Bn...>:: buffer_cat_view<Bn...>::
const_iterator::operator--() -> const_iterator::operator--() ->
const_iterator& const_iterator&
{ {
@@ -449,7 +449,7 @@ const_iterator::operator--() ->
template<class... Bn> template<class... Bn>
auto auto
buffers_view<Bn...>:: buffer_cat_view<Bn...>::
const_iterator::operator--(int) -> const_iterator::operator--(int) ->
const_iterator const_iterator
{ {
@@ -461,8 +461,8 @@ const_iterator::operator--(int) ->
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template<class... Bn> template<class... Bn>
buffers_view<Bn...>:: buffer_cat_view<Bn...>::
buffers_view(Bn const&... bn) buffer_cat_view(Bn const&... bn)
: bn_(bn...) : bn_(bn...)
{ {
} }
@@ -471,7 +471,7 @@ buffers_view(Bn const&... bn)
template<class... Bn> template<class... Bn>
inline inline
auto auto
buffers_view<Bn...>::begin() const -> buffer_cat_view<Bn...>::begin() const ->
const_iterator const_iterator
{ {
return const_iterator{bn_, false}; return const_iterator{bn_, false};
@@ -480,7 +480,7 @@ buffers_view<Bn...>::begin() const ->
template<class... Bn> template<class... Bn>
inline inline
auto auto
buffers_view<Bn...>::end() const -> buffer_cat_view<Bn...>::end() const ->
const_iterator const_iterator
{ {
return const_iterator{bn_, true}; return const_iterator{bn_, true};

View File

@@ -162,14 +162,14 @@ class serializer
using is_deferred = using is_deferred =
typename reader::is_deferred; typename reader::is_deferred;
using cb0_t = consuming_buffers<buffers_view< using cb0_t = consuming_buffers<buffer_cat_view<
typename buffer_type::const_buffers_type, // header typename buffer_type::const_buffers_type, // header
typename reader::const_buffers_type>>; // body typename reader::const_buffers_type>>; // body
using cb1_t = consuming_buffers< using cb1_t = consuming_buffers<
typename reader::const_buffers_type>; // body typename reader::const_buffers_type>; // body
using ch0_t = consuming_buffers<buffers_view< using ch0_t = consuming_buffers<buffer_cat_view<
typename buffer_type::const_buffers_type, // header typename buffer_type::const_buffers_type, // header
detail::chunk_header, // chunk-header detail::chunk_header, // chunk-header
boost::asio::const_buffers_1, // chunk-ext boost::asio::const_buffers_1, // chunk-ext
@@ -177,14 +177,14 @@ class serializer
typename reader::const_buffers_type, // body typename reader::const_buffers_type, // body
boost::asio::const_buffers_1>>; // crlf boost::asio::const_buffers_1>>; // crlf
using ch1_t = consuming_buffers<buffers_view< using ch1_t = consuming_buffers<buffer_cat_view<
detail::chunk_header, // chunk-header detail::chunk_header, // chunk-header
boost::asio::const_buffers_1, // chunk-ext boost::asio::const_buffers_1, // chunk-ext
boost::asio::const_buffers_1, // crlf boost::asio::const_buffers_1, // crlf
typename reader::const_buffers_type, // body typename reader::const_buffers_type, // body
boost::asio::const_buffers_1>>; // crlf boost::asio::const_buffers_1>>; // crlf
using ch2_t = consuming_buffers<buffers_view< using ch2_t = consuming_buffers<buffer_cat_view<
boost::asio::const_buffers_1, // chunk-final boost::asio::const_buffers_1, // chunk-final
boost::asio::const_buffers_1, // trailers boost::asio::const_buffers_1, // trailers
boost::asio::const_buffers_1>>; // crlf boost::asio::const_buffers_1>>; // crlf

View File

@@ -120,7 +120,7 @@ public:
void void
testInPlace() testInPlace()
{ {
consuming_buffers<buffers_view< consuming_buffers<buffer_cat_view<
boost::asio::const_buffers_1, boost::asio::const_buffers_1,
boost::asio::const_buffers_1>> cb( boost::asio::const_buffers_1>> cb(
boost::in_place_init, boost::in_place_init,