-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMathExpressionString.h
More file actions
42 lines (33 loc) · 1.67 KB
/
Copy pathMathExpressionString.h
File metadata and controls
42 lines (33 loc) · 1.67 KB
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
/**
* THIS IS A PRIVATE FILE. NO RESULTS ARE GUARENTEED IF YOU #INCLUDE THIS FILE INTO
* YOUR OTHER PIECES OF CODE. This is the declaration of a nested class; putting
* its declaration in the header of the original class would make the original
* class's private section too difficult to read. To top things off, it had two
* nested classes, so I've decided to #include the code instead.
*/
class MathExpressionString : public String
{
public:
//Overload the constructors!
MathExpressionString() : String() {}
MathExpressionString(const std::string& str) : String(str) {}
MathExpressionString(const char* s, size_t n) : String(s, n) {}
MathExpressionString(const char* s) : String(s) {}
MathExpressionString(size_t n, char c) : String(n, c) {}
MathExpressionString(const String& str, size_t pos, size_t n = npos)
: String(str, pos, n) {}
template<typename InputIterator> MathExpressionString(InputIterator begin, InputIterator end)
: String (begin, end) {}
MathExpressionString(const MathExpressionString& str)
{ *this = str.c_str(); }
//"Value name"; this is so it encompasses both variables and constants.
bool isValName() const;
unsigned findValNameEnd (unsigned) const;
unsigned findValNameStart(unsigned) const;
EvaluationTreeNode* getEvaluationTree();
private:
void replaceWithInverse (char, char, String);
void changeOperationsToFuncs(unsigned char);
void juxtToOperation (String);
EvaluationTreeNode* parsePureMathExpression() const;
};