RESTinio
pct_encoded_symbols.hpp
Go to the documentation of this file.
1/*
2 * RESTinio
3 */
4
12#pragma once
13
15
16namespace restinio
17{
18
19namespace http_field_parsers
20{
21
22namespace details
23{
24
25//
26// pct_encoded_result_type_t
27//
39using pct_encoded_result_type_t = std::array< char, 3 >;
40
41//
42// pct_encoded_symbols_producer
43//
56inline auto
58{
59 return produce< pct_encoded_result_type_t >(
60 symbol_p( '%' ) >> to_container(),
63 );
64}
65
66//
67// pct_encoded_symbols_consumer_t
68//
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 */
93
94
Utilities for parsing values of http-fields.
#define RESTINIO_NODISCARD
RESTINIO_NODISCARD auto hexdigit_p() noexcept
A factory function to create a hexdigit_producer.
RESTINIO_NODISCARD auto to_container()
A factory function to create a to_container_consumer.
RESTINIO_NODISCARD auto symbol_p(char expected) noexcept
A factory function to create a symbol_producer.
std::array< char, 3 > pct_encoded_result_type_t
A type for representing extraction of percent-encoded char from the input stream.
RESTINIO_NODISCARD auto pct_encoded_symbols_p()
A producer that extract a sequence of symbols represented a percent-encoded character.
A special base class to be used with consumers.
A special consumer that inserts an extracted sequence of symbols into the result string.
void consume(std::string &to, pct_encoded_result_type_t &&from) const