akregator/src

nodelist.h
1/*
2 This file is part of Akregator.
3
4 Copyright (C) 2005 Frank Osterfeld <frank.osterfeld at kdemail.net>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20 As a special exception, permission is given to link this program
21 with any edition of TQt, and distribute the resulting executable,
22 without including the source code for TQt in the source distribution.
23*/
24
25#ifndef AKREGATOR_NODELIST_H
26#define AKREGATOR_NODELIST_H
27
28#include <tqobject.h>
29
30class TQDomDocument;
31class TQDomNode;
32class TQString;
33
34template <class K,class T> class TQMap;
35template <class T> class TQValueList;
36
37// hack for KDE 3.x series
38#ifdef signals
39# undef signals
40# define signals public
41#endif
42
43namespace Akregator {
44
45class Folder;
46class TreeNode;
47
48class NodeList : public TQObject
49{
50
51TQ_OBJECT
52
53
54public:
55 NodeList(TQObject *parent=0, const char *name=0);
56 virtual ~NodeList();
57
58 virtual Folder* rootNode() const;
59
60 virtual bool readFromXML(const TQDomDocument& doc) = 0;
61
62 virtual TQDomDocument toXML() const = 0;
63
64 virtual bool isEmpty() const;
65
66 TreeNode* findByID(int id) const;
67
69 const TQString& title() const;
70
72 void setTitle(const TQString& name);
73
75 const TQValueList<TreeNode*>& asFlatList() const;
76
77signals:
78 void signalDestroyed(NodeList*);
80 void signalNodeAdded(TreeNode*);
82 void signalNodeRemoved(TreeNode*);
83
84public slots:
85
89 void clear();
90
91public: // compat with KDE-3.x assertions, remove for KDE 4
92// protected:
93
94 TQValueList<TreeNode*>* flatList() const;
95 TQMap<int, TreeNode*>* idMap() const;
96
97 int generateID();
98 void setRootNode(Folder* folder);
99 virtual void addNode(TreeNode* node, bool preserveID);
100 virtual void removeNode(TreeNode* node);
101
102public slots: // compat with KDE-3.x assertions, remove for KDE 4
103// protected slots:
104
105 virtual void slotNodeDestroyed(TreeNode* node);
106 virtual void slotNodeAdded(TreeNode* node);
107 virtual void slotNodeRemoved(Folder* parent, TreeNode* node);
108
109public: // compat with KDE-3.x assertions, remove for KDE 4
110// private:
111 NodeList(const NodeList&) : TQObject() {}
112 NodeList& operator=(const NodeList&) { return *this; }
113
114 friend class AddNodeVisitor;
115 class AddNodeVisitor;
116
117 friend class RemoveNodeVisitor;
118 class RemoveNodeVisitor;
119
120 class NodeListPrivate;
121 NodeListPrivate* d;
122
123};
124
125} // namespace Akregator
126
127#endif // AKREGATOR_NODELIST_H