* signature changed from void() to void(engine::api::Parameters&) * performance increase due to use "static const GrammarT" and avoid construction and destruction of grammars during parsing * removed code duplication in inherited grammars * rule unlimited changed to qi::lit * added rule size_t_ * parser accepts "&geometries=" and "&overview=" and fails at "foo" instead of "&geometries=foo" and &overview=foo * added expectations checks for derived grammars * changed rules qi::list(".") to character rules '.'
43 lines
891 B
C++
43 lines
891 B
C++
#ifndef TRIP_PARAMETERS_GRAMMAR_HPP
|
|
#define TRIP_PARAMETERS_GRAMMAR_HPP
|
|
|
|
#include "engine/api/trip_parameters.hpp"
|
|
#include "server/api/route_parameters_grammar.hpp"
|
|
|
|
#include <boost/spirit/include/qi.hpp>
|
|
|
|
namespace osrm
|
|
{
|
|
namespace server
|
|
{
|
|
namespace api
|
|
{
|
|
|
|
namespace
|
|
{
|
|
namespace qi = boost::spirit::qi;
|
|
}
|
|
|
|
template <typename Iterator = std::string::iterator,
|
|
typename Signature = void(engine::api::TripParameters &)>
|
|
struct TripParametersGrammar final : public RouteParametersGrammar<Iterator, Signature>
|
|
{
|
|
using BaseGrammar = RouteParametersGrammar<Iterator, Signature>;
|
|
|
|
TripParametersGrammar() : BaseGrammar(root_rule)
|
|
{
|
|
root_rule
|
|
= BaseGrammar::query_rule(qi::_r1) > -qi::lit(".json")
|
|
> -('?' > (BaseGrammar::base_rule(qi::_r1)) % '&')
|
|
;
|
|
}
|
|
|
|
private:
|
|
qi::rule<Iterator, Signature> root_rule;
|
|
};
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif
|