31 lines
856 B
C++
31 lines
856 B
C++
#include "engine/functions/registry.hpp"
|
|||
|
|
|
||
|
|
namespace htab {
|
||
|
|
|
||
|
|
const FunctionRegistry& FunctionRegistry::instance() {
|
||
|
|
static const FunctionRegistry reg;
|
||
|
|
return reg;
|
||
|
|
}
|
||
|
|
|
||
|
|
FunctionRegistry::FunctionRegistry() {
|
||
|
|
register_math_trig_functions(*this);
|
||
|
|
register_logical_functions(*this);
|
||
|
|
register_statistical_functions(*this);
|
||
|
|
register_lookup_functions(*this);
|
||
|
|
register_text_functions(*this);
|
||
|
|
register_datetime_functions(*this);
|
||
|
|
register_financial_functions(*this);
|
||
|
|
register_database_functions(*this);
|
||
|
|
}
|
||
|
|
|
||
|
|
void FunctionRegistry::register_fn(std::string name, FunctionImpl fn) {
|
||
|
|
funcs_.emplace(std::move(name), std::move(fn));
|
||
|
|
}
|
||
|
|
|
||
|
|
const FunctionImpl* FunctionRegistry::find(std::string_view upper_name) const {
|
||
|
|
auto it = funcs_.find(std::string(upper_name));
|
||
|
|
if (it == funcs_.end()) return nullptr;
|
||
|
|
return &it->second;
|
||
|
|
}
|
||
|
|
|
||
|
|
} // namespace htab
|