akregator/src

feedstorage.h
1/*
2 This file is part of Akregator.
3
4 Copyright (C) 2005 Frank Osterfeld <frank.osterfeld@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#ifndef AKREGATOR_BACKEND_FEEDSTORAGE_H
25#define AKREGATOR_BACKEND_FEEDSTORAGE_H
26
27#include <tqobject.h>
28#include <tqstring.h>
29
30#include "akregator_export.h"
31
32class TQStringList;
33
34
35namespace Akregator {
36namespace Backend {
37
39class AKREGATOR_EXPORT Category
40{
41 public:
42
43 TQString term;
44 TQString scheme;
45 TQString name;
46
49 bool operator==(const Category& other) const
50 {
51 return term == other.term && scheme == other.scheme;
52 }
53
54 bool operator!=(const Category& other) const
55 {
56 return !operator==(other);
57 }
59 bool operator<(const Category& other) const
60 {
61 return other.scheme < other.scheme || (other.scheme == other.scheme && term < other.term);
62 }
63};
64
65class Storage;
66
67class AKREGATOR_EXPORT FeedStorage : public TQObject
68{
69 public:
70
71 virtual int unread() = 0;
72 virtual void setUnread(int unread) = 0;
73 virtual int totalCount() = 0;
74 virtual int lastFetch() = 0;
75 virtual void setLastFetch(int lastFetch) = 0;
76
78 virtual TQStringList articles(const TQString& tagID=TQString()) = 0;
79
81 virtual TQStringList articles(const Category& cat) = 0;
82
86 virtual void add(FeedStorage* source) = 0;
87
89 virtual void copyArticle(const TQString& guid, FeedStorage* source) = 0;
90
92 virtual void clear() = 0;
93
94
95 virtual bool contains(const TQString& guid) = 0;
96 virtual void addEntry(const TQString& guid) = 0;
97 virtual void deleteArticle(const TQString& guid) = 0;
98 virtual int comments(const TQString& guid) = 0;
99 virtual TQString commentsLink(const TQString& guid) = 0;
100 virtual void setCommentsLink(const TQString& guid, const TQString& commentsLink) = 0;
101 virtual void setComments(const TQString& guid, int comments) = 0;
102 virtual bool guidIsHash(const TQString& guid) = 0;
103 virtual void setGuidIsHash(const TQString& guid, bool isHash) = 0;
104 virtual bool guidIsPermaLink(const TQString& guid) = 0;
105 virtual void setGuidIsPermaLink(const TQString& guid, bool isPermaLink) = 0;
106 virtual uint hash(const TQString& guid) = 0;
107 virtual void setHash(const TQString& guid, uint hash) = 0;
108 virtual void setDeleted(const TQString& guid) = 0;
109 virtual TQString link(const TQString& guid) = 0;
110 virtual void setLink(const TQString& guid, const TQString& link) = 0;
111 virtual uint pubDate(const TQString& guid) = 0;
112 virtual void setPubDate(const TQString& guid, uint pubdate) = 0;
113 virtual int status(const TQString& guid) = 0;
114 virtual void setStatus(const TQString& guid, int status) = 0;
115 virtual TQString title(const TQString& guid) = 0;
116 virtual void setTitle(const TQString& guid, const TQString& title) = 0;
117 virtual TQString description(const TQString& guid) = 0;
118 virtual void setDescription(const TQString& guid, const TQString& description) = 0;
119
120 virtual void addTag(const TQString& guid, const TQString& tag) = 0;
121 virtual void removeTag(const TQString& guid, const TQString& tag) = 0;
122
124 virtual TQStringList tags(const TQString& guid=TQString()) = 0;
125
126 virtual void addCategory(const TQString& guid, const Category& category) = 0;
127 virtual TQValueList<Category> categories(const TQString& guid=TQString()) = 0;
128
129 virtual void setEnclosure(const TQString& guid, const TQString& url, const TQString& type, int length) = 0;
130 virtual void removeEnclosure(const TQString& guid) = 0;
131
132 virtual void setAuthor(const TQString& /*guid*/, const TQString& /*author*/) {}
133 virtual TQString author(const TQString& /*guid*/) { return TQString(); }
134
135 virtual void enclosure(const TQString& guid, bool& hasEnclosure, TQString& url, TQString& type, int& length) = 0;
136 virtual void close() = 0;
137 virtual void commit() = 0;
138 virtual void rollback() = 0;
139
140 virtual void convertOldArchive() = 0;
141};
142
143}
144}
145
146#endif
a convenience class to handle categories in the backend
Definition: feedstorage.h:40
bool operator==(const Category &other) const
two categories are equal when scheme and term are equal, name is ignored
Definition: feedstorage.h:49
bool operator<(const Category &other) const
we need this for TQMaps
Definition: feedstorage.h:59