123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- #ifndef BOOST_BEAST_HTTP_MESSAGE_GENERATOR_HPP
- #define BOOST_BEAST_HTTP_MESSAGE_GENERATOR_HPP
- #include <boost/beast/core/span.hpp>
- #include <boost/beast/http/message.hpp>
- #include <boost/beast/http/serializer.hpp>
- #include <memory>
- namespace boost {
- namespace beast {
- namespace http {
- class message_generator
- {
- public:
- using const_buffers_type = span<net::const_buffer>;
- template <bool isRequest, class Body, class Fields>
- message_generator(http::message<isRequest, Body, Fields>&&);
-
- bool is_done() const {
- return impl_->is_done();
- }
-
- const_buffers_type
- prepare(error_code& ec)
- {
- return impl_->prepare(ec);
- }
-
- void
- consume(std::size_t n)
- {
- impl_->consume(n);
- }
-
- bool
- keep_alive() const noexcept
- {
- return impl_->keep_alive();
- }
- private:
- struct impl_base
- {
- virtual ~impl_base() = default;
- virtual bool is_done() = 0;
- virtual const_buffers_type prepare(error_code& ec) = 0;
- virtual void consume(std::size_t n) = 0;
- virtual bool keep_alive() const noexcept = 0;
- };
- std::unique_ptr<impl_base> impl_;
- template <bool isRequest, class Body, class Fields>
- struct generator_impl;
- };
- }
- }
- }
- #include <boost/beast/http/impl/message_generator.hpp>
- #endif
|