node.h

00001 /*
00002  * Silence
00003  *
00004  * Copyright (C) 2009 Manuel Unglaub
00005  *
00006  * This file is part of Silence.
00007  *
00008  * Silence is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, version GPLv2 only of the License.
00011  *
00012  * Silence is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016 
00017  * You should have received a copy of the GNU General Public License
00018  * along with Silence.  If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00021 #ifndef NODE_H
00022 #define NODE_H
00023 
00024 #include "src/data/node/abstractnodecontent.h"
00025 #include "src/data/node/nodeid.h"
00026 #include <QDateTime>
00027 #include <QString>
00028 #include <QStringList>
00029 
00030 
00038 class Node : public QObject
00039 {
00040     Q_OBJECT
00041 
00042     public:
00048         Node(Node *parent = 0); 
00049 
00054         ~Node();
00055 
00060         int getIndex() const;
00061 
00066         Node* getParent() const;
00067 
00072         QList<Node*> toNodeList();
00073 
00079         NodeId getId();
00080 
00086         void setId(NodeId *id);
00087 
00093         bool contains(Node* node);
00094 
00102         bool addChildren(int position, int count);
00103 
00110         Node* getChild(int index) const;
00111 
00116         int getChildCount() const;
00117 
00125         bool removeChildren(int position, int count);
00126 
00133         Node* takeChild(int position);
00134 
00142         bool addChild(Node* child, int position);
00143         
00149         QString getCaption() const;
00150 
00157         bool setCaption(QString caption);
00158 
00164         AbstractNodeContent* getContent() const;
00165 
00171         void setContent(AbstractNodeContent *content);
00172 
00178         QDateTime getCreationDate() const;
00179 
00185         void setCreationDate(QDateTime date);
00186 
00192         QDateTime getModificationDate() const;
00193 
00199         void setModificationDate(QDateTime date);
00200 
00206         QStringList* getLabels();
00207 
00213         void addLabel(QString label);
00214 
00220         void addLabels(QStringList labels);
00221 
00228         bool removeLabel(QString label);
00229 
00235         QString toString();
00236         
00237     signals:
00242         void changed(Node *node);
00243 
00244     protected:
00250         void setParent(Node* parent);
00251 
00252     private slots:
00253         void change();
00254 
00255     private:
00256         NodeId *id;
00257         QString caption;
00258         AbstractNodeContent *content;
00259         QDateTime creationDate;
00260         QDateTime modificationDate;
00261         QStringList labels;
00262         
00263         Node *parent;
00264         QList<Node*> children;
00265 };
00266 
00267 #endif // NODE_H
00268 
00269 
Generated on Fri May 14 19:12:50 2010 for Silence by  doxygen 1.6.3