LCOV - code coverage report
Current view: top level - boost/http_proto/detail - array_of_buffers.hpp (source / functions) Hit Total Coverage
Test: coverage_filtered.info Lines: 1 1 100.0 %
Date: 2024-04-23 20:44:52 Functions: 1 1 100.0 %

          Line data    Source code
       1             : //
       2             : // Copyright (c) 2019 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_DETAIL_ARRAY_OF_BUFFERS_HPP
      11             : #define BOOST_HTTP_PROTO_DETAIL_ARRAY_OF_BUFFERS_HPP
      12             : 
      13             : #include <boost/buffers/const_buffer.hpp>
      14             : #include <boost/buffers/mutable_buffer.hpp>
      15             : 
      16             : namespace boost {
      17             : namespace http_proto {
      18             : namespace detail {
      19             : 
      20             : template<bool isConst>
      21             : class array_of_buffers
      22             : {
      23             : public:
      24             :     using value_type = typename
      25             :         std::conditional<isConst,
      26             :             buffers::const_buffer,
      27             :             buffers::mutable_buffer>::type;
      28             :     using iterator = value_type*;
      29             :     using const_iterator = iterator;
      30             : 
      31          40 :     array_of_buffers() = default;
      32             :     array_of_buffers(
      33             :         array_of_buffers const&) = default;
      34             :     array_of_buffers& operator=(
      35             :         array_of_buffers const&) = default;
      36             : 
      37             :     array_of_buffers(
      38             :         value_type* p,
      39             :         std::size_t n) noexcept;
      40             : 
      41             :     bool empty() const noexcept;
      42             :     value_type* data() const noexcept;
      43             :     std::size_t size() const noexcept;
      44             :     value_type& operator[](std::size_t) const noexcept;
      45             :     void consume(std::size_t n);
      46             : 
      47             :     iterator begin() const noexcept;
      48             :     iterator end() const noexcept;
      49             : 
      50             : private:
      51             :     value_type* p_ = nullptr;
      52             :     std::size_t n_ = 0;
      53             : };
      54             : 
      55             : using array_of_const_buffers =
      56             :     array_of_buffers<true>;
      57             : 
      58             : using array_of_mutable_buffers =
      59             :     array_of_buffers<true>;
      60             : 
      61             : } // detail
      62             : } // http_proto
      63             : } // boost
      64             : 
      65             : #include <boost/http_proto/detail/impl/array_of_buffers.hpp>
      66             : 
      67             : #endif

Generated by: LCOV version 1.15