Line | Branch | Exec | Source |
---|---|---|---|
1 | // | ||
2 | // Copyright (c) 2021 Vinnie Falco (vinnie.falco@gmail.com) | ||
3 | // Copyright (c) 2024 Christian Mazakas | ||
4 | // | ||
5 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
6 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
7 | // | ||
8 | // Official repository: https://github.com/cppalliance/http_proto | ||
9 | // | ||
10 | |||
11 | #include <boost/http_proto/fields.hpp> | ||
12 | #include <boost/http_proto/fields_base.hpp> | ||
13 | #include <boost/http_proto/fields_view.hpp> | ||
14 | #include <boost/http_proto/fields_view_base.hpp> | ||
15 | #include <boost/core/detail/string_view.hpp> | ||
16 | #include <utility> | ||
17 | |||
18 | namespace boost { | ||
19 | namespace http_proto { | ||
20 | |||
21 | 56 | fields:: | |
22 | 56 | fields() noexcept | |
23 | : fields_view_base( | ||
24 | 56 | &this->fields_base::h_) | |
25 | , fields_base( | ||
26 | 56 | detail::kind::fields) | |
27 | { | ||
28 | 56 | } | |
29 | |||
30 | 530 | fields:: | |
31 | fields( | ||
32 | 530 | core::string_view s) | |
33 | : fields_view_base( | ||
34 | 530 | &this->fields_base::h_) | |
35 | , fields_base( | ||
36 | 530 | detail::kind::fields, s) | |
37 | { | ||
38 | 528 | } | |
39 | |||
40 | 20 | fields:: | |
41 | fields( | ||
42 | std::size_t cap, | ||
43 | 20 | std::size_t max_cap) | |
44 | 20 | : fields() | |
45 | { | ||
46 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | reserve_bytes(cap); |
47 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 2 taken 2 times.
|
20 | set_max_capacity_in_bytes(max_cap); |
48 | 20 | } | |
49 | |||
50 | 12 | fields:: | |
51 | fields( | ||
52 | 12 | fields&& other) noexcept | |
53 | : fields_view_base( | ||
54 | 12 | &this->fields_base::h_) | |
55 | 12 | , fields_base(other.h_.kind) | |
56 | { | ||
57 | 12 | swap(other); | |
58 | 12 | } | |
59 | |||
60 | 4 | fields:: | |
61 | fields( | ||
62 | 4 | fields const& other) | |
63 | : fields_view_base( | ||
64 | 4 | &this->fields_base::h_) | |
65 | 4 | , fields_base(*other.ph_) | |
66 | { | ||
67 | 4 | } | |
68 | |||
69 | 4 | fields:: | |
70 | fields( | ||
71 | 4 | fields_view const& other) | |
72 | : fields_view_base( | ||
73 | 4 | &this->fields_base::h_) | |
74 | 4 | , fields_base(*other.ph_) | |
75 | { | ||
76 | 4 | } | |
77 | |||
78 | fields& | ||
79 | 4 | fields:: | |
80 | operator=( | ||
81 | fields&& other) noexcept | ||
82 | { | ||
83 | 4 | fields tmp(std::move(other)); | |
84 | 4 | tmp.swap(*this); | |
85 | 8 | return *this; | |
86 | 4 | } | |
87 | |||
88 | } // http_proto | ||
89 | } // boost | ||
90 |