14 #include <restinio/helpers/http_field_parsers/basics.hpp> 73 auto product_producer = produce< product_t >(
74 token_p() >> &product_t::product,
77 token_p() >> &product_t::product_version
81 return produce< user_agent_value_t >(
82 product_producer >> &user_agent_value_t::product,
83 produce< std::vector< tail_item_t > >(
88 product_producer >> to_container(),
89 comment_p() >> to_container()
92 ) >> &user_agent_value_t::tail
105 return restinio::easy_parser::try_parse( what, make_parser() );
static expected_t< user_agent_value_t, restinio::easy_parser::parse_error_t > try_parse(string_view_t what)
An attempt to parse User-Agent HTTP-field.
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.
std::vector< tail_item_t > tail
A type for holding an info about a product.
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 User-Agent HTTP-field.
std::optional< std::string > product_version
static auto make_parser()
A factory function for a parser of User-Agent value.