mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7316 Curve Calculator: Add support for single line if-statement
This commit is contained in:
18
ThirdParty/expressionparser/ExpressionParser.cpp
vendored
18
ThirdParty/expressionparser/ExpressionParser.cpp
vendored
@@ -59,3 +59,21 @@ bool ExpressionParser::evaluate(const QString& expressionText, QString* errorTex
|
||||
{
|
||||
return m_expressionParserImpl->evaluate(expressionText, errorText);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool ExpressionParser::expandIfStatementsAndEvaluate(const QString& expressionText, QString* errorText /*= nullptr*/)
|
||||
{
|
||||
if (expressionText.contains("if"))
|
||||
{
|
||||
QString expandedExpressionText = ExpressionParserImpl::expandIfStatements(expressionText);
|
||||
|
||||
return m_expressionParserImpl->evaluate(expandedExpressionText, errorText);
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_expressionParserImpl->evaluate(expressionText, errorText);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user