ExpressionParser.h
Go to the documentation of this file.
1
2//
3// Copyright (C) 2017- Statoil ASA
4//
5// ResInsight is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
11// WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// FITNESS FOR A PARTICULAR PURPOSE.
13//
14// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
15// for more details.
16//
18
19#pragma once
20
21#include <QString>
22
23#include <memory>
24#include <vector>
25
27
28//==================================================================================================
30//==================================================================================================
32{
33public:
36
37 static std::vector<QString> detectReferencedVariables(const QString& expression);
38
39 void assignVector(const QString& variableName, std::vector<double>& vector);
40 bool evaluate(const QString& expressionText, QString* errorText = nullptr);
41 bool expandIfStatementsAndEvaluate(const QString& expressionText, QString* errorText = nullptr);
42
43private:
44 std::unique_ptr<ExpressionParserImpl> m_expressionParserImpl;
45};
Definition: ExpressionParserImpl.h:29
Definition: ExpressionParser.h:32
bool evaluate(const QString &expressionText, QString *errorText=nullptr)
static std::vector< QString > detectReferencedVariables(const QString &expression)
bool expandIfStatementsAndEvaluate(const QString &expressionText, QString *errorText=nullptr)
void assignVector(const QString &variableName, std::vector< double > &vector)