diff --git a/CHANGELOG.md b/CHANGELOG.md
index 15e3562d..ee89a19e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@ Version 198:
* saved_handler maintains a work_guard (websocket)
* Add buffer_traits.hpp, buffers_type
* Tidy up experimental files
+* Tidy up core files
API Changes:
diff --git a/doc/source.dox b/doc/source.dox
index 705ab158..a9c5737f 100644
--- a/doc/source.dox
+++ b/doc/source.dox
@@ -289,9 +289,9 @@ PREDEFINED = \
BOOST_BEAST_DOXYGEN \
BOOST_BEAST_USE_POSIX_FILE=1 \
BOOST_BEAST_USE_WIN32_FILE=1 \
- BOOST_ASIO_INITFN_RESULT_TYPE(t,a)=void_or_deduced \
- GENERATING_DOCUMENTATION
-
+ BOOST_ASIO_INITFN_RESULT_TYPE(t,a)=__deduced__ \
+ GENERATING_DOCUMENTATION \
+ BOOST_BEAST_DECL
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
diff --git a/doc/xsl/class_detail.xsl b/doc/xsl/class_detail.xsl
index 5ef923f5..dab37942 100644
--- a/doc/xsl/class_detail.xsl
+++ b/doc/xsl/class_detail.xsl
@@ -9,7 +9,7 @@
class __AsyncWriteStream__
- class ``[link beast.concepts.Body [*Body]]``
+ class __Body__
class ``[link beast.concepts.BufferSequence [*BufferSequence]]``
@@ -76,24 +76,3 @@
class __WriteHandler__
-
-
-
-
- class __Protocol__
-
-
- class __Executor__
-
-
- class __EndpointSequence__
-
-
- class __RangeConnectHandler__
-
-
- class __ConnectCondition__
-
-
- class __IteratorConnectHandler__
-
diff --git a/include/boost/beast/core/buffered_read_stream.hpp b/include/boost/beast/core/buffered_read_stream.hpp
index db873854..3ad17f7e 100644
--- a/include/boost/beast/core/buffered_read_stream.hpp
+++ b/include/boost/beast/core/buffered_read_stream.hpp
@@ -31,7 +31,7 @@ namespace beast {
is part of the object.
The use-case for this class is different than that of the
- `net::buffered_readstream`. It is designed to facilitate
+ `net::buffered_read_stream`. It is designed to facilitate
the use of `net::read_until`, and to allow buffers
acquired during detection of handshakes to be made transparently
available to callers. A hypothetical implementation of the
@@ -51,9 +51,9 @@ namespace beast {
// Process the next HTTP header on the stream,
// leaving excess bytes behind for the next call.
//
- template
+ template
void process_http_message(
- buffered_read_stream& stream)
+ buffered_read_stream& stream)
{
// Read up to and including the end of the HTTP
// header, leaving the sequence in the stream's
@@ -137,28 +137,28 @@ public:
/// Get a reference to the next layer.
next_layer_type&
- next_layer()
+ next_layer() noexcept
{
return next_layer_;
}
/// Get a const reference to the next layer.
next_layer_type const&
- next_layer() const
+ next_layer() const noexcept
{
return next_layer_;
}
/// Get a reference to the lowest layer.
lowest_layer_type&
- lowest_layer()
+ lowest_layer() noexcept
{
return next_layer_.lowest_layer();
}
/// Get a const reference to the lowest layer.
lowest_layer_type const&
- lowest_layer() const
+ lowest_layer() const noexcept
{
return next_layer_.lowest_layer();
}
@@ -196,14 +196,14 @@ public:
the caller defined maximum.
*/
DynamicBuffer&
- buffer()
+ buffer() noexcept
{
return buffer_;
}
/// Access the internal buffer
DynamicBuffer const&
- buffer() const
+ buffer() const noexcept
{
return buffer_;
}
@@ -224,7 +224,7 @@ public:
than the amount of data in the buffer, no bytes are discarded.
*/
void
- capacity(std::size_t size)
+ capacity(std::size_t size) noexcept
{
capacity_ = size;
}
@@ -367,6 +367,6 @@ public:
} // beast
} // boost
-#include
+#include
#endif
diff --git a/include/boost/beast/core/buffers_adapter.hpp b/include/boost/beast/core/buffers_adapter.hpp
index 660d0db8..e545ca9a 100644
--- a/include/boost/beast/core/buffers_adapter.hpp
+++ b/include/boost/beast/core/buffers_adapter.hpp
@@ -19,11 +19,11 @@
namespace boost {
namespace beast {
-/** Adapts a @b MutableBufferSequence into a @b DynamicBuffer.
+/** Adapts a MutableBufferSequence into a DynamicBuffer.
- This class wraps a @b MutableBufferSequence to meet the requirements
- of @b DynamicBuffer. Upon construction the input and output sequences are
- empty. A copy of the mutable buffer sequence object is stored; however,
+ This class wraps a MutableBufferSequence to meet the requirements
+ of DynamicBuffer. Upon construction the input and output sequences
+ are empty. A copy of the mutable buffer sequence object is stored; however,
ownership of the underlying memory is not transferred. The caller is
responsible for making sure that referenced memory remains valid
for the duration of any operations.
@@ -36,7 +36,8 @@ namespace beast {
template
class buffers_adapter
{
- static_assert(net::is_mutable_buffer_sequence::value,
+ static_assert(net::is_mutable_buffer_sequence<
+ MutableBufferSequence>::value,
"MutableBufferSequence requirements not met");
using iter_type = typename
@@ -75,20 +76,6 @@ public:
/// The type of the underlying mutable buffer sequence
using value_type = MutableBufferSequence;
-#if BOOST_BEAST_DOXYGEN
- /// The type used to represent the input sequence as a list of buffers.
- using const_buffers_type = __implementation_defined__;
-
- /// The type used to represent the output sequence as a list of buffers.
- using mutable_buffers_type = __implementation_defined__;
-
-#else
- class const_buffers_type;
-
- class mutable_buffers_type;
-
-#endif
-
/// Move constructor.
buffers_adapter(buffers_adapter&& other);
@@ -121,27 +108,6 @@ public:
explicit
buffers_adapter(boost::in_place_init_t, Args&&... args);
- /// Returns the largest size output sequence possible.
- std::size_t
- max_size() const
- {
- return max_size_;
- }
-
- /// Get the size of the input sequence.
- std::size_t
- size() const
- {
- return in_size_;
- }
-
- /// Returns the maximum sum of the sizes of the input sequence and output sequence the buffer can hold without requiring reallocation.
- std::size_t
- capacity() const
- {
- return max_size_;
- }
-
/// Returns the original mutable buffer sequence
value_type const&
value() const
@@ -149,40 +115,112 @@ public:
return bs_;
}
- /** Get a list of buffers that represents the output sequence, with the given size.
+ //--------------------------------------------------------------------------
- @throws std::length_error if the size would exceed the limit
- imposed by the underlying mutable buffer sequence.
+#if BOOST_BEAST_DOXYGEN
+ /// The ConstBufferSequence used to represent the readable bytes.
+ using const_buffers_type = __implementation_defined__;
- @note Buffers representing the input sequence acquired prior to
- this call remain valid.
+ /// The MutableBufferSequence used to represent the writable bytes.
+ using mutable_buffers_type = __implementation_defined__;
+
+#else
+ class const_buffers_type;
+ class mutable_buffers_type;
+#endif
+
+ /// Returns the number of readable bytes.
+ std::size_t
+ size() const noexcept
+ {
+ return in_size_;
+ }
+
+ /// Return the maximum number of bytes, both readable and writable, that can ever be held.
+ std::size_t
+ max_size() const noexcept
+ {
+ return max_size_;
+ }
+
+ /// Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation.
+ std::size_t
+ capacity() const noexcept
+ {
+ return max_size_;
+ }
+
+ /// Returns a constant buffer sequence representing the readable bytes
+ const_buffers_type
+ data() const noexcept;
+
+ /** Returns a mutable buffer sequence representing writable bytes.
+
+ Returns a mutable buffer sequence representing the writable
+ bytes containing exactly `n` bytes of storage. This function
+ does not allocate memory. Instead, the storage comes from
+ the underlying mutable buffer sequence.
+
+ All buffer sequences previously obtained using @ref prepare are
+ invalidated. Buffer sequences previously obtained using @ref data
+ remain valid.
+
+ @param n The desired number of bytes in the returned buffer
+ sequence.
+
+ @throws std::length_error if `size() + n` exceeds `max_size()`.
+
+ @par Exception Safety
+
+ Strong guarantee.
*/
mutable_buffers_type
prepare(std::size_t n);
- /** Move bytes from the output sequence to the input sequence.
+ /** Append writable bytes to the readable bytes.
- @note Buffers representing the input sequence acquired prior to
- this call remain valid.
+ Appends n bytes from the start of the writable bytes to the
+ end of the readable bytes. The remainder of the writable bytes
+ are discarded. If n is greater than the number of writable
+ bytes, all writable bytes are appended to the readable bytes.
+
+ All buffer sequences previously obtained using @ref prepare are
+ invalidated. Buffer sequences previously obtained using @ref data
+ remain valid.
+
+ @param n The number of bytes to append. If this number
+ is greater than the number of writable bytes, all
+ writable bytes are appended.
+
+ @par Exception Safety
+
+ No-throw guarantee.
*/
void
- commit(std::size_t n);
+ commit(std::size_t n) noexcept;
- /** Get a list of buffers that represents the input sequence.
+ /** Remove bytes from beginning of the readable bytes.
- @note These buffers remain valid across subsequent calls to `prepare`.
+ Removes n bytes from the beginning of the readable bytes.
+
+ All buffers sequences previously obtained using
+ @ref data or @ref prepare are invalidated.
+
+ @param n The number of bytes to remove. If this number
+ is greater than the number of readable bytes, all
+ readable bytes are removed.
+
+ @par Exception Safety
+
+ No-throw guarantee.
*/
- const_buffers_type
- data() const;
-
- /// Remove bytes from the input sequence.
void
- consume(std::size_t n);
+ consume(std::size_t n) noexcept;
};
} // beast
} // boost
-#include
+#include
#endif
diff --git a/include/boost/beast/core/buffers_cat.hpp b/include/boost/beast/core/buffers_cat.hpp
index 2befd0b3..b85fedae 100644
--- a/include/boost/beast/core/buffers_cat.hpp
+++ b/include/boost/beast/core/buffers_cat.hpp
@@ -11,7 +11,7 @@
#define BOOST_BEAST_BUFFERS_CAT_HPP
#include
-#include
+#include
#include
namespace boost {
@@ -24,12 +24,12 @@ namespace beast {
template
class buffers_cat_view
{
- detail::lean_tuple bn_;
+ detail::tuple bn_;
public:
/** The type of buffer returned when dereferencing an iterator.
- If every buffer sequence in the view is a @b MutableBufferSequence,
+ If every buffer sequence in the view is a MutableBufferSequence,
then `value_type` will be `net::mutable_buffer`.
Otherwise, `value_type` will be `net::const_buffer`.
*/
@@ -43,34 +43,33 @@ public:
/// The type of iterator used by the concatenated sequence
class const_iterator;
- /// Constructor
+ /// Copy Constructor
+ buffers_cat_view(buffers_cat_view const&) = default;
+
+ /// Move Constructor
buffers_cat_view(buffers_cat_view&&) = default;
- /// Assignment
- buffers_cat_view& operator=(buffers_cat_view&&) = default;
-
- /// Assignment
+ /// Copy Assignment
buffers_cat_view& operator=(buffers_cat_view const&) = default;
+ /// Move Assignment
+ buffers_cat_view& operator=(buffers_cat_view&&) = default;
+
/** Constructor
@param buffers The list of buffer sequences to concatenate.
- Copies of the arguments will be made; however, the ownership
- of memory is not transferred.
+ Copies of the arguments will be maintained for the lifetime
+ of the concatenated sequence; however, the ownership of memory
+ is not transferred.
*/
explicit
buffers_cat_view(Buffers const&... buffers);
- //-----
-
- /// Required for @b BufferSequence
- buffers_cat_view(buffers_cat_view const&) = default;
-
- /// Required for @b BufferSequence
+ /// Returns an iterator to the first buffer in the sequence
const_iterator
begin() const;
- /// Required for @b BufferSequence
+ /// Returns an iterator to one past the last buffer in the sequence
const_iterator
end() const;
};
@@ -88,9 +87,9 @@ public:
@return A new buffer sequence that represents the concatenation of
the input buffer sequences. This buffer sequence will be a
- @b MutableBufferSequence if each of the passed buffer sequences is
- also a @b MutableBufferSequence; otherwise the returned buffer
- sequence will be a @b ConstBufferSequence.
+ MutableBufferSequence if each of the passed buffer sequences is
+ also a MutableBufferSequence; otherwise the returned buffer
+ sequence will be a ConstBufferSequence.
@see @ref buffers_cat_view
*/
@@ -100,7 +99,6 @@ buffers_cat_view
buffers_cat(BufferSequence const&... buffers)
#else
template
-inline
buffers_cat_view
buffers_cat(B1 const& b1, B2 const& b2, Bn const&... bn)
#endif
@@ -114,6 +112,6 @@ buffers_cat(B1 const& b1, B2 const& b2, Bn const&... bn)
} // beast
} // boost
-#include
+#include
#endif
diff --git a/include/boost/beast/core/buffers_prefix.hpp b/include/boost/beast/core/buffers_prefix.hpp
index e85596fa..003c0e79 100644
--- a/include/boost/beast/core/buffers_prefix.hpp
+++ b/include/boost/beast/core/buffers_prefix.hpp
@@ -13,7 +13,8 @@
#include
#include
#include
-#include
+#include // for in_place_init_t
+#include
#include
#include
@@ -73,16 +74,16 @@ public:
#endif
- /// Move constructor.
+ /// Move Constructor
buffers_prefix_view(buffers_prefix_view&&);
- /// Copy constructor.
+ /// Copy Constructor
buffers_prefix_view(buffers_prefix_view const&);
- /// Move assignment.
+ /// Move Assignment
buffers_prefix_view& operator=(buffers_prefix_view&&);
- /// Copy assignment.
+ /// Copy Assignment
buffers_prefix_view& operator=(buffers_prefix_view const&);
/** Construct a buffer sequence prefix.
@@ -94,7 +95,8 @@ public:
@param buffers The buffer sequence to adapt. A copy of
the sequence will be made, but ownership of the underlying
- memory is not transferred.
+ memory is not transferred. The copy is maintained for
+ the lifetime of the view.
*/
buffers_prefix_view(
std::size_t size,
@@ -115,96 +117,117 @@ public:
boost::in_place_init_t,
Args&&... args);
- /// Get a bidirectional iterator to the first element.
+ /// Returns an iterator to the first buffer in the sequence
const_iterator
begin() const;
- /// Get a bidirectional iterator to one past the last element.
+ /// Returns an iterator to one past the last buffer in the sequence
const_iterator
end() const;
};
+//------------------------------------------------------------------------------
+
/** Returns a prefix of a constant buffer.
- The returned buffer points to the same memory as the
- passed buffer, but with a size that is equal to or less
- than the size of the original buffer.
+ The returned buffer points to the same memory as the passed
+ buffer, but with a size that is equal to or smaller.
- @param size The size of the returned buffer.
+ @param size The maximum size of the returned buffer in bytes. If
+ this is greater than or equal to the size of the passed buffer,
+ the result will have the same size as the original buffer.
- @param buffer The buffer to shorten. The underlying
- memory is not modified.
+ @param buffer The buffer to return a prefix for. The
+ underlying memory is not modified, and ownership of the
+ memory is not transferred.
- @return A new buffer that points to the first `size`
- bytes of the original buffer.
+ @return A constant buffer that represents the prefix of
+ the original buffer.
+
+ @par Exception Safety
+
+ No-throw guarantee.
*/
inline
net::const_buffer
buffers_prefix(std::size_t size,
- net::const_buffer buffer)
+ net::const_buffer buffer) noexcept
{
- return {buffer.data(),
- (std::min)(size, buffer.size())};
+ return {buffer.data(), std::min<
+ std::size_t>(size, buffer.size())};
}
/** Returns a prefix of a mutable buffer.
- The returned buffer points to the same memory as the
- passed buffer, but with a size that is equal to or less
- than the size of the original buffer.
+ The returned buffer points to the same memory as the passed
+ buffer, but with a size that is equal to or smaller.
- @param size The size of the returned buffer.
+ @param size The maximum size of the returned buffer in bytes. If
+ this is greater than or equal to the size of the passed buffer,
+ the result will have the same size as the original buffer.
- @param buffer The buffer to shorten. The underlying
- memory is not modified.
+ @param buffer The buffer to return a prefix for. The
+ underlying memory is not modified, and ownership of the
+ memory is not transferred.
- @return A new buffer that points to the first `size` bytes
- of the original buffer.
+ @return A mutable buffer that represents the prefix of
+ the original buffer.
*/
inline
net::mutable_buffer
buffers_prefix(std::size_t size,
- net::mutable_buffer buffer)
+ net::mutable_buffer buffer) noexcept
{
- return {buffer.data(),
- (std::min)(size, buffer.size())};
+ return {buffer.data(), std::min<
+ std::size_t>(size, buffer.size())};
}
-/** Returns a prefix of a buffer sequence.
+/** Returns a prefix of a constant or mutable buffer sequence.
- This function returns a new buffer sequence which when iterated,
- presents a shorter subset of the original list of buffers starting
- with the first byte of the original sequence.
+ The returned buffer sequence points to the same memory as the
+ passed buffer sequence, but with a size that is equal to or
+ smaller. No memory allocations are performed; the resulting
+ sequence is calculated as a lazy range.
- @param size The maximum number of bytes in the wrapped
- sequence. If this is larger than the size of passed,
- buffers, the resulting sequence will represent the
- entire input sequence.
+ @param size The maximum size of the returned buffer sequence
+ in bytes. If this is greater than or equal to the size of
+ the passed buffer sequence, the result will have the same
+ size as the original buffer sequence.
- @param buffers An instance of @b ConstBufferSequence or
- @b MutableBufferSequence to adapt. A copy of the sequence
- will be made, but ownership of the underlying memory is
- not transferred.
+ @param buffers An object whose type meets the requirements
+ of ConstBufferSequence. The returned value will
+ maintain a copy of the passed buffers for its lifetime;
+ however, ownership of the underlying memory is not
+ transferred.
+
+ @return A constant buffer sequence that represents the prefix
+ of the original buffer sequence. If the original buffer sequence
+ also meets the requirements of MutableBufferSequence,
+ then the returned value will also be a mutable buffer sequence.
+
+ @note This function does not participate in overload resolution
+ if `buffers` is convertible to either `net::const_buffer` or
+ `net::mutable_buffer`.
*/
-template
+template
#if BOOST_BEAST_DOXYGEN
-buffers_prefix_view
+buffers_prefix_view
#else
inline
typename std::enable_if<
- ! std::is_same::value &&
- ! std::is_same::value,
- buffers_prefix_view>::type
+ buffers_prefix_view>::type
#endif
-buffers_prefix(std::size_t size, BufferSequence const& buffers)
+buffers_prefix(std::size_t size, ConstBufferSequence const& buffers)
{
static_assert(
- net::is_const_buffer_sequence::value ||
- net::is_mutable_buffer_sequence::value,
- "BufferSequence requirements not met");
- return buffers_prefix_view(size, buffers);
+ net::is_const_buffer_sequence::value ||
+ net::is_mutable_buffer_sequence::value,
+ "ConstBufferSequence requirements not met");
+ return buffers_prefix_view(size, buffers);
}
/** Returns the first buffer in a buffer sequence
@@ -234,6 +257,6 @@ buffers_front(BufferSequence const& buffers)
} // beast
} // boost
-#include
+#include
#endif
diff --git a/include/boost/beast/core/buffers_range.hpp b/include/boost/beast/core/buffers_range.hpp
index 3eb24492..1e6bcd69 100644
--- a/include/boost/beast/core/buffers_range.hpp
+++ b/include/boost/beast/core/buffers_range.hpp
@@ -18,7 +18,7 @@
namespace boost {
namespace beast {
-/** Return a range representing a const or mutable buffer sequence.
+/** Returns an iterable range representing a buffer sequence.
This function returns an iterable range representing the
passed buffer sequence. The values obtained when iterating
@@ -51,7 +51,7 @@ namespace beast {
the lifetime of the returned range.
@return An object of unspecified type, meeting the requirements of
- @em ConstBufferSequence, or @em MutableBufferSequence if `buffers`
+ ConstBufferSequence, and also @em MutableBufferSequence if `buffers`
is a mutable buffer sequence.
*/
/** @{ */
diff --git a/include/boost/beast/core/buffers_suffix.hpp b/include/boost/beast/core/buffers_suffix.hpp
index 101b8d2a..61ea1f77 100644
--- a/include/boost/beast/core/buffers_suffix.hpp
+++ b/include/boost/beast/core/buffers_suffix.hpp
@@ -21,12 +21,12 @@
namespace boost {
namespace beast {
-/** Adapter to trim the front of a `BufferSequence`.
+/** Adaptor to progressively trim the front of a BufferSequence.
- This adapter wraps a buffer sequence to create a new sequence
+ This adaptor wraps a buffer sequence to create a new sequence
which may be incrementally consumed. Bytes consumed are removed
from the front of the buffer. The underlying memory is not changed,
- instead the adapter efficiently iterates through a subset of
+ instead the adaptor efficiently iterates through a subset of
the buffers wrapped.
The wrapped buffer is not modified, a copy is made instead.
@@ -104,10 +104,7 @@ public:
/// Constructor
buffers_suffix();
- /// Constructor
- buffers_suffix(buffers_suffix&&);
-
- /// Constructor
+ /// Copy Constructor
buffers_suffix(buffers_suffix const&);
/** Constructor
@@ -128,9 +125,6 @@ public:
template
buffers_suffix(boost::in_place_init_t, Args&&... args);
- /// Assignment
- buffers_suffix& operator=(buffers_suffix&&);
-
/// Assignment
buffers_suffix& operator=(buffers_suffix const&);
@@ -155,6 +149,6 @@ public:
} // beast
} // boost
-#include
+#include
#endif
diff --git a/include/boost/beast/core/buffers_to_string.hpp b/include/boost/beast/core/buffers_to_string.hpp
index 726342c2..8aed006c 100644
--- a/include/boost/beast/core/buffers_to_string.hpp
+++ b/include/boost/beast/core/buffers_to_string.hpp
@@ -48,8 +48,9 @@ buffers_to_string(ConstBufferSequence const& buffers)
net::is_const_buffer_sequence::value,
"ConstBufferSequence requirements not met");
std::string result;
- result.reserve(net::buffer_size(buffers));
- for(auto const buffer : buffers_range(std::ref(buffers)))
+ using net::buffer_size;
+ result.reserve(buffer_size(buffers));
+ for(auto const buffer : beast::buffers_range(std::ref(buffers)))
result.append(static_cast(
buffer.data()), buffer.size());
return result;
diff --git a/include/boost/beast/core/detail/base64.hpp b/include/boost/beast/core/detail/base64.hpp
index 6cb3f67a..735da0f3 100644
--- a/include/boost/beast/core/detail/base64.hpp
+++ b/include/boost/beast/core/detail/base64.hpp
@@ -34,12 +34,12 @@
3. This notice may not be removed or altered from any source distribution.
Rene Nyffenegger rene.nyffenegger@adp-gmbh.ch
-
*/
#ifndef BOOST_BEAST_DETAIL_BASE64_HPP
#define BOOST_BEAST_DETAIL_BASE64_HPP
+#include
#include
#include
#include
@@ -55,7 +55,10 @@ char const*
get_alphabet()
{
static char constexpr tab[] = {
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
+ "ABCDEFGHIJKLMNOP"
+ "QRSTUVWXYZabcdef"
+ "ghijklmnopqrstuv"
+ "wxyz0123456789+/"
};
return &tab[0];
}
@@ -115,7 +118,7 @@ decoded_size(std::size_t n)
@return The number of characters written to `out`. This
will exclude any null termination.
*/
-template
+inline
std::size_t
encode(void* dest, void const* src, std::size_t len)
{
@@ -166,7 +169,7 @@ encode(void* dest, void const* src, std::size_t len)
the number of characters read from the input string,
expressed as a pair.
*/
-template
+inline
std::pair
decode(void* dest, char const* src, std::size_t len)
{
@@ -213,9 +216,10 @@ decode(void* dest, char const* src, std::size_t len)
} // base64
-template
+inline
std::string
-base64_encode (std::uint8_t const* data,
+base64_encode(
+ std::uint8_t const* data,
std::size_t len)
{
std::string dest;
@@ -226,7 +230,7 @@ base64_encode (std::uint8_t const* data,
inline
std::string
-base64_encode(std::string const& s)
+base64_encode(string_view s)
{
return base64_encode (reinterpret_cast <
std::uint8_t const*> (s.data()), s.size());
@@ -234,7 +238,7 @@ base64_encode(std::string const& s)
template
std::string
-base64_decode(std::string const& data)
+base64_decode(string_view data)
{
std::string dest;
dest.resize(base64::decoded_size(data.size()));
diff --git a/include/boost/beast/core/detail/bind_handler.hpp b/include/boost/beast/core/detail/bind_handler.hpp
index 42806487..411f8550 100644
--- a/include/boost/beast/core/detail/bind_handler.hpp
+++ b/include/boost/beast/core/detail/bind_handler.hpp
@@ -11,18 +11,18 @@
#define BOOST_BEAST_DETAIL_BIND_HANDLER_HPP
#include
-#include
+#include
#include
#include
+#include
#include
#include
#include
#include
#include
#include
-#include
-
#include
+#include
namespace boost {
namespace beast {
@@ -31,7 +31,7 @@ namespace detail {
template
class bind_wrapper
{
- using args_type = detail::lean_tuple<
+ using args_type = detail::tuple<
typename std::decay::type...>;
Handler h_;
@@ -94,7 +94,7 @@ class bind_wrapper
invoke(
Handler& h,
ArgsTuple& args,
- lean_tuple<>&&,
+ tuple<>&&,
mp11::index_sequence)
{
boost::ignore_unused(args);
@@ -122,9 +122,6 @@ class bind_wrapper
public:
using result_type = void;
- using allocator_type =
- net::associated_allocator_t;
-
bind_wrapper(bind_wrapper&&) = default;
bind_wrapper(bind_wrapper const&) = default;
@@ -137,47 +134,76 @@ public:
{
}
- allocator_type
- get_allocator() const noexcept
- {
- return (net::get_associated_allocator)(h_);
- }
-
- friend
- bool
- asio_handler_is_continuation(bind_wrapper* w)
- {
- using net::asio_handler_is_continuation;
- return asio_handler_is_continuation(std::addressof(w->h_));
- }
-
- template
- friend
- void asio_handler_invoke(Function&& f, bind_wrapper* w)
- {
- using net::asio_handler_invoke;
- asio_handler_invoke(f, std::addressof(w->h_));
- }
-
template
void
operator()(Values&&... values)
{
invoke(h_, args_,
- lean_tuple(
+ tuple(
std::forward(values)...),
mp11::index_sequence_for());
}
+ // VFALCO I don't think this should be needed,
+ // please let me know if something breaks.
+ /*
template
void
operator()(Values&&... values) const
{
invoke(h_, args_,
- lean_tuple(
+ tuple(
std::forward(values)...),
mp11::index_sequence_for());
}
+ */
+
+ //
+
+ using allocator_type =
+ net::associated_allocator_t;
+
+ allocator_type
+ get_allocator() const noexcept
+ {
+ return net::get_associated_allocator(h_);
+ }
+
+ template
+ friend
+ void asio_handler_invoke(
+ Function&& f, bind_wrapper* w)
+ {
+ using net::asio_handler_invoke;
+ asio_handler_invoke(f, std::addressof(w->h_));
+ }
+
+ friend
+ void* asio_handler_allocate(
+ std::size_t size, bind_wrapper* op)
+ {
+ using net::asio_handler_allocate;
+ return asio_handler_allocate(
+ size, std::addressof(op->h_));
+ }
+
+ friend
+ void asio_handler_deallocate(
+ void* p, std::size_t size, bind_wrapper* op)
+ {
+ using net::asio_handler_deallocate;
+ asio_handler_deallocate(
+ p, size, std::addressof(op->h_));
+ }
+
+ friend
+ bool asio_handler_is_continuation(
+ bind_wrapper* op)
+ {
+ using net::asio_handler_is_continuation;
+ return asio_handler_is_continuation(
+ std::addressof(op->h_));
+ }
};
//------------------------------------------------------------------------------
@@ -199,9 +225,6 @@ class bind_front_wrapper
public:
using result_type = void;
- using allocator_type =
- net::associated_allocator_t;
-
bind_front_wrapper(bind_front_wrapper&&) = default;
bind_front_wrapper(bind_front_wrapper const&) = default;
@@ -212,32 +235,57 @@ public:
{
}
+ template
+ void operator()(Ts&&... ts)
+ {
+ h_(std::forward(ts)...);
+ }
+
+ //
+
+ using allocator_type =
+ net::associated_allocator_t;
+
allocator_type
get_allocator() const noexcept
{
return net::get_associated_allocator(h_);
}
- friend
- bool
- asio_handler_is_continuation(bind_front_wrapper* w)
- {
- using net::asio_handler_is_continuation;
- return asio_handler_is_continuation(std::addressof(w->h_));
- }
-
template
friend
- void asio_handler_invoke(Function&& f, bind_front_wrapper* w)
+ void asio_handler_invoke(
+ Function&& f, bind_front_wrapper* w)
{
using net::asio_handler_invoke;
asio_handler_invoke(f, std::addressof(w->h_));
}
- template
- void operator()(Ts&&... ts)
+ friend
+ void* asio_handler_allocate(
+ std::size_t size, bind_front_wrapper* op)
{
- h_(std::forward(ts)...);
+ using net::asio_handler_allocate;
+ return asio_handler_allocate(
+ size, std::addressof(op->h_));
+ }
+
+ friend
+ void asio_handler_deallocate(
+ void* p, std::size_t size, bind_front_wrapper* op)
+ {
+ using net::asio_handler_deallocate;
+ asio_handler_deallocate(
+ p, size, std::addressof(op->h_));
+ }
+
+ friend
+ bool asio_handler_is_continuation(
+ bind_front_wrapper* op)
+ {
+ using net::asio_handler_is_continuation;
+ return asio_handler_is_continuation(
+ std::addressof(op->h_));
}
};
@@ -256,9 +304,6 @@ class bind_front_wrapper
public:
using result_type = void;
- using allocator_type =
- net::associated_allocator_t;
-
bind_front_wrapper(bind_front_wrapper&&) = default;
bind_front_wrapper(bind_front_wrapper const&) = default;
@@ -270,33 +315,58 @@ public:
{
}
+ template
+ void operator()(Ts&&... ts)
+ {
+ h_( std::forward(arg_),
+ std::forward(ts)...);
+ }
+
+ //
+
+ using allocator_type =
+ net::associated_allocator_t;
+
allocator_type
get_allocator() const noexcept
{
return net::get_associated_allocator(h_);
}
- friend
- bool
- asio_handler_is_continuation(bind_front_wrapper* w)
- {
- using net::asio_handler_is_continuation;
- return asio_handler_is_continuation(std::addressof(w->h_));
- }
-
template
friend
- void asio_handler_invoke(Function&& f, bind_front_wrapper* w)
+ void asio_handler_invoke(
+ Function&& f, bind_front_wrapper* w)
{
using net::asio_handler_invoke;
asio_handler_invoke(f, std::addressof(w->h_));
}
- template
- void operator()(Ts&&... ts)
+ friend
+ void* asio_handler_allocate(
+ std::size_t size, bind_front_wrapper* op)
{
- h_( std::forward(arg_),
- std::forward(ts)...);
+ using net::asio_handler_allocate;
+ return asio_handler_allocate(
+ size, std::addressof(op->h_));
+ }
+
+ friend
+ void asio_handler_deallocate(
+ void* p, std::size_t size, bind_front_wrapper* op)
+ {
+ using net::asio_handler_deallocate;
+ asio_handler_deallocate(
+ p, size, std::addressof(op->h_));
+ }
+
+ friend
+ bool asio_handler_is_continuation(
+ bind_front_wrapper* op)
+ {
+ using net::asio_handler_is_continuation;
+ return asio_handler_is_continuation(
+ std::addressof(op->h_));
}
};
@@ -316,9 +386,6 @@ class bind_front_wrapper
public:
using result_type = void;
- using allocator_type =
- net::associated_allocator_t;
-
bind_front_wrapper(bind_front_wrapper&&) = default;
bind_front_wrapper(bind_front_wrapper const&) = default;
@@ -331,28 +398,6 @@ public:
{
}
- allocator_type
- get_allocator() const noexcept
- {
- return net::get_associated_allocator(h_);
- }
-
- friend
- bool
- asio_handler_is_continuation(bind_front_wrapper* w)
- {
- using net::asio_handler_is_continuation;
- return asio_handler_is_continuation(std::addressof(w->h_));
- }
-
- template
- friend
- void asio_handler_invoke(Function&& f, bind_front_wrapper* w)
- {
- using net::asio_handler_invoke;
- asio_handler_invoke(f, std::addressof(w->h_));
- }
-
template
void operator()(Ts&&... ts)
{
@@ -360,6 +405,53 @@ public:
std::forward(arg2_),
std::forward(ts)...);
}
+
+ //
+
+ using allocator_type =
+ net::associated_allocator_t;
+
+ allocator_type
+ get_allocator() const noexcept
+ {
+ return net::get_associated_allocator(h_);
+ }
+
+ template
+ friend
+ void asio_handler_invoke(
+ Function&& f, bind_front_wrapper* w)
+ {
+ using net::asio_handler_invoke;
+ asio_handler_invoke(f, std::addressof(w->h_));
+ }
+
+ friend
+ void* asio_handler_allocate(
+ std::size_t size, bind_front_wrapper* op)
+ {
+ using net::asio_handler_allocate;
+ return asio_handler_allocate(
+ size, std::addressof(op->h_));
+ }
+
+ friend
+ void asio_handler_deallocate(
+ void* p, std::size_t size, bind_front_wrapper* op)
+ {
+ using net::asio_handler_deallocate;
+ asio_handler_deallocate(
+ p, size, std::addressof(op->h_));
+ }
+
+ friend
+ bool asio_handler_is_continuation(
+ bind_front_wrapper* op)
+ {
+ using net::asio_handler_is_continuation;
+ return asio_handler_is_continuation(
+ std::addressof(op->h_));
+ }
};
// 3+ arg specialization
@@ -367,7 +459,7 @@ template
class bind_front_wrapper
{
- using args_type = lean_tuple<
+ using args_type = tuple<
typename std::decay::type,
typename std::decay::type,
typename std::decay::type,
@@ -394,9 +486,6 @@ class bind_front_wrapper
public:
using result_type = void;
- using allocator_type =
- net::associated_allocator_t;
-
bind_front_wrapper(bind_front_wrapper&&) = default;
bind_front_wrapper(bind_front_wrapper const&) = default;
@@ -413,28 +502,6 @@ public:
{
}
- allocator_type
- get_allocator() const noexcept
- {
- return net::get_associated_allocator(h_);
- }
-
- friend
- bool
- asio_handler_is_continuation(bind_front_wrapper* w)
- {
- using net::asio_handler_is_continuation;
- return asio_handler_is_continuation(std::addressof(w->h_));
- }
-
- template
- friend
- void asio_handler_invoke(Function&& f, bind_front_wrapper* w)
- {
- using net::asio_handler_invoke;
- asio_handler_invoke(f, std::addressof(w->h_));
- }
-
template
void operator()(Ts&&... ts)
{
@@ -443,6 +510,53 @@ public:
Arg1, Arg2, Arg3, Args...>{},
std::forward(ts)...);
}
+
+ //
+
+ using allocator_type =
+ net::associated_allocator_t;
+
+ allocator_type
+ get_allocator() const noexcept
+ {
+ return net::get_associated_allocator(h_);
+ }
+
+ template
+ friend
+ void asio_handler_invoke(
+ Function&& f, bind_front_wrapper* w)
+ {
+ using net::asio_handler_invoke;
+ asio_handler_invoke(f, std::addressof(w->h_));
+ }
+
+ friend
+ void* asio_handler_allocate(
+ std::size_t size, bind_front_wrapper* op)
+ {
+ using net::asio_handler_allocate;
+ return asio_handler_allocate(
+ size, std::addressof(op->h_));
+ }
+
+ friend
+ void asio_handler_deallocate(
+ void* p, std::size_t size, bind_front_wrapper* op)
+ {
+ using net::asio_handler_deallocate;
+ asio_handler_deallocate(
+ p, size, std::addressof(op->h_));
+ }
+
+ friend
+ bool asio_handler_is_continuation(
+ bind_front_wrapper* op)
+ {
+ using net::asio_handler_is_continuation;
+ return asio_handler_is_continuation(
+ std::addressof(op->h_));
+ }
};
//------------------------------------------------------------------------------
@@ -460,9 +574,6 @@ class bind_front_wrapper<
public:
using result_type = void;
- using allocator_type =
- net::associated_allocator_t;
-
bind_front_wrapper(bind_front_wrapper&&) = default;
bind_front_wrapper(bind_front_wrapper const&) = default;
@@ -475,39 +586,66 @@ public:
{
}
+ void operator()()
+ {
+ h_(ec_, n_);
+ }
+
+ //
+
+ using allocator_type =
+ net::associated_allocator_t;
+
allocator_type
get_allocator() const noexcept
{
return net::get_associated_allocator(h_);
}
- friend
- bool
- asio_handler_is_continuation(bind_front_wrapper* w)
- {
- using net::asio_handler_is_continuation;
- return asio_handler_is_continuation(std::addressof(w->h_));
- }
-
template
friend
- void asio_handler_invoke(Function&& f, bind_front_wrapper* w)
+ void asio_handler_invoke(
+ Function&& f, bind_front_wrapper* w)
{
using net::asio_handler_invoke;
asio_handler_invoke(f, std::addressof(w->h_));
}
- void operator()()
+ friend
+ void* asio_handler_allocate(
+ std::size_t size, bind_front_wrapper* op)
{
- h_(ec_, n_);
+ using net::asio_handler_allocate;
+ return asio_handler_allocate(
+ size, std::addressof(op->h_));
+ }
+
+ friend
+ void asio_handler_deallocate(
+ void* p, std::size_t size, bind_front_wrapper* op)
+ {
+ using net::asio_handler_deallocate;
+ asio_handler_deallocate(
+ p, size, std::addressof(op->h_));
+ }
+
+ friend
+ bool asio_handler_is_continuation(
+ bind_front_wrapper* op)
+ {
+ using net::asio_handler_is_continuation;
+ return asio_handler_is_continuation(
+ std::addressof(op->h_));
}
};
} // detail
} // beast
+} // boost
//------------------------------------------------------------------------------
+namespace boost {
namespace asio {
template
@@ -545,9 +683,10 @@ struct associated_executor<
};
} // asio
-
} // boost
+//------------------------------------------------------------------------------
+
namespace std {
template
@@ -562,4 +701,6 @@ bind(boost::beast::detail::bind_front_wrapper<
} // std
+//------------------------------------------------------------------------------
+
#endif
diff --git a/include/boost/beast/core/detail/config.hpp b/include/boost/beast/core/detail/config.hpp
index 60243e42..a96092f4 100644
--- a/include/boost/beast/core/detail/config.hpp
+++ b/include/boost/beast/core/detail/config.hpp
@@ -10,11 +10,9 @@
#ifndef BOOST_BEAST_CORE_DETAIL_CONFIG_HPP
#define BOOST_BEAST_CORE_DETAIL_CONFIG_HPP
-#include
-#include
-
// Available to every header
#include
+#include
#include
#include
@@ -69,6 +67,10 @@ namespace net = boost::asio;
# endif
#endif
-#define BOOST_BEAST_DECL inline
+#if BOOST_BEAST_DOXYGEN
+# define BOOST_BEAST_DECL
+#else
+# define BOOST_BEAST_DECL inline
+#endif
#endif
diff --git a/include/boost/beast/core/detail/impl/read.hpp b/include/boost/beast/core/detail/impl/read.hpp
index 89a209e1..f9b4d53a 100644
--- a/include/boost/beast/core/detail/impl/read.hpp
+++ b/include/boost/beast/core/detail/impl/read.hpp
@@ -12,6 +12,9 @@
#include
#include
+#include
+#include
+#include
namespace boost {
namespace beast {
@@ -431,7 +434,7 @@ read(
void(error_code&, std::size_t, DynamicBuffer&)>::value,
"CompletionCondition requirements not met");
error_code ec;
- auto const bytes_transferred = read(
+ auto const bytes_transferred = detail::read(
stream, buffer, std::move(cond), ec);
if(ec)
BOOST_THROW_EXCEPTION(system_error{ec});
diff --git a/include/boost/beast/core/detail/ostream.hpp b/include/boost/beast/core/detail/ostream.hpp
index 19619834..6a9d7472 100644
--- a/include/boost/beast/core/detail/ostream.hpp
+++ b/include/boost/beast/core/detail/ostream.hpp
@@ -11,6 +11,7 @@
#define BOOST_BEAST_DETAIL_OSTREAM_HPP
#include
+#include
#include
#include
#include
diff --git a/include/boost/beast/core/detail/static_string.hpp b/include/boost/beast/core/detail/static_string.hpp
index a5384591..c4af2077 100644
--- a/include/boost/beast/core/detail/static_string.hpp
+++ b/include/boost/beast/core/detail/static_string.hpp
@@ -41,24 +41,22 @@ lexicographical_compare(
}
template
-inline
int
lexicographical_compare(
basic_string_view s1,
CharT const* s2, std::size_t n2)
{
- return lexicographical_compare(
- s1.data(), s1.size(), s2, n2);
+ return detail::lexicographical_compare<
+ CharT, Traits>(s1.data(), s1.size(), s2, n2);
}
template
-inline
int
lexicographical_compare(
basic_string_view s1,
basic_string_view s2)
{
- return lexicographical_compare(
+ return detail::lexicographical_compare(
s1.data(), s1.size(), s2.data(), s2.size());
}
diff --git a/include/boost/beast/core/detail/stream_algorithm.hpp b/include/boost/beast/core/detail/stream_algorithm.hpp
index f531c629..029492d6 100644
--- a/include/boost/beast/core/detail/stream_algorithm.hpp
+++ b/include/boost/beast/core/detail/stream_algorithm.hpp
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/include/boost/beast/core/detail/lean_tuple.hpp b/include/boost/beast/core/detail/tuple.hpp
similarity index 73%
rename from include/boost/beast/core/detail/lean_tuple.hpp
rename to include/boost/beast/core/detail/tuple.hpp
index 9539844b..cb64b8b3 100644
--- a/include/boost/beast/core/detail/lean_tuple.hpp
+++ b/include/boost/beast/core/detail/tuple.hpp
@@ -7,8 +7,8 @@
// Official repository: https://github.com/boostorg/beast
//
-#ifndef BOOST_BEAST_DETAIL_LEAN_TUPLE_HPP
-#define BOOST_BEAST_DETAIL_LEAN_TUPLE_HPP
+#ifndef BOOST_BEAST_DETAIL_TUPLE_HPP
+#define BOOST_BEAST_DETAIL_TUPLE_HPP
#include
#include
@@ -22,33 +22,33 @@ namespace beast {
namespace detail {
template
-struct lean_tuple_element
+struct tuple_element_impl
{
T t;
};
template
-struct lean_tuple_impl;
+struct tuple_impl;
template
-struct lean_tuple_impl<
+struct tuple_impl<
boost::mp11::index_sequence, Ts...>
- : lean_tuple_element...
+ : tuple_element_impl...
{
template
- explicit lean_tuple_impl(Us&&... us)
- : lean_tuple_element{std::forward(us)}...
+ explicit tuple_impl(Us&&... us)
+ : tuple_element_impl{std::forward(us)}...
{
}
};
template
-struct lean_tuple : lean_tuple_impl<
+struct tuple : tuple_impl<
boost::mp11::index_sequence_for, Ts...>
{
template
- explicit lean_tuple(Us&&... us)
- : lean_tuple_impl<
+ explicit tuple(Us&&... us)
+ : tuple_impl<
boost::mp11::index_sequence_for, Ts...>{
std::forward(us)...}
{
@@ -57,21 +57,21 @@ struct lean_tuple : lean_tuple_impl<
template
T&
-get(lean_tuple_element& te)
+get(tuple_element_impl& te)
{
return te.t;
}
template
T const&
-get(lean_tuple_element const& te)
+get(tuple_element_impl const& te)
{
return te.t;
}
template
T&&
-get(lean_tuple_element&& te)
+get(tuple_element_impl&& te)
{
return std::move(te.t);
}
diff --git a/include/boost/beast/core/file.hpp b/include/boost/beast/core/file.hpp
index 09c8e820..bb1ed7bc 100644
--- a/include/boost/beast/core/file.hpp
+++ b/include/boost/beast/core/file.hpp
@@ -15,7 +15,6 @@
#include
#include
#include
-#include
namespace boost {
namespace beast {
diff --git a/include/boost/beast/core/file_posix.hpp b/include/boost/beast/core/file_posix.hpp
index 65bac206..c0addcde 100644
--- a/include/boost/beast/core/file_posix.hpp
+++ b/include/boost/beast/core/file_posix.hpp
@@ -10,7 +10,7 @@
#ifndef BOOST_BEAST_CORE_FILE_POSIX_HPP
#define BOOST_BEAST_CORE_FILE_POSIX_HPP
-#include
+#include
#if ! defined(BOOST_BEAST_NO_POSIX_FILE)
# if ! defined(__APPLE__) && ! defined(__linux__)
@@ -54,6 +54,7 @@ public:
If the file is open it is first closed.
*/
+ BOOST_BEAST_DECL
~file_posix();
/** Constructor
@@ -66,12 +67,14 @@ public:
The moved-from object behaves as if default constructed.
*/
+ BOOST_BEAST_DECL
file_posix(file_posix&& other);
/** Assignment
The moved-from object behaves as if default constructed.
*/
+ BOOST_BEAST_DECL
file_posix& operator=(file_posix&& other);
/// Returns the native handle associated with the file.
@@ -87,6 +90,7 @@ public:
@param fd The native file handle to assign.
*/
+ BOOST_BEAST_DECL
void
native_handle(native_handle_type fd);
@@ -101,6 +105,7 @@ public:
@param ec Set to the error, if any occurred.
*/
+ BOOST_BEAST_DECL
void
close(error_code& ec);
@@ -112,6 +117,7 @@ public:
@param ec Set to the error, if any occurred
*/
+ BOOST_BEAST_DECL
void
open(char const* path, file_mode mode, error_code& ec);
@@ -121,6 +127,7 @@ public:
@return The size in bytes
*/
+ BOOST_BEAST_DECL
std::uint64_t
size(error_code& ec) const;
@@ -130,6 +137,7 @@ public:
@return The offset in bytes from the beginning of the file
*/
+ BOOST_BEAST_DECL
std::uint64_t
pos(error_code& ec) const;
@@ -139,6 +147,7 @@ public:
@param ec Set to the error, if any occurred
*/
+ BOOST_BEAST_DECL
void
seek(std::uint64_t offset, error_code& ec);
@@ -150,6 +159,7 @@ public:
@param ec Set to the error, if any occurred
*/
+ BOOST_BEAST_DECL
std::size_t
read(void* buffer, std::size_t n, error_code& ec) const;
@@ -161,6 +171,7 @@ public:
@param ec Set to the error, if any occurred
*/
+ BOOST_BEAST_DECL
std::size_t
write(void const* buffer, std::size_t n, error_code& ec);
};
@@ -168,7 +179,7 @@ public:
} // beast
} // boost
-#include
+#include
#endif
diff --git a/include/boost/beast/core/file_stdio.hpp b/include/boost/beast/core/file_stdio.hpp
index 09ca0c42..836905b7 100644
--- a/include/boost/beast/core/file_stdio.hpp
+++ b/include/boost/beast/core/file_stdio.hpp
@@ -39,6 +39,7 @@ public:
If the file is open it is first closed.
*/
+ BOOST_BEAST_DECL
~file_stdio();
/** Constructor
@@ -51,12 +52,14 @@ public:
The moved-from object behaves as if default constructed.
*/
+ BOOST_BEAST_DECL
file_stdio(file_stdio&& other);
/** Assignment
The moved-from object behaves as if default constructed.
*/
+ BOOST_BEAST_DECL
file_stdio& operator=(file_stdio&& other);
/// Returns the native handle associated with the file.
@@ -72,6 +75,7 @@ public:
@param f The native file handle to assign.
*/
+ BOOST_BEAST_DECL
void
native_handle(FILE* f);
@@ -86,6 +90,7 @@ public:
@param ec Set to the error, if any occurred.
*/
+ BOOST_BEAST_DECL
void
close(error_code& ec);
@@ -97,6 +102,7 @@ public:
@param ec Set to the error, if any occurred
*/
+ BOOST_BEAST_DECL
void
open(char const* path, file_mode mode, error_code& ec);
@@ -106,6 +112,7 @@ public:
@return The size in bytes
*/
+ BOOST_BEAST_DECL
std::uint64_t
size(error_code& ec) const;
@@ -115,6 +122,7 @@ public:
@return The offset in bytes from the beginning of the file
*/
+ BOOST_BEAST_DECL
std::uint64_t
pos(error_code& ec) const;
@@ -124,6 +132,7 @@ public:
@param ec Set to the error, if any occurred
*/
+ BOOST_BEAST_DECL
void
seek(std::uint64_t offset, error_code& ec);
@@ -135,6 +144,7 @@ public:
@param ec Set to the error, if any occurred
*/
+ BOOST_BEAST_DECL
std::size_t
read(void* buffer, std::size_t n, error_code& ec) const;
@@ -146,6 +156,7 @@ public:
@param ec Set to the error, if any occurred
*/
+ BOOST_BEAST_DECL
std::size_t
write(void const* buffer, std::size_t n, error_code& ec);
};
@@ -153,6 +164,6 @@ public:
} // beast
} // boost
-#include
+#include
#endif
diff --git a/include/boost/beast/core/file_win32.hpp b/include/boost/beast/core/file_win32.hpp
index 3e9a18ab..5a5c6ab0 100644
--- a/include/boost/beast/core/file_win32.hpp
+++ b/include/boost/beast/core/file_win32.hpp
@@ -10,7 +10,7 @@
#ifndef BOOST_BEAST_CORE_FILE_WIN32_HPP
#define BOOST_BEAST_CORE_FILE_WIN32_HPP
-#include
+#include
#if ! defined(BOOST_BEAST_USE_WIN32_FILE)
# ifdef BOOST_MSVC
@@ -56,6 +56,7 @@ public:
If the file is open it is first closed.
*/
+ BOOST_BEAST_DECL
~file_win32();
/** Constructor
@@ -68,12 +69,14 @@ public:
The moved-from object behaves as if default constructed.
*/
+ BOOST_BEAST_DECL
file_win32(file_win32&& other);
/** Assignment
The moved-from object behaves as if default constructed.
*/
+ BOOST_BEAST_DECL
file_win32& operator=(file_win32&& other);
/// Returns the native handle associated with the file.
@@ -89,6 +92,7 @@ public:
@param h The native file handle to assign.
*/
+ BOOST_BEAST_DECL
void
native_handle(native_handle_type h);
@@ -103,6 +107,7 @@ public:
@param ec Set to the error, if any occurred.
*/
+ BOOST_BEAST_DECL
void
close(error_code& ec);
@@ -114,6 +119,7 @@ public:
@param ec Set to the error, if any occurred
*/
+ BOOST_BEAST_DECL
void
open(char const* path, file_mode mode, error_code& ec);
@@ -123,6 +129,7 @@ public:
@return The size in bytes
*/
+ BOOST_BEAST_DECL
std::uint64_t
size(error_code& ec) const;
@@ -132,6 +139,7 @@ public:
@return The offset in bytes from the beginning of the file
*/
+ BOOST_BEAST_DECL
std::uint64_t
pos(error_code& ec);
@@ -141,6 +149,7 @@ public:
@param ec Set to the error, if any occurred
*/
+ BOOST_BEAST_DECL
void
seek(std::uint64_t offset, error_code& ec);
@@ -152,6 +161,7 @@ public:
@param ec Set to the error, if any occurred
*/
+ BOOST_BEAST_DECL
std::size_t
read(void* buffer, std::size_t n, error_code& ec);
@@ -163,6 +173,7 @@ public:
@param ec Set to the error, if any occurred
*/
+ BOOST_BEAST_DECL
std::size_t
write(void const* buffer, std::size_t n, error_code& ec);
};
@@ -170,7 +181,7 @@ public:
} // beast
} // boost
-#include
+#include
#endif
diff --git a/include/boost/beast/core/flat_buffer.hpp b/include/boost/beast/core/flat_buffer.hpp
index 76438d5e..1227f97e 100644
--- a/include/boost/beast/core/flat_buffer.hpp
+++ b/include/boost/beast/core/flat_buffer.hpp
@@ -73,7 +73,7 @@ class basic_flat_buffer
std::is_nothrow_default_constructible::value;
using alloc_traits =
- detail::allocator_traits;
+ beast::detail::allocator_traits;
using pocma = typename
alloc_traits::propagate_on_container_move_assignment;
@@ -516,6 +516,6 @@ using flat_buffer =
} // beast
} // boost
-#include
+#include
#endif
diff --git a/include/boost/beast/core/flat_static_buffer.hpp b/include/boost/beast/core/flat_static_buffer.hpp
index 9c1f6359..d993181a 100644
--- a/include/boost/beast/core/flat_static_buffer.hpp
+++ b/include/boost/beast/core/flat_static_buffer.hpp
@@ -77,7 +77,7 @@ public:
}
/// Change the number of readable and writable bytes to zero.
- inline
+ BOOST_BEAST_DECL
void
clear() noexcept;
@@ -168,7 +168,7 @@ public:
Strong guarantee.
*/
- inline
+ BOOST_BEAST_DECL
mutable_buffers_type
prepare(std::size_t n);
@@ -211,7 +211,7 @@ public:
No-throw guarantee.
*/
- inline
+ BOOST_BEAST_DECL
void
consume(std::size_t n) noexcept;
@@ -239,7 +239,7 @@ protected:
No-throw guarantee.
*/
- inline
+ BOOST_BEAST_DECL
void
reset(void* p, std::size_t n) noexcept;
@@ -318,6 +318,6 @@ public:
} // beast
} // boost
-#include
+#include
#endif
\ No newline at end of file
diff --git a/include/boost/beast/core/handler_ptr.hpp b/include/boost/beast/core/handler_ptr.hpp
index e4117cc8..d758e060 100644
--- a/include/boost/beast/core/handler_ptr.hpp
+++ b/include/boost/beast/core/handler_ptr.hpp
@@ -118,14 +118,14 @@ public:
/// Return a reference to the handler
handler_type const&
- handler() const
+ handler() const noexcept
{
return h_;
}
/// Return a reference to the handler
handler_type&
- handler()
+ handler() noexcept
{
return h_;
}
@@ -165,6 +165,7 @@ public:
T*
operator->() const
{
+ BOOST_ASSERT(t_);
return t_;
}
@@ -211,6 +212,6 @@ public:
} // beast
} // boost
-#include
+#include
#endif
diff --git a/include/boost/beast/core/impl/buffered_read_stream.ipp b/include/boost/beast/core/impl/buffered_read_stream.hpp
similarity index 87%
rename from include/boost/beast/core/impl/buffered_read_stream.ipp
rename to include/boost/beast/core/impl/buffered_read_stream.hpp
index 00d96f71..a2de635e 100644
--- a/include/boost/beast/core/impl/buffered_read_stream.ipp
+++ b/include/boost/beast/core/impl/buffered_read_stream.hpp
@@ -7,8 +7,8 @@
// Official repository: https://github.com/boostorg/beast
//
-#ifndef BOOST_BEAST_IMPL_BUFFERED_READ_STREAM_IPP
-#define BOOST_BEAST_IMPL_BUFFERED_READ_STREAM_IPP
+#ifndef BOOST_BEAST_IMPL_BUFFERED_READ_STREAM_HPP
+#define BOOST_BEAST_IMPL_BUFFERED_READ_STREAM_HPP
#include
#include
@@ -19,6 +19,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -54,44 +55,65 @@ public:
{
}
+ void
+ operator()(error_code ec,
+ std::size_t bytes_transferred);
+
+ //
+
using allocator_type =
net::associated_allocator_t;
- allocator_type
- get_allocator() const noexcept
- {
- return (net::get_associated_allocator)(h_);
- }
-
using executor_type =
net::associated_executor_t().get_executor())>;
+ allocator_type
+ get_allocator() const noexcept
+ {
+ return net::get_associated_allocator(h_);
+ }
+
executor_type
get_executor() const noexcept
{
- return (net::get_associated_executor)(
+ return net::get_associated_executor(
h_, s_.get_executor());
}
- void
- operator()(error_code const& ec,
- std::size_t bytes_transferred);
+ template
+ friend
+ void asio_handler_invoke(
+ Function&& f, read_some_op* op)
+ {
+ using net::asio_handler_invoke;
+ asio_handler_invoke(f, std::addressof(op->h_));
+ }
+
+ friend
+ void* asio_handler_allocate(
+ std::size_t size, read_some_op* op)
+ {
+ using net::asio_handler_allocate;
+ return asio_handler_allocate(
+ size, std::addressof(op->h_));
+ }
+
+ friend
+ void asio_handler_deallocate(
+ void* p, std::size_t size, read_some_op* op)
+ {
+ using net::asio_handler_deallocate;
+ asio_handler_deallocate(
+ p, size, std::addressof(op->h_));
+ }
friend
bool asio_handler_is_continuation(read_some_op* op)
{
using net::asio_handler_is_continuation;
return asio_handler_is_continuation(
- std::addressof(op->h_));
- }
-
- template
- friend
- void asio_handler_invoke(Function&& f, read_some_op* op)
- {
- using net::asio_handler_invoke;
- asio_handler_invoke(f, std::addressof(op->h_));
+ std::addressof(op->h_));
}
};
@@ -99,8 +121,9 @@ template
template
void
buffered_read_stream::
-read_some_op::operator()(
- error_code const& ec, std::size_t bytes_transferred)
+read_some_op::
+operator()(
+ error_code ec, std::size_t bytes_transferred)
{
switch(step_)
{
@@ -114,19 +137,18 @@ read_some_op::operator()(
return s_.next_layer_.async_read_some(
b_, std::move(*this));
}
-
// read
step_ = 2;
return s_.next_layer_.async_read_some(
s_.buffer_.prepare(read_size(
s_.buffer_, s_.capacity_)),
std::move(*this));
-
}
step_ = 3;
return net::post(
s_.get_executor(),
- beast::bind_front_handler(std::move(*this), ec, 0));
+ beast::bind_front_handler(
+ std::move(*this), ec, 0));
case 1:
// upcall
@@ -221,7 +243,7 @@ read_some(MutableBufferSequence const& buffers,
}
else
{
- ec.assign(0, ec.category());
+ ec = {};
}
auto bytes_transferred =
buffer_copy(buffers, buffer_.data());
diff --git a/include/boost/beast/core/impl/buffers_adapter.ipp b/include/boost/beast/core/impl/buffers_adapter.hpp
similarity index 97%
rename from include/boost/beast/core/impl/buffers_adapter.ipp
rename to include/boost/beast/core/impl/buffers_adapter.hpp
index b8eeb82c..8d7415d6 100644
--- a/include/boost/beast/core/impl/buffers_adapter.ipp
+++ b/include/boost/beast/core/impl/buffers_adapter.hpp
@@ -308,7 +308,6 @@ private:
};
template
-inline
auto
buffers_adapter::
mutable_buffers_type::
@@ -319,7 +318,6 @@ begin() const ->
}
template
-inline
auto
buffers_adapter::
mutable_buffers_type::
@@ -479,19 +477,27 @@ prepare(std::size_t n) ->
return mutable_buffers_type{*this};
}
+template
+auto
+buffers_adapter::
+data() const noexcept ->
+ const_buffers_type
+{
+ return const_buffers_type{*this};
+}
+
template
void
buffers_adapter::
-commit(std::size_t n)
+commit(std::size_t n) noexcept
{
- using net::buffer_size;
if(out_ == end_)
return;
auto const last = std::prev(end_);
while(out_ != last)
{
auto const avail =
- buffer_size(*out_) - out_pos_;
+ net::buffer_size(*out_) - out_pos_;
if(n < avail)
{
out_pos_ += n;
@@ -504,10 +510,11 @@ commit(std::size_t n)
in_size_ += avail;
}
- n = (std::min)(n, out_end_ - out_pos_);
+ n = std::min(
+ n, out_end_ - out_pos_);
out_pos_ += n;
in_size_ += n;
- if(out_pos_ == buffer_size(*out_))
+ if(out_pos_ == net::buffer_size(*out_))
{
++out_;
out_pos_ = 0;
@@ -515,26 +522,15 @@ commit(std::size_t n)
}
}
-template
-inline
-auto
-buffers_adapter::
-data() const ->
- const_buffers_type
-{
- return const_buffers_type{*this};
-}
-
template
void
buffers_adapter::
-consume(std::size_t n)
+consume(std::size_t n) noexcept
{
- using net::buffer_size;
while(begin_ != out_)
{
auto const avail =
- buffer_size(*begin_) - in_pos_;
+ net::buffer_size(*begin_) - in_pos_;
if(n < avail)
{
in_size_ -= n;
diff --git a/include/boost/beast/core/impl/buffers_cat.ipp b/include/boost/beast/core/impl/buffers_cat.hpp
similarity index 95%
rename from include/boost/beast/core/impl/buffers_cat.ipp
rename to include/boost/beast/core/impl/buffers_cat.hpp
index b1b5ec2e..bd762bf7 100644
--- a/include/boost/beast/core/impl/buffers_cat.ipp
+++ b/include/boost/beast/core/impl/buffers_cat.hpp
@@ -7,10 +7,10 @@
// Official repository: https://github.com/boostorg/beast
//
-#ifndef BOOST_BEAST_IMPL_BUFFERS_CAT_IPP
-#define BOOST_BEAST_IMPL_BUFFERS_CAT_IPP
+#ifndef BOOST_BEAST_IMPL_BUFFERS_CAT_HPP
+#define BOOST_BEAST_IMPL_BUFFERS_CAT_HPP
-#include
+#include
#include
#include
#include
@@ -57,7 +57,7 @@ class buffers_cat_view::const_iterator
static_assert(sizeof...(Bn) >= 2,
"A minimum of two sequences are required");
- detail::lean_tuple