2016-02-17 18:20:53 -05:00
|
|
|
#ifndef TRIP_PARAMETERS_GRAMMAR_HPP
|
|
|
|
#define TRIP_PARAMETERS_GRAMMAR_HPP
|
|
|
|
|
|
|
|
#include "engine/api/trip_parameters.hpp"
|
2016-04-20 14:40:17 -04:00
|
|
|
#include "server/api/route_parameters_grammar.hpp"
|
2016-02-17 18:20:53 -05:00
|
|
|
|
2016-04-07 07:25:35 -04:00
|
|
|
#include <boost/spirit/include/qi.hpp>
|
2016-02-17 18:20:53 -05:00
|
|
|
|
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace server
|
|
|
|
{
|
|
|
|
namespace api
|
|
|
|
{
|
|
|
|
|
2016-04-20 14:40:17 -04:00
|
|
|
namespace
|
|
|
|
{
|
2016-02-17 18:20:53 -05:00
|
|
|
namespace qi = boost::spirit::qi;
|
2016-04-20 14:40:17 -04:00
|
|
|
}
|
2016-02-17 18:20:53 -05:00
|
|
|
|
2016-04-20 14:40:17 -04:00
|
|
|
template <typename Iterator = std::string::iterator,
|
|
|
|
typename Signature = void(engine::api::TripParameters &)>
|
|
|
|
struct TripParametersGrammar final : public RouteParametersGrammar<Iterator, Signature>
|
2016-02-17 18:20:53 -05:00
|
|
|
{
|
2016-04-20 14:40:17 -04:00
|
|
|
using BaseGrammar = RouteParametersGrammar<Iterator, Signature>;
|
2016-02-17 18:20:53 -05:00
|
|
|
|
2016-04-20 14:40:17 -04:00
|
|
|
TripParametersGrammar() : BaseGrammar(root_rule)
|
2016-02-17 18:20:53 -05:00
|
|
|
{
|
2016-04-20 14:40:17 -04:00
|
|
|
root_rule
|
|
|
|
= BaseGrammar::query_rule(qi::_r1) > -qi::lit(".json")
|
|
|
|
> -('?' > (BaseGrammar::base_rule(qi::_r1)) % '&')
|
|
|
|
;
|
2016-02-17 18:20:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2016-04-20 14:40:17 -04:00
|
|
|
qi::rule<Iterator, Signature> root_rule;
|
2016-02-17 18:20:53 -05:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|