[core] convert CompoundExpressionRegistry to constexpr hash map
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user