#pragma once #include #include class RPN { public: // Constructors RPN(); RPN(std::string expression); // Copy constructor and copy assignment operator RPN(const RPN &other); RPN &operator=(const RPN &other); // Move constructor and move assignment operator RPN(RPN &&other) noexcept; RPN &operator=(RPN &&other) noexcept; // Destructor ~RPN(); void setExpression(std::string expression); int evaluate(); class NoExpressionException : public std::exception { public: const char *what() const noexcept override; }; class InvalidExpressionException : public std::exception { public: const char *what() const noexcept override; }; class DivisionByZeroException : public std::exception { public: const char *what() const noexcept override; }; class InvalidCharacterException : public std::exception { public: const char *what() const noexcept override; }; private: std::string _expression; bool isWellformed() const; bool isOperator(char c) const; int applyOperator(int a, int b, char op) const; };