summaryrefslogtreecommitdiff
path: root/src/mbgl/storage
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2019-03-21 18:36:43 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2019-03-22 18:54:48 +0200
commit03db58cdc1f1f31034863020f205f5c5696bfa8b (patch)
treee4201a14948d3772fbd4f8bcff6f7d38e2dfd27d /src/mbgl/storage
parent2de2b0b068520a55170d23c86f349232b3e28ae7 (diff)
downloadqtlocation-mapboxgl-03db58cdc1f1f31034863020f205f5c5696bfa8b.tar.gz
[core] Replace shared_ptr with unique_ptr in {Map,Resource}Options
Diffstat (limited to 'src/mbgl/storage')
-rw-r--r--src/mbgl/storage/resource_options.cpp29
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 {