BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
SimpleCalc.h
1 #pragma once
2 
3 namespace BeeeOn {
4 
17 class SimpleCalc {
18 public:
19  double evaluate(const std::string &input) const;
20 
21 protected:
22  double parseTerm(
23  std::string::const_iterator &at,
24  std::string::const_iterator end) const;
25  char parseOpOrEOF(
26  std::string::const_iterator &at,
27  std::string::const_iterator end) const;
28  void skipWhitespace(
29  std::string::const_iterator &at,
30  std::string::const_iterator end) const;
31 
32  void apply(double &result, char op, double tmp) const;
33 
34  bool isWhitespace(const char c) const;
35  bool isOperator(const char c) const;
36  bool isTerm(const char c) const;
37 };
38 
39 }
Definition: SimpleCalc.h:17