diff options
author | VladiMihaylenko <vxmihaylenko@gmail.com> | 2016-07-27 12:02:55 +0300 |
---|---|---|
committer | VladiMihaylenko <vxmihaylenko@gmail.com> | 2016-08-08 11:39:34 +0300 |
commit | 96eadf606e3426aa857630e1806c444a8e1a7bc5 (patch) | |
tree | b1f8cdfb61664b2c063ea2af952d1863960ec6ae /routing | |
parent | d6877910b56295f4792a3884ee2ceb1eefea26af (diff) |
[api] Routing api.
Diffstat (limited to 'routing')
-rw-r--r-- | routing/router.cpp | 19 | ||||
-rw-r--r-- | routing/router.hpp | 1 |
2 files changed, 17 insertions, 3 deletions
diff --git a/routing/router.cpp b/routing/router.cpp index 2cfd491360..ffd69ad642 100644 --- a/routing/router.cpp +++ b/routing/router.cpp @@ -7,12 +7,25 @@ string ToString(RouterType type) { switch(type) { - case RouterType::Vehicle: return "Vehicle"; - case RouterType::Pedestrian: return "Pedestrian"; - case RouterType::Bicycle: return "Bicycle"; + case RouterType::Vehicle: return "Vehicle"; + case RouterType::Pedestrian: return "Pedestrian"; + case RouterType::Bicycle: return "Bicycle"; } ASSERT(false, ()); return "Error"; } +RouterType FromString(string const & str) +{ + if (str == "vehicle") + return RouterType::Vehicle; + if (str == "pedestrian") + return RouterType::Pedestrian; + if (str == "bicycle") + return RouterType::Bicycle; + + ASSERT(false, ("Incorrect routing string:", str)); + return RouterType::Vehicle; +} + } // namespace routing diff --git a/routing/router.hpp b/routing/router.hpp index 667521b432..ac91916414 100644 --- a/routing/router.hpp +++ b/routing/router.hpp @@ -25,6 +25,7 @@ enum class RouterType }; string ToString(RouterType type); +RouterType FromString(string const & str); class IRouter { |