RESTinio
Loading...
Searching...
No Matches
transfer-encoding.hpp
Go to the documentation of this file.
1/*
2 * RESTinio
3 */
4
11
12#pragma once
13
15
16#include <variant>
17#include <tuple>
18
19namespace restinio
20{
21
22namespace http_field_parsers
23{
24
25//
26// transfer_encoding_value_t
27//
48{
57
58 [[nodiscard]]
59 static constexpr known_transfer_coding_t chunked() noexcept
61
62 [[nodiscard]]
63 static constexpr known_transfer_coding_t compress() noexcept
65
66 [[nodiscard]]
67 static constexpr known_transfer_coding_t deflate() noexcept
69
70 [[nodiscard]]
71 static constexpr known_transfer_coding_t gzip() noexcept
73
76 {
77 std::string token;
79
80 [[nodiscard]]
81 bool
82 operator==( const transfer_extension_t & o ) const noexcept
83 {
84 return std::tie(this->token, this->transfer_parameters) ==
85 std::tie(o.token, o.transfer_parameters);
86 }
87 };
88
90 using value_t = std::variant<
93 >;
94
95 using value_container_t = std::vector< value_t >;
96
98
104 [[nodiscard]]
105 static auto
132
138 [[nodiscard]]
139 static expected_t<
143 {
145 }
146};
147
148} /* namespace http_field_parsers */
149
150} /* namespace restinio */
151
Utilities for parsing values of http-fields.
Information about parsing error.
expected_t< typename Producer::result_type, parse_error_t > try_parse(string_view_t from, Producer producer)
Perform the parsing of the specified content by using specified value producer.
auto as_result() noexcept
A factory function to create a as_result_consumer.
auto just_result(T value) noexcept(noexcept(impl::just_result_consumer_t< T >{value}))
A special consumer that replaces the produced value by a value specified by a user and sets that user...
auto to_lower() noexcept
A factory function to create a to_lower_transformer.
auto alternatives(Clauses &&... clauses)
A factory function to create an alternatives clause.
auto produce(Clauses &&... clauses)
A factory function to create a producer that creates an instance of the target type by using specifie...
impl::params_with_value_producer_t params_with_value_p()
A factory of producer of parameter_with_mandatory_value_container.
Definition basics.hpp:1687
auto token_p() noexcept
A factory function to create a token_producer.
Definition basics.hpp:987
auto non_empty_comma_separated_list_p(Element_Producer element)
A factory for a producer that handles non-empty list of comma-separated values.
Definition basics.hpp:1459
auto expected_caseless_token_p(string_view_t token)
A factory function to create a producer that expect a token with specific value.
Definition basics.hpp:1114
std::vector< parameter_with_mandatory_value_t > parameter_with_mandatory_value_container_t
A type of container for parameters with mandatory values.
Definition basics.hpp:1533
std::string_view string_view_t
nonstd::expected< T, E > expected_t
Definition expected.hpp:18
Tools for working with the value of Transfer-Encoding HTTP-field.
static auto make_parser()
A factory function for a parser of Transfer-Encoding value.
std::variant< known_transfer_coding_t, transfer_extension_t > value_t
Type for one value from Transfer-Encoding HTTP-field.
static expected_t< transfer_encoding_value_t, restinio::easy_parser::parse_error_t > try_parse(string_view_t what)
An attempt to parse Transfer-Encoding HTTP-field.
static constexpr known_transfer_coding_t deflate() noexcept
static constexpr known_transfer_coding_t compress() noexcept
known_transfer_coding_t
Enumeration for transfer-coding values from RFC7230.
static constexpr known_transfer_coding_t gzip() noexcept
static constexpr known_transfer_coding_t chunked() noexcept