]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/beast/http/impl/parser.ipp
Add patch for failing prerm scripts
[ceph.git] / ceph / src / boost / boost / beast / http / impl / parser.ipp
CommitLineData
b32b8144
FG
1//
2// Copyright (c) 2016-2017 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/boostorg/beast
8//
9
10#ifndef BOOST_BEAST_HTTP_IMPL_PARSER_IPP
11#define BOOST_BEAST_HTTP_IMPL_PARSER_IPP
12
13#include <boost/throw_exception.hpp>
14#include <stdexcept>
15
16namespace boost {
17namespace beast {
18namespace http {
19
20template<bool isRequest, class Body, class Allocator>
21parser<isRequest, Body, Allocator>::
22parser()
11fdf7f2
TL
23 : parser{detail::has_deprecated_body_reader<Body>{}}
24{
25}
26
27template<bool isRequest, class Body, class Allocator>
28parser<isRequest, Body, Allocator>::
29parser(std::true_type)
30 : rd_(m_)
31{
32#ifndef BOOST_BEAST_ALLOW_DEPRECATED
33 // Deprecated BodyReader Concept (v1.66)
34 static_assert(sizeof(Body) == 0,
35 BOOST_BEAST_DEPRECATION_STRING);
36#endif
37}
38
39template<bool isRequest, class Body, class Allocator>
40parser<isRequest, Body, Allocator>::
41parser(std::false_type)
42 : rd_(m_.base(), m_.body())
b32b8144
FG
43{
44}
45
46template<bool isRequest, class Body, class Allocator>
47template<class Arg1, class... ArgN, class>
48parser<isRequest, Body, Allocator>::
49parser(Arg1&& arg1, ArgN&&... argn)
11fdf7f2
TL
50 : parser(std::forward<Arg1>(arg1),
51 detail::has_deprecated_body_reader<Body>{},
52 std::forward<ArgN>(argn)...)
53{
54}
55
56// VFALCO arg1 comes before `true_type` to make
57// the signature unambiguous.
58template<bool isRequest, class Body, class Allocator>
59template<class Arg1, class... ArgN, class>
60parser<isRequest, Body, Allocator>::
61parser(Arg1&& arg1, std::true_type, ArgN&&... argn)
b32b8144
FG
62 : m_(std::forward<Arg1>(arg1),
63 std::forward<ArgN>(argn)...)
11fdf7f2 64 , rd_(m_)
b32b8144
FG
65{
66 m_.clear();
11fdf7f2
TL
67#ifndef BOOST_BEAST_ALLOW_DEPRECATED
68 /* Deprecated BodyWriter Concept (v1.66) */
69 static_assert(sizeof(Body) == 0,
70 BOOST_BEAST_DEPRECATION_STRING);
71#endif // BOOST_BEAST_ALLOW_DEPRECATED
72}
73
74// VFALCO arg1 comes before `false_type` to make
75// the signature unambiguous.
76template<bool isRequest, class Body, class Allocator>
77template<class Arg1, class... ArgN, class>
78parser<isRequest, Body, Allocator>::
79parser(Arg1&& arg1, std::false_type, ArgN&&... argn)
80 : m_(std::forward<Arg1>(arg1),
81 std::forward<ArgN>(argn)...)
82 , rd_(m_.base(), m_.body())
83{
84 m_.clear();
85}
86
87template<bool isRequest, class Body, class Allocator>
88template<class OtherBody, class... Args, class>
89parser<isRequest, Body, Allocator>::
90parser(
91 parser<isRequest, OtherBody, Allocator>&& other,
92 Args&&... args)
93 : parser(detail::has_deprecated_body_reader<Body>{},
94 std::move(other), std::forward<Args>(args)...)
95{
96}
97
98template<bool isRequest, class Body, class Allocator>
99template<class OtherBody, class... Args, class>
100parser<isRequest, Body, Allocator>::
101parser(std::true_type,
102 parser<isRequest, OtherBody, Allocator>&& other,
103 Args&&... args)
104 : base_type(std::move(other))
105 , m_(other.release(), std::forward<Args>(args)...)
106 , rd_(m_)
107{
108 if(other.rd_inited_)
109 BOOST_THROW_EXCEPTION(std::invalid_argument{
110 "moved-from parser has a body"});
111#ifndef BOOST_BEAST_ALLOW_DEPRECATED
112 // Deprecated BodyReader Concept (v1.66)
113 static_assert(sizeof(Body) == 0,
114 BOOST_BEAST_DEPRECATION_STRING);
115#endif
b32b8144
FG
116}
117
118template<bool isRequest, class Body, class Allocator>
119template<class OtherBody, class... Args, class>
120parser<isRequest, Body, Allocator>::
11fdf7f2 121parser(std::false_type, parser<isRequest, OtherBody, Allocator>&& other,
b32b8144
FG
122 Args&&... args)
123 : base_type(std::move(other))
124 , m_(other.release(), std::forward<Args>(args)...)
11fdf7f2 125 , rd_(m_.base(), m_.body())
b32b8144
FG
126{
127 if(other.rd_inited_)
128 BOOST_THROW_EXCEPTION(std::invalid_argument{
129 "moved-from parser has a body"});
130}
131
132} // http
133} // beast
134} // boost
135
136#endif