UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BinaryExpressionParser Class Reference

Evaluates stuff like this expression. More...

Public Member Functions

 BinaryExpressionParser (const char *expr, BEPEvaluteCallback_t varFuncParam, const void *userdataPtr)
 
bool getResult () const
 
binaryExpressionParserError_t getError () const
 

Private Member Functions

void SkipWhiteSpaces (const char **s) const
 
void NextChar (const char **s) const
 Advance to the next char that is no whitespace. More...
 
const char * GetSwitchName (const char **s)
 
bool CheckOR (const char **s)
 Evaluates or and xor in the given string. This is the entry point, it delegates to the and checks that are done in CheckAnd. More...
 
bool CheckAND (const char **s)
 

Private Attributes

binaryExpressionParserError_t binaryExpressionParserError
 
BEPEvaluteCallback_t varFunc
 
char varName [MAX_VAR]
 
bool result
 
const voiduserdata
 

Detailed Description

Evaluates stuff like this expression.

(x & !y) ^ z

Definition at line 36 of file binaryexpressionparser.cpp.

Constructor & Destructor Documentation

BinaryExpressionParser::BinaryExpressionParser ( const char *  expr,
BEPEvaluteCallback_t  varFuncParam,
const void userdataPtr 
)
inline

Definition at line 153 of file binaryexpressionparser.cpp.

References BEPERR_NOEND, CheckOR(), and Q_strvalid.

Member Function Documentation

bool BinaryExpressionParser::CheckAND ( const char **  s)
inlineprivate
bool BinaryExpressionParser::CheckOR ( const char **  s)
inlineprivate

Evaluates or and xor in the given string. This is the entry point, it delegates to the and checks that are done in CheckAnd.

Returns
The result of the evaluation

Definition at line 79 of file binaryexpressionparser.cpp.

References CheckAND(), NextChar(), result, and SkipWhiteSpaces().

Referenced by BinaryExpressionParser(), and CheckAND().

binaryExpressionParserError_t BinaryExpressionParser::getError ( ) const
inline

Definition at line 169 of file binaryexpressionparser.cpp.

References binaryExpressionParserError.

Referenced by BEP_Evaluate().

bool BinaryExpressionParser::getResult ( ) const
inline

Definition at line 164 of file binaryexpressionparser.cpp.

References result.

Referenced by BEP_Evaluate().

const char* BinaryExpressionParser::GetSwitchName ( const char **  s)
inlineprivate

Definition at line 60 of file binaryexpressionparser.cpp.

References varName.

Referenced by CheckAND().

void BinaryExpressionParser::NextChar ( const char **  s) const
inlineprivate

Advance to the next char that is no whitespace.

Definition at line 53 of file binaryexpressionparser.cpp.

References SkipWhiteSpaces().

Referenced by CheckAND(), and CheckOR().

void BinaryExpressionParser::SkipWhiteSpaces ( const char **  s) const
inlineprivate

Definition at line 44 of file binaryexpressionparser.cpp.

Referenced by CheckAND(), CheckOR(), and NextChar().

Field Documentation

binaryExpressionParserError_t BinaryExpressionParser::binaryExpressionParserError
private

Definition at line 38 of file binaryexpressionparser.cpp.

Referenced by getError().

bool BinaryExpressionParser::result
private

Definition at line 41 of file binaryexpressionparser.cpp.

Referenced by CheckAND(), CheckOR(), and getResult().

const void* BinaryExpressionParser::userdata
private

Definition at line 42 of file binaryexpressionparser.cpp.

BEPEvaluteCallback_t BinaryExpressionParser::varFunc
private

Definition at line 39 of file binaryexpressionparser.cpp.

Referenced by CheckAND().

char BinaryExpressionParser::varName[MAX_VAR]
private

Definition at line 40 of file binaryexpressionparser.cpp.

Referenced by GetSwitchName().


The documentation for this class was generated from the following file: