Initial commit: HTab spreadsheet engine and GemUI X11 frontend
This commit is contained in:
commit
395f458fee
55 files changed
+12682
No files matched your search
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include "engine/evaluator.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace htab {
|
||||
|
||||
using FunctionImpl =
|
||||
std::function<EvalResult(const std::vector<std::shared_ptr<Expr>>& args, const EvalContext& ctx)>;
|
||||
|
||||
class FunctionRegistry {
|
||||
public:
|
||||
static const FunctionRegistry& instance();
|
||||
|
||||
const FunctionImpl* find(std::string_view upper_name) const;
|
||||
size_t registered_count() const { return funcs_.size(); }
|
||||
|
||||
void register_fn(std::string name, FunctionImpl fn);
|
||||
|
||||
private:
|
||||
FunctionRegistry();
|
||||
|
||||
std::unordered_map<std::string, FunctionImpl> funcs_;
|
||||
};
|
||||
|
||||
void register_math_trig_functions(FunctionRegistry& reg);
|
||||
void register_logical_functions(FunctionRegistry& reg);
|
||||
void register_statistical_functions(FunctionRegistry& reg);
|
||||
void register_lookup_functions(FunctionRegistry& reg);
|
||||
void register_text_functions(FunctionRegistry& reg);
|
||||
void register_datetime_functions(FunctionRegistry& reg);
|
||||
void register_financial_functions(FunctionRegistry& reg);
|
||||
void register_database_functions(FunctionRegistry& reg);
|
||||
|
||||
} // namespace htab
|
||||
Reference in new issue
Block a user