8#ifndef INFIXTOPOSTFIX_H_
9#define INFIXTOPOSTFIX_H_
51 QString
convert(
const QString &infix);
65 QString formatFunctionCalls(QString equation);
66 QString cleanSpaces(QString equation);
68 void closeParenthesis(QString &postfix, std::stack<InfixOperator> &theStack);
69 void addOperator(QString &postfix,
const InfixOperator &op, std::stack<InfixOperator> &theStack);
70 bool isFunction(QString representation);
71 void checkArgument(QString funcName,
int argNum, QString argument);
85 m_inputString = inString;
86 m_outputString = inString;
87 m_isFunction = isFunc;
91 bool isFunc =
false) {
93 m_inputString = inString;
94 m_outputString = outString;
95 m_isFunction = isFunc;
103 return m_outputString;
117 QString m_inputString;
118 QString m_outputString;
134 m_numArguments = argCount;
139 m_numArguments = argCount;
143 return m_numArguments;
InfixOperator and InfixFunction are helper classes for InfixToPostfix.
Definition InfixToPostfix.h:130
int argumentCount() const
Definition InfixToPostfix.h:142
InfixFunction(QString inString, int argCount)
Definition InfixToPostfix.h:132
InfixFunction(QString inString, QString outString, int argCount)
Definition InfixToPostfix.h:137
InfixOperator and InfixFunction are helper classes for InfixToPostfix.
Definition InfixToPostfix.h:81
InfixOperator(int prec, QString inString, bool isFunc=false)
Definition InfixToPostfix.h:83
const QString & outputString() const
Definition InfixToPostfix.h:102
const QString & inputString() const
Definition InfixToPostfix.h:98
InfixOperator(int prec, QString inString, QString outString, bool isFunc=false)
Definition InfixToPostfix.h:90
bool isFunction() const
Definition InfixToPostfix.h:110
int precedence() const
Definition InfixToPostfix.h:106
Converter for math equations.
Definition InfixToPostfix.h:46
virtual InfixOperator * findOperator(QString representation)
This method will return a pointer to the operator represented by 'representation.
Definition InfixToPostfix.cpp:347
QString convert(const QString &infix)
This method converts infix to postfix.
Definition InfixToPostfix.cpp:139
virtual bool isKnownSymbol(QString representation)
This method will return true if it believes the argument represents a valid function or operator.
Definition InfixToPostfix.cpp:253
virtual ~InfixToPostfix()
Definition InfixToPostfix.cpp:23
InfixToPostfix()
Constructor.
Definition InfixToPostfix.cpp:19
QString tokenizeEquation(const QString &equation)
This method will add spaces between all operators and numbers, making it possible to get each element...
Definition InfixToPostfix.cpp:369
QList< InfixOperator * > p_operators
Definition InfixToPostfix.h:59
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16