Integration #3149 and #3815

This commit is contained in:
Lev Dragunov
2017-03-14 14:35:09 +03:00
committed by Patrick Niklaus
parent bd9eb76a2d
commit e9c0987e8a
4 changed files with 57 additions and 13 deletions
+11 -4
View File
@@ -50,24 +50,31 @@ namespace api
*/
struct MatchParameters : public RouteParameters
{
enum class PreprocessingType
{
False,
Simple,
Full
};
MatchParameters()
: RouteParameters(false,
false,
false,
RouteParameters::GeometriesType::Polyline,
RouteParameters::OverviewType::Simplified,
{}), use_tidying(true)
{}), track_preprocessing(PreprocessingType::Simple)
{
}
template <typename... Args>
MatchParameters(std::vector<unsigned> timestamps_, bool use_tidying_, Args... args_)
: RouteParameters{std::forward<Args>(args_)...}, timestamps{std::move(timestamps_)}, use_tidying(use_tidying_)
MatchParameters(std::vector<unsigned> timestamps_, PreprocessingType track_preprocessing_, Args... args_)
: RouteParameters{std::forward<Args>(args_)...}, timestamps{std::move(timestamps_)}, track_preprocessing(track_preprocessing_)
{
}
std::vector<unsigned> timestamps;
bool use_tidying;
PreprocessingType track_preprocessing;
bool IsValid() const
{
@@ -33,15 +33,22 @@ struct MatchParametersGrammar final : public RouteParametersGrammar<Iterator, Si
(qi::uint_ %
';')[ph::bind(&engine::api::MatchParameters::timestamps, qi::_r1) = qi::_1];
preprocessing_type.add("simple", engine::api::MatchParameters::PreprocessingType::Simple)(
"full", engine::api::MatchParameters::PreprocessingType::Full)(
"false", engine::api::MatchParameters::PreprocessingType::False);
root_rule = BaseGrammar::query_rule(qi::_r1) > -qi::lit(".json") >
-('?' > (timestamps_rule(qi::_r1) | BaseGrammar::base_rule(qi::_r1) | (
qi::lit("tidying=") > qi::bool_[ph::bind(&engine::api::MatchParameters::use_tidying,
qi::_r1) = qi::_1])) % '&');
qi::lit("preprocess=") > preprocessing_type[ph::bind(&engine::api::MatchParameters::track_preprocessing, qi::_r1) = qi::_1])
) % '&');
}
private:
qi::rule<Iterator, Signature> root_rule;
qi::rule<Iterator, Signature> timestamps_rule;
qi::symbols<char, engine::api::MatchParameters::PreprocessingType> preprocessing_type;
};
}
}