diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-25 18:20:26 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-12 11:26:27 -0700 |
commit | c2a5894f2dbe9982830066ab9347b059e6e7d845 (patch) | |
tree | c09363c2025b80265de195969ee56cc64e567e70 /src/mbgl/style/layer_impl.hpp | |
parent | d3f23b83d42de8ef23ea1dbd8abfc6276009531f (diff) | |
download | qtlocation-mapboxgl-c2a5894f2dbe9982830066ab9347b059e6e7d845.tar.gz |
[core] Immutable Impls
Diffstat (limited to 'src/mbgl/style/layer_impl.hpp')
-rw-r--r-- | src/mbgl/style/layer_impl.hpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/mbgl/style/layer_impl.hpp b/src/mbgl/style/layer_impl.hpp index 914203f804..fe7259a11a 100644 --- a/src/mbgl/style/layer_impl.hpp +++ b/src/mbgl/style/layer_impl.hpp @@ -3,13 +3,10 @@ #include <mbgl/style/layer.hpp> #include <mbgl/style/types.hpp> #include <mbgl/style/filter.hpp> -#include <mbgl/style/layer_observer.hpp> -#include <mbgl/util/noncopyable.hpp> #include <rapidjson/writer.h> #include <rapidjson/stringbuffer.h> -#include <memory> #include <string> #include <limits> @@ -30,24 +27,19 @@ namespace style { * Members that are public in `FooLayer::Impl` are part of the internal API for "foo" layers. * Members that are private in `FooLayer::Impl` are internal to "foo" layers. */ -class Layer::Impl { +class Layer::Impl : public EnableImmutableFromThis<Layer::Impl> { public: + Impl(LayerType, std::string layerID, std::string sourceID); virtual ~Impl() = default; - // Create an identical copy of this layer. - virtual std::unique_ptr<Layer> clone() const = 0; - - // Create a layer, copying all properties except id and paint properties from this layer. - virtual std::unique_ptr<Layer> cloneRef(const std::string& id) const = 0; + Impl& operator=(const Impl&) = delete; // Utility function for automatic layer grouping. virtual void stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const = 0; virtual std::unique_ptr<RenderLayer> createRenderLayer() const = 0; - void setObserver(LayerObserver*); - -public: + const LayerType type; std::string id; std::string source; std::string sourceLayer; @@ -56,13 +48,8 @@ public: float maxZoom = std::numeric_limits<float>::infinity(); VisibilityType visibility = VisibilityType::Visible; - LayerObserver nullObserver; - LayerObserver* observer = &nullObserver; - protected: - Impl() = default; Impl(const Impl&) = default; - Impl& operator=(const Impl&) = delete; }; } // namespace style |