Skip to content

Commit 9ee7f6d

Browse files
committed
container hierarchy is refactored
1 parent 0e85b91 commit 9ee7f6d

55 files changed

Lines changed: 1719 additions & 4895 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

include/boost/http_proto.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,21 @@
1414
#include <boost/http_proto/field.hpp>
1515
#include <boost/http_proto/fields.hpp>
1616
#include <boost/http_proto/fields_base.hpp>
17-
#include <boost/http_proto/fields_view.hpp>
18-
#include <boost/http_proto/fields_view_base.hpp>
1917
#include <boost/http_proto/file.hpp>
2018
#include <boost/http_proto/file_mode.hpp>
2119
#include <boost/http_proto/file_sink.hpp>
2220
#include <boost/http_proto/file_source.hpp>
2321
#include <boost/http_proto/header_limits.hpp>
2422
#include <boost/http_proto/message_base.hpp>
25-
#include <boost/http_proto/message_view_base.hpp>
2623
#include <boost/http_proto/method.hpp>
2724
#include <boost/http_proto/parser.hpp>
2825
#include <boost/http_proto/request.hpp>
2926
#include <boost/http_proto/request_parser.hpp>
30-
#include <boost/http_proto/request_view.hpp>
3127
#include <boost/http_proto/response.hpp>
3228
#include <boost/http_proto/response_parser.hpp>
33-
#include <boost/http_proto/response_view.hpp>
3429
#include <boost/http_proto/serializer.hpp>
3530
#include <boost/http_proto/sink.hpp>
3631
#include <boost/http_proto/source.hpp>
37-
#include <boost/http_proto/static_fields.hpp>
3832
#include <boost/http_proto/static_request.hpp>
3933
#include <boost/http_proto/static_response.hpp>
4034
#include <boost/http_proto/status.hpp>

include/boost/http_proto/fields.hpp

Lines changed: 27 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
#include <boost/http_proto/detail/config.hpp>
1616
#include <boost/http_proto/fields_base.hpp>
17-
#include <boost/http_proto/fields_view.hpp>
18-
#include <boost/core/detail/string_view.hpp>
1917

2018
namespace boost {
2119
namespace http_proto {
@@ -79,7 +77,11 @@ class fields final
7977
Constant.
8078
*/
8179
BOOST_HTTP_PROTO_DECL
82-
fields() noexcept;
80+
fields() noexcept
81+
: fields_base(detail::kind::fields)
82+
{
83+
}
84+
8385

8486
/** Constructor.
8587
@@ -119,7 +121,10 @@ class fields final
119121
BOOST_HTTP_PROTO_DECL
120122
explicit
121123
fields(
122-
core::string_view s);
124+
core::string_view s)
125+
: fields_base(detail::kind::fields, s)
126+
{
127+
}
123128

124129
/** Constructor.
125130
@@ -151,7 +156,12 @@ class fields final
151156
explicit
152157
fields(
153158
std::size_t cap,
154-
std::size_t max_cap = std::size_t(-1));
159+
std::size_t max_cap = std::size_t(-1))
160+
: fields()
161+
{
162+
reserve_bytes(cap);
163+
set_max_capacity_in_bytes(max_cap);
164+
}
155165

156166
/** Constructor.
157167
@@ -173,28 +183,12 @@ class fields final
173183
@param f The fields to move from.
174184
*/
175185
BOOST_HTTP_PROTO_DECL
176-
fields(fields&& f) noexcept;
177-
178-
/** Constructor.
179-
180-
The newly constructed object contains
181-
a copy of `f`.
182-
183-
@par Postconditions
184-
@code
185-
this->buffer() == f.buffer() && this->buffer().data() != f.buffer().data()
186-
@endcode
186+
fields(fields&& f) noexcept
187+
: fields_base(f.h_.kind)
188+
{
189+
swap(f);
190+
}
187191

188-
@par Complexity
189-
Linear in `f.size()`.
190-
191-
@par Exception Safety
192-
Calls to allocate may throw.
193-
194-
@param f The fields to copy.
195-
*/
196-
BOOST_HTTP_PROTO_DECL
197-
fields(fields const& f);
198192

199193
/** Constructor.
200194
@@ -210,13 +204,12 @@ class fields final
210204
Linear in `f.size()`.
211205
212206
@par Exception Safety
213-
Strong guarantee.
214207
Calls to allocate may throw.
215208
216209
@param f The fields to copy.
217210
*/
218211
BOOST_HTTP_PROTO_DECL
219-
fields(fields_view const& f);
212+
fields(fields const& f) = default;
220213

221214
/** Assignment.
222215
@@ -241,38 +234,10 @@ class fields final
241234
*/
242235
BOOST_HTTP_PROTO_DECL
243236
fields&
244-
operator=(fields&& f) noexcept;
245-
246-
/** Assignment.
247-
248-
The contents of `f` are copied and
249-
the previous contents of `this` are
250-
discarded.
251-
252-
@par Postconditions
253-
@code
254-
this->buffer() == f.buffer() && this->buffer().data() != f.buffer().data()
255-
@endcode
256-
257-
@par Complexity
258-
Linear in `f.size()`.
259-
260-
@par Exception Safety
261-
Strong guarantee.
262-
Calls to allocate may throw.
263-
Exception thrown if max capacity exceeded.
264-
265-
@throw std::length_error
266-
Max capacity would be exceeded.
267-
268-
@return A reference to this object.
269-
270-
@param f The fields to copy.
271-
*/
272-
fields&
273-
operator=(fields const& f) noexcept
237+
operator=(fields&& f) noexcept
274238
{
275-
copy_impl(*f.ph_);
239+
fields tmp(std::move(f));
240+
tmp.swap(*this);
276241
return *this;
277242
}
278243

@@ -288,7 +253,7 @@ class fields final
288253
@endcode
289254
290255
@par Complexity
291-
Linear in `r.size()`.
256+
Linear in `f.size()`.
292257
293258
@par Exception Safety
294259
Strong guarantee.
@@ -303,24 +268,12 @@ class fields final
303268
@param f The fields to copy.
304269
*/
305270
fields&
306-
operator=(fields_view const& f)
271+
operator=(fields const& f) noexcept
307272
{
308-
copy_impl(*f.ph_);
273+
copy_impl(f.h_);
309274
return *this;
310275
}
311276

312-
/** Conversion.
313-
314-
@see
315-
@ref fields_view.
316-
317-
@return A view of the fields.
318-
*/
319-
operator fields_view() const noexcept
320-
{
321-
return fields_view(ph_);
322-
}
323-
324277
//--------------------------------------------
325278

326279
/** Swap.

0 commit comments

Comments
 (0)