OpenCurves
0.9
|
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 PlotFunctionRegister & | functionRegister () const |
Returns the function register. More... | |
PlotExpression * | parse (const QString &expression, QStringList &errors) |
Attempt to parse the expression and return the operation. More... | |
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.
PlotExpressionParser::PlotExpressionParser | ( | const PlotFunctionRegister * | functionRegister = nullptr | ) |
Create an expression parser.
functionRegister | Optional function register to use. Uses the default implementation if not specified. |
const PlotFunctionRegister& PlotExpressionParser::functionRegister | ( | ) | const |
Returns the function register.
This is either the one provided on construction, or the default implementation.
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
.
expression | The expression string to parser. |
errors | Errors messages are added here. |
PlotExpression
on success, or null on failure.