-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuiltinfunction.cpp
61 lines (55 loc) · 976 Bytes
/
builtinfunction.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "builtinfunction.h"
builtinFunction::builtinFunction(QString name,hfloat (*ptr1a)(hfloat a))
{
this->m_name = name;
this->m_ptr1a = ptr1a;
}
builtinFunction::builtinFunction(QString name,hfloat (*ptr2a)(hfloat a,hfloat b))
{
this->m_name = name;
this->m_ptr2a = ptr2a;
}
QString builtinFunction::name(void)
{
return this->m_name;
}
hfloat builtinFunction::exec(void)
{
hfloat retVal;
switch (arg.count())
{
case 0:
{
if (m_ptr0a)
{
retVal = (*m_ptr0a)();
}
break;
}
case 1:
{
if (m_ptr1a)
{
retVal = (*m_ptr1a)(arg[0]);
}
break;
}
case 2:
{
if (m_ptr2a)
{
retVal = (*m_ptr2a)(arg[0],arg[1]);
}
break;
}
}
return retVal;
}
void builtinFunction::clearArgs(void)
{
arg.clear();
}
void builtinFunction::addArg(hfloat arg)
{
this->arg.append(arg);
}