akregator/src

tagset.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_TAGSET_H
26 #define AKREGATOR_TAGSET_H
27 
28 #include <tqobject.h>
29 
30 class TQDomDocument;
31 template <class K,class T> class TQMap;
32 class TQString;
33 class TQStringList;
34 
35 namespace Akregator {
36 
37 class Tag;
38 
47 class TagSet : public TQObject
48 {
49  friend class Tag;
50  TQ_OBJECT
51 
52  public:
53 
54  TagSet(TQObject* parent=0);
55  virtual ~TagSet();
56 
58  void insert(const Tag& tag);
59 
61  void remove(const Tag& tag);
62 
64  TQMap<TQString,Tag> toMap() const;
65 
67  bool contains(const Tag& tag) const;
68 
70  bool containsID(const TQString& id) const;
71 
73  Tag findByID(const TQString& id) const;
74 
77  void readFromXML(const TQDomDocument& doc);
78 
91  TQDomDocument toXML() const;
92 
93  signals:
95  void signalTagAdded(const Tag&);
97  void signalTagRemoved(const Tag&);
99  void signalTagUpdated(const Tag&);
100 
101  protected:
103  void tagUpdated(const Tag& tag);
104 
105  private:
106  class TagSetPrivate;
107  TagSetPrivate* d;
108 };
109 
110 } // namespace Akregator
111 
112 #endif // AKREGATOR_TAGSET_H
bool containsID(const TQString &id) const
returns true if this set contains a tag with a given ID
Definition: tagset.cpp:75
represents a set of tags (see Tag) In an application, there is usually one central tag set that is us...
Definition: tagset.h:47
void readFromXML(const TQDomDocument &doc)
reads tag set from XML see toXML() for an explanation of the format
Definition: tagset.cpp:95
TQMap< TQString, Tag > toMap() const
returns the tag set as map ((id, Tag) pairs)
Definition: tagset.cpp:90
void signalTagUpdated(const Tag &)
emitted when a tag in this set was changed (e.g.
void remove(const Tag &tag)
removes a tag from the tag set.
Definition: tagset.cpp:65
void signalTagAdded(const Tag &)
emitted when a tag was added to this tag set
void signalTagRemoved(const Tag &)
emitted when a tag was removed from this set
void insert(const Tag &tag)
adds a tag to the tag set.
Definition: tagset.cpp:55
bool contains(const Tag &tag) const
returns true if this set contains tag
Definition: tagset.cpp:80
TQDomDocument toXML() const
returns an XML representation of the tag set.
Definition: tagset.cpp:132
Tag findByID(const TQString &id) const
returns the tag with the given ID if the tag is element of the set, or a null tag if not
Definition: tagset.cpp:85
void tagUpdated(const Tag &tag)
called by the tag (Tag is friend class) after a change
Definition: tagset.cpp:127