diff options
author | Kirill Zhdanovich <kzhdanovich@gmail.com> | 2013-04-08 22:21:04 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:53:15 +0300 |
commit | 7860b5c951ee0361d3d7ce45e570b56a490e201f (patch) | |
tree | 2e9c9166fe6373a2a3ac976407060a419939c7d3 /map/ge0_parser.hpp | |
parent | 325591f08ec58f717e57b0933eeea5e677cb1829 (diff) |
Add geo://... url scheme parser.
Diffstat (limited to 'map/ge0_parser.hpp')
-rw-r--r-- | map/ge0_parser.hpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/map/ge0_parser.hpp b/map/ge0_parser.hpp new file mode 100644 index 0000000000..fabfa1f6b0 --- /dev/null +++ b/map/ge0_parser.hpp @@ -0,0 +1,33 @@ +#pragma once +#include "../base/base.hpp" +#include "../std/string.hpp" + +namespace url_api +{ + +class Request; + +class Ge0Parser +{ +public: + Ge0Parser(); + + bool Parse(string const & url, Request & request); + +protected: + uint8_t DecodeBase64Char(char const c); + static double DecodeZoom(uint8_t const zoomByte); + void DecodeLatLon(string const & url, double & lat, double & lon); + void DecodeLatLonToInt(string const & url, int & lat, int & lon, int const bytes); + double DecodeLatFromInt(int const lat, int const maxValue); + double DecodeLonFromInt(int const lon, int const maxValue); + string DecodeName(string const & name); + void SpacesToUnderscore(string & name); + void ValidateName(string & name); + static bool IsHexChar(char const a); + +private: + uint8_t m_base64ReverseCharTable[256]; +}; + +} // namespace url_api |