GCC Code Coverage Report


Directory: libs/http_proto/include/boost/http_proto/
File: boost/http_proto/detail/circular_buffer.hpp
Date: 2023-01-15 07:18:31
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_CIRCULAR_BUFFER_HPP
11 #define BOOST_HTTP_PROTO_DETAIL_CIRCULAR_BUFFER_HPP
12
13 #include <boost/http_proto/buffer.hpp>
14
15 namespace boost {
16 namespace http_proto {
17 namespace detail {
18
19 class circular_buffer
20 {
21 unsigned char* base_ = nullptr;
22 std::size_t cap_ = 0;
23 std::size_t in_pos_ = 0;
24 std::size_t in_len_ = 0;
25 std::size_t out_size_ = 0;
26
27 public:
28 30 circular_buffer() = default;
29 circular_buffer(
30 circular_buffer const&) = default;
31 circular_buffer& operator=(
32 circular_buffer const&) = default;
33
34 circular_buffer(
35 void* base,
36 std::size_t capacity) noexcept;
37
38 bool empty() const noexcept;
39 std::size_t size() const noexcept;
40 std::size_t capacity() const noexcept;
41 const_buffers_pair data() const noexcept;
42 mutable_buffers_pair prepare(std::size_t n);
43 void commit(std::size_t n);
44 void uncommit(std::size_t n);
45 void consume(std::size_t n) noexcept;
46 };
47
48 } // detail
49 } // http_proto
50 } // boost
51
52 #endif
53