File indexing completed on 2024-04-28 03:40:46
0001 /************************************************************************************* 0002 * Copyright (C) 2007 by Aleix Pol <aleixpol@kde.org> * 0003 * * 0004 * This program is free software; you can redistribute it and/or * 0005 * modify it under the terms of the GNU General Public License * 0006 * as published by the Free Software Foundation; either version 2 * 0007 * of the License, or (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program; if not, write to the Free Software * 0016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 0017 *************************************************************************************/ 0018 0019 #ifndef VARIABLE_H 0020 #define VARIABLE_H 0021 0022 #include "object.h" 0023 namespace Analitza 0024 { 0025 0026 /** 0027 * \class Ci 0028 * 0029 * \ingroup AnalitzaModule 0030 * 0031 * \brief A variable object, name refers to MathML standard. 0032 */ 0033 0034 class ANALITZA_EXPORT Ci : public Object 0035 { 0036 public: 0037 /** Constructor. Creates a variable with a @p b name */ 0038 explicit Ci(const QString& b); 0039 0040 ~Ci() override; 0041 0042 /** Returns the variable name */ 0043 QString name() const { return m_name; } 0044 0045 /** Returns whether @p var name is equal to this variable one. */ 0046 bool operator==(const Ci& var) const { return var.m_name==m_name; } 0047 0048 /** Sets whether it is a function. */ 0049 void setFunction(bool f) { m_function=f; } 0050 0051 /** Returns whether it is a variable that has to be a function */ 0052 bool isFunction() const { return m_function; } 0053 0054 /** Returns the MathML representation of the variable */ 0055 QString toMathML() const; 0056 0057 /** Returns the HTML representation of the variable */ 0058 QString toHtml() const; 0059 0060 virtual QVariant accept(AbstractExpressionVisitor*) const override; 0061 virtual bool matches(const Object* pattern, QMap<QString, const Object*>* found) const override; 0062 Ci* copy() const override; 0063 0064 void setBVarDepth(int depth) { m_depth = depth; } 0065 int depth() const { return m_depth; } 0066 0067 void setName(const QString& newName) { m_name = newName; } 0068 0069 private: 0070 QString m_name; 0071 bool m_function; 0072 int m_depth; 0073 }; 0074 0075 } 0076 #endif