diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-03-21 18:36:43 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-03-22 18:54:48 +0200 |
commit | 03db58cdc1f1f31034863020f205f5c5696bfa8b (patch) | |
tree | e4201a14948d3772fbd4f8bcff6f7d38e2dfd27d /include | |
parent | 2de2b0b068520a55170d23c86f349232b3e28ae7 (diff) | |
download | qtlocation-mapboxgl-03db58cdc1f1f31034863020f205f5c5696bfa8b.tar.gz |
[core] Replace shared_ptr with unique_ptr in {Map,Resource}Options
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/map/map_options.hpp | 21 | ||||
-rw-r--r-- | include/mbgl/storage/resource_options.hpp | 25 |
2 files changed, 26 insertions, 20 deletions
diff --git a/include/mbgl/map/map_options.hpp b/include/mbgl/map/map_options.hpp index f2297484a3..384b113dba 100644 --- a/include/mbgl/map/map_options.hpp +++ b/include/mbgl/map/map_options.hpp @@ -17,15 +17,18 @@ public: MapOptions(); ~MapOptions(); + MapOptions(MapOptions&&); + explicit MapOptions(const MapOptions&); + /** * @brief Sets the map rendering mode. By default, it is set to Continuous * so the map will render as data arrives from the network and react * immediately to state changes. * * @param mode Map rendering mode. - * @return reference to MapOptions for chaining options together. + * @return MapOptions for chaining options together. */ - MapOptions& withMapMode(MapMode mode); + MapOptions withMapMode(MapMode mode); /** * @brief Gets the previously set (or default) map mode. @@ -40,9 +43,9 @@ public: * HeightOnly. * * @param mode Map constrain mode. - * @return reference to MapOptions for chaining options together. + * @return MapOptions for chaining options together. */ - MapOptions& withConstrainMode(ConstrainMode mode); + MapOptions withConstrainMode(ConstrainMode mode); /** * @brief Gets the previously set (or default) constrain mode. @@ -56,9 +59,9 @@ public: * orientation of the map as some devices may use inverted orientation. * * @param mode Viewport mode. - * @return reference to MapOptions for chaining options together. + * @return MapOptions for chaining options together. */ - MapOptions& withViewportMode(ViewportMode mode); + MapOptions withViewportMode(ViewportMode mode); /** * @brief Gets the previously set (or default) viewport mode. @@ -72,9 +75,9 @@ public: * or not. By default, it is set to true. * * @param enableCollisions true to enable, false to disable - * @return reference to MapOptions for chaining options together. + * @return MapOptions for chaining options together. */ - MapOptions& withCrossSourceCollisions(bool enableCollisions); + MapOptions withCrossSourceCollisions(bool enableCollisions); /** * @brief Gets the previously set (or default) crossSourceCollisions value. @@ -86,7 +89,7 @@ public: private: class Impl; - std::shared_ptr<Impl> impl_; + std::unique_ptr<Impl> impl_; }; } // namespace mbgl diff --git a/include/mbgl/storage/resource_options.hpp b/include/mbgl/storage/resource_options.hpp index 0a4669ea15..958392175c 100644 --- a/include/mbgl/storage/resource_options.hpp +++ b/include/mbgl/storage/resource_options.hpp @@ -16,13 +16,16 @@ public: ResourceOptions(); ~ResourceOptions(); + ResourceOptions(ResourceOptions&&); + explicit ResourceOptions(const ResourceOptions&); + /** * @brief Sets the Mapbox access token - see https://docs.mapbox.com/help/how-mapbox-works/access-tokens/ for details. * * @param token Mapbox access token. - * @return reference to ResourceOptions for chaining options together. + * @return ResourceOptions for chaining options together. */ - ResourceOptions& withAccessToken(std::string token); + ResourceOptions withAccessToken(std::string token); /** * @brief Gets the previously set (or default) Mapbox access token. @@ -35,9 +38,9 @@ public: * @brief Sets the API base URL. Default is https://api.mapbox.com for Mapbox. * * @param baseURL API base URL. - * @return reference to ResourceOptions for chaining options together. + * @return ResourceOptions for chaining options together. */ - ResourceOptions& withBaseURL(std::string baseURL); + ResourceOptions withBaseURL(std::string baseURL); /** * @brief Gets the previously set (or default) API base URL. @@ -50,9 +53,9 @@ public: * @brief Sets the cache path. * * @param path Cache path. - * @return reference to ResourceOptions for chaining options together. + * @return ResourceOptions for chaining options together. */ - ResourceOptions& withCachePath(std::string path); + ResourceOptions withCachePath(std::string path); /** * @brief Gets the previously set (or default) cache path. @@ -66,9 +69,9 @@ public: * the asset:// scheme gets resolved in a style. * * @param path Asset path. - * @return reference to ResourceOptions for chaining options together. + * @return ResourceOptions for chaining options together. */ - ResourceOptions& withAssetPath(std::string path); + ResourceOptions withAssetPath(std::string path); /** * @brief Gets the previously set (or default) asset path. @@ -83,7 +86,7 @@ public: * @param size Cache maximum size in bytes. * @return reference to ResourceOptions for chaining options together. */ - ResourceOptions& withMaximumCacheSize(uint64_t size); + ResourceOptions withMaximumCacheSize(uint64_t size); /** * @brief Gets the previously set (or default) maximum allowed cache size. @@ -99,7 +102,7 @@ public: * @param context Platform context. * @return reference to ResourceOptions for chaining options together. */ - ResourceOptions& withPlatformContext(void* context); + ResourceOptions withPlatformContext(void* context); /** * @brief Gets the previously set (or default) platform context. @@ -110,7 +113,7 @@ public: private: class Impl; - std::shared_ptr<Impl> impl_; + std::unique_ptr<Impl> impl_; }; } // namespace mbgl |