summaryrefslogtreecommitdiff
path: root/src/mbgl/util/mapbox.hpp
blob: 3c44d704c769c689aa09740da4f5dbab3b09311b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef MBGL_UTIL_MAPBOX
#define MBGL_UTIL_MAPBOX

#include <string>
#include <mbgl/style/types.hpp>

namespace mbgl {
namespace util {
namespace mapbox {

bool isMapboxURL(const std::string& url);

std::string normalizeSourceURL(const std::string& url, const std::string& accessToken);
std::string normalizeStyleURL(const std::string& url, const std::string& accessToken);
std::string normalizeSpriteURL(const std::string& url, const std::string& accessToken);
std::string normalizeGlyphsURL(const std::string& url, const std::string& accessToken);
std::string normalizeRasterTileURL(const std::string& url);

// Canonicalizes Mapbox URLs by removing [a-d] subdomain prefixes, access tokens, and protocol.
// Note that this is close, but not exactly the reverse operation as above, as this retains certain
// information, such as the API version. It is used to cache resources retrieved from the URL, that
// sometimes have multiple valid URLs.
std::string canonicalURL(const std::string &url);

} // namespace mapbox
} // namespace util
} // namespace mbgl

#endif