akregator/src
nodelist.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef AKREGATOR_NODELIST_H
00026 #define AKREGATOR_NODELIST_H
00027
00028 #include <qobject.h>
00029
00030 class QDomDocument;
00031 class QDomNode;
00032 class QString;
00033
00034 template <class K,class T> class QMap;
00035 template <class T> class QValueList;
00036
00037
00038 #ifdef signals
00039 # undef signals
00040 # define signals public
00041 #endif
00042
00043 namespace Akregator {
00044
00045 class Folder;
00046 class TreeNode;
00047
00048 class NodeList : public QObject
00049 {
00050
00051 Q_OBJECT
00052
00053 public:
00054 NodeList(QObject *parent=0, const char *name=0);
00055 virtual ~NodeList();
00056
00057 virtual Folder* rootNode() const;
00058
00059 virtual bool readFromXML(const QDomDocument& doc) = 0;
00060
00061 virtual QDomDocument toXML() const = 0;
00062
00063 virtual bool isEmpty() const;
00064
00065 TreeNode* findByID(int id) const;
00066
00068 const QString& title() const;
00069
00071 void setTitle(const QString& name);
00072
00074 const QValueList<TreeNode*>& asFlatList() const;
00075
00076 signals:
00077 void signalDestroyed(NodeList*);
00079 void signalNodeAdded(TreeNode*);
00081 void signalNodeRemoved(TreeNode*);
00082
00083 public slots:
00084
00088 void clear();
00089
00090 public:
00091
00092
00093 QValueList<TreeNode*>* flatList() const;
00094 QMap<int, TreeNode*>* idMap() const;
00095
00096 int generateID();
00097 void setRootNode(Folder* folder);
00098 virtual void addNode(TreeNode* node, bool preserveID);
00099 virtual void removeNode(TreeNode* node);
00100
00101 public slots:
00102
00103
00104 virtual void slotNodeDestroyed(TreeNode* node);
00105 virtual void slotNodeAdded(TreeNode* node);
00106 virtual void slotNodeRemoved(Folder* parent, TreeNode* node);
00107
00108 public:
00109
00110 NodeList(const NodeList&) : QObject() {}
00111 NodeList& operator=(const NodeList&) { return *this; }
00112
00113 friend class AddNodeVisitor;
00114 class AddNodeVisitor;
00115
00116 friend class RemoveNodeVisitor;
00117 class RemoveNodeVisitor;
00118
00119 class NodeListPrivate;
00120 NodeListPrivate* d;
00121
00122 };
00123
00124 }
00125
00126 #endif // AKREGATOR_NODELIST_H
|