2016-03-02 19:48:30 -05:00
|
|
|
#ifndef SERVER_API_TILE_PARAMETERS_GRAMMAR_HPP
|
|
|
|
#define SERVER_API_TILE_PARAMETERS_GRAMMAR_HPP
|
|
|
|
|
|
|
|
#include "engine/api/tile_parameters.hpp"
|
|
|
|
|
|
|
|
#include "engine/hint.hpp"
|
2016-04-07 07:25:35 -04:00
|
|
|
#include "engine/polyline_compressor.hpp"
|
2016-03-02 19:48:30 -05:00
|
|
|
|
2016-04-07 07:25:35 -04:00
|
|
|
//#define BOOST_SPIRIT_DEBUG
|
|
|
|
#include <boost/spirit/include/qi.hpp>
|
2016-03-02 19:48:30 -05:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace server
|
|
|
|
{
|
|
|
|
namespace api
|
|
|
|
{
|
|
|
|
|
|
|
|
namespace qi = boost::spirit::qi;
|
|
|
|
struct TileParametersGrammar final : boost::spirit::qi::grammar<std::string::iterator>
|
|
|
|
{
|
|
|
|
using Iterator = std::string::iterator;
|
|
|
|
|
2016-03-03 08:26:13 -05:00
|
|
|
TileParametersGrammar() : TileParametersGrammar::base_type(root_rule)
|
2016-03-02 19:48:30 -05:00
|
|
|
{
|
2016-04-07 07:25:35 -04:00
|
|
|
const auto set_x = [this](const unsigned x_) { parameters.x = x_; };
|
|
|
|
const auto set_y = [this](const unsigned y_) { parameters.y = y_; };
|
|
|
|
const auto set_z = [this](const unsigned z_) { parameters.z = z_; };
|
2016-03-03 08:26:13 -05:00
|
|
|
|
2016-04-08 08:05:39 -04:00
|
|
|
query_rule = qi::lit("tile(") > qi::uint_[set_x] //
|
|
|
|
> qi::lit(",") > qi::uint_[set_y] > //
|
|
|
|
qi::lit(",") > qi::uint_[set_z] > qi::lit(")"); //
|
2016-03-02 19:48:30 -05:00
|
|
|
|
2016-04-08 08:05:39 -04:00
|
|
|
root_rule = query_rule > qi::lit(".mvt");
|
2016-03-02 19:48:30 -05:00
|
|
|
}
|
|
|
|
engine::api::TileParameters parameters;
|
|
|
|
|
2016-03-03 08:26:13 -05:00
|
|
|
private:
|
2016-03-02 19:48:30 -05:00
|
|
|
qi::rule<Iterator> root_rule;
|
|
|
|
qi::rule<Iterator> query_rule;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|