GCC Code Coverage Report


Directory: libs/http_proto/include/boost/http_proto/
File: boost/http_proto/detail/array_of_buffers.hpp
Date: 2023-01-26 23:44:13
Exec Total Coverage
Lines: 1 1 100.0%
Functions: 1 1 100.0%
Branches: 0 0 -%

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