OpenCurves  0.9
PlotExpressionParser Class Reference

Parses plot expressions into a PlotExpression that can be bound and executed. More...

#include <plotexpressionparser.h>

Public Member Functions

 PlotExpressionParser (const PlotFunctionRegister *functionRegister=nullptr)
 Create an expression parser. More...
 
 ~PlotExpressionParser ()
 Destructor.
 
const PlotFunctionRegisterfunctionRegister () const
 Returns the function register. More...
 
PlotExpressionparse (const QString &expression, QStringList &errors)
 Attempt to parse the expression and return the operation. More...
 

Detailed Description

Parses plot expressions into a PlotExpression that can be bound and executed.

Supports single line expressions using +, -, *, /, bracketing, negation and constants (double precision numbers). The operands are the names of existing plot curves. Bracketing operations and precedence are also supported.

Constructor & Destructor Documentation

PlotExpressionParser::PlotExpressionParser ( const PlotFunctionRegister functionRegister = nullptr)

Create an expression parser.

Parameters
functionRegisterOptional function register to use. Uses the default implementation if not specified.

Member Function Documentation

const PlotFunctionRegister& PlotExpressionParser::functionRegister ( ) const

Returns the function register.

This is either the one provided on construction, or the default implementation.

Returns
The parser's function register.
PlotExpression* PlotExpressionParser::parse ( const QString &  expression,
QStringList &  errors 
)

Attempt to parse the expression and return the operation.

On failure, error messages are available in errors.

Parameters
expressionThe expression string to parser.
errorsErrors messages are added here.
Returns
A valid PlotExpression on success, or null on failure.

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