Line data Source code
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 28 : fields::
22 28 : fields() noexcept
23 : : fields_view_base(
24 28 : &this->fields_base::h_)
25 : , fields_base(
26 28 : detail::kind::fields)
27 : {
28 28 : }
29 :
30 265 : fields::
31 : fields(
32 265 : core::string_view s)
33 : : fields_view_base(
34 265 : &this->fields_base::h_)
35 : , fields_base(
36 265 : detail::kind::fields, s)
37 : {
38 264 : }
39 :
40 10 : fields::
41 : fields(
42 : std::size_t cap,
43 10 : std::size_t max_cap)
44 10 : : fields()
45 : {
46 10 : reserve_bytes(cap);
47 10 : set_max_capacity_in_bytes(max_cap);
48 10 : }
49 :
50 6 : fields::
51 : fields(
52 6 : fields&& other) noexcept
53 : : fields_view_base(
54 6 : &this->fields_base::h_)
55 6 : , fields_base(other.h_.kind)
56 : {
57 6 : swap(other);
58 6 : }
59 :
60 2 : fields::
61 : fields(
62 2 : fields const& other)
63 : : fields_view_base(
64 2 : &this->fields_base::h_)
65 2 : , fields_base(*other.ph_)
66 : {
67 2 : }
68 :
69 2 : fields::
70 : fields(
71 2 : fields_view const& other)
72 : : fields_view_base(
73 2 : &this->fields_base::h_)
74 2 : , fields_base(*other.ph_)
75 : {
76 2 : }
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
|