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 23 : fields:: 22 23 : fields() noexcept 23 : : fields_view_base( 24 23 : &this->fields_base::h_) 25 : , fields_base( 26 23 : detail::kind::fields) 27 : { 28 23 : } 29 : 30 241 : fields:: 31 : fields( 32 241 : core::string_view s) 33 : : fields_view_base( 34 241 : &this->fields_base::h_) 35 : , fields_base( 36 241 : detail::kind::fields, s) 37 : { 38 240 : } 39 : 40 4 : fields:: 41 : fields( 42 4 : std::size_t size) 43 4 : : fields_view_base(&this->fields_base::h_) 44 : , fields_base( 45 4 : detail::kind::fields, size) 46 : { 47 4 : } 48 : 49 8 : fields:: 50 : fields( 51 : std::size_t size, 52 8 : std::size_t max_size) 53 8 : : fields_view_base(&this->fields_base::h_) 54 : , fields_base( 55 8 : detail::kind::fields, size, max_size) 56 : { 57 6 : } 58 : 59 6 : fields:: 60 : fields( 61 6 : fields&& other) noexcept 62 : : fields_view_base( 63 6 : &this->fields_base::h_) 64 6 : , fields_base(other.h_.kind) 65 : { 66 6 : swap(other); 67 6 : } 68 : 69 2 : fields:: 70 : fields( 71 2 : fields const& other) 72 : : fields_view_base( 73 2 : &this->fields_base::h_) 74 2 : , fields_base(*other.ph_) 75 : { 76 2 : } 77 : 78 2 : fields:: 79 : fields( 80 2 : fields_view const& other) 81 : : fields_view_base( 82 2 : &this->fields_base::h_) 83 2 : , fields_base(*other.ph_) 84 : { 85 2 : } 86 : 87 : fields& 88 4 : fields:: 89 : operator=( 90 : fields&& other) noexcept 91 : { 92 4 : fields tmp(std::move(other)); 93 4 : tmp.swap(*this); 94 4 : return *this; 95 : } 96 : 97 : } // http_proto 98 : } // boost