Line data Source code
1 : #ifndef FEEDSOURCE_H
2 : #define FEEDSOURCE_H
3 :
4 : #include <memory>
5 :
6 : #include <QObject>
7 : #include <QUrl>
8 :
9 : #include "FeedFetchResult.h"
10 : #include "RawFeed.h"
11 :
12 : /*!
13 : \brief Abstract interface for async feed fetch + parse.
14 : */
15 : class FeedSource : public QObject
16 : {
17 : Q_OBJECT
18 :
19 : public:
20 : explicit FeedSource(QObject *parent = nullptr);
21 97 : virtual ~FeedSource() {}
22 :
23 : signals:
24 : // Call getResult() and getFeed() now, yo!
25 : void done();
26 :
27 : public slots:
28 :
29 : /*!
30 : \brief Contacts URL and parses the RSS/Atom feed, if it exists.
31 : \param url The URL
32 : */
33 : virtual void parse(const QUrl& url,
34 : const QString& ifNoneMatch = QString(),
35 : const QString& ifModifiedSince = QString()) =0;
36 :
37 : virtual FeedFetchResult getResult() =0;
38 : virtual std::shared_ptr<RawFeed> getFeed() =0;
39 : virtual QUrl getURL() =0;
40 :
41 : // Conditional request response headers.
42 0 : virtual QString responseEtag() { return QString(); }
43 0 : virtual QString responseLastModified() { return QString(); }
44 :
45 : };
46 :
47 : #endif // FEEDSOURCE_H
|