GCC Code Coverage Report


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