#pragma once #include #include #include #include #include namespace mbgl { namespace style { template class DataDrivenPropertyValue { private: using Value = variant< Undefined, T, CameraFunction, SourceFunction, CompositeFunction>; Value value; friend bool operator==(const DataDrivenPropertyValue& lhs, const DataDrivenPropertyValue& rhs) { return lhs.value == rhs.value; } public: DataDrivenPropertyValue() = default; DataDrivenPropertyValue( T v) : value(std::move(v)) {} DataDrivenPropertyValue( CameraFunction v) : value(std::move(v)) {} DataDrivenPropertyValue( SourceFunction v) : value(std::move(v)) {} DataDrivenPropertyValue(CompositeFunction v) : value(std::move(v)) {} bool isUndefined() const { return value.template is(); } bool isDataDriven() const { return value.template is>() || value.template is>(); } template auto evaluate(const Evaluator& evaluator) const { return Value::visit(value, evaluator); } }; } // namespace style } // namespace mbgl