42 #if !defined(GLS_BOOLEXPRESSION_H)
43 #define GLS_BOOLEXPRESSION_H
46 #pragma warning (disable:4786)
112 virtual void Set(
const std::string& val);
180 static OperatorMap_t
OP;
206 const std::string& operand1,
207 const std::string& operand2)
const;
214 virtual bool IsTrue(
const std::string& word)
const;
223 return OP.find(token) != OP.end();
232 static TokenCont_t
InfixToRPN(
const TokenCont_t& infixTokens);
240 static void Tokenize(
const std::string& expr, TokenCont_t& tokens);
249 const std::string& input,
250 std::string::size_type start);
257 static std::string
Uppercase(
const std::string& str);
265 static bool ValidInfix(
const TokenCont_t& infixTokens);
289 std::getline(instr, exprStr);
295 #endif // GLS_BOOLEXPRESSION_H
static OperatorMap_t OP
A map to convert from operator strings to their enum equivalent.
static const unsigned PRECEDENCE[MAX_OPERATORS]
Operator precedence values used when evaluating the expression.
static TokenCont_t InfixToRPN(const TokenCont_t &infixTokens)
std::string ExpressionString() const
std::vector< std::string > TokenCont_t
std::istream & operator>>(std::istream &instr, GlsBoolExpression &e)
bool operator==(const GlsBoolExpression &r) const
virtual void Set(const std::string &val)
static void Tokenize(const std::string &expr, TokenCont_t &tokens)
GlsBoolExpression & operator=(const GlsBoolExpression &r)
virtual bool IsTrue(const std::string &word) const
GlsBoolExpression(GlsMenuDictionary &evalDict, bool defaultVal=false)
virtual std::string Evaluate(Operator_t op, const std::string &operand1, const std::string &operand2) const
static bool ValidInfix(const TokenCont_t &infixTokens)
static bool IsAnOperator(const std::string &token)
static std::string Uppercase(const std::string &str)
virtual ~GlsBoolExpression()
GlsMenuDictionary & _evalDict
The dictionary to use to evaluate meta-data variables found in the expression.
TokenCont_t _RPNTokens
These are the tokens that were extracted from the expression string and are stored in Reverse Polish ...
std::ostream & operator<<(std::ostream &outstr, const GlsBoolExpression &e)
static std::string::size_type VarLength(const std::string &input, std::string::size_type start)
static bool _initializedStaticData
Whether or not the static class data has been initialized. This needs to be done only once by the fir...
bool _latestValue
The latest calculated result of the expression.
std::string _expressionString
Storage of the original string for the expression.
std::map< std::string, Operator_t > OperatorMap_t