-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathparameter.hpp
More file actions
123 lines (97 loc) · 2.62 KB
/
parameter.hpp
File metadata and controls
123 lines (97 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//
// Copyright (c) 2021 Vinnie Falco (vinnie.falco@gmail.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Official repository: https://github.com/cppalliance/http_proto
//
#ifndef BOOST_HTTP_PROTO_RFC_PARAMETER_HPP
#define BOOST_HTTP_PROTO_RFC_PARAMETER_HPP
#include <boost/http_proto/detail/config.hpp>
#include <boost/http_proto/rfc/quoted_token_view.hpp>
#include <boost/system/result.hpp>
#include <boost/url/grammar/range_rule.hpp>
namespace boost {
namespace http_proto {
/** An HTTP header parameter
@par BNF
@code
parameter = token "=" ( token / quoted-string )
@endcode
@par Specification
@li <a href="https://www.rfc-editor.org/rfc/rfc7231#section-3.1.1.1"
>3.1.1.1. Media Type (rfc7231)</a>
*/
struct parameter
{
core::string_view name;
quoted_token_view value;
};
//------------------------------------------------
namespace implementation_defined {
struct parameter_rule_t
{
using value_type = parameter;
BOOST_HTTP_PROTO_DECL
auto
parse(
char const*&,
char const*) const noexcept ->
system::result<value_type>;
};
struct parameters_rule_t
{
using value_type = grammar::range<parameter>;
BOOST_HTTP_PROTO_DECL
auto
parse(
char const*&,
char const*) const noexcept ->
system::result<value_type>;
};
} // implementation_defined
/** Rule matching parameter
@par Value Type
@code
using value_type = parameter;
@endcode
@par Example
@code
@endcode
@par BNF
@code
parameter = token "=" ( token / quoted-string )
@endcode
@par Specification
@li <a href="https://www.rfc-editor.org/rfc/rfc7231#section-3.1.1.1"
>3.1.1.1. Media Type (rfc7231)</a>
@see
@ref parameter.
*/
BOOST_INLINE_CONSTEXPR implementation_defined::parameter_rule_t parameter_rule{};
//------------------------------------------------
/** Rule matching parameters
@par Value Type
@code
using value_type = grammar::range< parameter >;
@endcode
@par Example
@code
@endcode
@par BNF
@code
parameters = *( OWS ";" OWS parameter )
parameter = token "=" ( token / quoted-string )
@endcode
@par Specification
@li <a href="https://www.rfc-editor.org/rfc/rfc7231#section-3.1.1.1"
>3.1.1.1. Media Type (rfc7231)</a>
@see
@ref parameter,
@ref parameter_rule.
*/
BOOST_INLINE_CONSTEXPR implementation_defined::parameters_rule_t parameters_rule{};
} // http_proto
} // boost
#endif