-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExpression.h
49 lines (40 loc) · 1.04 KB
/
Expression.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
41
42
43
44
45
46
47
48
49
#ifndef CEXPRESSION_H
#define CEXPRESSION_H
#include <QString>
#include "Field.h"
#include "Queue.h"
//! Simple Tree Node wich contains pointer to the left and right child
//! nodes. Which kind
typedef struct treeatom {
struct treeatom *left;
struct treeatom *right;
int what;
int value;
} treeatom;
//! This class saves a numerical expression as expression tree.
class Expression
{
public:
Expression();
~Expression();
int compute (Field *aField, QList<int> &vVars);
void show ();
QString getError ();
char *equation_error_text();
void clear ();
void importQueue (Queue *expr_queue);
unsigned char number (char *t, int *d);
int value (char *t);
private:
treeatom *tree;
int dummy; /* Dummy-Variable f"ur Number-aufrufe */
QString exp_error;
Field *currentField;
QList<int> varList;
int power (int a, int p);
int computeTreeInternal (treeatom *tree);
void showTreeInternal (treeatom *tree, QString &resStr);
void clearTreeInternal(treeatom *tree);
void importQueueInternal(Queue *expr_queue, treeatom **tree);
};
#endif