osrm-backend/include/server/api/tile_parameter_grammar.hpp

48 lines
1.2 KiB
C++
Raw Normal View History

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"
#include "engine/polyline_compressor.hpp"
2016-03-02 19:48:30 -05:00
#include <boost/spirit/include/phoenix.hpp>
#include <boost/spirit/include/qi.hpp>
2016-03-02 19:48:30 -05:00
#include <string>
namespace osrm
{
namespace server
{
namespace api
{
namespace
2016-03-02 19:48:30 -05:00
{
namespace ph = boost::phoenix;
namespace qi = boost::spirit::qi;
}
2016-03-02 19:48:30 -05:00
template <typename Iterator = std::string::iterator,
typename Signature = void(engine::api::TileParameters &)>
struct TileParametersGrammar final : boost::spirit::qi::grammar<Iterator, Signature>
{
2016-03-03 08:26:13 -05:00
TileParametersGrammar() : TileParametersGrammar::base_type(root_rule)
2016-03-02 19:48:30 -05:00
{
2016-05-27 15:05:04 -04:00
root_rule = qi::lit("tile(") >
qi::uint_[ph::bind(&engine::api::TileParameters::x, qi::_r1) = qi::_1] > ',' >
qi::uint_[ph::bind(&engine::api::TileParameters::y, qi::_r1) = qi::_1] > ',' >
qi::uint_[ph::bind(&engine::api::TileParameters::z, qi::_r1) = qi::_1] >
qi::lit(").mvt");
2016-03-02 19:48:30 -05:00
}
2016-03-03 08:26:13 -05:00
private:
qi::rule<Iterator, Signature> root_rule;
2016-03-02 19:48:30 -05:00
};
}
}
}
#endif