42 #if !defined( GLS_BOOLEXPRESSION_H )
43 # define GLS_BOOLEXPRESSION_H
46 # pragma warning( disable : 4786 )
111 virtual void Set(
const std::string& val );
176 static OperatorMap_t
OP;
201 const std::string& operand1,
202 const std::string& operand2 )
const;
209 virtual bool IsTrue(
const std::string& word )
const;
218 return OP.find( token ) != OP.end();
227 static TokenCont_t
InfixToRPN(
const TokenCont_t& infixTokens );
235 static void Tokenize(
const std::string& expr, TokenCont_t& tokens );
244 const std::string& input,
245 std::string::size_type start );
252 static std::string
Uppercase(
const std::string& str );
259 static bool ValidInfix(
const TokenCont_t& infixTokens );
282 std::getline( instr, exprStr );
287 #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