summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-01-24 10:40:50 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-04-17 17:21:41 +0300
commit1a66a02097f0e3c95a4d06610fc0b7609f6d77b9 (patch)
treee6a0c00bb8b45497df58fc5088319800139c10ee /include
parentcd5f87e9d2f373d1a6c7797de767e545b52cddcc (diff)
downloadqtlocation-mapboxgl-1a66a02097f0e3c95a4d06610fc0b7609f6d77b9.tar.gz
[core] Introduce `style::LayerProperties` interface and its implementations
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/style/layer_properties.hpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/mbgl/style/layer_properties.hpp b/include/mbgl/style/layer_properties.hpp
new file mode 100644
index 0000000000..89d599dfbc
--- /dev/null
+++ b/include/mbgl/style/layer_properties.hpp
@@ -0,0 +1,29 @@
+#pragma once
+#include <mbgl/style/layer_impl.hpp>
+
+namespace mbgl {
+
+namespace style {
+
+/**
+ * @brief An interface, wrapping evaluated layer properties.
+ *
+ * It is an abstract base class; concrete derived classes that hold the actual data are provided for each layer type.
+ */
+class LayerProperties {
+public:
+ virtual ~LayerProperties() = default;
+
+ Immutable<Layer::Impl> baseImpl;
+
+protected:
+ LayerProperties(Immutable<Layer::Impl> impl) : baseImpl(std::move(impl)) {}
+};
+
+template <class Derived>
+inline const auto& getEvaluated(const Immutable<LayerProperties>& properties) {
+ return static_cast<const Derived&>(*properties).evaluated;
+}
+
+} // namespace style
+} // namespace mbgl