Fix akonadimodel.cpp:1: warning: unterminated character constant
[kdepim.git] / akregator / interfaces / article.h
blob0ba6ac20bd6db698f4ccd94d379039888255dc71
1 /*
2 This file is part of Akregator.
4 Copyright (C) 2004 Stanislav Karchebny <Stanislav.Karchebny@kdemail.net>
5 2005 Frank Osterfeld <osterfeld@kde.org>
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.
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.
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.
21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution.
26 #ifndef AKREGATOR_ARTICLE_H
27 #define AKREGATOR_ARTICLE_H
29 #include "akregator_export.h"
30 #include "types.h"
32 #include <syndication/person.h>
34 #include <boost/shared_ptr.hpp>
36 class QDateTime;
37 class QString;
39 template <class T> class QList;
41 typedef unsigned int uint;
43 class KUrl;
45 namespace Syndication
47 class Enclosure;
48 class Item;
49 typedef boost::shared_ptr<Item> ItemPtr;
52 namespace Akregator {
54 namespace Backend
56 class FeedStorage;
59 class Feed;
60 /** A proxy class for Syndication::ItemPtr with some additional methods to assist sorting. */
61 class AKREGATORPART_EXPORT Article
63 friend class ArticleDeleteJob;
64 friend class ArticleModifyJob;
65 friend class Feed;
67 public:
68 enum ContentOption {
69 ContentAndOnlyContent, /*< returns the content field even if empty */
70 DescriptionAsFallback /*< uses the description field as fallback if the content field is empty */
73 Article();
74 /** creates am article object for an existing article.
75 The constructor accesses the archive to load it's data
77 Article(const QString& guid, Feed* feed);
78 /** creates an article object from a parsed librss Article
79 the article is added to the archive if not yet stored, or updated if stored but modified
81 Article(const Syndication::ItemPtr& article, Feed* feed);
83 Article(const Syndication::ItemPtr& article, Backend::FeedStorage* archive);
84 Article(const Article &other);
85 ~Article();
87 void swap( Article & other ) {
88 std::swap( d, other.d );
91 Article &operator=(const Article &other);
92 bool operator==(const Article &other) const;
93 bool operator!=(const Article &other) const;
96 bool isNull() const;
98 int status() const;
100 QString title() const;
101 KUrl link() const;
102 QString description() const;
104 QString content( ContentOption opt = ContentAndOnlyContent ) const;
106 QString guid() const;
107 /** if true, the article should be kept even when expired **/
108 bool keep() const;
110 bool isDeleted() const;
112 void offsetPubDate(int secs);
114 Feed* feed() const;
116 /** returns a hash value used to detect changes in articles with non-hash GUIDs. If the guid is a hash itself, it returns @c 0 */
118 uint hash() const;
120 /** returns if the guid is a hash or an ID taken from the source */
122 bool guidIsHash() const;
124 bool guidIsPermaLink() const;
126 QDateTime pubDate() const;
128 KUrl commentsLink() const;
130 int comments() const;
132 QString authorName() const;
133 QString authorUri() const;
134 QString authorEMail() const;
135 QString authorAsHtml() const;
136 QString authorShort() const;
138 boost::shared_ptr<const Syndication::Enclosure> enclosure() const;
140 bool operator<(const Article &other) const;
141 bool operator<=(const Article &other) const;
142 bool operator>(const Article &other) const;
143 bool operator>=(const Article &other) const;
145 private: //only for our friends
146 void setStatus(int s);
147 void setDeleted();
148 void setKeep(bool keep);
150 private:
151 struct Private;
152 Private* d;
155 } // namespace Akregator
157 #endif // AKREGATOR_ARTICLE_H