akregator/src

tagset.h

00001 /*
00002     This file is part of Akregator.
00003 
00004     Copyright (C) 2005 Frank Osterfeld <frank.osterfeld at kdemail.net>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 
00020     As a special exception, permission is given to link this program
00021     with any edition of TQt, and distribute the resulting executable,
00022     without including the source code for TQt in the source distribution.
00023 */
00024 
00025 #ifndef AKREGATOR_TAGSET_H
00026 #define AKREGATOR_TAGSET_H
00027 
00028 #include <tqobject.h>
00029 
00030 class TQDomDocument;
00031 template <class K,class T> class TQMap;
00032 class TQString;
00033 class TQStringList;
00034 
00035 namespace Akregator {
00036 
00037 class Tag;
00038 
00047 class TagSet : public TQObject
00048 {
00049     friend class Tag;
00050     Q_OBJECT
00051   
00052     public:
00053 
00054         TagSet(TQObject* parent=0);
00055         virtual ~TagSet();
00056 
00058         void insert(const Tag& tag);
00059 
00061         void remove(const Tag& tag);
00062 
00064         TQMap<TQString,Tag> toMap() const;
00065 
00067         bool contains(const Tag& tag) const;
00068 
00070         bool containsID(const TQString& id) const;
00071 
00073         Tag findByID(const TQString& id) const;
00074 
00077         void readFromXML(const TQDomDocument& doc);
00078 
00091         TQDomDocument toXML() const;
00092 
00093     signals:
00095         void signalTagAdded(const Tag&);
00097         void signalTagRemoved(const Tag&);
00099         void signalTagUpdated(const Tag&);
00100 
00101     protected:
00103         void tagUpdated(const Tag& tag);
00104         
00105     private:
00106         class TagSetPrivate;
00107         TagSetPrivate* d;
00108 };
00109 
00110 } // namespace Akregator
00111 
00112 #endif // AKREGATOR_TAGSET_H