-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath_notation.hpp
33 lines (27 loc) · 1.2 KB
/
math_notation.hpp
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
#ifndef MATH_NOTATION
#define MATH_NOTATION
#include "app.hpp"
/*
These functions prevent invalid input as user clicks buttons.
Assumes that last expr is correct,
checks if a button press will still lead to an correct expression,
if not do nothing
or correct input [ expr = "2" then users hits '(', app will correct it to '2*(' ]
Equations should be explicit, no missing '*', this happens with paras and the 'x' variable.
We correct this before the user hits '=',
*/
std::string cleanExpr(const std::string& expr);
void leftParaPressEvent(const char& ch);
void rightParaPressEvent(const char& ch);
void xPressEvent(const char& ch);
void zeroPressEvent(const char& ch);
void decimalPressEvent(const char& ch);
void operatorPressEvent(const char& ch); // instead of access to the whole button, we just need the char it stores,
void equalPressEvent(const char& ch); // if we dont pass a parameter, then we need a function for every number
void numberPressEvent(const char& ch);
void equalPressEvent(const char& ch);
void CEPressEvent(const char& ch);
void clearPressEvent(const char& ch);
void backPressEvent(const char& ch);
void negatePressEvent(const char& ch);
#endif