-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalclogic.h
40 lines (30 loc) · 1.09 KB
/
calclogic.h
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
#ifndef CALCLOGIC_H
#define CALCLOGIC_H
#include <QObject>
class CalcLogic : public QObject
{
Q_OBJECT
public:
explicit CalcLogic(QObject *parent = nullptr) noexcept;
virtual ~CalcLogic() noexcept;
Q_INVOKABLE QString onNumberPressed( const QString inputNumber ) noexcept;
Q_INVOKABLE QString arithmeticOpsPressed( const QString inputOp ) noexcept;
Q_INVOKABLE QString evaluateExpression() noexcept;
Q_INVOKABLE QString onDotPressed() noexcept;
Q_INVOKABLE QString onOtherOpsPressed(const QString input) noexcept;
private:
static const unsigned char NO_OPERATION = 0;
static const unsigned char ADD_OPERATION = 1;
static const unsigned char SUBTRACT_OPERATION = 2;
static const unsigned char MULTIPLY_OPERATION = 3;
static const unsigned char DIVISION_OPERATION = 4;
QString leftOperand;
QString rightOperand;
QString output;
unsigned char operationType;
void ResetAfterCalculation() noexcept;
void updateOutput() noexcept;
void calculationDone() noexcept;
signals:
};
#endif // CALCLOGIC_H