14 #include <restinio/helpers/http_field_parsers/basics.hpp> 32 return produce<std::string>(
33 repeat(1u, 8u, alpha_symbol_p() >> to_container()),
35 symbol_p(
'-') >> to_container(),
36 repeat(1u, 8u, alphanum_symbol_p() >> to_container())
45 return produce<std::string>(
47 symbol_p(
'*') >> to_container(),
48 make_language_tag_p() >> as_result()
99 return produce< accept_language_value_t >(
100 non_empty_comma_separated_list_p< item_container_t >(
102 make_language_range_p() >> &item_t::language_range,
103 maybe( weight_p() >> &item_t::weight )
105 ) >> &accept_language_value_t::languages
118 return restinio::easy_parser::try_parse( what, make_parser() );
expected_t< std::optional< string_view_t >, not_found_t > find_first(const parameter_with_optional_value_container_t &where, string_view_t what)
A helper function to find the first occurence of a parameter with the specified value.
item_container_t languages
std::string language_range
std::enable_if< std::is_same< Parameter_Container, query_string_params_t >::value||std::is_same< Parameter_Container, router::route_params_t >::value, std::optional< Value_Type > >::type opt_value(const Parameter_Container ¶ms, string_view_t key)
Gets the value of a parameter specified by key wrapped in std::optional<Value_Type> if parameter exis...
Tools for working with the value of Accept-Language HTTP-field.
auto make_language_tag_p()
static auto make_parser()
A factory function for a parser of Accept-Language value.
auto make_language_range_p()
static expected_t< accept_language_value_t, restinio::easy_parser::parse_error_t > try_parse(string_view_t what)
An attempt to parse Accept-Language HTTP-field.