RESTinio
Toggle main menu visibility
Loading...
Searching...
No Matches
restinio
helpers
http_field_parsers
details
pct_encoded_symbols.hpp
Go to the documentation of this file.
1
/*
2
* RESTinio
3
*/
4
5
/*!
6
* @file
7
* @brief Stuff related to percent-encoded symbols.
8
*
9
* @since v.0.6.9
10
*/
11
12
#
pragma
once
13
14
#
include
<
restinio
/
helpers
/
http_field_parsers
/
basics
.
hpp
>
15
16
namespace
restinio
17
{
18
19
namespace
http_field_parsers
20
{
21
22
namespace
details
23
{
24
25
//
26
// pct_encoded_result_type_t
27
//
28
/*!
29
* @brief A type for representing extraction of percent-encoded char
30
* from the input stream.
31
*
32
* Exactly three symbols are extracted: `% HEXDIGIT HEXDIGIT`
33
*
34
* @note
35
* Moved into restinio::http_field_parsers::details namespace in v.0.6.9.
36
*
37
* @since v.0.6.1
38
*/
39
using
pct_encoded_result_type_t
= std::array<
char
, 3 >;
40
41
//
42
// pct_encoded_symbols_producer
43
//
44
/*!
45
* @brief A producer that extract a sequence of symbols represented
46
* a percent-encoded character.
47
*
48
* This producer returns instances of pct_encoded_result_type_t.
49
*
50
* @note
51
* Moved into restinio::http_field_parsers::details namespace in v.0.6.9.
52
*
53
* @since v.0.6.1
54
*/
55
[[
nodiscard
]]
56
inline
auto
57
pct_encoded_symbols_p
()
58
{
59
return
produce<
pct_encoded_result_type_t
>(
60
symbol_p
(
'%'
)
>>
to_container
(
)
,
61
hexdigit_p
(
)
>>
to_container
(
)
,
62
hexdigit_p
(
)
>>
to_container
(
)
63
);
64
}
65
66
//
67
// pct_encoded_symbols_consumer_t
68
//
69
/*!
70
* @brief A special consumer that inserts an extracted sequence
71
* of symbols into the result string.
72
*
73
* @note
74
* Moved into restinio::http_field_parsers::details namespace in v.0.6.9.
75
*
76
* @since v.0.6.1
77
*/
78
struct
pct_encoded_symbols_consumer_t
79
:
public
restinio
::
easy_parser
::
impl
::
consumer_tag
80
{
81
void
82
consume
( std::string & to,
pct_encoded_result_type_t
&& from )
const
83
{
84
to.append( &from[0], from.size() );
85
}
86
};
87
88
}
/* namespace details */
89
90
}
/* namespace http_field_parsers */
91
92
}
/* namespace restinio */
restinio::easy_parser::impl
Definition
easy_parser.hpp:283
restinio::easy_parser
Definition
easy_parser.hpp:42
restinio::easy_parser::to_container
auto to_container()
A factory function to create a to_container_consumer.
Definition
easy_parser.hpp:4566
restinio::easy_parser::symbol_p
auto symbol_p(char expected) noexcept
A factory function to create a symbol_producer.
Definition
easy_parser.hpp:3958
restinio::easy_parser::hexdigit_p
auto hexdigit_p() noexcept
A factory function to create a hexdigit_producer.
Definition
easy_parser.hpp:4175
restinio::http_field_parsers::details
Definition
pct_encoded_symbols.hpp:23
restinio::http_field_parsers::details::pct_encoded_result_type_t
std::array< char, 3 > pct_encoded_result_type_t
A type for representing extraction of percent-encoded char from the input stream.
Definition
pct_encoded_symbols.hpp:39
restinio::http_field_parsers::details::pct_encoded_symbols_p
auto pct_encoded_symbols_p()
A producer that extract a sequence of symbols represented a percent-encoded character.
Definition
pct_encoded_symbols.hpp:57
restinio::http_field_parsers
Definition
accept-charset.hpp:20
restinio
Definition
sendfile_operation_default.ipp:12
restinio::easy_parser::impl::consumer_tag
A special base class to be used with consumers.
Definition
easy_parser.hpp:1346
restinio::http_field_parsers::details::pct_encoded_symbols_consumer_t
A special consumer that inserts an extracted sequence of symbols into the result string.
Definition
pct_encoded_symbols.hpp:80
restinio::http_field_parsers::details::pct_encoded_symbols_consumer_t::consume
void consume(std::string &to, pct_encoded_result_type_t &&from) const
Definition
pct_encoded_symbols.hpp:82
Generated by
1.17.0