LCOV - code coverage report
Current view: top level - http_proto - message_base.hpp (source / functions) Hit Total Coverage
Test: coverage_filtered.info Lines: 6 6 100.0 %
Date: 2023-01-09 16:11:12 Functions: 2 2 100.0 %

          Line data    Source code
       1             : //
       2             : // Copyright (c) 2021 Vinnie Falco (vinnie dot falco at gmail dot 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         287 :     message_base(
      32             :         detail::kind k) noexcept
      33             :         : fields_view_base(
      34             :             &this->fields_base::h_)
      35         287 :         , fields_base(k)
      36             :     {
      37         287 :     }
      38             : 
      39             :     explicit
      40           2 :     message_base(
      41             :         detail::header const& ph) noexcept
      42             :         : fields_view_base(
      43             :             &this->fields_base::h_)
      44           2 :         , fields_base(ph)
      45             :     {
      46           2 :     }
      47             : 
      48             : public:
      49             :     //--------------------------------------------
      50             :     //
      51             :     // Metadata
      52             :     //
      53             :     //--------------------------------------------
      54             : 
      55             :     /** Set the payload size
      56             :     */
      57             :     BOOST_HTTP_PROTO_DECL
      58             :     void
      59             :     set_payload_size(
      60             :         std::uint64_t n);
      61             : 
      62             :     /** Set the Content-Length to the specified value
      63             :     */
      64             :     BOOST_HTTP_PROTO_DECL
      65             :     void
      66             :     set_content_length(
      67             :         std::uint64_t n);
      68             : 
      69             :     /** Set whether the payload is chunked.
      70             :     */
      71             :     BOOST_HTTP_PROTO_DECL
      72             :     void
      73             :     set_chunked(bool value);
      74             : 
      75             :     /** Set whether the connection should stay open.
      76             : 
      77             :         Even when keep-alive is set to true, the
      78             :         semantics of the other header fields may
      79             :         require the connection to be closed. For
      80             :         example when there is no content length
      81             :         specified in a response.
      82             :     */
      83             :     BOOST_HTTP_PROTO_DECL
      84             :     void
      85             :     set_keep_alive(bool value);
      86             : 
      87             : private:
      88             :     char* set_prefix_impl(std::size_t);
      89             : };
      90             : 
      91             : } // http_proto
      92             : } // boost
      93             : 
      94             : #endif

Generated by: LCOV version 1.15