diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2018-11-15 15:47:25 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2018-11-15 17:48:36 +0200 |
commit | ff09c94d0825f5dbe7dddce52b64e74d61978976 (patch) | |
tree | 86833d95d8bf7abbcb8e6965aaba65d666ffff52 /include/mbgl/style/layers | |
parent | 73dcfe2d0d3475ad9584969c7908ba681a3f5bfa (diff) | |
download | qtlocation-mapboxgl-ff09c94d0825f5dbe7dddce52b64e74d61978976.tar.gz |
[core][android] Introduce mbgl::style::LayerTypeInfoupstream/mikhail_LayerTypeInfo
The `LayerTypeInfo` contains static meta data about certain layer type.
Each layer module should have a single immutable `LayerTypeInfo` instance
for the represented layer type. Both `LayerImpl` and `LayerFactory` from the
module always refer to the same `LayerTypeInfo` instance, so address of this
instance can be used as a layer module Id during the process life time.
Diffstat (limited to 'include/mbgl/style/layers')
-rw-r--r-- | include/mbgl/style/layers/background_layer.hpp | 10 | ||||
-rw-r--r-- | include/mbgl/style/layers/circle_layer.hpp | 10 | ||||
-rw-r--r-- | include/mbgl/style/layers/custom_layer.hpp | 8 | ||||
-rw-r--r-- | include/mbgl/style/layers/fill_extrusion_layer.hpp | 10 | ||||
-rw-r--r-- | include/mbgl/style/layers/fill_layer.hpp | 10 | ||||
-rw-r--r-- | include/mbgl/style/layers/heatmap_layer.hpp | 10 | ||||
-rw-r--r-- | include/mbgl/style/layers/hillshade_layer.hpp | 10 | ||||
-rw-r--r-- | include/mbgl/style/layers/layer.hpp.ejs | 10 | ||||
-rw-r--r-- | include/mbgl/style/layers/line_layer.hpp | 10 | ||||
-rw-r--r-- | include/mbgl/style/layers/raster_layer.hpp | 10 | ||||
-rw-r--r-- | include/mbgl/style/layers/symbol_layer.hpp | 10 |
11 files changed, 32 insertions, 76 deletions
diff --git a/include/mbgl/style/layers/background_layer.hpp b/include/mbgl/style/layers/background_layer.hpp index 639cb5154c..e188a9ba2c 100644 --- a/include/mbgl/style/layers/background_layer.hpp +++ b/include/mbgl/style/layers/background_layer.hpp @@ -59,15 +59,11 @@ protected: class BackgroundLayerFactory : public LayerFactory { public: BackgroundLayerFactory(); - // LayerFactory overrides. ~BackgroundLayerFactory() override; - bool supportsType(const std::string& type) const noexcept final; - std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; - - static BackgroundLayerFactory* get() noexcept; -private: - static BackgroundLayerFactory* instance; + // LayerFactory overrides. + const LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; }; } // namespace style diff --git a/include/mbgl/style/layers/circle_layer.hpp b/include/mbgl/style/layers/circle_layer.hpp index 4c134a58bf..4dacb905df 100644 --- a/include/mbgl/style/layers/circle_layer.hpp +++ b/include/mbgl/style/layers/circle_layer.hpp @@ -107,15 +107,11 @@ protected: class CircleLayerFactory : public LayerFactory { public: CircleLayerFactory(); - // LayerFactory overrides. ~CircleLayerFactory() override; - bool supportsType(const std::string& type) const noexcept final; - std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; - - static CircleLayerFactory* get() noexcept; -private: - static CircleLayerFactory* instance; + // LayerFactory overrides. + const LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; }; } // namespace style diff --git a/include/mbgl/style/layers/custom_layer.hpp b/include/mbgl/style/layers/custom_layer.hpp index 0d13001b91..5021df6a60 100644 --- a/include/mbgl/style/layers/custom_layer.hpp +++ b/include/mbgl/style/layers/custom_layer.hpp @@ -90,13 +90,9 @@ public: CustomLayerFactory(); // LayerFactory overrides. ~CustomLayerFactory() override; - bool supportsType(const std::string& type) const noexcept final; - std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; - - static CustomLayerFactory* get() noexcept; -private: - static CustomLayerFactory* instance; + const LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; }; } // namespace style diff --git a/include/mbgl/style/layers/fill_extrusion_layer.hpp b/include/mbgl/style/layers/fill_extrusion_layer.hpp index 621eb45bc4..0092e61f3b 100644 --- a/include/mbgl/style/layers/fill_extrusion_layer.hpp +++ b/include/mbgl/style/layers/fill_extrusion_layer.hpp @@ -83,15 +83,11 @@ protected: class FillExtrusionLayerFactory : public LayerFactory { public: FillExtrusionLayerFactory(); - // LayerFactory overrides. ~FillExtrusionLayerFactory() override; - bool supportsType(const std::string& type) const noexcept final; - std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; - - static FillExtrusionLayerFactory* get() noexcept; -private: - static FillExtrusionLayerFactory* instance; + // LayerFactory overrides. + const LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; }; } // namespace style diff --git a/include/mbgl/style/layers/fill_layer.hpp b/include/mbgl/style/layers/fill_layer.hpp index aeb0ba988a..52bbd054ae 100644 --- a/include/mbgl/style/layers/fill_layer.hpp +++ b/include/mbgl/style/layers/fill_layer.hpp @@ -83,15 +83,11 @@ protected: class FillLayerFactory : public LayerFactory { public: FillLayerFactory(); - // LayerFactory overrides. ~FillLayerFactory() override; - bool supportsType(const std::string& type) const noexcept final; - std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; - - static FillLayerFactory* get() noexcept; -private: - static FillLayerFactory* instance; + // LayerFactory overrides. + const LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; }; } // namespace style diff --git a/include/mbgl/style/layers/heatmap_layer.hpp b/include/mbgl/style/layers/heatmap_layer.hpp index 3630dafba9..d1760100ad 100644 --- a/include/mbgl/style/layers/heatmap_layer.hpp +++ b/include/mbgl/style/layers/heatmap_layer.hpp @@ -72,15 +72,11 @@ protected: class HeatmapLayerFactory : public LayerFactory { public: HeatmapLayerFactory(); - // LayerFactory overrides. ~HeatmapLayerFactory() override; - bool supportsType(const std::string& type) const noexcept final; - std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; - - static HeatmapLayerFactory* get() noexcept; -private: - static HeatmapLayerFactory* instance; + // LayerFactory overrides. + const LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; }; } // namespace style diff --git a/include/mbgl/style/layers/hillshade_layer.hpp b/include/mbgl/style/layers/hillshade_layer.hpp index a251956d01..978670f8a9 100644 --- a/include/mbgl/style/layers/hillshade_layer.hpp +++ b/include/mbgl/style/layers/hillshade_layer.hpp @@ -77,15 +77,11 @@ protected: class HillshadeLayerFactory : public LayerFactory { public: HillshadeLayerFactory(); - // LayerFactory overrides. ~HillshadeLayerFactory() override; - bool supportsType(const std::string& type) const noexcept final; - std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; - - static HillshadeLayerFactory* get() noexcept; -private: - static HillshadeLayerFactory* instance; + // LayerFactory overrides. + const LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; }; } // namespace style diff --git a/include/mbgl/style/layers/layer.hpp.ejs b/include/mbgl/style/layers/layer.hpp.ejs index d335829efb..11d45b4b0c 100644 --- a/include/mbgl/style/layers/layer.hpp.ejs +++ b/include/mbgl/style/layers/layer.hpp.ejs @@ -75,15 +75,11 @@ protected: class <%- camelize(type) %>LayerFactory : public LayerFactory { public: <%- camelize(type) %>LayerFactory(); - // LayerFactory overrides. ~<%- camelize(type) %>LayerFactory() override; - bool supportsType(const std::string& type) const noexcept final; - std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; - - static <%- camelize(type) %>LayerFactory* get() noexcept; -private: - static <%- camelize(type) %>LayerFactory* instance; + // LayerFactory overrides. + const LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; }; } // namespace style diff --git a/include/mbgl/style/layers/line_layer.hpp b/include/mbgl/style/layers/line_layer.hpp index 26837f4d06..0f5e2bb347 100644 --- a/include/mbgl/style/layers/line_layer.hpp +++ b/include/mbgl/style/layers/line_layer.hpp @@ -128,15 +128,11 @@ protected: class LineLayerFactory : public LayerFactory { public: LineLayerFactory(); - // LayerFactory overrides. ~LineLayerFactory() override; - bool supportsType(const std::string& type) const noexcept final; - std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; - - static LineLayerFactory* get() noexcept; -private: - static LineLayerFactory* instance; + // LayerFactory overrides. + const LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; }; } // namespace style diff --git a/include/mbgl/style/layers/raster_layer.hpp b/include/mbgl/style/layers/raster_layer.hpp index 86f57f3d12..4b63570590 100644 --- a/include/mbgl/style/layers/raster_layer.hpp +++ b/include/mbgl/style/layers/raster_layer.hpp @@ -89,15 +89,11 @@ protected: class RasterLayerFactory : public LayerFactory { public: RasterLayerFactory(); - // LayerFactory overrides. ~RasterLayerFactory() override; - bool supportsType(const std::string& type) const noexcept final; - std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; - - static RasterLayerFactory* get() noexcept; -private: - static RasterLayerFactory* instance; + // LayerFactory overrides. + const LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; }; } // namespace style diff --git a/include/mbgl/style/layers/symbol_layer.hpp b/include/mbgl/style/layers/symbol_layer.hpp index 685e3cb4df..62ea393b33 100644 --- a/include/mbgl/style/layers/symbol_layer.hpp +++ b/include/mbgl/style/layers/symbol_layer.hpp @@ -277,15 +277,11 @@ protected: class SymbolLayerFactory : public LayerFactory { public: SymbolLayerFactory(); - // LayerFactory overrides. ~SymbolLayerFactory() override; - bool supportsType(const std::string& type) const noexcept final; - std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; - - static SymbolLayerFactory* get() noexcept; -private: - static SymbolLayerFactory* instance; + // LayerFactory overrides. + const LayerTypeInfo* getTypeInfo() const noexcept final; + std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final; }; } // namespace style |