XII Release 0.1.0
Loading...
Searching...
No Matches
xiiMathExpression Class Reference

A wrapper around xiiExpression infrastructure to evaluate simple math expressions. More...

#include <MathExpression.h>

Classes

struct  Input
 

Public Member Functions

 xiiMathExpression ()
 Creates a new invalid math expression.
 
 xiiMathExpression (xiiStringView sExpressionString)
 Initializes using a given expression.
 
void Reset (xiiStringView sExpressionString)
 Reinitializes using the given expression.
 
bool IsValid () const
 Whether the expression is valid and can be evaluated.
 
xiiStringView GetExpressionString () const
 Returns the original expression string that this MathExpression can evaluate.
 
float Evaluate (xiiArrayPtr< Input > inputs=xiiArrayPtr< Input >())
 Evaluates parsed expression with the given inputs.
 

Detailed Description

A wrapper around xiiExpression infrastructure to evaluate simple math expressions.

Constructor & Destructor Documentation

◆ xiiMathExpression() [1/2]

xiiMathExpression::xiiMathExpression ( )
default

Creates a new invalid math expression.

Need to call Reset before you can do anything with it.

◆ xiiMathExpression() [2/2]

xiiMathExpression::xiiMathExpression ( xiiStringView sExpressionString)
explicit

Initializes using a given expression.

If anything goes wrong it is logged and the math expression is in an invalid state.

Parameters
logIf null, default log interface will be used.

Member Function Documentation

◆ Evaluate()

float xiiMathExpression::Evaluate ( xiiArrayPtr< Input > inputs = xiiArrayPtr<Input>())

Evaluates parsed expression with the given inputs.

Only way this function can fail is if the expression was not valid.

See also
IsValid

◆ Reset()

void xiiMathExpression::Reset ( xiiStringView sExpressionString)

Reinitializes using the given expression.

An empty string or nullptr are considered to be 'invalid' expressions.


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