diff options
Diffstat (limited to 'src/mbgl/storage/resource_options.cpp')
-rw-r--r-- | src/mbgl/storage/resource_options.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/mbgl/storage/resource_options.cpp b/src/mbgl/storage/resource_options.cpp index ce82b51a14..dcd7f84f7e 100644 --- a/src/mbgl/storage/resource_options.cpp +++ b/src/mbgl/storage/resource_options.cpp @@ -13,57 +13,60 @@ public: void* platformContext = nullptr; }; -ResourceOptions::ResourceOptions() : impl_(std::make_shared<ResourceOptions::Impl>()) {} +// These requires the complete type of Impl. +ResourceOptions::ResourceOptions() : impl_(std::make_unique<Impl>()) {} ResourceOptions::~ResourceOptions() = default; +ResourceOptions::ResourceOptions(ResourceOptions&&) = default; +ResourceOptions::ResourceOptions(const ResourceOptions& other) : impl_(std::make_unique<Impl>(*other.impl_)) {} -ResourceOptions& ResourceOptions::withAccessToken(std::string token) { +ResourceOptions ResourceOptions::withAccessToken(std::string token) { impl_->accessToken = std::move(token); - return *this; + return std::move(*this); } const std::string& ResourceOptions::accessToken() const { return impl_->accessToken; } -ResourceOptions& ResourceOptions::withBaseURL(std::string url) { +ResourceOptions ResourceOptions::withBaseURL(std::string url) { impl_->baseURL = std::move(url); - return *this; + return std::move(*this); } const std::string& ResourceOptions::baseURL() const { return impl_->baseURL; } -ResourceOptions& ResourceOptions::withCachePath(std::string path) { +ResourceOptions ResourceOptions::withCachePath(std::string path) { impl_->cachePath = std::move(path); - return *this; + return std::move(*this); } const std::string& ResourceOptions::cachePath() const { return impl_->cachePath; } -ResourceOptions& ResourceOptions::withAssetPath(std::string path) { +ResourceOptions ResourceOptions::withAssetPath(std::string path) { impl_->assetPath = std::move(path); - return *this; + return std::move(*this); } const std::string& ResourceOptions::assetPath() const { return impl_->assetPath; } -ResourceOptions& ResourceOptions::withMaximumCacheSize(uint64_t size) { +ResourceOptions ResourceOptions::withMaximumCacheSize(uint64_t size) { impl_->maximumSize = size; - return *this; + return std::move(*this); } uint64_t ResourceOptions::maximumCacheSize() const { return impl_->maximumSize; } -ResourceOptions& ResourceOptions::withPlatformContext(void* context) { +ResourceOptions ResourceOptions::withPlatformContext(void* context) { impl_->platformContext = context; - return *this; + return std::move(*this); } void* ResourceOptions::platformContext() const { |