akregator/src

article.h
1 /*
2  This file is part of Akregator.
3 
4  Copyright (C) 2004 Stanislav Karchebny <Stanislav.Karchebny@kdemail.net>
5  2005 Frank Osterfeld <frank.osterfeld at kdemail.net>
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 
21  As a special exception, permission is given to link this program
22  with any edition of TQt, and distribute the resulting executable,
23  without including the source code for TQt in the source distribution.
24 */
25 
26 #ifndef AKREGATOR_ARTICLE_H
27 #define AKREGATOR_ARTICLE_H
28 
29 class TQDateTime;
30 class TQDomDocument;
31 class TQDomElement;
32 class TQString;
33 class TQStringList;
34 class TQWidget;
35 
36 template <class T> class TQValueList;
37 
38 typedef unsigned int uint;
39 
40 class KURL;
41 class KURLLabel;
42 
43 namespace RSS
44 {
45  class Article;
46  class Enclosure;
47 }
48 
49 namespace Akregator
50 {
51  namespace Backend
52  {
53  class FeedStorage;
54  }
55  class Feed;
57  class Article
58  {
59  public:
60  enum Status { Unread=0, Read, New };
61  typedef TQValueList<Article> List;
62 
63  Article();
67  Article(const TQString& guid, Feed* feed);
71  Article(RSS::Article article, Feed* feed);
72 
73  Article(RSS::Article article, Backend::FeedStorage* archive);
74  Article(const Article &other);
75  Article &operator=(const Article &other);
76  bool operator==(const Article &other) const;
77  bool operator!=(const Article &other) const { return !operator==(other); }
78  virtual ~Article();
79 
80  bool isNull() const;
81 
82  int status() const;
83  void setStatus(int s);
84 
85  void offsetPubDate(int secs);
86 
87  TQString title() const;
88  KURL link() const;
89 
90  TQString author() const;
91 
92  TQString description() const;
93  TQString guid() const;
95  bool keep() const;
96  void setKeep(bool keep);
97  bool isDeleted() const;
98 
99  RSS::Enclosure enclosure() const;
100 
101  void setDeleted();
102 
103 
104  Feed* feed() const;
105 
108  uint hash() const;
109 
112  bool guidIsHash() const;
113 
114  bool guidIsPermaLink() const;
115 
116  const TQDateTime& pubDate() const;
117 
118  KURL commentsLink() const;
119 
120  int comments() const;
121 
122  void addTag(const TQString& tag);
123  void removeTag(const TQString& tag);
124  bool hasTag(const TQString& tag) const;
125  TQStringList tags() const;
126 
127  bool operator<(const Article &other) const;
128  bool operator<=(const Article &other) const;
129  bool operator>(const Article &other) const;
130  bool operator>=(const Article &other) const;
131 
132 
133  private:
134  void initialize(RSS::Article article, Backend::FeedStorage* archive);
135  static TQString buildTitle(const TQString& description);
136 
137  int statusBits() const; // returns all of the status bits for the article. this
138  // differs from status() which only returns the most relevant
139  // status flag.
140 
141 
142  struct Private;
143  Private *d;
144  };
145 }
146 
147 #endif
A proxy class for RSS::Article with some additional methods to assist sorting.
Definition: article.h:58
bool guidIsHash() const
returns if the guid is a hash or an ID taken from the source
Definition: article.cpp:371
uint hash() const
returns a hash value used to detect changes in articles with non-hash GUIDs.
Definition: article.cpp:376
bool keep() const
if true, the article should be kept even when expired
Definition: article.cpp:387
represents a feed
Definition: feed.h:63