This file is indexed.

/usr/include/Analitza5/analitza/expression.h is in libanalitza-dev 4:16.08.3-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
/*************************************************************************************
 *  Copyright (C) 2007 by Aleix Pol <aleixpol@kde.org>                               *
 *                                                                                   *
 *  This program is free software; you can redistribute it and/or                    *
 *  modify it under the terms of the GNU General Public License                      *
 *  as published by the Free Software Foundation; either version 2                   *
 *  of the License, or (at your option) any later version.                           *
 *                                                                                   *
 *  This program is distributed in the hope that it will be useful,                  *
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of                   *
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                    *
 *  GNU General Public License for more details.                                     *
 *                                                                                   *
 *  You should have received a copy of the GNU General Public License                *
 *  along with this program; if not, write to the Free Software                      *
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA   *
 *************************************************************************************/

#ifndef EXPRESSION_H
#define EXPRESSION_H

#include <QStringList>
#include <QSharedDataPointer>

#include "analitzaexport.h"
#include "object.h"

namespace Analitza
{
class Ci;
class Container;
class Cn;

/**
 * \class Expression
 * 
 * \ingroup AnalitzaModule
 *
 * \brief Represents a mathematical expression.
 *
 * Expression let to convert it to string, MathML and make some little queries 
 * to it, without calculating anything.
 */

class ANALITZA_EXPORT Expression
{
    public:
        typedef void (*CustomObjectDestructor)(const QVariant&);
        /**
         *    Constructs an empty Expression.
         */
        Expression();
        
        /**
         *    Copy constructor, copies the whole object to the constructed one.
         */
        Expression(const Expression& e);
        
        /**
         *    Creates an expression from a value
         */
        Expression(const Cn& e);
        
        explicit Expression(Object* o);
        
        /**
         *    Constructor. Parses an expression and creates the object.
         *    @param exp expression to be assigned
         *    @param mathml format of the expression
         */
        explicit Expression(const QString& exp, bool mathml=false);
        
        /** Destructor */
        ~Expression();
        
        /**
         *    Sets an expression @p exp which is not in MathML format. Returns whether it was correctly assigned or not.
         */
        bool setText(const QString &exp);
        
        /**
         *    Sets an expression @p exp which is in MathML format. Returns whether it was correctly assigned or not.
         */
        bool setMathML(const QString &exp);
        
        /**
         *    Returns the list of errors that had experienced while building the expression.
         */
        QStringList error() const;
        
        /** Adds a new error @p error to the expression, to be reported afterwards. */
        void addError(const QString& error);
        
        /**
         *    Returns whether this is a correct expression.
         */
        bool isCorrect() const;
        
        /**
         *    Returns whether the @p e is equal.
         */
        bool operator==(const Expression& e) const;
        
        bool operator!=(const Expression& e) const;
        
        /**
         *    Copy assignment. Copies the @p e expression here.
         */
        Expression operator=(const Expression& e);
        
        /**
         *    Returns whether it is a lambda-expression.
         */
        bool isLambda() const;
        
        /**
         *    Returns the expression of the lambda body (without resolving the dependencies)
         */
        Expression lambdaBody() const Q_REQUIRED_RESULT;
        
        /**
         *    Returns whether it is a vector expression.
         */
        bool isVector() const;
        
        /**
         *    Returns whether it is a matrix expression.
         */
        bool isMatrix() const;
        
        /**
         *    Returns whether it is a list expression.
         */
        bool isList() const;
        
        /**
         *    Returns whether it is a string expression (a list of chars).
         */
        bool isString() const;
        
        /**
         *    Returns the element at @p position in a vector
         */
        Expression elementAt(int position) const;
        
        /**
         *    sets an expression value @p value to a @p position
         */
        void setElementAt(int position, const Analitza::Expression& exp);
        
        /**
         *    Returns the tree associated to this object.
         */
        const Object* tree() const;
        
        /**
         *    Returns the tree associated to this object.
         */
        Object* tree();

        /**
         *    Returns the tree associated to this object and clears the object,
         *    so the ownership of the tree is acquired by the caller.
         */
        Object* takeTree();
        
        void setTree(Object* o);
        /**
         *    Converts the expression to a string expression.
         */
        QString toString() const;
        
        /**
         *    Converts the expression to MathML.
         */
        QString toMathML() const;
        
        /**
         *    Exports the expression to HTML.
         */
        QString toHtml() const;
        
        /**
         *    Converts the expression to MathML Presentation Markup.
         */
        QString toMathMLPresentation() const;
        
        /** @returns the contained string value */
        QString stringValue() const;
        
        /**
         * Invalidates the data of the expression.
         */
        void clear();
        
        /**
         * @returns Lists the global bounded variables in the expression
         */
        QStringList bvarList() const;
        
        /** @returns Value representation of the expression. */
        Cn toReal() const;
        
        /** @returns true if the expression is a value, false otherwise. */
        bool isReal() const;
        
        /** @returns true if the expression is a custom object, false otherwise. */
        bool isCustomObject() const;
        
        /** @returns a list of the parameters in case this expression represents
            a lambda construction. */
        QList<Ci*> parameters() const;
        
        /** In case it was a vector or list, it returns a list of each expression on the vector. */
        QList<Expression> toExpressionList() const;
        
        /** In case it contains a custom object it returns its value. */
        QVariant customObjectValue() const;
        
        /** renames the @p depth -th variable into @p newName */
        void renameArgument(int depth, const QString& newName);
        
        /** @returns whether it's an equation */
        bool isEquation() const;
        
        /** @returns whether it's a declaration */
        bool isDeclaration() const;
        
        /** @returns the name of the expression. If it's not a declaration
         * then an empty string it's returned.
         */
        QString name() const;
        
        /** @returns the value of the declaration. If it's not a declaration
         * then an expression it's returned.
         */
        Expression declarationValue() const;
        
        /** @returns the expression that evaluates the current equation to equal 0 */
        Expression equationToFunction() const;
        
        QStringList comments() const;
        
        /**
         *    Converts a @p tag to an object type.
         */
        static enum Object::ObjectType whatType(const QString& tag);
        
        /**
         *    @returns whether @p s is MathML or not. Very simple.
         */
        static bool isMathML(const QString& s) { return !s.isEmpty() && s[0]=='<'; }
        
        static void computeDepth(Object* o);
        
        /**
         * @returns an expression containing a list of every expression passed on @p exps on the form:
         *    list { exps[0], exps[1], ... }
         */
        static Expression constructList(const QList<Expression> & exps);
        
        /** creates an expression filled with just a custom object */
        static Expression constructCustomObject(const QVariant& custom, Analitza::Expression::CustomObjectDestructor d);
        
        /** creates an expression filled with just a string */
        static Expression constructString(const QString& str);
        
        /** @returns if a non-mathml expression is fully introduced (e.g. has closed all parentheses).
            @param justempty tells if it's an expression with just spaces and comments
         */
        static bool isCompleteExpression(const QString& exp, bool justempty=false);
    private:
        class ExpressionPrivate;
        QSharedDataPointer<ExpressionPrivate> d;
        QStringList m_comments;
};

}

#endif