labplot  2.8.2
About: LabPlot is an application for plotting and analysis of 2D and 3D functions and data. It is a complete rewrite of LabPlot1 and lacks in the first release a lot of features available in the predecessor. On the other hand, the GUI and the usability is more superior.
  Fossies Dox: labplot-2.8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

ExpressionParser.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : ExpressionParser.h
3  Project : LabPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2014 Alexander Semke (alexander.semke@web.de)
6  Copyright : (C) 2020 Stefan Gerlach (stefan.gerlach@uni.kn)
7  Description : c++ wrapper for the bison generated parser.
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 
30 #ifndef EXPRESSIONPARSER_H
31 #define EXPRESSIONPARSER_H
32 
33 #include "backend/lib/Range.h"
35 #include <QVector>
36 
37 class QStringList;
38 
40 
41 public:
42  static ExpressionParser* getInstance();
43  static int functionArgumentCount(const QString& functionName);
44  static QString functionArgumentString(const QString& functionName, const XYEquationCurve::EquationType);
45 
46  bool isValid(const QString& expr, const QStringList& vars);
47  QStringList getParameter(const QString& expr, const QStringList& vars);
48  bool evaluateCartesian( const QString& expr, const QString& min, const QString& max,
49  int count, QVector<double>* xVector, QVector<double>* yVector,
50  const QStringList& paramNames, const QVector<double>& paramValues);
51  bool evaluateCartesian(const QString& expr, const QString& min, const QString& max,
52  int count, QVector<double>* xVector, QVector<double>* yVector);
53  bool evaluateCartesian(const QString& expr, QVector<double>* xVector, QVector<double>* yVector);
54  bool evaluateCartesian(const QString& expr, QVector<double>* xVector, QVector<double>* yVector,
55  const QStringList& paramNames, const QVector<double>& paramValues);
56  bool evaluateCartesian(const QString& expr, const QStringList& vars, const QVector<QVector<double>*>& xVectors, QVector<double>* yVector);
57  bool evaluatePolar(const QString& expr, const QString& min, const QString& max,
58  int count, QVector<double>* xVector, QVector<double>* yVector);
59  bool evaluateParametric(const QString& expr1, const QString& expr2, const QString& min, const QString& max,
60  int count, QVector<double>* xVector, QVector<double>* yVector);
61 
62  const QStringList& functions();
63  const QStringList& functionsGroups();
64  const QStringList& functionsNames();
66 
67  const QStringList& constants();
68  const QStringList& constantsGroups();
69  const QStringList& constantsNames();
70  const QStringList& constantsValues();
71  const QStringList& constantsUnits();
73 
74 private:
77 
78  void initFunctions();
79  void initConstants();
80 
82 
83  QStringList m_functions;
84  QStringList m_functionsGroups;
85  QStringList m_functionsNames;
87 
88  QStringList m_constants;
89  QStringList m_constantsGroups;
90  QStringList m_constantsNames;
91  QStringList m_constantsValues;
92  QStringList m_constantsUnits;
94 };
95 #endif
const QVector< int > & constantsGroupIndices()
QStringList m_constantsGroups
bool evaluateCartesian(const QString &expr, const QString &min, const QString &max, int count, QVector< double > *xVector, QVector< double > *yVector, const QStringList &paramNames, const QVector< double > &paramValues)
QVector< int > m_functionsGroupIndex
QStringList m_constants
const QStringList & functionsGroups()
QVector< int > m_constantsGroupIndex
const QStringList & constants()
bool isValid(const QString &expr, const QStringList &vars)
QStringList m_constantsValues
const QStringList & functions()
QStringList m_constantsNames
bool evaluateParametric(const QString &expr1, const QString &expr2, const QString &min, const QString &max, int count, QVector< double > *xVector, QVector< double > *yVector)
static int functionArgumentCount(const QString &functionName)
QStringList m_functions
const QStringList & constantsUnits()
QStringList getParameter(const QString &expr, const QStringList &vars)
bool evaluatePolar(const QString &expr, const QString &min, const QString &max, int count, QVector< double > *xVector, QVector< double > *yVector)
static ExpressionParser * m_instance
static ExpressionParser * getInstance()
const QStringList & constantsGroups()
QStringList m_functionsGroups
const QStringList & constantsValues()
static QString functionArgumentString(const QString &functionName, const XYEquationCurve::EquationType)
const QVector< int > & functionsGroupIndices()
QStringList m_functionsNames
const QStringList & functionsNames()
QStringList m_constantsUnits
const QStringList & constantsNames()