| 25 | } |
| 26 | |
| 27 | bool Ge0Parser::Parse(std::string const & url, Result & result) |
| 28 | { |
| 29 | // Original URL format: |
| 30 | // |
| 31 | // +------------------ 1 byte: zoom level |
| 32 | // |+-------+--------- 9 bytes: lat,lon |
| 33 | // || | +--+---- Variable number of bytes: point name |
| 34 | // || | | | |
| 35 | // cm://ZCoordba64/Name |
| 36 | |
| 37 | // Alternative format (differs only in the prefix): |
| 38 | // http://comaps.app/ZCoordba64/Name |
| 39 | |
| 40 | for (auto prefix : kGe0Prefixes) |
| 41 | if (url.starts_with(prefix)) |
| 42 | return ParseAfterPrefix(url, prefix.size(), result); |
| 43 | |
| 44 | return false; |
| 45 | } |
| 46 | |
| 47 | bool Ge0Parser::ParseAfterPrefix(std::string const & url, size_t from, Result & result) |
| 48 | { |