LCOV - code coverage report
Current view: top level - libs/http_proto/src/file_body.cpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 0.0 % 18 0
Test Date: 2024-07-03 18:58:30 Functions: 0.0 % 4 0

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2022 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              : #include <boost/http_proto/file_body.hpp>
      11              : #include <boost/buffers/algorithm.hpp>
      12              : #include <boost/assert.hpp>
      13              : 
      14              : namespace boost {
      15              : namespace http_proto {
      16              : 
      17            0 : file_body::
      18              : ~file_body() = default;
      19              : 
      20            0 : file_body::
      21              : file_body(
      22              :     file_body&&) noexcept = default;
      23              : 
      24            0 : file_body::
      25              : file_body(
      26              :     file&& f,
      27            0 :     std::uint64_t size) noexcept
      28            0 :     : f_(std::move(f))
      29            0 :     , n_(size)
      30              : {
      31            0 : }
      32              : 
      33              : auto
      34            0 : file_body::
      35              : on_read(
      36              :     buffers::mutable_buffer b) ->
      37              :         results
      38              : {
      39            0 :     results rv;
      40            0 :     if(n_ > 0)
      41              :     {
      42              :         std::size_t n;
      43            0 :         if( n_ >= b.size())
      44            0 :             n = b.size();
      45              :         else
      46            0 :             n = static_cast<std::size_t>(n_);
      47            0 :         n = f_.read(
      48              :             b.data(), n, rv.ec);
      49            0 :         rv.bytes = n;
      50            0 :         n_ -= n;
      51              :     }
      52            0 :     rv.finished = n_ == 0;
      53            0 :     return rv;
      54              : }
      55              : 
      56              : } // http_proto
      57              : } // boost
        

Generated by: LCOV version 2.1