summaryrefslogtreecommitdiff
path: root/src/mbgl/map/map_options.cpp
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/map/map_options.cpp
parent2de2b0b068520a55170d23c86f349232b3e28ae7 (diff)
downloadqtlocation-mapboxgl-03db58cdc1f1f31034863020f205f5c5696bfa8b.tar.gz
[core] Replace shared_ptr with unique_ptr in {Map,Resource}Options
Diffstat (limited to 'src/mbgl/map/map_options.cpp')
-rw-r--r--src/mbgl/map/map_options.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/mbgl/map/map_options.cpp b/src/mbgl/map/map_options.cpp
index ddb3f8e3be..c1146ab0bc 100644
--- a/src/mbgl/map/map_options.cpp
+++ b/src/mbgl/map/map_options.cpp
@@ -10,39 +10,42 @@ public:
bool crossSourceCollisions = true;
};
-MapOptions::MapOptions() : impl_(std::make_shared<MapOptions::Impl>()) {}
+// These requires the complete type of Impl.
+MapOptions::MapOptions() : impl_(std::make_unique<Impl>()) {}
MapOptions::~MapOptions() = default;
+MapOptions::MapOptions(MapOptions&&) = default;
+MapOptions::MapOptions(const MapOptions& other) : impl_(std::make_unique<Impl>(*other.impl_)) {}
-MapOptions& MapOptions::withMapMode(MapMode mode) {
+MapOptions MapOptions::withMapMode(MapMode mode) {
impl_->mapMode = mode;
- return *this;
+ return std::move(*this);
}
MapMode MapOptions::mapMode() const {
return impl_->mapMode;
}
-MapOptions& MapOptions::withConstrainMode(ConstrainMode mode) {
+MapOptions MapOptions::withConstrainMode(ConstrainMode mode) {
impl_->constrainMode = mode;
- return *this;
+ return std::move(*this);
}
ConstrainMode MapOptions::constrainMode() const {
return impl_->constrainMode;
}
-MapOptions& MapOptions::withViewportMode(ViewportMode mode) {
+MapOptions MapOptions::withViewportMode(ViewportMode mode) {
impl_->viewportMode = mode;
- return *this;
+ return std::move(*this);
}
ViewportMode MapOptions::viewportMode() const {
return impl_->viewportMode;
}
-MapOptions& MapOptions::withCrossSourceCollisions(bool enableCollisions) {
+MapOptions MapOptions::withCrossSourceCollisions(bool enableCollisions) {
impl_->crossSourceCollisions = enableCollisions;
- return *this;
+ return std::move(*this);
}
bool MapOptions::crossSourceCollisions() const {