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 |
|
|
fields(fields&& other) noexcept; |
47 |
|
|
|
48 |
|
|
/** Constructor |
49 |
|
|
*/ |
50 |
|
|
BOOST_HTTP_PROTO_DECL |
51 |
|
|
fields(fields const& other); |
52 |
|
|
|
53 |
|
|
/** Constructor |
54 |
|
|
*/ |
55 |
|
|
BOOST_HTTP_PROTO_DECL |
56 |
|
|
fields(fields_view const& other); |
57 |
|
|
|
58 |
|
|
/** Assignment |
59 |
|
|
*/ |
60 |
|
|
BOOST_HTTP_PROTO_DECL |
61 |
|
|
fields& |
62 |
|
|
operator=(fields&& f) noexcept; |
63 |
|
|
|
64 |
|
|
/** Assignment |
65 |
|
|
*/ |
66 |
|
|
fields& |
67 |
|
3 |
operator=(fields const& f) noexcept |
68 |
|
|
{ |
69 |
|
3 |
copy_impl(*f.ph_); |
70 |
|
3 |
return *this; |
71 |
|
|
} |
72 |
|
|
|
73 |
|
|
/** Assignment |
74 |
|
|
*/ |
75 |
|
|
fields& |
76 |
|
4 |
operator=(fields_view const& f) |
77 |
|
|
{ |
78 |
|
4 |
copy_impl(*f.ph_); |
79 |
|
4 |
return *this; |
80 |
|
|
} |
81 |
|
|
|
82 |
|
|
/** Conversion |
83 |
|
|
*/ |
84 |
|
4 |
operator fields_view() const noexcept |
85 |
|
|
{ |
86 |
|
4 |
return fields_view(ph_); |
87 |
|
|
} |
88 |
|
|
|
89 |
|
|
//-------------------------------------------- |
90 |
|
|
// |
91 |
|
|
// Modifiers |
92 |
|
|
// |
93 |
|
|
//-------------------------------------------- |
94 |
|
|
|
95 |
|
|
/** Swap this with another instance |
96 |
|
|
*/ |
97 |
|
|
void |
98 |
|
8 |
swap(fields& other) noexcept |
99 |
|
|
{ |
100 |
|
8 |
h_.swap(other.h_); |
101 |
|
8 |
} |
102 |
|
|
|
103 |
|
|
/** Swap two instances |
104 |
|
|
*/ |
105 |
|
|
// hidden friend |
106 |
|
|
friend |
107 |
|
|
void |
108 |
|
|
swap( |
109 |
|
|
fields& t0, |
110 |
|
|
fields& t1) noexcept |
111 |
|
|
{ |
112 |
|
|
t0.swap(t1); |
113 |
|
|
} |
114 |
|
|
}; |
115 |
|
|
|
116 |
|
|
} // http_proto |
117 |
|
|
} // boost |
118 |
|
|
|
119 |
|
|
#endif |
120 |
|
|
|