File indexing completed on 2025-01-18 09:29:32
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_BEAST_HTTP_MESSAGE_GENERATOR_HPP
0010 #define BOOST_BEAST_HTTP_MESSAGE_GENERATOR_HPP
0011
0012 #include <boost/beast/core/span.hpp>
0013 #include <boost/beast/http/message.hpp>
0014 #include <boost/beast/http/serializer.hpp>
0015 #include <memory>
0016
0017 namespace boost {
0018 namespace beast {
0019 namespace http {
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 class message_generator
0044 {
0045 public:
0046 using const_buffers_type = span<net::const_buffer>;
0047
0048 template <bool isRequest, class Body, class Fields>
0049 message_generator(http::message<isRequest, Body, Fields>&&);
0050
0051
0052 bool is_done() const {
0053 return impl_->is_done();
0054 }
0055
0056
0057 const_buffers_type
0058 prepare(error_code& ec)
0059 {
0060 return impl_->prepare(ec);
0061 }
0062
0063
0064 void
0065 consume(std::size_t n)
0066 {
0067 impl_->consume(n);
0068 }
0069
0070
0071 bool
0072 keep_alive() const noexcept
0073 {
0074 return impl_->keep_alive();
0075 }
0076
0077 private:
0078 struct impl_base
0079 {
0080 virtual ~impl_base() = default;
0081 virtual bool is_done() = 0;
0082 virtual const_buffers_type prepare(error_code& ec) = 0;
0083 virtual void consume(std::size_t n) = 0;
0084 virtual bool keep_alive() const noexcept = 0;
0085 };
0086
0087 std::unique_ptr<impl_base> impl_;
0088
0089 template <bool isRequest, class Body, class Fields>
0090 struct generator_impl;
0091 };
0092
0093 }
0094 }
0095 }
0096
0097 #include <boost/beast/http/impl/message_generator.hpp>
0098
0099 #endif