From 141e995806576364d185626176c1b993fc519291 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Fri, 28 Oct 2016 16:39:50 -0700 Subject: [core] Add support for data-driven styling --- include/mbgl/style/property_value.hpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'include/mbgl/style/property_value.hpp') diff --git a/include/mbgl/style/property_value.hpp b/include/mbgl/style/property_value.hpp index 83c4b4cf1b..e784633aa7 100644 --- a/include/mbgl/style/property_value.hpp +++ b/include/mbgl/style/property_value.hpp @@ -1,20 +1,16 @@ #pragma once #include -#include +#include +#include namespace mbgl { namespace style { -class Undefined {}; - -inline bool operator==(const Undefined&, const Undefined&) { return true; } -inline bool operator!=(const Undefined&, const Undefined&) { return false; } - template class PropertyValue { private: - using Value = variant>; + using Value = variant>; Value value; friend bool operator==(const PropertyValue& lhs, const PropertyValue& rhs) { @@ -26,16 +22,16 @@ private: } public: - PropertyValue() : value() {} - PropertyValue( T constant) : value(constant) {} - PropertyValue(Function function) : value(function) {} + PropertyValue() : value() {} + PropertyValue( T constant) : value(constant) {} + PropertyValue(CameraFunction function) : value(function) {} - bool isUndefined() const { return value.which() == 0; } - bool isConstant() const { return value.which() == 1; } - bool isFunction() const { return value.which() == 2; } + bool isUndefined() const { return value.which() == 0; } + bool isConstant() const { return value.which() == 1; } + bool isCameraFunction() const { return value.which() == 2; } - const T & asConstant() const { return value.template get< T >(); } - const Function& asFunction() const { return value.template get>(); } + const T & asConstant() const { return value.template get< T >(); } + const CameraFunction& asCameraFunction() const { return value.template get>(); } explicit operator bool() const { return !isUndefined(); }; -- cgit v1.2.1