• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

Analitza

  • sources
  • kde-4.14
  • kdeedu
  • analitza
  • analitza
expression.h
Go to the documentation of this file.
1 /*************************************************************************************
2  * Copyright (C) 2007 by Aleix Pol <aleixpol@kde.org> *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License *
6  * as published by the Free Software Foundation; either version 2 *
7  * of the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the Free Software *
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
17  *************************************************************************************/
18 
19 #ifndef EXPRESSION_H
20 #define EXPRESSION_H
21 
22 #include <QStringList>
23 #include <QSharedDataPointer>
24 
25 #include "analitzaexport.h"
26 #include "object.h"
27 
28 namespace Analitza
29 {
30 class Ci;
31 class Container;
32 class Cn;
33 
45 class ANALITZA_EXPORT Expression
46 {
47  public:
48  typedef void (*CustomObjectDestructor)(const QVariant&);
52  Expression();
53 
57  Expression(const Expression& e);
58 
62  Expression(const Cn& e);
63 
64  explicit Expression(Object* o);
65 
71  explicit Expression(const QString& exp, bool mathml=false);
72 
74  ~Expression();
75 
79  bool setText(const QString &exp);
80 
84  bool setMathML(const QString &exp);
85 
89  QStringList error() const;
90 
92  void addError(const QString& error);
93 
97  bool isCorrect() const;
98 
102  bool operator==(const Expression& e) const;
103 
104  bool operator!=(const Expression& e) const;
105 
109  Expression operator=(const Expression& e);
110 
114  bool isLambda() const;
115 
119  Expression lambdaBody() const Q_REQUIRED_RESULT;
120 
124  bool isVector() const;
125 
129  bool isList() const;
130 
134  bool isString() const;
135 
139  Expression elementAt(int position) const;
140 
144  void setElementAt(int position, const Analitza::Expression& exp);
145 
149  const Object* tree() const;
150 
154  Object* tree();
155 
156  void setTree(Object* o);
160  QString toString() const;
161 
165  QString toMathML() const;
166 
170  QString toHtml() const;
171 
175  QString toMathMLPresentation() const;
176 
178  QString stringValue() const;
179 
183  void clear();
184 
188  QStringList bvarList() const;
189 
191  Cn toReal() const;
192 
194  bool isReal() const;
195 
197  bool isCustomObject() const;
198 
201  QList<Ci*> parameters() const;
202 
204  QList<Expression> toExpressionList() const;
205 
207  QVariant customObjectValue() const;
208 
210  void renameArgument(int depth, const QString& newName);
211 
213  bool isEquation() const;
214 
216  bool isDeclaration() const;
217 
221  QString name() const;
222 
226  Expression declarationValue() const;
227 
229  Expression equationToFunction() const;
230 
231  QStringList comments() const;
232 
236  static enum Object::ObjectType whatType(const QString& tag);
237 
241  static bool isMathML(const QString& s) { return !s.isEmpty() && s[0]=='<'; }
242 
243  static void computeDepth(Object* o);
244 
249  static Expression constructList(const QList<Expression> & exps);
250 
252  static Expression constructCustomObject(const QVariant& custom, Analitza::Expression::CustomObjectDestructor d);
253 
255  static Expression constructString(const QString& str);
256 
260  static bool isCompleteExpression(const QString& exp, bool justempty=false);
261  private:
262  class ExpressionPrivate;
263  QSharedDataPointer<ExpressionPrivate> d;
264  QStringList m_comments;
265 };
266 
267 }
268 
269 #endif
Analitza::Cn
Cn is a value in MathML.
Definition: value.h:42
Analitza::Ci
A variable object, name refers to MathML standard.
Definition: variable.h:34
QString
QList
QStringList
analitzaexport.h
Analitza::Object
Definition: object.h:38
Analitza::Expression::CustomObjectDestructor
void(* CustomObjectDestructor)(const QVariant &)
Definition: expression.h:48
object.h
ANALITZA_EXPORT
#define ANALITZA_EXPORT
Definition: analitzaexport.h:31
Analitza::Expression
Represents a mathematical expression.
Definition: expression.h:45
AnalitzaUtils::isLambda
bool isLambda(const Analitza::Object *o)
QSharedDataPointer< ExpressionPrivate >
QVariant
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:11:37 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Analitza

Skip menu "Analitza"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal