Wraps a particular binary operator. More...
#include <elambinary.h>
Public Member Functions | |
BinaryOperator (const BinaryOperator &) | |
BinaryOperator () | |
~BinaryOperator () | |
BinaryOperator & | operator= (const BinaryOperator &op) |
the operator becomes a shared copy of op and abandones its old link More... | |
void | setCallback (BinaryOperatorCall callback, QString type1, QString type2) |
sets a callback function for the operator and a specific typ More... | |
void | setCallback (BinaryOperatorCall callback, int type1, int type2) |
sets a callback function for the operator and a specific typ More... | |
BinaryOperatorCall | getCallback (QString type1, QString type2) const |
returns the callback function attached to the type or NULL if there is none More... | |
BinaryOperatorCall | getCallback (int type1, int type2) const |
returns the callback function attached to the type or NULL if there is none More... | |
void | removeCallback (QString, QString) |
removes the type from this operators list More... | |
void | removeCallback (int, int) |
removes the type from this operators list More... | |
QList< QPair< QString, QString > > | getTypeNames () const |
returns all combinations of type names that have a valid callback in this operator More... | |
QList< QPair< int, int > > | getTypeIds () const |
returns all combinations of type IDs that have a valid callback in this operator More... | |
QVariant | execute (const QVariant &, const QVariant &, Engine &) const |
calls the callback function associated with the type of the argument, throws an exception if there is no callback More... | |
bool | isNull () const |
true if this operator has no callbacks More... | |
Wraps a particular binary operator.
You can use the methods of this class to change the routines that handle the operator and the types on which it operates. Instances of this class are implicitly shared - meaning calls on a copy of an instance are also visible on the original and all other copies.
ELAM::BinaryOperator::BinaryOperator | ( | const BinaryOperator & | ) |
ELAM::BinaryOperator::BinaryOperator | ( | ) |
ELAM::BinaryOperator::~BinaryOperator | ( | ) |
QVariant ELAM::BinaryOperator::execute | ( | const QVariant & | , |
const QVariant & | , | ||
Engine & | |||
) | const |
calls the callback function associated with the type of the argument, throws an exception if there is no callback
BinaryOperatorCall ELAM::BinaryOperator::getCallback | ( | QString | type1, |
QString | type2 | ||
) | const |
returns the callback function attached to the type or NULL if there is none
BinaryOperatorCall ELAM::BinaryOperator::getCallback | ( | int | type1, |
int | type2 | ||
) | const |
returns the callback function attached to the type or NULL if there is none
QList<QPair<int,int> > ELAM::BinaryOperator::getTypeIds | ( | ) | const |
returns all combinations of type IDs that have a valid callback in this operator
QList<QPair<QString,QString> > ELAM::BinaryOperator::getTypeNames | ( | ) | const |
returns all combinations of type names that have a valid callback in this operator
bool ELAM::BinaryOperator::isNull | ( | ) | const |
true if this operator has no callbacks
BinaryOperator& ELAM::BinaryOperator::operator= | ( | const BinaryOperator & | op | ) |
the operator becomes a shared copy of op and abandones its old link
void ELAM::BinaryOperator::removeCallback | ( | QString | , |
QString | |||
) |
removes the type from this operators list
void ELAM::BinaryOperator::removeCallback | ( | int | , |
int | |||
) |
removes the type from this operators list
void ELAM::BinaryOperator::setCallback | ( | BinaryOperatorCall | callback, |
QString | type1, | ||
QString | type2 | ||
) |
sets a callback function for the operator and a specific typ
callback | the function to call, if it is null the type is deleted from this operators type list |
type | the type of variable to work on, this must be a type registered with QVariant, if this type is already known to the operator its callback is replaced |
void ELAM::BinaryOperator::setCallback | ( | BinaryOperatorCall | callback, |
int | type1, | ||
int | type2 | ||
) |
sets a callback function for the operator and a specific typ
callback | the function to call, if it is null the type is deleted from this operators type list |
type | the type of variable to work on, this must be a type registered with QVariant, if this type is already known to the operator its callback is replaced |