node.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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