LCOV - code coverage report
Current view: top level - http_proto - message_base.hpp (source / functions) Hit Total Coverage
Test: coverage_filtered.info Lines: 9 9 100.0 %
Date: 2023-02-21 17:23:31 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             : 
      17             : namespace boost {
      18             : namespace http_proto {
      19             : 
      20             : /** Provides message metadata for requests and responses
      21             : */
      22             : class BOOST_SYMBOL_VISIBLE
      23             :     message_base
      24             :     : public fields_base
      25             :     , public message_view_base
      26             : {
      27             :     friend class request;
      28             :     friend class response;
      29             : 
      30             :     explicit
      31          42 :     message_base(
      32             :         detail::kind k) noexcept
      33             :         : fields_view_base(
      34             :             &this->fields_base::h_)
      35          42 :         , fields_base(k)
      36             :     {
      37          42 :     }
      38             : 
      39         256 :     message_base(
      40             :         detail::kind k,
      41             :         string_view s)
      42             :         : fields_view_base(
      43             :             &this->fields_base::h_)
      44         256 :         , fields_base(k, s)
      45             :     {
      46         256 :     }
      47             : 
      48             :     explicit
      49           2 :     message_base(
      50             :         detail::header const& ph) noexcept
      51             :         : fields_view_base(
      52             :             &this->fields_base::h_)
      53           2 :         , fields_base(ph)
      54             :     {
      55           2 :     }
      56             : 
      57             : public:
      58             :     //--------------------------------------------
      59             :     //
      60             :     // Metadata
      61             :     //
      62             :     //--------------------------------------------
      63             : 
      64             :     /** Set the payload size
      65             :     */
      66             :     BOOST_HTTP_PROTO_DECL
      67             :     void
      68             :     set_payload_size(
      69             :         std::uint64_t n);
      70             : 
      71             :     /** Set the Content-Length to the specified value
      72             :     */
      73             :     BOOST_HTTP_PROTO_DECL
      74             :     void
      75             :     set_content_length(
      76             :         std::uint64_t n);
      77             : 
      78             :     /** Set whether the payload is chunked.
      79             :     */
      80             :     BOOST_HTTP_PROTO_DECL
      81             :     void
      82             :     set_chunked(bool value);
      83             : 
      84             :     /** Set whether the connection should stay open.
      85             : 
      86             :         Even when keep-alive is set to true, the
      87             :         semantics of the other header fields may
      88             :         require the connection to be closed. For
      89             :         example when there is no content length
      90             :         specified in a response.
      91             :     */
      92             :     BOOST_HTTP_PROTO_DECL
      93             :     void
      94             :     set_keep_alive(bool value);
      95             : 
      96             : private:
      97             :     char* set_prefix_impl(std::size_t);
      98             : };
      99             : 
     100             : } // http_proto
     101             : } // boost
     102             : 
     103             : #endif

Generated by: LCOV version 1.15