diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-09-17 16:01:35 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-09-24 16:16:29 +0200 |
commit | 19129cbd023345569b24f1b9863e0ee32ae61182 (patch) | |
tree | 5ba50fe2bef783594ca1bff64c74137f575da623 /include | |
parent | 111fccb76c1f599470074a75ca77e9de016cca73 (diff) | |
download | qtlocation-mapboxgl-19129cbd023345569b24f1b9863e0ee32ae61182.tar.gz |
make SourceInfo object noncopyable and use a shared_pointer for it
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/map/raster_tile_data.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/map/source.hpp | 4 | ||||
-rw-r--r-- | include/mbgl/map/tile_data.hpp | 4 | ||||
-rw-r--r-- | include/mbgl/map/vector_tile_data.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/style/style_source.hpp | 7 |
5 files changed, 10 insertions, 9 deletions
diff --git a/include/mbgl/map/raster_tile_data.hpp b/include/mbgl/map/raster_tile_data.hpp index 329bbf4634..14833c0d84 100644 --- a/include/mbgl/map/raster_tile_data.hpp +++ b/include/mbgl/map/raster_tile_data.hpp @@ -16,7 +16,7 @@ class RasterTileData : public TileData { friend class TileParser; public: - RasterTileData(Tile::ID id, Map &map, const SourceInfo &source); + RasterTileData(Tile::ID id, Map &map, const util::ptr<SourceInfo> &source); ~RasterTileData(); virtual void parse(); diff --git a/include/mbgl/map/source.hpp b/include/mbgl/map/source.hpp index 471165f37c..e74ddb9902 100644 --- a/include/mbgl/map/source.hpp +++ b/include/mbgl/map/source.hpp @@ -25,7 +25,7 @@ struct box; class Source : public std::enable_shared_from_this<Source>, private util::noncopyable { public: - Source(SourceInfo& info); + Source(const util::ptr<SourceInfo>& info); void load(Map &map); @@ -54,7 +54,7 @@ private: double getZoom(const TransformState &state) const; - SourceInfo& info; + util::ptr<SourceInfo> info; bool loaded = false; // Stores the time when this source was most recently updated. diff --git a/include/mbgl/map/tile_data.hpp b/include/mbgl/map/tile_data.hpp index 803f0447b3..07cf19c5c8 100644 --- a/include/mbgl/map/tile_data.hpp +++ b/include/mbgl/map/tile_data.hpp @@ -40,7 +40,7 @@ public: }; public: - TileData(Tile::ID id, Map &map, const SourceInfo &source); + TileData(Tile::ID id, Map &map, const util::ptr<SourceInfo> &source); ~TileData(); void request(); @@ -68,7 +68,7 @@ protected: Map ↦ public: - const SourceInfo &source; + util::ptr<SourceInfo> source; protected: std::unique_ptr<Request> req; diff --git a/include/mbgl/map/vector_tile_data.hpp b/include/mbgl/map/vector_tile_data.hpp index 3f80c0080c..9de666c84f 100644 --- a/include/mbgl/map/vector_tile_data.hpp +++ b/include/mbgl/map/vector_tile_data.hpp @@ -26,7 +26,7 @@ class VectorTileData : public TileData { friend class TileParser; public: - VectorTileData(Tile::ID id, Map &map, const SourceInfo &source); + VectorTileData(Tile::ID id, Map &map, const util::ptr<SourceInfo> &source); ~VectorTileData(); virtual void beforeParse(); diff --git a/include/mbgl/style/style_source.hpp b/include/mbgl/style/style_source.hpp index 4b89a6557c..00c48431a1 100644 --- a/include/mbgl/style/style_source.hpp +++ b/include/mbgl/style/style_source.hpp @@ -3,6 +3,7 @@ #include <mbgl/style/types.hpp> #include <mbgl/util/ptr.hpp> +#include <mbgl/util/noncopyable.hpp> #include <rapidjson/document.h> #include <vector> @@ -12,7 +13,7 @@ namespace mbgl { class Source; -class SourceInfo { +class SourceInfo : private util::noncopyable { public: SourceType type = SourceType::Vector; std::string url; @@ -30,12 +31,12 @@ public: class StyleSource : public std::enable_shared_from_this<StyleSource> { public: - SourceInfo info; + util::ptr<SourceInfo> info; bool enabled = false; util::ptr<Source> source; - StyleSource(const SourceInfo &info) + StyleSource(const util::ptr<SourceInfo> &info) : info(info) {} }; |