LCOV - code coverage report
Current view: top level - libs/buffers/src/const_buffer_pair.cpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 100.0 % 24 24
Test Date: 2024-07-24 21:34:17 Functions: 100.0 % 2 2

            Line data    Source code
       1              : //
       2              : // Copyright (c) 2023 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/buffers
       8              : //
       9              : 
      10              : #include <boost/buffers/const_buffer_pair.hpp>
      11              : 
      12              : namespace boost {
      13              : namespace buffers {
      14              : 
      15              : const_buffer_pair
      16       139808 : const_buffer_pair::
      17              : prefix_impl(
      18              :     std::size_t n) const noexcept
      19              : {
      20       139808 :     auto const it0 = begin();
      21       139808 :     if(n <= it0->size())
      22              :         return { {
      23              :             it0->data(), n },
      24        84304 :             const_buffer{} };
      25        55504 :     n -= it0->size();
      26        55504 :     auto it1 = it0;
      27        55504 :     ++it1;
      28        55504 :     if(n < it1->size())
      29              :         return { *it0, {
      30        40978 :             it1->data(), n } };
      31        14526 :     return *this;
      32              : }
      33              : 
      34              : const_buffer_pair
      35       139808 : const_buffer_pair::
      36              : suffix_impl(
      37              :     std::size_t n) const noexcept
      38              : {
      39       139808 :     auto it0 = end();
      40       139808 :     --it0;
      41       139808 :     if(n <= it0->size())
      42        55504 :         return { *it0 + (
      43        55504 :                 it0->size() - n),
      44        55504 :             const_buffer{} };
      45        84304 :     n -= it0->size();
      46        84304 :     auto it1 = it0;
      47        84304 :     --it1;
      48        84304 :     if(n < it1->size())
      49        67858 :         return { *it1 + (
      50        67858 :             it1->size() - n), *it0 };
      51        16446 :     return *this;
      52              : }
      53              : 
      54              : } // buffers
      55              : } // boost
        

Generated by: LCOV version 2.1