Files
MapLibreParticleLab/src/mbgl/util/mapbox.hpp
John Firebaugh baaae99a03 [core, android] Factor JSON string conversions
This adds a `convertJSON` template, to be used like:

   Error error
   optional<Foo> foo = convertJSON<Foo>(string, error);

Internally, it parses the string with RapidJSON and then calls `convert<Foo>(parsed, error)`.

While here, rationalize GeoJSON converters and fix error handling for Tileset conversion in OfflineDownload.
2017-05-08 13:48:57 -07:00

32 lines
1.2 KiB
C++

#pragma once
#include <string>
#include <mbgl/style/types.hpp>
namespace mbgl {
class Tileset;
namespace util {
namespace mapbox {
bool isMapboxURL(const std::string& url);
std::string normalizeSourceURL(const std::string& baseURL, const std::string& url, const std::string& accessToken);
std::string normalizeStyleURL(const std::string& baseURL, const std::string& url, const std::string& accessToken);
std::string normalizeSpriteURL(const std::string& baseURL, const std::string& url, const std::string& accessToken);
std::string normalizeGlyphsURL(const std::string& baseURL, const std::string& url, const std::string& accessToken);
std::string normalizeTileURL(const std::string& baseURL, const std::string& url, const std::string& accessToken);
// Return a "mapbox://tiles/..." URL (suitable for normalizeTileURL) for the given Mapbox tile URL.
std::string canonicalizeTileURL(const std::string& url, SourceType, uint16_t tileSize);
// Replace URL templates with "mapbox://tiles/..." URLs (suitable for normalizeTileURL).
void canonicalizeTileset(Tileset&, const std::string& url, SourceType, uint16_t tileSize);
extern const uint64_t DEFAULT_OFFLINE_TILE_COUNT_LIMIT;
} // namespace mapbox
} // namespace util
} // namespace mbgl