forked from boostorg/beast
Rename to static_buffer, static_buffer_n (API Change):
These classes are renamed: * static_streambuf to static_buffer * static_streambuf_n to static_buffer_n
This commit is contained in:
1 parent
6e47e9a0ac
commit
aa9f42cd06
14 files changed
+82
-81
No files matched your search
+15
-16
@@ -5,8 +5,8 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_IMPL_STATIC_STREAMBUF_IPP
|
||||
#define BEAST_IMPL_STATIC_STREAMBUF_IPP
|
||||
#ifndef BEAST_IMPL_STATIC_BUFFER_IPP
|
||||
#define BEAST_IMPL_STATIC_BUFFER_IPP
|
||||
|
||||
#include <beast/core/detail/type_traits.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
namespace beast {
|
||||
|
||||
class static_streambuf::const_buffers_type
|
||||
class static_buffer::const_buffers_type
|
||||
{
|
||||
std::size_t n_;
|
||||
std::uint8_t const* p_;
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
end() const;
|
||||
|
||||
private:
|
||||
friend class static_streambuf;
|
||||
friend class static_buffer;
|
||||
|
||||
const_buffers_type(
|
||||
std::uint8_t const* p, std::size_t n)
|
||||
@@ -50,7 +50,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
class static_streambuf::const_buffers_type::const_iterator
|
||||
class static_buffer::const_buffers_type::const_iterator
|
||||
{
|
||||
std::size_t n_ = 0;
|
||||
std::uint8_t const* p_ = nullptr;
|
||||
@@ -133,7 +133,7 @@ private:
|
||||
|
||||
inline
|
||||
auto
|
||||
static_streambuf::const_buffers_type::begin() const ->
|
||||
static_buffer::const_buffers_type::begin() const ->
|
||||
const_iterator
|
||||
{
|
||||
return const_iterator{p_, n_};
|
||||
@@ -141,7 +141,7 @@ static_streambuf::const_buffers_type::begin() const ->
|
||||
|
||||
inline
|
||||
auto
|
||||
static_streambuf::const_buffers_type::end() const ->
|
||||
static_buffer::const_buffers_type::end() const ->
|
||||
const_iterator
|
||||
{
|
||||
return const_iterator{p_ + n_, n_};
|
||||
@@ -149,7 +149,7 @@ static_streambuf::const_buffers_type::end() const ->
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class static_streambuf::mutable_buffers_type
|
||||
class static_buffer::mutable_buffers_type
|
||||
{
|
||||
std::size_t n_;
|
||||
std::uint8_t* p_;
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
end() const;
|
||||
|
||||
private:
|
||||
friend class static_streambuf;
|
||||
friend class static_buffer;
|
||||
|
||||
mutable_buffers_type(
|
||||
std::uint8_t* p, std::size_t n)
|
||||
@@ -182,7 +182,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
class static_streambuf::mutable_buffers_type::const_iterator
|
||||
class static_buffer::mutable_buffers_type::const_iterator
|
||||
{
|
||||
std::size_t n_ = 0;
|
||||
std::uint8_t* p_ = nullptr;
|
||||
@@ -264,7 +264,7 @@ private:
|
||||
|
||||
inline
|
||||
auto
|
||||
static_streambuf::mutable_buffers_type::begin() const ->
|
||||
static_buffer::mutable_buffers_type::begin() const ->
|
||||
const_iterator
|
||||
{
|
||||
return const_iterator{p_, n_};
|
||||
@@ -272,7 +272,7 @@ static_streambuf::mutable_buffers_type::begin() const ->
|
||||
|
||||
inline
|
||||
auto
|
||||
static_streambuf::mutable_buffers_type::end() const ->
|
||||
static_buffer::mutable_buffers_type::end() const ->
|
||||
const_iterator
|
||||
{
|
||||
return const_iterator{p_ + n_, n_};
|
||||
@@ -280,10 +280,9 @@ static_streambuf::mutable_buffers_type::end() const ->
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
inline
|
||||
auto
|
||||
static_streambuf::data() const ->
|
||||
static_buffer::data() const ->
|
||||
const_buffers_type
|
||||
{
|
||||
return const_buffers_type{in_,
|
||||
@@ -292,12 +291,12 @@ static_streambuf::data() const ->
|
||||
|
||||
inline
|
||||
auto
|
||||
static_streambuf::prepare(std::size_t n) ->
|
||||
static_buffer::prepare(std::size_t n) ->
|
||||
mutable_buffers_type
|
||||
{
|
||||
if(n > static_cast<std::size_t>(end_ - out_))
|
||||
throw detail::make_exception<std::length_error>(
|
||||
"no space in static_buffer", __FILE__, __LINE__);
|
||||
"static_buffer overflow", __FILE__, __LINE__);
|
||||
last_ = out_ + n;
|
||||
return mutable_buffers_type{out_, n};
|
||||
}
|
||||
@@ -5,8 +5,8 @@
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef BEAST_STATIC_STREAMBUF_HPP
|
||||
#define BEAST_STATIC_STREAMBUF_HPP
|
||||
#ifndef BEAST_STATIC_BUFFER_HPP
|
||||
#define BEAST_STATIC_BUFFER_HPP
|
||||
|
||||
#include <beast/config.hpp>
|
||||
#include <boost/utility/base_from_member.hpp>
|
||||
@@ -16,17 +16,17 @@
|
||||
|
||||
namespace beast {
|
||||
|
||||
/** A @b `DynamicBuffer` with a fixed size internal buffer.
|
||||
/** A @b DynamicBuffer with a fixed size internal buffer.
|
||||
|
||||
Ownership of the underlying storage belongs to the derived class.
|
||||
|
||||
@note Variables are usually declared using the template class
|
||||
@ref static_streambuf_n; however, to reduce the number of instantiations
|
||||
@ref static_buffer_n; however, to reduce the number of instantiations
|
||||
of template functions receiving static stream buffer arguments in a
|
||||
deduced context, the signature of the receiving function should use
|
||||
@ref static_streambuf.
|
||||
@ref static_buffer.
|
||||
*/
|
||||
class static_streambuf
|
||||
class static_buffer
|
||||
{
|
||||
#if BEAST_DOXYGEN
|
||||
private:
|
||||
@@ -51,11 +51,11 @@ public:
|
||||
class const_buffers_type;
|
||||
class mutable_buffers_type;
|
||||
|
||||
static_streambuf(
|
||||
static_streambuf const& other) noexcept = delete;
|
||||
static_buffer(
|
||||
static_buffer const& other) noexcept = delete;
|
||||
|
||||
static_streambuf& operator=(
|
||||
static_streambuf const&) noexcept = delete;
|
||||
static_buffer& operator=(
|
||||
static_buffer const&) noexcept = delete;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -121,7 +121,7 @@ private:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
static_streambuf(std::uint8_t* p, std::size_t n)
|
||||
static_buffer(std::uint8_t* p, std::size_t n)
|
||||
{
|
||||
reset(p, n);
|
||||
}
|
||||
@@ -139,17 +139,17 @@ protected:
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** A `DynamicBuffer` with a fixed size internal buffer.
|
||||
/** A @b DynamicBuffer with a fixed size internal buffer.
|
||||
|
||||
@tparam N The number of bytes in the internal buffer.
|
||||
|
||||
@note To reduce the number of template instantiations when passing
|
||||
objects of this type in a deduced context, the signature of the
|
||||
receiving function should use `static_streambuf` instead.
|
||||
receiving function should use `static_buffer` instead.
|
||||
*/
|
||||
template<std::size_t N>
|
||||
class static_streambuf_n
|
||||
: public static_streambuf
|
||||
class static_buffer_n
|
||||
: public static_buffer
|
||||
#if ! BEAST_DOXYGEN
|
||||
, private boost::base_from_member<
|
||||
std::array<std::uint8_t, N>>
|
||||
@@ -161,23 +161,23 @@ public:
|
||||
#if BEAST_DOXYGEN
|
||||
private:
|
||||
#endif
|
||||
static_streambuf_n(
|
||||
static_streambuf_n const&) = delete;
|
||||
static_streambuf_n& operator=(
|
||||
static_streambuf_n const&) = delete;
|
||||
static_buffer_n(
|
||||
static_buffer_n const&) = delete;
|
||||
static_buffer_n& operator=(
|
||||
static_buffer_n const&) = delete;
|
||||
#if BEAST_DOXYGEN
|
||||
public:
|
||||
#endif
|
||||
|
||||
/// Construct a static stream buffer.
|
||||
static_streambuf_n()
|
||||
: static_streambuf(
|
||||
/// Construct a static buffer.
|
||||
static_buffer_n()
|
||||
: static_buffer(
|
||||
member_type::member.data(),
|
||||
member_type::member.size())
|
||||
{
|
||||
}
|
||||
|
||||
/** Reset the stream buffer.
|
||||
/** Reset the static buffer.
|
||||
|
||||
Postconditions:
|
||||
The input sequence and output sequence are empty,
|
||||
@@ -186,7 +186,7 @@ public:
|
||||
void
|
||||
reset()
|
||||
{
|
||||
static_streambuf::reset(
|
||||
static_buffer::reset(
|
||||
member_type::member.data(),
|
||||
member_type::member.size());
|
||||
}
|
||||
@@ -194,6 +194,6 @@ public:
|
||||
|
||||
} // beast
|
||||
|
||||
#include <beast/core/impl/static_streambuf.ipp>
|
||||
#include <beast/core/impl/static_buffer.ipp>
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user