Line data Source code
1 : //
2 : // Copyright (c) 2025 Mohammad Nejati
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_STATIC_REQUEST_HPP
11 : #define BOOST_HTTP_PROTO_STATIC_REQUEST_HPP
12 :
13 : #include <boost/http_proto/request_base.hpp>
14 :
15 : namespace boost {
16 : namespace http_proto {
17 :
18 : /** A modfiable static container for HTTP requests
19 : */
20 : template<std::size_t Capacity>
21 : class static_request
22 : : public request_base
23 : {
24 : alignas(entry)
25 : char buf_[Capacity];
26 :
27 : public:
28 : /** Constructor
29 : */
30 20 : static_request() noexcept
31 20 : : fields_view_base(&this->fields_base::h_)
32 20 : , request_base(buf_, Capacity)
33 : {
34 20 : }
35 :
36 : /** Constructor
37 : */
38 : explicit
39 22 : static_request(
40 : core::string_view s)
41 22 : : fields_view_base(&this->fields_base::h_)
42 22 : , request_base(s, buf_, Capacity)
43 : {
44 22 : }
45 :
46 : /** Constructor
47 : */
48 2 : static_request(
49 : static_request const& other) noexcept
50 2 : : fields_view_base(&this->fields_base::h_)
51 2 : , request_base(*other.ph_, buf_, Capacity)
52 : {
53 2 : }
54 :
55 : /** Constructor
56 : */
57 2 : static_request(
58 : request_view const& other)
59 2 : : fields_view_base(&this->fields_base::h_)
60 2 : , request_base(*other.ph_, buf_, Capacity)
61 : {
62 2 : }
63 :
64 : /** Assignment
65 : */
66 : static_request&
67 9 : operator=(
68 : static_request const& other) noexcept
69 : {
70 9 : copy_impl(*other.ph_);
71 9 : return *this;
72 : }
73 :
74 : /** Assignment
75 : */
76 : static_request&
77 : operator=(
78 : request_view const& other)
79 : {
80 : copy_impl(*other.ph_);
81 : return *this;
82 : }
83 : };
84 :
85 : } // http_proto
86 : } // boost
87 :
88 : #endif
|