diff options
Diffstat (limited to 'include/mbgl/style/expression/expression.hpp')
-rw-r--r-- | include/mbgl/style/expression/expression.hpp | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/include/mbgl/style/expression/expression.hpp b/include/mbgl/style/expression/expression.hpp index e36db1b3c7..99aaed8a14 100644 --- a/include/mbgl/style/expression/expression.hpp +++ b/include/mbgl/style/expression/expression.hpp @@ -6,8 +6,8 @@ #include <mbgl/util/optional.hpp> #include <mbgl/util/variant.hpp> #include <mbgl/util/color.hpp> -#include <mbgl/style/function/type.hpp> -#include <mbgl/util/feature.hpp> +#include <mbgl/style/expression/type.hpp> +#include <mbgl/style/expression/value.hpp> #include <mbgl/style/expression/parsing_context.hpp> #include <mbgl/style/conversion.hpp> @@ -20,20 +20,6 @@ class GeometryTileFeature; namespace style { namespace expression { -struct Value; -using ValueBase = variant< - NullValue, - float, - std::string, - mbgl::Color, - mapbox::util::recursive_wrapper<std::vector<Value>>, - mapbox::util::recursive_wrapper<std::unordered_map<std::string, Value>>>; -struct Value : ValueBase { - using ValueBase::ValueBase; -}; - -constexpr NullValue Null = NullValue(); - struct EvaluationError { std::string message; }; @@ -102,17 +88,7 @@ public: template <class V> static ParseResult parse(const V& value, const ParsingContext& ctx) { const Value& parsedValue = parseValue(value); - const type::Type& type = parsedValue.match( - [&](float) -> type::Type { return type::Primitive::Number; }, - [&](const std::string&) -> type::Type { return type::Primitive::String; }, - [&](const mbgl::Color&) -> type::Type { return type::Primitive::Color; }, - [&](const NullValue&) -> type::Type { return type::Primitive::Null; }, - [&](const std::unordered_map<std::string, Value>&) -> type::Type { return type::Primitive::Object; }, - [&](const std::vector<Value>& arr) -> type::Type { - // TODO - return type::Array(type::Primitive::Value, arr.size()); - } - ); + const type::Type& type = typeOf(parsedValue); return std::make_unique<LiteralExpression>(ctx.key(), type, parsedValue); } |