ELAM
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Typedefs | Functions
ELAM Namespace Reference

Classes

class  AnyType
 this type is not actually used, its ID is used as a fallback to tell operators, functions and engines that any supported type can be used More...
 
class  BinaryOperator
 Wraps a particular binary operator. More...
 
class  BoolEngine
 A boolean and logic math enabled engine. More...
 
class  CharacterClassSettings
 This class holds the character classes used by an Engine. More...
 
class  Engine
 The calculation engine of . More...
 
class  Exception
 Objects of this class represent an exception in the evaluation of an ELAM expression. More...
 
class  Expression
 Represents an expression in the context of its engine. More...
 
class  FloatEngine
 an engine that has floating point (double) numbers implemented More...
 
class  IntEngine
 integer math enabled engine More...
 
class  IntFloatEngine
 an engine with integer and float math pre-installed, see IntEngine and FloatEngine More...
 
class  Position
 A character position inside a text/string that is being evaluated. More...
 
class  StringEngine
 integer math enabled engine More...
 
class  Token
 Represents a single token in a parsed expression. More...
 
class  UnaryOperator
 Wraps a particular unary operator. More...
 

Typedefs

typedef std::function
< QVariant(const QVariant &op1,
const QVariant &op2, Engine
&engine)> 
BinaryOperatorCall
 pointer to a function wrapping a binary operator More...
 
typedef QVariant(* BinaryOperatorCall_FP )(const QVariant &op1, const QVariant &op2, Engine &engine)
 Helper type to select the correct overload from several variants. More...
 
typedef std::function
< QVariant(const QList
< QVariant > &args, Engine
&engine)> 
Function
 pointer to a function wrapping a mathematical function More...
 
typedef QVariant(* Function_FP )(const QList< QVariant > &args, Engine &engine)
 Helper type to select the correct overload from several variants. More...
 
typedef std::function< QPair
< QString, QVariant >const
QString &expr, Engine &engine,
int start)> 
LiteralParser
 wraps the parser routine for a literal More...
 
typedef QPair< QString,
QVariant >(* 
LiteralParser_FP )(const QString &expr, Engine &engine, int start)
 Helper type to select the correct overload from several variants. More...
 
typedef std::function
< QVariant(const QVariant
&orig, const Engine &engine)> 
TypeCast
 Wraps a cast function to convert various types into another type. More...
 
typedef QVariant(* TypeCast_FP )(const QVariant &orig, const Engine &engine)
 Helper type to select the correct overload from several variants. More...
 
typedef std::function
< QVariant(const QVariant &op,
Engine &engine)> 
UnaryOperatorCall
 pointer to a function wrapping an unary operator More...
 
typedef QVariant(* UnaryOperatorCall_FP )(const QVariant &op, Engine &engine)
 Helper type to select the correct overload from several variants. More...
 

Functions

ELAM_EXPORT QString versionInfo ()
 returns version information about ELAM More...
 
ELAM_EXPORT QDebug & operator<< (QDebug, const Token &)
 makes tokens accessable to qDebug() More...
 
ELAM_EXPORT QDebug & operator<< (QDebug, const QList< Token > &)
 makes tokens accessable to qDebug() More...
 
ELAM_EXPORT QDebug & operator<< (QDebug, const Expression &)
 makes expressions accessable to qDebug() More...
 
ELAM_EXPORT QDebug & operator<< (QDebug, const Position &)
 
ELAM_EXPORT QDebug & operator<< (QDebug, const Exception &)
 
QDebug & operator<< (QDebug, const AnyType &)
 

Typedef Documentation

typedef std::function<QVariant(const QVariant&op1,const QVariant&op2,Engine&engine)> ELAM::BinaryOperatorCall

pointer to a function wrapping a binary operator

Parameters
op1the left operand
op2the right operand
enginethe engine calling the operator
Returns
the result of the operation
typedef QVariant(* ELAM::BinaryOperatorCall_FP)(const QVariant &op1, const QVariant &op2, Engine &engine)

Helper type to select the correct overload from several variants.

If your compiler complains that it cannot resolve an overloaded pointer when calling BinaryOperator::setCallback then cast to this type to help the compiler:

myBinaryOp.setCallback(BinaryOperatorCall_FP(myFunction),type1,type2);
typedef std::function<QVariant(const QList<QVariant>&args,Engine&engine)> ELAM::Function

pointer to a function wrapping a mathematical function

Parameters
argsthe list of arguments
Returns
the result of the function or ELAM::Exception in case or errors

Functions must check their arguments for validity before they start calculating. On error a function should returns an ELAM::Exception.

Parameters
argsthe list of arguments that was given to the function, the implementation must check for length and type of the arguments
enginethe engine calling the function
typedef QVariant(* ELAM::Function_FP)(const QList< QVariant > &args, Engine &engine)

Helper type to select the correct overload from several variants.

If your compiler complains that it cannot resolve an overloaded pointer when calling Engine::setFunction then cast to this type to help the compiler:

myEngine.setFunction("hellofunc",Function_FP(myFunction));
typedef std::function<QPair<QString,QVariant>const QString&expr,Engine&engine,int start)> ELAM::LiteralParser

wraps the parser routine for a literal

Parameters
exprthe original expression string
enginethe engine that is calling this parser
startthe character (index of expr) at which the literal starts
Returns
the parsed literal (first=string representation, second=value represented by it

The string representation of the literal must be verbatim from expr, so that the calling engine can determine where to continue parsing in expr.

If the parser does not find a valid literal according to its rules it must return an empty string.

typedef QPair<QString,QVariant>(* ELAM::LiteralParser_FP)(const QString &expr, Engine &engine, int start)

Helper type to select the correct overload from several variants.

If your compiler complains that it cannot resolve an overloaded pointer when calling Engine::setLiteralParser then cast to this type to help the compiler:

myEngine.setLiteralParser(Function_FP(myDecimal),"123456789");
typedef std::function<QVariant(const QVariant&orig,const Engine&engine)> ELAM::TypeCast

Wraps a cast function to convert various types into another type.

Parameters
origthe original value of any type
enginethe engine calling the cast
Returns
the converted value that conforms to the expected type
typedef QVariant(* ELAM::TypeCast_FP)(const QVariant &orig, const Engine &engine)

Helper type to select the correct overload from several variants.

If your compiler complains that it cannot resolve an overloaded pointer when calling Engine::setAutoCast then cast to this type to help the compiler:

myEngine.setAutoCast(targetType,QList<int>()<<origintype,TypeCast_FP(myCast));
typedef std::function<QVariant(const QVariant&op,Engine&engine)> ELAM::UnaryOperatorCall

pointer to a function wrapping an unary operator

Parameters
opthe operand to be worked on
enginethe engine calling the operator
Returns
the result of the operation
typedef QVariant(* ELAM::UnaryOperatorCall_FP)(const QVariant &op, Engine &engine)

Helper type to select the correct overload from several variants.

If your compiler complains that it cannot resolve an overloaded pointer when calling UnaryOperator::setCallback then cast to this type to help the compiler:

myUnaryOp.setCallback(UnaryOperatorCall_FP(myFunction),type);

Function Documentation

ELAM_EXPORT QDebug& ELAM::operator<< ( QDebug  ,
const Position &   
)
ELAM_EXPORT QDebug& ELAM::operator<< ( QDebug  ,
const Token &   
)

makes tokens accessable to qDebug()

ELAM_EXPORT QDebug& ELAM::operator<< ( QDebug  ,
const QList< Token > &   
)

makes tokens accessable to qDebug()

ELAM_EXPORT QDebug& ELAM::operator<< ( QDebug  ,
const Exception &   
)
QDebug& ELAM::operator<< ( QDebug  ,
const AnyType &   
)
ELAM_EXPORT QDebug& ELAM::operator<< ( QDebug  ,
const Expression &   
)

makes expressions accessable to qDebug()

ELAM_EXPORT QString ELAM::versionInfo ( )

returns version information about ELAM