Represents an expression in the context of its engine. More...
#include <elamexpression.h>
Public Types | |
enum | Type { Literal = Token::Literal, Variable = Token::Variable, Constant = Token::Constant, Function = Token::Function, Parentheses = Token::Parentheses, UnaryOp = Token::UnaryOp, BinaryOp = Token::BinaryOp, AssignmentOp = Token::AssignmentOp, Exception = Token::IgnoredTokenMask } |
Public Member Functions | |
Expression () | |
creates and invalid expression, that always evaluates to an exception | |
Expression (Engine *parent, const QList< Token > &tokens) | |
creates an expression by its context engine and its tokens | |
QVariant | evaluate () |
evaluates the expression and returns the result of the evaluation | |
Position | position () const |
returns the position of the main element of this expression | |
Friends | |
QDebug & | operator<< (QDebug, const Expression &) |
makes expressions accessable to qDebug() |
Represents an expression in the context of its engine.
An expression always has an engine as context and stores a hierarchy of operations (also expressions) to perform when called to evaluate. Expressions may become invalid if constants, functions, or operators change between the time they are created and the time they are evaluated.
ELAM::Expression::Expression | ( | ) |
creates and invalid expression, that always evaluates to an exception
creates an expression by its context engine and its tokens
QVariant ELAM::Expression::evaluate | ( | ) |
evaluates the expression and returns the result of the evaluation
Position ELAM::Expression::position | ( | ) | const |
returns the position of the main element of this expression
QDebug& operator<< | ( | QDebug | , | |
const Expression & | ||||
) | [friend] |
makes expressions accessable to qDebug()