LCOV - code coverage report
Current view: top level - boost/http_proto - message_base.hpp (source / functions) Hit Total Coverage
Test: coverage_filtered.info Lines: 9 9 100.0 %
Date: 2024-03-04 15:37:43 Functions: 3 3 100.0 %

          Line data    Source code
       1             : //
       2             : // Copyright (c) 2021 Vinnie Falco (vinnie.falco@gmail.com)
       3             : //
       4             : // Distributed under the Boost Software License, Version 1.0. (See accompanying
       5             : // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       6             : //
       7             : // Official repository: https://github.com/cppalliance/http_proto
       8             : //
       9             : 
      10             : #ifndef BOOST_HTTP_PROTO_MESSAGE_BASE_HPP
      11             : #define BOOST_HTTP_PROTO_MESSAGE_BASE_HPP
      12             : 
      13             : #include <boost/http_proto/detail/config.hpp>
      14             : #include <boost/http_proto/fields_base.hpp>
      15             : #include <boost/http_proto/message_view_base.hpp>
      16             : #include <boost/core/detail/string_view.hpp>
      17             : 
      18             : namespace boost {
      19             : namespace http_proto {
      20             : 
      21             : /** Provides message metadata for requests and responses
      22             : */
      23             : class BOOST_SYMBOL_VISIBLE
      24             :     message_base
      25             :     : public fields_base
      26             :     , public message_view_base
      27             : {
      28             :     friend class request;
      29             :     friend class response;
      30             : 
      31             :     explicit
      32          80 :     message_base(
      33             :         detail::kind k) noexcept
      34             :         : fields_view_base(
      35             :             &this->fields_base::h_)
      36          80 :         , fields_base(k)
      37             :     {
      38          80 :     }
      39             : 
      40         277 :     message_base(
      41             :         detail::kind k,
      42             :         core::string_view s)
      43             :         : fields_view_base(
      44             :             &this->fields_base::h_)
      45         277 :         , fields_base(k, s)
      46             :     {
      47         277 :     }
      48             : 
      49             :     explicit
      50           8 :     message_base(
      51             :         detail::header const& ph) noexcept
      52             :         : fields_view_base(
      53             :             &this->fields_base::h_)
      54           8 :         , fields_base(ph)
      55             :     {
      56           8 :     }
      57             : 
      58             : public:
      59             :     //--------------------------------------------
      60             :     //
      61             :     // Metadata
      62             :     //
      63             :     //--------------------------------------------
      64             : 
      65             :     /** Set the payload size
      66             :     */
      67             :     BOOST_HTTP_PROTO_DECL
      68             :     void
      69             :     set_payload_size(
      70             :         std::uint64_t n);
      71             : 
      72             :     /** Set the Content-Length to the specified value
      73             :     */
      74             :     BOOST_HTTP_PROTO_DECL
      75             :     void
      76             :     set_content_length(
      77             :         std::uint64_t n);
      78             : 
      79             :     /** Set whether the payload is chunked.
      80             :     */
      81             :     BOOST_HTTP_PROTO_DECL
      82             :     void
      83             :     set_chunked(bool value);
      84             : 
      85             :     /** Set whether the connection should stay open.
      86             : 
      87             :         Even when keep-alive is set to true, the
      88             :         semantics of the other header fields may
      89             :         require the connection to be closed. For
      90             :         example when there is no content length
      91             :         specified in a response.
      92             :     */
      93             :     BOOST_HTTP_PROTO_DECL
      94             :     void
      95             :     set_keep_alive(bool value);
      96             : 
      97             : private:
      98             :     char* set_prefix_impl(std::size_t);
      99             : };
     100             : 
     101             : } // http_proto
     102             : } // boost
     103             : 
     104             : #endif

Generated by: LCOV version 1.15