buffers_cat replaces buffer_cat (API Change):

fix #773

* buffer_cat is renamed to buffers_cat
* buffer_cat_view is renamed to buffers_cat_view

Actions Required:

* Use buffers_cat instead of buffer_cat
* Use buffers_cat_view instead of buffer_cat_view
This commit is contained in:
Vinnie Falco
2017-09-15 12:52:59 -07:00
parent 38c2816539
commit 06fb2b9dfc
17 changed files with 90 additions and 86 deletions
+1 -1
View File
@@ -14,7 +14,7 @@
#include <boost/beast/core/async_result.hpp>
#include <boost/beast/core/bind_handler.hpp>
#include <boost/beast/core/buffer_cat.hpp>
#include <boost/beast/core/buffers_cat.hpp>
#include <boost/beast/core/buffers_prefix.hpp>
#include <boost/beast/core/buffered_read_stream.hpp>
#include <boost/beast/core/buffers_adapter.hpp>
@@ -7,8 +7,8 @@
// Official repository: https://github.com/boostorg/beast
//
#ifndef BOOST_BEAST_BUFFER_CAT_HPP
#define BOOST_BEAST_BUFFER_CAT_HPP
#ifndef BOOST_BEAST_BUFFERS_CAT_HPP
#define BOOST_BEAST_BUFFERS_CAT_HPP
#include <boost/beast/config.hpp>
#include <boost/beast/core/detail/type_traits.hpp>
@@ -19,10 +19,10 @@ namespace beast {
/** A buffer sequence representing a concatenation of buffer sequences.
@see @ref buffer_cat
@see @ref buffers_cat
*/
template<class... Buffers>
class buffer_cat_view
class buffers_cat_view
{
std::tuple<Buffers...> bn_;
@@ -44,13 +44,13 @@ public:
class const_iterator;
/// Constructor
buffer_cat_view(buffer_cat_view&&) = default;
buffers_cat_view(buffers_cat_view&&) = default;
/// Assignment
buffer_cat_view& operator=(buffer_cat_view&&) = default;
buffers_cat_view& operator=(buffers_cat_view&&) = default;
/// Assignment
buffer_cat_view& operator=(buffer_cat_view const&) = default;
buffers_cat_view& operator=(buffers_cat_view const&) = default;
/** Constructor
@@ -59,12 +59,12 @@ public:
of memory is not transferred.
*/
explicit
buffer_cat_view(Buffers const&... buffers);
buffers_cat_view(Buffers const&... buffers);
//-----
/// Required for @b BufferSequence
buffer_cat_view(buffer_cat_view const&) = default;
buffers_cat_view(buffers_cat_view const&) = default;
/// Required for @b BufferSequence
const_iterator
@@ -92,28 +92,28 @@ public:
also a @b MutableBufferSequence; otherwise the returned buffer
sequence will be a @b ConstBufferSequence.
@see @ref buffer_cat_view
@see @ref buffers_cat_view
*/
#if BOOST_BEAST_DOXYGEN
template<class... BufferSequence>
buffer_cat_view<BufferSequence...>
buffer_cat(BufferSequence const&... buffers)
buffers_cat_view<BufferSequence...>
buffers_cat(BufferSequence const&... buffers)
#else
template<class B1, class B2, class... Bn>
inline
buffer_cat_view<B1, B2, Bn...>
buffer_cat(B1 const& b1, B2 const& b2, Bn const&... bn)
buffers_cat_view<B1, B2, Bn...>
buffers_cat(B1 const& b1, B2 const& b2, Bn const&... bn)
#endif
{
static_assert(
detail::is_all_const_buffer_sequence<B1, B2, Bn...>::value,
"BufferSequence requirements not met");
return buffer_cat_view<B1, B2, Bn...>{b1, b2, bn...};
return buffers_cat_view<B1, B2, Bn...>{b1, b2, bn...};
}
} // beast
} // boost
#include <boost/beast/core/impl/buffer_cat.ipp>
#include <boost/beast/core/impl/buffers_cat.ipp>
#endif
@@ -7,8 +7,8 @@
// Official repository: https://github.com/boostorg/beast
//
#ifndef BOOST_BEAST_IMPL_BUFFER_CAT_IPP
#define BOOST_BEAST_IMPL_BUFFER_CAT_IPP
#ifndef BOOST_BEAST_IMPL_BUFFERS_CAT_IPP
#define BOOST_BEAST_IMPL_BUFFERS_CAT_IPP
#include <boost/beast/core/detail/type_traits.hpp>
#include <boost/asio/buffer.hpp>
@@ -25,14 +25,14 @@ namespace boost {
namespace beast {
template<class... Bn>
class buffer_cat_view<Bn...>::const_iterator
class buffers_cat_view<Bn...>::const_iterator
{
std::size_t n_;
std::tuple<Bn...> const* bn_;
std::array<char, detail::max_sizeof<
typename Bn::const_iterator...>()> buf_;
friend class buffer_cat_view<Bn...>;
friend class buffers_cat_view<Bn...>;
template<std::size_t I>
using C = std::integral_constant<std::size_t, I>;
@@ -322,14 +322,14 @@ private:
//------------------------------------------------------------------------------
template<class... Bn>
buffer_cat_view<Bn...>::
buffers_cat_view<Bn...>::
const_iterator::~const_iterator()
{
destroy(C<0>{});
}
template<class... Bn>
buffer_cat_view<Bn...>::
buffers_cat_view<Bn...>::
const_iterator::const_iterator()
: n_(sizeof...(Bn))
, bn_(nullptr)
@@ -337,7 +337,7 @@ const_iterator::const_iterator()
}
template<class... Bn>
buffer_cat_view<Bn...>::
buffers_cat_view<Bn...>::
const_iterator::const_iterator(
std::tuple<Bn...> const& bn, bool at_end)
: bn_(&bn)
@@ -349,7 +349,7 @@ const_iterator::const_iterator(
}
template<class... Bn>
buffer_cat_view<Bn...>::
buffers_cat_view<Bn...>::
const_iterator::const_iterator(const_iterator&& other)
: n_(other.n_)
, bn_(other.bn_)
@@ -358,7 +358,7 @@ const_iterator::const_iterator(const_iterator&& other)
}
template<class... Bn>
buffer_cat_view<Bn...>::
buffers_cat_view<Bn...>::
const_iterator::const_iterator(const_iterator const& other)
: n_(other.n_)
, bn_(other.bn_)
@@ -368,7 +368,7 @@ const_iterator::const_iterator(const_iterator const& other)
template<class... Bn>
auto
buffer_cat_view<Bn...>::
buffers_cat_view<Bn...>::
const_iterator::operator=(const_iterator&& other) ->
const_iterator&
{
@@ -384,7 +384,7 @@ const_iterator::operator=(const_iterator&& other) ->
template<class... Bn>
auto
buffer_cat_view<Bn...>::
buffers_cat_view<Bn...>::
const_iterator::operator=(const_iterator const& other) ->
const_iterator&
{
@@ -400,7 +400,7 @@ const_iterator&
template<class... Bn>
bool
buffer_cat_view<Bn...>::
buffers_cat_view<Bn...>::
const_iterator::operator==(const_iterator const& other) const
{
if(bn_ != other.bn_)
@@ -412,7 +412,7 @@ const_iterator::operator==(const_iterator const& other) const
template<class... Bn>
auto
buffer_cat_view<Bn...>::
buffers_cat_view<Bn...>::
const_iterator::operator*() const ->
reference
{
@@ -421,7 +421,7 @@ const_iterator::operator*() const ->
template<class... Bn>
auto
buffer_cat_view<Bn...>::
buffers_cat_view<Bn...>::
const_iterator::operator++() ->
const_iterator&
{
@@ -431,7 +431,7 @@ const_iterator::operator++() ->
template<class... Bn>
auto
buffer_cat_view<Bn...>::
buffers_cat_view<Bn...>::
const_iterator::operator++(int) ->
const_iterator
{
@@ -442,7 +442,7 @@ const_iterator::operator++(int) ->
template<class... Bn>
auto
buffer_cat_view<Bn...>::
buffers_cat_view<Bn...>::
const_iterator::operator--() ->
const_iterator&
{
@@ -452,7 +452,7 @@ const_iterator::operator--() ->
template<class... Bn>
auto
buffer_cat_view<Bn...>::
buffers_cat_view<Bn...>::
const_iterator::operator--(int) ->
const_iterator
{
@@ -464,8 +464,8 @@ const_iterator::operator--(int) ->
//------------------------------------------------------------------------------
template<class... Bn>
buffer_cat_view<Bn...>::
buffer_cat_view(Bn const&... bn)
buffers_cat_view<Bn...>::
buffers_cat_view(Bn const&... bn)
: bn_(bn...)
{
}
@@ -474,7 +474,7 @@ buffer_cat_view(Bn const&... bn)
template<class... Bn>
inline
auto
buffer_cat_view<Bn...>::begin() const ->
buffers_cat_view<Bn...>::begin() const ->
const_iterator
{
return const_iterator{bn_, false};
@@ -483,7 +483,7 @@ buffer_cat_view<Bn...>::begin() const ->
template<class... Bn>
inline
auto
buffer_cat_view<Bn...>::end() const ->
buffers_cat_view<Bn...>::end() const ->
const_iterator
{
return const_iterator{bn_, true};
+4 -4
View File
@@ -11,7 +11,7 @@
#define BOOST_BEAST_HTTP_CHUNK_ENCODE_HPP
#include <boost/beast/config.hpp>
#include <boost/beast/core/buffer_cat.hpp>
#include <boost/beast/core/buffers_cat.hpp>
#include <boost/beast/core/string.hpp>
#include <boost/beast/http/type_traits.hpp>
#include <boost/beast/http/detail/chunk_encode.hpp>
@@ -104,7 +104,7 @@ struct chunk_crlf
*/
class chunk_header
{
using view_type = buffer_cat_view<
using view_type = buffers_cat_view<
detail::chunk_size, // chunk-size
boost::asio::const_buffers_1, // chunk-extensions
chunk_crlf>; // CRLF
@@ -283,7 +283,7 @@ public:
template<class ConstBufferSequence>
class chunk_body
{
using view_type = buffer_cat_view<
using view_type = buffers_cat_view<
detail::chunk_size, // chunk-size
boost::asio::const_buffers_1, // chunk-extensions
chunk_crlf, // CRLF
@@ -466,7 +466,7 @@ class chunk_last
detail::buffers_or_fields<Trailer>::type;
using view_type =
buffer_cat_view<
buffers_cat_view<
detail::chunk_size0, // "0\r\n"
buffers_type>; // Trailer (includes CRLF)
+2 -2
View File
@@ -10,7 +10,7 @@
#ifndef BOOST_BEAST_HTTP_IMPL_FIELDS_IPP
#define BOOST_BEAST_HTTP_IMPL_FIELDS_IPP
#include <boost/beast/core/buffer_cat.hpp>
#include <boost/beast/core/buffers_cat.hpp>
#include <boost/beast/core/string.hpp>
#include <boost/beast/core/static_string.hpp>
#include <boost/beast/core/detail/buffers_ref.hpp>
@@ -142,7 +142,7 @@ public:
}
};
using view_type = buffer_cat_view<
using view_type = buffers_cat_view<
boost::asio::const_buffers_1,
boost::asio::const_buffers_1,
boost::asio::const_buffers_1,
+7 -7
View File
@@ -11,7 +11,7 @@
#define BOOST_BEAST_HTTP_SERIALIZER_HPP
#include <boost/beast/config.hpp>
#include <boost/beast/core/buffer_cat.hpp>
#include <boost/beast/core/buffers_cat.hpp>
#include <boost/beast/core/buffers_prefix.hpp>
#include <boost/beast/core/buffers_suffix.hpp>
#include <boost/beast/core/string.hpp>
@@ -120,7 +120,7 @@ private:
Fields::reader::const_buffers_type>; // header
using pcb1_t = buffers_prefix_view<cb1_t const&>;
using cb2_t = buffers_suffix<buffer_cat_view<
using cb2_t = buffers_suffix<buffers_cat_view<
typename Fields::reader::const_buffers_type,// header
typename reader::const_buffers_type>>; // body
using pcb2_t = buffers_prefix_view<cb2_t const&>;
@@ -129,7 +129,7 @@ private:
typename reader::const_buffers_type>; // body
using pcb3_t = buffers_prefix_view<cb3_t const&>;
using cb4_t = buffers_suffix<buffer_cat_view<
using cb4_t = buffers_suffix<buffers_cat_view<
typename Fields::reader::const_buffers_type,// header
detail::chunk_size, // chunk-size
boost::asio::const_buffers_1, // chunk-ext
@@ -138,7 +138,7 @@ private:
chunk_crlf>>; // crlf
using pcb4_t = buffers_prefix_view<cb4_t const&>;
using cb5_t = buffers_suffix<buffer_cat_view<
using cb5_t = buffers_suffix<buffers_cat_view<
detail::chunk_size, // chunk-header
boost::asio::const_buffers_1, // chunk-ext
chunk_crlf, // crlf
@@ -146,7 +146,7 @@ private:
chunk_crlf>>; // crlf
using pcb5_t = buffers_prefix_view<cb5_t const&>;
using cb6_t = buffers_suffix<buffer_cat_view<
using cb6_t = buffers_suffix<buffers_cat_view<
detail::chunk_size, // chunk-header
boost::asio::const_buffers_1, // chunk-size
chunk_crlf, // crlf
@@ -157,7 +157,7 @@ private:
chunk_crlf>>; // crlf
using pcb6_t = buffers_prefix_view<cb6_t const&>;
using cb7_t = buffers_suffix<buffer_cat_view<
using cb7_t = buffers_suffix<buffers_cat_view<
typename Fields::reader::const_buffers_type,// header
detail::chunk_size, // chunk-size
boost::asio::const_buffers_1, // chunk-ext
@@ -169,7 +169,7 @@ private:
chunk_crlf>>; // crlf
using pcb7_t = buffers_prefix_view<cb7_t const&>;
using cb8_t = buffers_suffix<buffer_cat_view<
using cb8_t = buffers_suffix<buffers_cat_view<
boost::asio::const_buffers_1, // chunk-final
boost::asio::const_buffers_1, // trailers
chunk_crlf>>; // crlf
+1 -1
View File
@@ -11,7 +11,7 @@
#define BOOST_BEAST_HTTP_WRITE_HPP
#include <boost/beast/config.hpp>
#include <boost/beast/core/buffer_cat.hpp>
#include <boost/beast/core/buffers_cat.hpp>
#include <boost/beast/core/buffers_suffix.hpp>
#include <boost/beast/core/multi_buffer.hpp>
#include <boost/beast/http/message.hpp>
@@ -18,7 +18,7 @@
#include <boost/beast/http/read.hpp>
#include <boost/beast/http/write.hpp>
#include <boost/beast/http/rfc7230.hpp>
#include <boost/beast/core/buffer_cat.hpp>
#include <boost/beast/core/buffers_cat.hpp>
#include <boost/beast/core/buffers_prefix.hpp>
#include <boost/beast/core/buffers_suffix.hpp>
#include <boost/beast/core/flat_static_buffer.hpp>
+11 -11
View File
@@ -11,7 +11,7 @@
#define BOOST_BEAST_WEBSOCKET_IMPL_WRITE_IPP
#include <boost/beast/core/bind_handler.hpp>
#include <boost/beast/core/buffer_cat.hpp>
#include <boost/beast/core/buffers_cat.hpp>
#include <boost/beast/core/buffers_prefix.hpp>
#include <boost/beast/core/buffers_suffix.hpp>
#include <boost/beast/core/handler_ptr.hpp>
@@ -246,7 +246,7 @@ operator()(
// Send frame
BOOST_ASIO_CORO_YIELD
boost::asio::async_write(ws_.stream_,
buffer_cat(ws_.wr_fb_.data(), cb_),
buffers_cat(ws_.wr_fb_.data(), cb_),
std::move(*this));
if(! ws_.check_ok(ec))
goto upcall;
@@ -271,7 +271,7 @@ operator()(
// Send frame
BOOST_ASIO_CORO_YIELD
boost::asio::async_write(
ws_.stream_, buffer_cat(
ws_.stream_, buffers_cat(
ws_.wr_fb_.data(), buffers_prefix(
clamp(fh_.len), cb_)),
std::move(*this));
@@ -320,7 +320,7 @@ operator()(
// Send frame header and partial payload
BOOST_ASIO_CORO_YIELD
boost::asio::async_write(
ws_.stream_, buffer_cat(ws_.wr_fb_.data(),
ws_.stream_, buffers_cat(ws_.wr_fb_.data(),
buffer(ws_.wr_buf_.get(), n)),
std::move(*this));
if(! ws_.check_ok(ec))
@@ -371,7 +371,7 @@ operator()(
// Send frame
BOOST_ASIO_CORO_YIELD
boost::asio::async_write(ws_.stream_,
buffer_cat(ws_.wr_fb_.data(),
buffers_cat(ws_.wr_fb_.data(),
buffer(ws_.wr_buf_.get(), n)),
std::move(*this));
if(! ws_.check_ok(ec))
@@ -435,7 +435,7 @@ operator()(
// Send frame
BOOST_ASIO_CORO_YIELD
boost::asio::async_write(ws_.stream_,
buffer_cat(ws_.wr_fb_.data(),
buffers_cat(ws_.wr_fb_.data(),
mutable_buffers_1{b}), std::move(*this));
if(! ws_.check_ok(ec))
goto upcall;
@@ -580,7 +580,7 @@ write_some(bool fin,
flat_static_buffer_base>(fh_buf, fh);
wr_cont_ = ! fin;
boost::asio::write(stream_,
buffer_cat(fh_buf.data(), b), ec);
buffers_cat(fh_buf.data(), b), ec);
if(! check_ok(ec))
return bytes_transferred;
if(! more)
@@ -607,7 +607,7 @@ write_some(bool fin,
flat_static_buffer_base>(fh_buf, fh);
wr_cont_ = ! fin;
boost::asio::write(stream_,
buffer_cat(fh_buf.data(), buffers), ec);
buffers_cat(fh_buf.data(), buffers), ec);
if(! check_ok(ec))
return bytes_transferred;
bytes_transferred += remain;
@@ -629,7 +629,7 @@ write_some(bool fin,
flat_static_buffer_base>(fh_buf, fh);
wr_cont_ = ! fin;
boost::asio::write(stream_,
buffer_cat(fh_buf.data(),
buffers_cat(fh_buf.data(),
buffers_prefix(n, cb)), ec);
if(! check_ok(ec))
return bytes_transferred;
@@ -663,7 +663,7 @@ write_some(bool fin,
detail::mask_inplace(b, key);
wr_cont_ = ! fin;
boost::asio::write(stream_,
buffer_cat(fh_buf.data(), b), ec);
buffers_cat(fh_buf.data(), b), ec);
if(! check_ok(ec))
return bytes_transferred;
bytes_transferred += n;
@@ -705,7 +705,7 @@ write_some(bool fin,
detail::write<
flat_static_buffer_base>(fh_buf, fh);
boost::asio::write(stream_,
buffer_cat(fh_buf.data(), b), ec);
buffers_cat(fh_buf.data(), b), ec);
if(! check_ok(ec))
return bytes_transferred;
bytes_transferred += n;