Line data Source code
1 : #ifndef OPMLPARSER_H
2 : #define OPMLPARSER_H
3 :
4 : #include <QObject>
5 : #include <QFile>
6 : #include <QList>
7 : #include <QXmlStreamReader>
8 :
9 : #include "ParserInterface.h"
10 : #include "RawFeed.h"
11 : #include "../FangObject.h"
12 :
13 : /**
14 : * @brief Parses an OPML document containing an RSS list. The feeds are
15 : * validated and can be added immediately.
16 : */
17 : class OPMLParser : public FangObject
18 : {
19 : Q_OBJECT
20 : public:
21 : explicit OPMLParser(QObject *parent = nullptr);
22 : virtual ~OPMLParser();
23 :
24 : signals:
25 : // Call getResult() and getFeedList() now, yo!
26 : void done();
27 :
28 : public slots:
29 :
30 : // Starts parsing a file.
31 : void parseFile(QString filename);
32 :
33 : // Gets the result status.
34 0 : ParserInterface::ParseResult getResult() { return result; }
35 :
36 : // Returns the feed list, assuming there is one.
37 4 : QList<RawFeed*> getFeedList() { return feedList; }
38 :
39 : // Returns the file you passed in parseFile()
40 0 : QFile* getFile() { return &file; }
41 :
42 : private:
43 : QFile file;
44 : QList<RawFeed*> feedList;
45 : ParserInterface::ParseResult result;
46 :
47 : QXmlStreamReader xml;
48 : };
49 :
50 :
51 : #endif // OPMLPARSER_H
|