LCOV - code coverage report
Current view: top level - libs/http_proto/src/detail/filter.hpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 100.0 % 2 2
Test Date: 2025-09-21 18:08:14 Functions: 100.0 % 1 1

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com)
       3              : // Copyright (c) 2024 Mohammad Nejati
       4              : //
       5              : // Distributed under the Boost Software License, Version 1.0. (See accompanying
       6              : // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       7              : //
       8              : // Official repository: https://github.com/cppalliance/http_proto
       9              : //
      10              : 
      11              : #ifndef BOOST_HTTP_PROTO_DETAIL_FILTER_HPP
      12              : #define BOOST_HTTP_PROTO_DETAIL_FILTER_HPP
      13              : 
      14              : #include <boost/buffers/buffer_pair.hpp>
      15              : #include <boost/buffers/slice.hpp>
      16              : #include <boost/core/span.hpp>
      17              : #include <boost/system/error_code.hpp>
      18              : 
      19              : namespace boost {
      20              : namespace http_proto {
      21              : namespace detail {
      22              : 
      23              : /** Base class for all filters
      24              : */
      25              : class filter
      26              : {
      27              : public:
      28              :     /** The results of processing the filter.
      29              :     */
      30              :     struct results
      31              :     {
      32              :         /** The error, if any occurred.
      33              :         */
      34              :         system::error_code ec;
      35              : 
      36              :         /** The number of bytes produced in the output.
      37              : 
      38              :             This may be less than the total number
      39              :             of bytes available for writing in the
      40              :             destination buffers.
      41              :         */
      42              :         std::size_t out_bytes = 0;
      43              : 
      44              :         /** The number of bytes consumed from the input.
      45              : 
      46              :             This may be less than the total number
      47              :             of bytes available for reading in the
      48              :             source buffers.
      49              :         */
      50              :         std::size_t in_bytes = 0;
      51              : 
      52              :         /** True if the output buffer is too
      53              :             small to make progress.
      54              : 
      55              :             This can only happen in deflate operation.
      56              :         */
      57              :         bool out_short = false;
      58              : 
      59              :         /** True if there will be no more output.
      60              :         */
      61              :         bool finished = false;
      62              :     };
      63              : 
      64              :     results
      65              :     process(
      66              :         buffers::slice_of<
      67              :             boost::span<const buffers::mutable_buffer>> out,
      68              :         buffers::const_buffer_pair in,
      69              :         bool more);
      70              : 
      71              : protected:
      72              :     virtual
      73              :     std::size_t
      74           92 :     min_out_buffer() const noexcept
      75              :     {
      76           92 :         return 0;
      77              :     }
      78              : 
      79              :     virtual
      80              :     results
      81              :     do_process(
      82              :         buffers::mutable_buffer,
      83              :         buffers::const_buffer,
      84              :         bool) noexcept = 0;
      85              : };
      86              : 
      87              : } // detail
      88              : } // http_proto
      89              : } // boost
      90              : 
      91              : #endif
        

Generated by: LCOV version 2.1