GCC Code Coverage Report


Directory: libs/http_proto/include/boost/http_proto/
File: boost/http_proto/fields.hpp
Date: 2023-02-27 20:43:06
Exec Total Coverage
Lines: 11 11 100.0%
Functions: 4 4 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 //
2 // Copyright (c) 2021 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_FIELDS_HPP
11 #define BOOST_HTTP_PROTO_FIELDS_HPP
12
13 #include <boost/http_proto/detail/config.hpp>
14 #include <boost/http_proto/fields_base.hpp>
15 #include <boost/http_proto/fields_view.hpp>
16 #include <boost/core/detail/string_view.hpp>
17 #include <initializer_list>
18
19 namespace boost {
20 namespace http_proto {
21
22 /** A modifiable container of HTTP fields
23 */
24 class BOOST_SYMBOL_VISIBLE
25 fields
26 : public fields_base
27 {
28 public:
29
30 //--------------------------------------------
31 //
32 // Special Members
33 //
34 //--------------------------------------------
35
36 /** Constructor
37
38 Default-constructed fields have no
39 name-value pairs.
40 */
41 BOOST_HTTP_PROTO_DECL
42 fields() noexcept;
43
44 /** Constructor
45 */
46 BOOST_HTTP_PROTO_DECL
47 explicit
48 fields(
49 core::string_view s) noexcept;
50
51 /** Constructor
52 */
53 BOOST_HTTP_PROTO_DECL
54 fields(fields&& other) noexcept;
55
56 /** Constructor
57 */
58 BOOST_HTTP_PROTO_DECL
59 fields(fields const& other);
60
61 /** Constructor
62 */
63 BOOST_HTTP_PROTO_DECL
64 fields(fields_view const& other);
65
66 /** Assignment
67 */
68 BOOST_HTTP_PROTO_DECL
69 fields&
70 operator=(fields&& f) noexcept;
71
72 /** Assignment
73 */
74 fields&
75 3 operator=(fields const& f) noexcept
76 {
77 3 copy_impl(*f.ph_);
78 3 return *this;
79 }
80
81 /** Assignment
82 */
83 fields&
84 4 operator=(fields_view const& f)
85 {
86 4 copy_impl(*f.ph_);
87 4 return *this;
88 }
89
90 /** Conversion
91 */
92 4 operator fields_view() const noexcept
93 {
94 4 return fields_view(ph_);
95 }
96
97 //--------------------------------------------
98 //
99 // Modifiers
100 //
101 //--------------------------------------------
102
103 /** Swap this with another instance
104 */
105 void
106 8 swap(fields& other) noexcept
107 {
108 8 h_.swap(other.h_);
109 8 }
110
111 /** Swap two instances
112 */
113 // hidden friend
114 friend
115 void
116 swap(
117 fields& t0,
118 fields& t1) noexcept
119 {
120 t0.swap(t1);
121 }
122 };
123
124 } // http_proto
125 } // boost
126
127 #endif
128