Numworks Epsilon
1.4.1
Graphing Calculator Operating System
helpers.cpp
Go to the documentation of this file.
1
#include "
helpers.h
"
2
#include <string.h>
3
4
namespace
Code
{
5
namespace
Helpers {
6
7
class
EventTextPair
{
8
public
:
9
constexpr
EventTextPair
(
Ion::Events::Event
event
,
const
char
*
text
) : m_event(
event
), m_text(
text
) {}
10
Ion::Events::Event
event
()
const
{
return
m_event; }
11
const
char
*
text
()
const
{
return
m_text; }
12
private
:
13
const
Ion::Events::Event
m_event;
14
const
char
* m_text;
15
};
16
17
static
constexpr EventTextPair sEventTextMap[] = {
18
EventTextPair(
Ion::Events::XNT
,
"x"
),
19
EventTextPair(
Ion::Events::Exp
,
"exp()"
),
20
EventTextPair(
Ion::Events::Ln
,
"log()"
),
21
EventTextPair(
Ion::Events::Log
,
"log10()"
),
22
EventTextPair(
Ion::Events::Sine
,
"sin()"
),
23
EventTextPair(
Ion::Events::Cosine
,
"cos()"
),
24
EventTextPair(
Ion::Events::Tangent
,
"tan()"
),
25
EventTextPair(
Ion::Events::Imaginary
,
"1j"
),
26
EventTextPair(
Ion::Events::Power
,
"**"
),
27
EventTextPair(
Ion::Events::Pi
,
"pi"
),
28
EventTextPair(
Ion::Events::Sqrt
,
"sqrt()"
),
29
EventTextPair(
Ion::Events::Square
,
"**2"
),
30
EventTextPair(
Ion::Events::Multiplication
,
"*"
),
31
EventTextPair(
Ion::Events::EE
,
"e"
),
32
EventTextPair(
Ion::Events::Arcsine
,
"asin()"
),
33
EventTextPair(
Ion::Events::Arccosine
,
"acos()"
),
34
EventTextPair(
Ion::Events::Arctangent
,
"atan()"
)
35
};
36
37
const
char
*
PythonTextForEvent
(
Ion::Events::Event
event) {
38
for
(
size_t
i=0; i<
sizeof
(sEventTextMap)/
sizeof
(sEventTextMap[0]); i++) {
39
if
(event == sEventTextMap[i].event()) {
40
return
sEventTextMap[i].
text
();
41
}
42
}
43
return
nullptr
;
44
}
45
46
}
47
}
Ion::Events::EE
constexpr Event EE
Definition:
events.h:112
Ion::Events::Power
constexpr Event Power
Definition:
events.h:83
Ion::Events::Arctangent
constexpr Event Arctangent
Definition:
events.h:136
Ion::Events::Tangent
constexpr Event Tangent
Definition:
events.h:87
Ion::Events::Square
constexpr Event Square
Definition:
events.h:90
Ion::Events::Exp
constexpr Event Exp
Definition:
events.h:78
Ion::Events::Ln
constexpr Event Ln
Definition:
events.h:79
Ion::Events::Sqrt
constexpr Event Sqrt
Definition:
events.h:89
Code::Helpers::EventTextPair::EventTextPair
constexpr EventTextPair(Ion::Events::Event event, const char *text)
Definition:
helpers.cpp:9
Ion::Events::Cosine
constexpr Event Cosine
Definition:
events.h:86
Ion::Events::Arcsine
constexpr Event Arcsine
Definition:
events.h:134
Ion::Events::Pi
constexpr Event Pi
Definition:
events.h:88
Ion::Events::Event
Definition:
events.h:9
Code::Helpers::EventTextPair::event
Ion::Events::Event event() const
Definition:
helpers.cpp:10
Code
Definition:
app.cpp:7
Code::Helpers::EventTextPair
Definition:
helpers.cpp:7
Ion::Events::XNT
constexpr Event XNT
Definition:
events.h:73
Ion::Events::Arccosine
constexpr Event Arccosine
Definition:
events.h:135
Ion::Events::Sine
constexpr Event Sine
Definition:
events.h:85
Ion::Events::Imaginary
constexpr Event Imaginary
Definition:
events.h:81
Ion::Events::Multiplication
constexpr Event Multiplication
Definition:
events.h:101
Code::Helpers::EventTextPair::text
const char * text() const
Definition:
helpers.cpp:11
helpers.h
Code::Helpers::PythonTextForEvent
const char * PythonTextForEvent(Ion::Events::Event event)
Definition:
helpers.cpp:37
Ion::Events::Log
constexpr Event Log
Definition:
events.h:80
epsilon
apps
code
helpers.cpp
Generated by
1.8.14