GCC Code Coverage Report


Directory: libs/http_proto/include/boost/http_proto/
File: boost/http_proto/detail/flat_buffer.hpp
Date: 2023-02-02 18:17:22
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_FLAT_BUFFER_HPP
11 #define BOOST_HTTP_PROTO_DETAIL_FLAT_BUFFER_HPP
12
13 #include <boost/http_proto/buffer.hpp>
14
15 namespace boost {
16 namespace http_proto {
17 namespace detail {
18
19 class flat_buffer
20 {
21 unsigned char* data_ = nullptr;
22 std::size_t cap_ = 0;
23 std::size_t in_pos_ = 0;
24 std::size_t in_size_ = 0;
25 std::size_t out_size_ = 0;
26
27 public:
28 745 flat_buffer() = default;
29 flat_buffer(
30 flat_buffer const&) = default;
31 flat_buffer& operator=(
32 flat_buffer const&) = default;
33
34 flat_buffer(
35 void* data,
36 std::size_t capacity,
37 std::size_t initial_size = 0) noexcept;
38
39 bool empty() const noexcept;
40 std::size_t size() const noexcept;
41 std::size_t capacity() const noexcept;
42 const_buffer data() const noexcept;
43 mutable_buffer prepare(std::size_t n);
44 void commit(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