summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-12-03 21:43:43 +0200
committerKonstantin Käfer <mail@kkaefer.com>2018-12-04 16:20:51 +0200
commit64559a255b0063a457d5ca5260926dfcdcb06f37 (patch)
treec6f08c5d69bb18b3d84424bb04ae1f4659d27944 /include
parent2b9f3aad9a69aba0035442364320c372c49053c0 (diff)
downloadqtlocation-mapboxgl-64559a255b0063a457d5ca5260926dfcdcb06f37.tar.gz
[core] convert CompoundExpressionRegistry to constexpr hash map
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/style/expression/compound_expression.hpp11
-rw-r--r--include/mbgl/style/expression/parsing_context.hpp3
2 files changed, 3 insertions, 11 deletions
diff --git a/include/mbgl/style/expression/compound_expression.hpp b/include/mbgl/style/expression/compound_expression.hpp
index b54720a258..57a96d08a0 100644
--- a/include/mbgl/style/expression/compound_expression.hpp
+++ b/include/mbgl/style/expression/compound_expression.hpp
@@ -39,20 +39,13 @@ public:
optional<std::size_t> getParameterCount() const;
+ static bool exists(const std::string& name);
+
protected:
const detail::SignatureBase& signature;
std::vector<std::unique_ptr<Expression>> args;
};
-/*
- Holds the map of expression name => implementation (which is just one or
- more evaluation functions, each wrapped in a Signature struct).
-*/
-struct CompoundExpressionRegistry {
- using Definition = std::vector<std::unique_ptr<detail::SignatureBase>>;
- static std::unordered_map<std::string, Definition> definitions;
-};
-
ParseResult parseCompoundExpression(const std::string name,
const mbgl::style::conversion::Convertible& value,
ParsingContext& ctx);
diff --git a/include/mbgl/style/expression/parsing_context.hpp b/include/mbgl/style/expression/parsing_context.hpp
index 08151a2b7d..596b136419 100644
--- a/include/mbgl/style/expression/parsing_context.hpp
+++ b/include/mbgl/style/expression/parsing_context.hpp
@@ -177,8 +177,7 @@ private:
std::shared_ptr<std::vector<ParsingError>> errors;
};
-using ParseFunction = ParseResult (*)(const conversion::Convertible&, ParsingContext&);
-ParseFunction getExpression(const std::string&);
+bool isExpression(const std::string&);
} // namespace expression
} // namespace style