5 #ifndef JODA_FUNCTION_ACTIONS_H
6 #define JODA_FUNCTION_ACTIONS_H
11 template <
typename Input>
13 std::string
pointer = in.string();
14 auto para = std::make_unique<joda::query::PointerProvider>(
19 state.
params.push_back(std::move(para));
24 template <
typename Input>
26 std::string str = in.string();
28 std::unique_ptr<joda::query::IValueProvider> ival;
31 double i = std::stod(str);
32 ival = std::make_unique<joda::query::DoubleProvider>(i);
33 }
catch (std::exception &e) {
34 LOG(ERROR) <<
"Could not parse number, out of range?";
38 if (ival ==
nullptr)
return false;
40 auto para = std::move(ival);
44 state.
params.push_back(std::move(para));
51 template <
typename Input>
53 std::string str = in.string();
55 std::unique_ptr<joda::query::IValueProvider> ival;
58 int64_t i = std::stol(str);
59 ival = std::make_unique<joda::query::Int64Provider>(i);
60 }
catch (std::exception &e) {
63 if (ival ==
nullptr) {
65 u_int64_t i = std::stoul(str);
66 ival = std::make_unique<joda::query::UInt64Provider>(i);
67 }
catch (std::exception &e) {
70 if (ival ==
nullptr) {
72 double i = std::stod(str);
73 ival = std::make_unique<joda::query::DoubleProvider>(i);
74 }
catch (std::exception &e) {
75 LOG(ERROR) <<
"Could not parse number, out of range?";
80 if (ival ==
nullptr)
return false;
82 auto para = std::move(ival);
86 state.
params.push_back(std::move(para));
93 static inline std::string
unescape(
const std::string &s) {
95 std::string::const_iterator it = s.begin();
96 while (it != s.end()) {
98 if (c ==
'\\' && it != s.end()) {
118 template <
typename Input>
120 std::string str = in.string();
122 auto unescaped = unescape(str.substr(1, str.size() - 2));
123 auto para = std::make_unique<joda::query::StringProvider>(unescaped);
127 state.
params.push_back(std::move(para));
132 template <
typename Input>
134 std::string b = in.string();
138 else if (b ==
"false")
141 assert(
false &&
"Did not change bool parsing");
142 auto para = std::make_unique<joda::query::BoolProvider>(bo);
146 state.
params.push_back(std::move(para));
152 template <
typename Input>
154 auto para = std::make_unique<joda::query::NullProvider>();
158 state.
params.push_back(std::move(para));
@ ATOM_BOOL
Definition: Function_State.h:16
@ ATOM_NUMBER
Definition: Function_State.h:15
@ ATOM_NULL
Definition: Function_State.h:18
@ NO_ATOM
Definition: Function_State.h:13
@ ATOM_POINTER
Definition: Function_State.h:17
@ ATOM_STRING
Definition: Function_State.h:14
Definition: Literals.h:65
Definition: Literals.h:38
static void apply(const Input &in, functionState &state)
Definition: Function_Actions.h:133
static bool apply(const Input &in, functionState &state)
Definition: Function_Actions.h:25
static bool apply(const Input &in, functionState &state)
Definition: Function_Actions.h:52
static void apply(const Input &in, functionState &state)
Definition: Function_Actions.h:153
static void apply(const Input &in, functionState &state)
Definition: Function_Actions.h:12
static void apply(const Input &in, functionState &state)
Definition: Function_Actions.h:119
static std::string unescape(const std::string &s)
Definition: Function_Actions.h:93
Definition: FunctionWrapper.h:12
Definition: Function_State.h:21
Atom_Value atom
Definition: Function_State.h:143
std::vector< std::unique_ptr< joda::query::IValueProvider > > params
Definition: Function_State.h:147
Definition: Literals.h:41
Definition: Literals.h:74
Definition: Literals.h:27
Definition: Literals.h:57