Mantis App v0.1.13
Loading...
Searching...
No Matches
expr_evaluator.h
Go to the documentation of this file.
1
6#ifndef EXPR_EVALUATOR_H
7#define EXPR_EVALUATOR_H
8
9#include <string>
10#include <shunting-yard.h>
11#include <containers.h>
12#include <nlohmann/json.hpp>
13
14// #define __file__ "core/expr_evaluator.h"
15
16namespace mantis
17{
18 using cparse::TokenMap;
19 using cparse::calculator;
20 using cparse::packToken;
21 using json = nlohmann::json;
22
27 {
28 ExprEvaluator() = default;
29
37 auto evaluate(const std::string& expr, const TokenMap& vars) -> bool;
38
46 auto evaluate(const std::string& expr, const json& vars) -> bool;
47
54 auto jsonToTokenMap(const json& j) -> TokenMap;
55
56 const std::string __class_name__ = "mantis::ExprEvaluator";
57 };
58} // mantis
59
60#endif //EXPR_EVALUATOR_H
nlohmann::json json
Definition mantis.h:35
router.h
Definition app.h:30
nlohmann::json json
Shorten JSON namespace.
Definition crud.h:14
Struct instance for handling evaluation of database access rules.
Definition expr_evaluator.h:27
const std::string __class_name__
Definition expr_evaluator.h:56
auto evaluate(const std::string &expr, const TokenMap &vars) -> bool
Evaluates a given expression in a context of the given TokenMap variables.
Definition expr_evaluator.cpp:13
auto jsonToTokenMap(const json &j) -> TokenMap
Convert a given JSON Object to the equivalent TokenMap so that we can pass it to the evaluator.
Definition expr_evaluator.cpp:32