AbaKus – a complex calculator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.4KB

  1. #ifndef ABAKUS_RPNMUNCHER_H
  2. #define ABAKUS_RPNMUNCHER_H
  3. /*
  4. * rpnmuncher.h - part of abakus
  5. * Copyright (C) 2004, 2005 Michael Pyne <michael.pyne@kdemail.net>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. class TQString;
  22. class Operand;
  23. template<class T> class TQValueStack;
  24. typedef TQValueStack<Operand> OperandStack;
  25. #include "numerictypes.h"
  26. class RPNParser
  27. {
  28. public:
  29. static Abakus::number_t rpnParseString(const TQString &text);
  30. static bool wasError() { return m_error; }
  31. static TQString errorString() { return m_errorStr; }
  32. static OperandStack &stack() { return m_stack; }
  33. private:
  34. static TQString m_errorStr;
  35. static bool m_error;
  36. static OperandStack m_stack;
  37. };
  38. #endif