/usr/include/analitza/container.h is in libanalitza-dev 4:4.14.0-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 | /*************************************************************************************
* 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 CONTAINER_H
#define CONTAINER_H
#include <QDomNode>
#include "object.h"
#include "operator.h"
#include "analitzaexport.h"
namespace Analitza
{
class Ci;
/**
* \class Container
*
* \ingroup AnalitzaModule
*
* \brief Container represents special tags of MathML called containers.
*
* This class is the one that will correspond to MathML container.
* e.g. apply, mathml, bvar, uplimit...
*/
class ANALITZA_EXPORT Container : public Object
{
public:
/** Is used to describe Container objects in reference to the MathML standard*/
enum ContainerType {
none=0, /**< No container type, usually means an error */
math, /**< Describes a container as a %lt;math> tag */
declare, /**< Describes a container as a %lt;declare> tag */
lambda, /**< Describes a container as a %lt;lambda> tag */
bvar, /**< Describes a container as a %lt;bvar> tag */
uplimit, /**< Describes a container as a %lt;uplimit> tag */
downlimit, /**< Describes a container as a %lt;downlimit> tag */
piece, /**< Describes a container as a %lt;piece> tag */
piecewise, /**< Describes a container as a %lt;piecewise> tag */
otherwise, /**< Describes a container as a %lt;otherwise> tag */
domainofapplication /**< Describes a container as a %lt;domainofapplication> tag */
};
typedef QList<Object*>::const_iterator const_iterator;
typedef QList<Object*>::iterator iterator;
/** Construtor. Creates an empty container with @p c type. */
Container(enum ContainerType c) : Object(container), m_cont_type(c) { }
/** Copy constructor, copies all of the branches derivated on it.*/
Container(const Container& c);
virtual Container* copy() const;
/** Destructor. Deletes all the references. */
virtual ~Container() { qDeleteAll(m_params); }
/** Sets the container type to @p c. */
void setContainerType(enum ContainerType c) { m_cont_type = c; }
/** Returns the type of the container. */
ContainerType containerType() const { Q_ASSERT(m_type==Object::container && m_cont_type!=none); return m_cont_type; }
/** Returns whether @p c is equal or not. */
bool operator==(const Container& c) const;
/** Converts a @p tag to a containerType. */
static ContainerType toContainerType(const QString& tag);
/** Adds a @p o branch at the end of the Container. */
void appendBranch(Object* o);
/** Adds a @p o branch right after @p before of the Container. */
void insertBranch(Container::iterator before, Object* o) { m_params.insert(before, o); }
/** Returns a QStringList where we have all of the bvar in the container */
QStringList bvarStrings() const;
/** Returns a QStringList where we have all of the bvar in the container */
QList<Ci*> bvarCi() const;
/** Returns the begin iterator on the contained object list */
Container::iterator begin() { return m_params.begin(); }
/** Returns the begin iterator on the contained object list */
Container::const_iterator constBegin() const { return m_params.constBegin(); }
/** Returns the end iterator on the contained object list */
Container::const_iterator constEnd() const { return m_params.constEnd(); }
/** Returns the end iterator on the contained object list */
Container::iterator end() { return m_params.end(); }
/** Returns whether it is an empty container. */
bool isEmpty() const { return m_params.isEmpty(); }
/** @return Returns whether it provides a numerical result instead of information. */
bool isNumber() const;
/** @return Returns the string associated to the container type. */
QString tagName() const;
virtual QVariant accept(AbstractExpressionVisitor*) const;
virtual bool isZero() const;
virtual bool matches(const Object* pattern, QMap< QString, const Object* >* found) const;
const Container* extractType(Container::ContainerType t) const;
/** @returns how many bvars are there in the container */
int bvarCount() const;
// protected:
QList<Object*> m_params;
private:
ContainerType m_cont_type;
static char m_typeStr[][20];
static QMap<QString, ContainerType> m_nameToType;
};
}
#endif
|