diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-03-19 16:57:36 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-03-20 21:30:08 +0200 |
commit | d5868d3da822f2bf3297229bd879e76853108a63 (patch) | |
tree | b3d28aab92b938cf541f917f1027d2bbd06d9780 /src/mbgl/storage/resource_options.cpp | |
parent | d1762d7111b39d45430bd7bb75ea60b7a5d85bd2 (diff) | |
download | qtlocation-mapboxgl-d5868d3da822f2bf3297229bd879e76853108a63.tar.gz |
[core] Remove file source from public Map ctor
Diffstat (limited to 'src/mbgl/storage/resource_options.cpp')
-rw-r--r-- | src/mbgl/storage/resource_options.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/mbgl/storage/resource_options.cpp b/src/mbgl/storage/resource_options.cpp new file mode 100644 index 0000000000..ce82b51a14 --- /dev/null +++ b/src/mbgl/storage/resource_options.cpp @@ -0,0 +1,73 @@ +#include <mbgl/storage/resource_options.hpp> +#include <mbgl/util/constants.hpp> + +namespace mbgl { + +class ResourceOptions::Impl { +public: + std::string accessToken; + std::string baseURL = mbgl::util::API_BASE_URL; + std::string cachePath = ":memory:"; + std::string assetPath = "."; + uint64_t maximumSize = mbgl::util::DEFAULT_MAX_CACHE_SIZE; + void* platformContext = nullptr; +}; + +ResourceOptions::ResourceOptions() : impl_(std::make_shared<ResourceOptions::Impl>()) {} +ResourceOptions::~ResourceOptions() = default; + +ResourceOptions& ResourceOptions::withAccessToken(std::string token) { + impl_->accessToken = std::move(token); + return *this; +} + +const std::string& ResourceOptions::accessToken() const { + return impl_->accessToken; +} + +ResourceOptions& ResourceOptions::withBaseURL(std::string url) { + impl_->baseURL = std::move(url); + return *this; +} + +const std::string& ResourceOptions::baseURL() const { + return impl_->baseURL; +} + +ResourceOptions& ResourceOptions::withCachePath(std::string path) { + impl_->cachePath = std::move(path); + return *this; +} + +const std::string& ResourceOptions::cachePath() const { + return impl_->cachePath; +} + +ResourceOptions& ResourceOptions::withAssetPath(std::string path) { + impl_->assetPath = std::move(path); + return *this; +} + +const std::string& ResourceOptions::assetPath() const { + return impl_->assetPath; +} + +ResourceOptions& ResourceOptions::withMaximumCacheSize(uint64_t size) { + impl_->maximumSize = size; + return *this; +} + +uint64_t ResourceOptions::maximumCacheSize() const { + return impl_->maximumSize; +} + +ResourceOptions& ResourceOptions::withPlatformContext(void* context) { + impl_->platformContext = context; + return *this; +} + +void* ResourceOptions::platformContext() const { + return impl_->platformContext; +} + +} // namespace mbgl |