Deleted Added
sdiff udiff text old ( 10447:a465576671d4 ) new ( 10448:bc1a3b7ab5ef )
full compact
1#ifndef __LIBUTIL_CALCULATOR_H__
2#define __LIBUTIL_CALCULATOR_H__
3
4#include <sstream>
5
6#include "String.h"
7#include "Map.h"
8#include "Assert.h"
9
10namespace LibUtil
11{
12 using std::istringstream;
13
14 /*
15 * program:
16 * END // END is end-of-input
17 * expr_list END
18 *
19 * expr_list:
20 * expression SEP expr_list // SEP is semicolon

--- 37 unchanged lines hidden (view full) ---

58 };
59
60 public:
61 Calculator();
62 virtual ~Calculator();
63
64 public:
65 void reset();
66 void evaluateString(const String& str_);
67
68 protected:
69 Token getToken(istringstream& ist_);
70 double prim(istringstream& ist_, bool is_get_);
71 double term(istringstream& ist_, bool is_get_);
72 double expr(istringstream& ist_, bool is_get_);
73 virtual double getEnvVar(const String& var_name_) const;
74
75 protected:
76 String m_reserved_chars_;
77 Map<double> m_var_;
78
79 Token m_curr_token_;
80 double m_value_number_;
81 String m_value_string_;
82 }; // class Calculator
83} // namespace LibUtil
84
85#endif // __LIBUTIL_CALCULATOR_H__
86