#ifndef NEAREST_PARAMETERS_GRAMMAR_HPP #define NEAREST_PARAMETERS_GRAMMAR_HPP #include "server/api/base_parameters_grammar.hpp" #include "engine/api/nearest_parameters.hpp" #include #include namespace osrm { namespace server { namespace api { namespace { namespace ph = boost::phoenix; namespace qi = boost::spirit::qi; } template struct NearestParametersGrammar final : public BaseParametersGrammar { using BaseGrammar = BaseParametersGrammar; NearestParametersGrammar() : BaseGrammar(root_rule) { nearest_rule = (qi::lit("number=") > qi::uint_)[ph::bind(&engine::api::NearestParameters::number_of_results, qi::_r1) = qi::_1]; root_rule = BaseGrammar::query_rule(qi::_r1) > BaseGrammar::format_rule(qi::_r1) > -('?' > (nearest_rule(qi::_r1) | BaseGrammar::base_rule(qi::_r1)) % '&'); } private: qi::rule root_rule; qi::rule nearest_rule; }; } } } #endif