diff options
author | Kevin Li <kevin.li@mapbox.com> | 2020-02-15 17:36:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-15 17:36:57 +0800 |
commit | 02274e76019bcfb938f50cdb638eca49c33de786 (patch) | |
tree | ed472d6d3eb511a51bd9fcd2fb568b96976aafd7 /include | |
parent | 59294aaef333bdd455bd13d6bab6fca730379b52 (diff) | |
download | qtlocation-mapboxgl-02274e76019bcfb938f50cdb638eca49c33de786.tar.gz |
[core] Implement 'in' expression. (#16162)
* Implement in.cpp
* Fix review comments.
* Add expression_equality test for 'in'
* Fix review comments.
* [core] Update changelog.
* [core] Update mapbox-gl-js
* [core] Ignore render-tests/debug/padding
* [core] Update baseline.
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/style/expression/expression.hpp | 1 | ||||
-rw-r--r-- | include/mbgl/style/expression/in.hpp | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/include/mbgl/style/expression/expression.hpp b/include/mbgl/style/expression/expression.hpp index 0fd5c4959e..e522821185 100644 --- a/include/mbgl/style/expression/expression.hpp +++ b/include/mbgl/style/expression/expression.hpp @@ -168,6 +168,7 @@ enum class Kind : int32_t { FormatSectionOverride, NumberFormat, ImageExpression, + In, Within }; diff --git a/include/mbgl/style/expression/in.hpp b/include/mbgl/style/expression/in.hpp new file mode 100644 index 0000000000..a7de17c94d --- /dev/null +++ b/include/mbgl/style/expression/in.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include <mbgl/style/conversion.hpp> +#include <mbgl/style/expression/expression.hpp> +#include <memory> + +namespace mbgl { +namespace style { +namespace expression { + +class In final : public Expression { +public: + In(std::unique_ptr<Expression> needle_, std::unique_ptr<Expression> haystack_); + + static ParseResult parse(const mbgl::style::conversion::Convertible& value, ParsingContext& ctx); + + EvaluationResult evaluate(const EvaluationContext& params) const override; + void eachChild(const std::function<void(const Expression&)>&) const override; + + bool operator==(const Expression& e) const override; + + std::vector<optional<Value>> possibleOutputs() const override; + + std::string getOperator() const override; + +private: + std::unique_ptr<Expression> needle; + std::unique_ptr<Expression> haystack; +}; + +} // namespace expression +} // namespace style +} // namespace mbgl |