-
Notifications
You must be signed in to change notification settings - Fork 1
/
Expression.h
41 lines (39 loc) · 1.61 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
#ifndef EXPRESSION_H_INCLUDED
#define EXPRESSION_H_INCLUDED
#include "TStack.cpp"
#include "Token.h"
#include "Operations.h"
#include <string>
#include <tuple>
#include <vector>
#include <sstream>
#include <iostream>
#include <regex>
class Expression{
private:
std::string expression;
TStack<std::tuple<std::string, int, bool, bool>>* operatorStack;
TStack<std::tuple<std::string, int, bool, bool>>* operandStack;
TStack<std::tuple<std::string, int, bool, bool>>* reversePolishStack;
std::vector<std::tuple<std::string, int, bool, bool>> mapTokens;
public:
Expression();
Expression(std::string &exp);
///getters da classe
std::string getExpression();
///setters da classe
void setExpression(std::string &exp);
///metodos das pilhas
TStack<std::tuple<std::string, int, bool, bool>>* getStack(int op);
void pushStack(TStack<std::tuple<std::string, int, bool, bool>>* pointerStack, std::tuple<std::string, int, bool, bool> token);
void popStack(TStack<std::tuple<std::string, int, bool, bool>>* pointerStack);
std::tuple<std::string, int, bool, bool> topStack(TStack<std::tuple<std::string, int, bool, bool>>* pointerStack);
///metodos da classe
void eval(std::string &exp);
void reversePolish(std::vector<std::tuple<std::string, int, bool, bool>> mapTkn);
bool HigerPriority(int op1, int op2);
void solve();
void removeSpaces(std::string &exp);
void removeVariables(std::string &exp);
};
#endif // EXPRESSION_H_INCLUDED