Fix naming of methodes for RouteParameters

This commit is contained in:
Patrick Niklaus 2016-01-04 11:36:45 +01:00
parent 3568de2c6c
commit b209952ce0
3 changed files with 49 additions and 49 deletions

View File

@ -12,7 +12,7 @@ template <typename Iterator, class HandlerT> struct APIGrammar : qi::grammar<Ite
explicit APIGrammar(HandlerT *h) : APIGrammar::base_type(api_call), handler(h)
{
api_call =
qi::lit('/') >> string[boost::bind(&HandlerT::setService, handler, ::_1)] >> -query;
qi::lit('/') >> string[boost::bind(&HandlerT::SetService, handler, ::_1)] >> -query;
query = ('?') >> +(zoom | output | jsonp | checksum | uturns | location_with_options |
destination_with_options | source_with_options | cmp | language |
instruction | geometry | alt_route | old_API | num_results |
@ -30,56 +30,56 @@ template <typename Iterator, class HandlerT> struct APIGrammar : qi::grammar<Ite
source_with_options = source >> -location_options;
destination_with_options = destination >> -location_options;
zoom = (-qi::lit('&')) >> qi::lit('z') >> '=' >>
qi::short_[boost::bind(&HandlerT::setZoomLevel, handler, ::_1)];
qi::short_[boost::bind(&HandlerT::SetZoomLevel, handler, ::_1)];
output = (-qi::lit('&')) >> qi::lit("output") >> '=' >>
string[boost::bind(&HandlerT::setOutputFormat, handler, ::_1)];
string[boost::bind(&HandlerT::SetOutputFormat, handler, ::_1)];
jsonp = (-qi::lit('&')) >> qi::lit("jsonp") >> '=' >>
stringwithPercent[boost::bind(&HandlerT::setJSONpParameter, handler, ::_1)];
stringwithPercent[boost::bind(&HandlerT::SetJSONpParameter, handler, ::_1)];
checksum = (-qi::lit('&')) >> qi::lit("checksum") >> '=' >>
qi::uint_[boost::bind(&HandlerT::setChecksum, handler, ::_1)];
qi::uint_[boost::bind(&HandlerT::SetChecksum, handler, ::_1)];
instruction = (-qi::lit('&')) >> qi::lit("instructions") >> '=' >>
qi::bool_[boost::bind(&HandlerT::setInstructionFlag, handler, ::_1)];
qi::bool_[boost::bind(&HandlerT::SetInstructionFlag, handler, ::_1)];
geometry = (-qi::lit('&')) >> qi::lit("geometry") >> '=' >>
qi::bool_[boost::bind(&HandlerT::setGeometryFlag, handler, ::_1)];
qi::bool_[boost::bind(&HandlerT::SetGeometryFlag, handler, ::_1)];
cmp = (-qi::lit('&')) >> qi::lit("compression") >> '=' >>
qi::bool_[boost::bind(&HandlerT::setCompressionFlag, handler, ::_1)];
qi::bool_[boost::bind(&HandlerT::SetCompressionFlag, handler, ::_1)];
location = (-qi::lit('&')) >> qi::lit("loc") >> '=' >>
(qi::double_ >> qi::lit(',') >>
qi::double_)[boost::bind(&HandlerT::addCoordinate, handler, ::_1)];
qi::double_)[boost::bind(&HandlerT::AddCoordinate, handler, ::_1)];
destination = (-qi::lit('&')) >> qi::lit("dst") >> '=' >>
(qi::double_ >> qi::lit(',') >>
qi::double_)[boost::bind(&HandlerT::addDestination, handler, ::_1)];
qi::double_)[boost::bind(&HandlerT::AddDestination, handler, ::_1)];
source = (-qi::lit('&')) >> qi::lit("src") >> '=' >>
(qi::double_ >> qi::lit(',') >>
qi::double_)[boost::bind(&HandlerT::addSource, handler, ::_1)];
qi::double_)[boost::bind(&HandlerT::AddSource, handler, ::_1)];
hint = (-qi::lit('&')) >> qi::lit("hint") >> '=' >>
stringwithDot[boost::bind(&HandlerT::addHint, handler, ::_1)];
stringwithDot[boost::bind(&HandlerT::AddHint, handler, ::_1)];
timestamp = (-qi::lit('&')) >> qi::lit("t") >> '=' >>
qi::uint_[boost::bind(&HandlerT::addTimestamp, handler, ::_1)];
qi::uint_[boost::bind(&HandlerT::AddTimestamp, handler, ::_1)];
bearing = (-qi::lit('&')) >> qi::lit("b") >> '=' >>
(qi::int_ >>
-(qi::lit(',') >> qi::int_ |
qi::attr(10)))[boost::bind(&HandlerT::addBearing, handler, ::_1, ::_2, ::_3)];
qi::attr(10)))[boost::bind(&HandlerT::AddBearing, handler, ::_1, ::_2, ::_3)];
u = (-qi::lit('&')) >> qi::lit("u") >> '=' >>
qi::bool_[boost::bind(&HandlerT::setUTurn, handler, ::_1)];
qi::bool_[boost::bind(&HandlerT::SetUTurn, handler, ::_1)];
uturns = (-qi::lit('&')) >> qi::lit("uturns") >> '=' >>
qi::bool_[boost::bind(&HandlerT::setAllUTurns, handler, ::_1)];
qi::bool_[boost::bind(&HandlerT::SetAllUTurns, handler, ::_1)];
language = (-qi::lit('&')) >> qi::lit("hl") >> '=' >>
string[boost::bind(&HandlerT::setLanguage, handler, ::_1)];
string[boost::bind(&HandlerT::SetLanguage, handler, ::_1)];
alt_route = (-qi::lit('&')) >> qi::lit("alt") >> '=' >>
qi::bool_[boost::bind(&HandlerT::setAlternateRouteFlag, handler, ::_1)];
qi::bool_[boost::bind(&HandlerT::SetAlternateRouteFlag, handler, ::_1)];
old_API = (-qi::lit('&')) >> qi::lit("geomformat") >> '=' >>
string[boost::bind(&HandlerT::setDeprecatedAPIFlag, handler, ::_1)];
string[boost::bind(&HandlerT::SetDeprecatedAPIFlag, handler, ::_1)];
num_results = (-qi::lit('&')) >> qi::lit("num_results") >> '=' >>
qi::short_[boost::bind(&HandlerT::setNumberOfResults, handler, ::_1)];
qi::short_[boost::bind(&HandlerT::SetNumberOfResults, handler, ::_1)];
matching_beta = (-qi::lit('&')) >> qi::lit("matching_beta") >> '=' >>
qi::float_[boost::bind(&HandlerT::setMatchingBeta, handler, ::_1)];
qi::float_[boost::bind(&HandlerT::SetMatchingBeta, handler, ::_1)];
gps_precision = (-qi::lit('&')) >> qi::lit("gps_precision") >> '=' >>
qi::float_[boost::bind(&HandlerT::setGPSPrecision, handler, ::_1)];
qi::float_[boost::bind(&HandlerT::SetGPSPrecision, handler, ::_1)];
classify = (-qi::lit('&')) >> qi::lit("classify") >> '=' >>
qi::bool_[boost::bind(&HandlerT::setClassify, handler, ::_1)];
qi::bool_[boost::bind(&HandlerT::SetClassify, handler, ::_1)];
locs = (-qi::lit('&')) >> qi::lit("locs") >> '=' >>
stringforPolyline[boost::bind(&HandlerT::getCoordinatesFromGeometry, handler, ::_1)];
stringforPolyline[boost::bind(&HandlerT::SetCoordinatesFromGeometry, handler, ::_1)];
string = +(qi::char_("a-zA-Z"));
stringwithDot = +(qi::char_("a-zA-Z0-9_.-"));

View File

@ -1,7 +1,7 @@
#ifndef ROUTED_OPTIONS_HPP
#define ROUTED_OPTIONS_HPP
#include "util/version.hpp"
#include "util/ini_file.hpp"
#include "util/version.hpp"
#include "util/osrm_exception.hpp"
#include "util/simple_logger.hpp"

View File

@ -14,7 +14,7 @@ RouteParameters::RouteParameters()
{
}
void RouteParameters::setZoomLevel(const short level)
void RouteParameters::SetZoomLevel(const short level)
{
if (18 >= level && 0 <= level)
{
@ -22,7 +22,7 @@ void RouteParameters::setZoomLevel(const short level)
}
}
void RouteParameters::setNumberOfResults(const short number)
void RouteParameters::SetNumberOfResults(const short number)
{
if (number > 0 && number <= 100)
{
@ -30,16 +30,16 @@ void RouteParameters::setNumberOfResults(const short number)
}
}
void RouteParameters::setAlternateRouteFlag(const bool flag) { alternate_route = flag; }
void RouteParameters::SetAlternateRouteFlag(const bool flag) { alternate_route = flag; }
void RouteParameters::setUTurn(const bool flag)
void RouteParameters::SetUTurn(const bool flag)
{
// the API grammar should make sure this never happens
BOOST_ASSERT(!uturns.empty());
uturns.back() = flag;
}
void RouteParameters::setAllUTurns(const bool flag)
void RouteParameters::SetAllUTurns(const bool flag)
{
// if the flag flips the default, then we erase everything.
if (flag)
@ -50,28 +50,28 @@ void RouteParameters::setAllUTurns(const bool flag)
}
}
void RouteParameters::setDeprecatedAPIFlag(const std::string & /*unused*/) { deprecatedAPI = true; }
void RouteParameters::SetDeprecatedAPIFlag(const std::string & /*unused*/) { deprecatedAPI = true; }
void RouteParameters::setChecksum(const unsigned sum) { check_sum = sum; }
void RouteParameters::SetChecksum(const unsigned sum) { check_sum = sum; }
void RouteParameters::setInstructionFlag(const bool flag) { print_instructions = flag; }
void RouteParameters::SetInstructionFlag(const bool flag) { print_instructions = flag; }
void RouteParameters::setService(const std::string &service_string) { service = service_string; }
void RouteParameters::SetService(const std::string &service_string) { service = service_string; }
void RouteParameters::setClassify(const bool flag) { classify = flag; }
void RouteParameters::SetClassify(const bool flag) { classify = flag; }
void RouteParameters::setMatchingBeta(const double beta) { matching_beta = beta; }
void RouteParameters::SetMatchingBeta(const double beta) { matching_beta = beta; }
void RouteParameters::setGPSPrecision(const double precision) { gps_precision = precision; }
void RouteParameters::SetGPSPrecision(const double precision) { gps_precision = precision; }
void RouteParameters::setOutputFormat(const std::string &format) { output_format = format; }
void RouteParameters::SetOutputFormat(const std::string &format) { output_format = format; }
void RouteParameters::setJSONpParameter(const std::string &parameter)
void RouteParameters::SetJSONpParameter(const std::string &parameter)
{
jsonp_parameter = parameter;
}
void RouteParameters::addHint(const std::string &hint)
void RouteParameters::AddHint(const std::string &hint)
{
hints.resize(coordinates.size());
if (!hints.empty())
@ -80,7 +80,7 @@ void RouteParameters::addHint(const std::string &hint)
}
}
void RouteParameters::addTimestamp(const unsigned timestamp)
void RouteParameters::AddTimestamp(const unsigned timestamp)
{
timestamps.resize(coordinates.size());
if (!timestamps.empty())
@ -89,7 +89,7 @@ void RouteParameters::addTimestamp(const unsigned timestamp)
}
}
void RouteParameters::addBearing(
void RouteParameters::AddBearing(
const boost::fusion::vector<int, boost::optional<int>> &received_bearing,
boost::spirit::qi::unused_type /* unused */,
bool &pass)
@ -105,16 +105,16 @@ void RouteParameters::addBearing(
pass = true;
}
void RouteParameters::setLanguage(const std::string &language_string)
void RouteParameters::SetLanguage(const std::string &language_string)
{
language = language_string;
}
void RouteParameters::setGeometryFlag(const bool flag) { geometry = flag; }
void RouteParameters::SetGeometryFlag(const bool flag) { geometry = flag; }
void RouteParameters::setCompressionFlag(const bool flag) { compression = flag; }
void RouteParameters::SetCompressionFlag(const bool flag) { compression = flag; }
void RouteParameters::addCoordinate(
void RouteParameters::AddCoordinate(
const boost::fusion::vector<double, double> &received_coordinates)
{
coordinates.emplace_back(
@ -125,7 +125,7 @@ void RouteParameters::addCoordinate(
uturns.push_back(uturn_default);
}
void RouteParameters::addDestination(
void RouteParameters::AddDestination(
const boost::fusion::vector<double, double> &received_coordinates)
{
coordinates.emplace_back(
@ -136,7 +136,7 @@ void RouteParameters::addDestination(
uturns.push_back(uturn_default);
}
void RouteParameters::addSource(const boost::fusion::vector<double, double> &received_coordinates)
void RouteParameters::AddSource(const boost::fusion::vector<double, double> &received_coordinates)
{
coordinates.emplace_back(
static_cast<int>(COORDINATE_PRECISION * boost::fusion::at_c<0>(received_coordinates)),
@ -146,7 +146,7 @@ void RouteParameters::addSource(const boost::fusion::vector<double, double> &rec
uturns.push_back(uturn_default);
}
void RouteParameters::getCoordinatesFromGeometry(const std::string &geometry_string)
void RouteParameters::SetCoordinatesFromGeometry(const std::string &geometry_string)
{
PolylineCompressor pc;
coordinates = pc.decode_string(geometry_string);