summaryrefslogtreecommitdiff
path: root/include/mbgl/style/property_value.hpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-08-29 12:00:08 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-09-06 14:29:22 -0700
commitfe2a26225f3746381b36ad8b6c6a3ce7727bf655 (patch)
tree62507ffd6a28654a377469d35e21719ff7a12fdc /include/mbgl/style/property_value.hpp
parent3a48c60813b18c092c8d8d75c80a318bdd8859bb (diff)
downloadqtlocation-mapboxgl-fe2a26225f3746381b36ad8b6c6a3ce7727bf655.tar.gz
[core, ios, android, qt] Observe style layer mutations rather than requiring SDKs to use Map::update
This paves the way for updates to filter and layout properties to trigger a source reload, without each SDK having to participate in the implementation.
Diffstat (limited to 'include/mbgl/style/property_value.hpp')
-rw-r--r--include/mbgl/style/property_value.hpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/mbgl/style/property_value.hpp b/include/mbgl/style/property_value.hpp
index d8f83a0fb3..d7e160fdca 100644
--- a/include/mbgl/style/property_value.hpp
+++ b/include/mbgl/style/property_value.hpp
@@ -8,12 +8,17 @@ namespace style {
class Undefined {};
+inline bool operator==(const Undefined&, const Undefined&) { return true; }
+inline bool operator!=(const Undefined&, const Undefined&) { return false; }
+
template <class T>
class PropertyValue {
private:
using Value = variant<Undefined, T, Function<T>>;
Value value;
+ template <class S> friend bool operator==(const PropertyValue<S>&, const PropertyValue<S>&);
+
public:
PropertyValue() : value() {}
PropertyValue( T constant) : value(constant) {}
@@ -34,5 +39,15 @@ public:
}
};
+template <class T>
+bool operator==(const PropertyValue<T>& lhs, const PropertyValue<T>& rhs) {
+ return lhs.value == rhs.value;
+}
+
+template <class T>
+bool operator!=(const PropertyValue<T>& lhs, const PropertyValue<T>& rhs) {
+ return !(lhs == rhs);
+}
+
} // namespace style
} // namespace mbgl