/usr/include/analitza/object.h is in libanalitza5-dev 4:4.14.3-0ubuntu1.
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 | /*************************************************************************************
* 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 OBJECT_H
#define OBJECT_H
#include <QDebug>
#include "analitzaexport.h"
namespace Analitza
{
class AbstractExpressionVisitor;
/**
* \internal
* Abstract expression tree node
* @author Aleix Pol <aleixpol@kde.org>
*/
//FIXME: Check for public -> protected on some members
class ANALITZA_EXPORT Object
{
public:
/** ObjectType is used to describe objects. */
enum ObjectType {
none=0, /**< No object type, usually means an error. */
value, /**< Describes an object as a value. */
variable, /**< Describes an object as a variable. */
vector, /**< Describes an object as a vector. */
list, /**< Describes an object as a list. */
apply, /**< Describes an object as an application. */
oper, /**< Describes an object as an operator. */
container, /**< Describes an object as a container. */
matrix, /**< Describes an object as a matrix. */
matrixrow, /**< Describes an object as a matrix row. */
custom /**< Describes a custom object */
};
/** Object destructor. Does nothing. */
virtual ~Object() { /*qDebug() << "Destroying " << this;*/}
/** Returns the object type of the object */
enum ObjectType type() const { return m_type; }
/** Returns whether it is an apply or not. */
bool isApply() const { return m_type==apply; }
/** Returns whether it is a container or not. */
bool isContainer() const { return m_type==container; }
/** Returns the string representation of the object. */
QString toString() const;
/** Returns some string depending on the visior */
virtual QVariant accept(AbstractExpressionVisitor* exp) const = 0;
virtual bool isZero() const { return false; }
/**
@p exp is the tree that we will compare to,
@p found is where we will pass the variables store the results.
It will return whether the object follows the @p pattern structure.
*/
virtual bool matches(const Object* exp, QMap<QString, const Object*>* found) const=0;
/** @returns a new and equal instance of the tree. */
virtual Object* copy() const =0;
protected:
/** Creates an object with a @p t type */
Object(enum ObjectType t) : m_type(t) {}
/** Specifies the Object type. */
const ObjectType m_type;
};
}
#endif
|