1 | /* |
2 | This file is part of the syndication library |
3 | SPDX-FileCopyrightText: 2005 Frank Osterfeld <osterfeld@kde.org> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #ifndef SYNDICATION_RDF_PARSER_H |
9 | #define SYNDICATION_RDF_PARSER_H |
10 | |
11 | #include <syndication/abstractparser.h> |
12 | #include <syndication/rdf/document.h> |
13 | |
14 | #include <memory> |
15 | |
16 | namespace Syndication |
17 | { |
18 | class DocumentSource; |
19 | |
20 | namespace RDF |
21 | { |
22 | /** |
23 | * Parser implementation for RDF-based RSS 0.9 and RSS 1.0 feeds. |
24 | * |
25 | * @author Frank Osterfeld |
26 | */ |
27 | class Parser : public Syndication::AbstractParser |
28 | { |
29 | public: |
30 | /** default constructor */ |
31 | Parser(); |
32 | |
33 | /** destructor */ |
34 | ~Parser() override; |
35 | |
36 | /** |
37 | * returns whether the passed document looks like |
38 | * an RSS 0.9 or RSS 1.0 document. |
39 | * @param source the document source to check |
40 | */ |
41 | bool accept(const DocumentSource &source) const override; |
42 | |
43 | /** |
44 | * Parses an RSS 0.9/1.0 document from a feed source. RSS 0.9 |
45 | * documents are converted to RSS 1.0. |
46 | * |
47 | * @param source The document source to parse |
48 | * @return parsed document (a Syndication::RDF::Document), or an |
49 | * invalid document if parsing failed. |
50 | * @see Document::isValid() |
51 | */ |
52 | SpecificDocumentPtr parse(const DocumentSource &source) const override; |
53 | |
54 | /** |
55 | * format string of this parser, which is @c "rdf". |
56 | * |
57 | * @return @c "rdf" |
58 | */ |
59 | QString format() const override; |
60 | |
61 | private: |
62 | Parser(const Parser &other); |
63 | Parser &operator=(const Parser &other); |
64 | |
65 | class ParserPrivate; |
66 | std::unique_ptr<ParserPrivate> const d; |
67 | }; |
68 | |
69 | } // namespace RDF |
70 | } // namespace Syndication |
71 | |
72 | #endif // SYNDICATION_RDF_PARSER_H |
73 | |