8#ifndef INFIXTOPOSTFIX_H_ 
    9#define INFIXTOPOSTFIX_H_ 
   51      QString 
convert(
const QString &infix);
 
   59      QList<InfixOperator *> p_operators;
 
   68      void closeParenthesis(QString &postfix, std::stack<InfixOperator> &theStack);
 
   71      void checkArgument(QString funcName, 
int argNum, QString argument);
 
 
   83      InfixOperator(
int prec, QString inString, 
bool isFunc = 
false) {
 
   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;
 
   98      const QString &inputString()
 const {
 
  102      const QString &outputString()
 const {
 
  103        return m_outputString;
 
  106      int precedence()
 const {
 
  110      bool isFunction()
 const {
 
  117      QString m_inputString;
 
  118      QString m_outputString;
 
 
  134        m_numArguments = argCount;
 
  137      InfixFunction(QString inString, QString outString, 
int argCount) :
 
  139        m_numArguments = argCount;
 
  142      int argumentCount()
 const {
 
  143        return m_numArguments;
 
 
InfixOperator and InfixFunction are helper classes for InfixToPostfix.
 
InfixOperator and InfixFunction are helper classes for InfixToPostfix.
 
Converter for math equations.
 
virtual InfixOperator * findOperator(QString representation)
This method will return a pointer to the operator represented by 'representation.
 
QString convert(const QString &infix)
This method converts infix to postfix.
 
bool isFunction(QString representation)
This method will return true if 'representation' is a known function.
 
QString cleanSpaces(QString equation)
This function takes a space-delimited string and removes empty delimiters.
 
void initialize()
This populates the known operators/functions list.
 
virtual bool isKnownSymbol(QString representation)
This method will return true if it believes the argument represents a valid function or operator.
 
void uninitialize()
This cleans the known operators/functions list.
 
InfixToPostfix()
Constructor.
 
QString tokenizeEquation(const QString &equation)
This method will add spaces between all operators and numbers, making it possible to get each element...
 
void closeParenthesis(QString &postfix, std::stack< InfixOperator > &theStack)
This is straight from the algorithm found on page 159 of "Data Structures & Algorithms in Java" Secon...
 
void addOperator(QString &postfix, const InfixOperator &op, std::stack< InfixOperator > &theStack)
This is straight from the algorithm found on page 159 of "Data Structures & Algorithms in Java" Secon...
 
QString formatFunctionCalls(QString equation)
This method looks through equation for function calls, parenthesizes them, and calls itself again wit...
 
This is free and unencumbered software released into the public domain.