diff options
Diffstat (limited to 'boost/beast/http/serializer.hpp')
-rw-r--r-- | boost/beast/http/serializer.hpp | 56 |
1 files changed, 42 insertions, 14 deletions
diff --git a/boost/beast/http/serializer.hpp b/boost/beast/http/serializer.hpp index 50e58185a9..bbb562a620 100644 --- a/boost/beast/http/serializer.hpp +++ b/boost/beast/http/serializer.hpp @@ -71,14 +71,20 @@ public: #if BOOST_BEAST_DOXYGEN using value_type = implementation_defined; #else - using value_type = - typename std::conditional< - std::is_constructible<typename Body::writer, - message<isRequest, Body, Fields>&>::value && - ! std::is_constructible<typename Body::writer, - message<isRequest, Body, Fields> const&>::value, - message<isRequest, Body, Fields>, - message<isRequest, Body, Fields> const>::type; + using value_type = typename std::conditional< + (std::is_constructible<typename Body::writer, + header<isRequest, Fields>&, + typename Body::value_type&>::value && + ! std::is_constructible<typename Body::writer, + header<isRequest, Fields> const&, + typename Body::value_type const&>::value) || + // Deprecated BodyWriter Concept (v1.66) + (std::is_constructible<typename Body::writer, + message<isRequest, Body, Fields>&>::value && + ! std::is_constructible<typename Body::writer, + message<isRequest, Body, Fields> const&>::value), + message<isRequest, Body, Fields>, + message<isRequest, Body, Fields> const>::type; #endif private: @@ -104,8 +110,8 @@ private: do_complete = 120 }; - void frdinit(std::true_type); - void frdinit(std::false_type); + void fwrinit(std::true_type); + void fwrinit(std::false_type); template<std::size_t, class Visit> void @@ -173,8 +179,8 @@ private: using pcb8_t = buffers_prefix_view<cb8_t const&>; value_type& m_; - writer rd_; - boost::optional<typename Fields::writer> frd_; + writer wr_; + boost::optional<typename Fields::writer> fwr_; beast::detail::variant< cb1_t, cb2_t, cb3_t, cb4_t, cb5_t ,cb6_t, cb7_t, cb8_t> v_; @@ -188,6 +194,8 @@ private: bool header_done_ = false; bool more_; + serializer(value_type& msg, std::true_type); + serializer(value_type& msg, std::false_type); public: /// Constructor serializer(serializer&&) = default; @@ -336,7 +344,7 @@ public: void consume(std::size_t n); - /** Provides low-level access to the associated @b BodyWriter + /** Provides low-level access to the associated @b BodyWriter (DEPRECATED) This function provides access to the instance of the writer associated with the body and created by the serializer @@ -349,7 +357,27 @@ public: writer& reader_impl() { - return rd_; + #ifndef BOOST_BEAST_ALLOW_DEPRECATED + BOOST_STATIC_ASSERT_MSG(sizeof(Body) == 0, + BOOST_BEAST_DEPRECATION_STRING); + #endif + return wr_; + } + + /** Provides low-level access to the associated @b BodyWriter + + This function provides access to the instance of the writer + associated with the body and created by the serializer + upon construction. The behavior of accessing this object + is defined by the specification of the particular writer + and its associated body. + + @return A reference to the writer. + */ + writer& + writer_impl() + { + return wr_; } }; |