1 | /* |
2 | This file is part of the syndication library |
3 | SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #ifndef SYNDICATION_ATOM_PARSER_H |
9 | #define SYNDICATION_ATOM_PARSER_H |
10 | |
11 | #include <syndication/abstractparser.h> |
12 | |
13 | #include <memory> |
14 | |
15 | class QString; |
16 | template<class T, class U> |
17 | class QHash; |
18 | |
19 | namespace Syndication |
20 | { |
21 | class SpecificDocument; |
22 | class DocumentSource; |
23 | |
24 | namespace Atom |
25 | { |
26 | /** |
27 | * parser implementation for Atom 1.0 and 0.3. |
28 | * |
29 | * @author Frank Osterfeld |
30 | */ |
31 | class SYNDICATION_EXPORT Parser : public Syndication::AbstractParser |
32 | { |
33 | public: |
34 | /** default constructor */ |
35 | Parser(); |
36 | |
37 | /** destructor */ |
38 | ~Parser() override; |
39 | |
40 | /** |
41 | * returns whether the source looks like an Atom 1.0 or 0.3 |
42 | * document, by checking the root element. |
43 | * @param source document source to check |
44 | */ |
45 | bool accept(const Syndication::DocumentSource &source) const override; |
46 | |
47 | /** |
48 | * parses either an EntryDocument or a FeedDocument from a |
49 | * document source. If the source is not an atom document, |
50 | * an invalid FeedDocument is returned. |
51 | * @see SpecificDocument::isValid() |
52 | * @param source the document source to parse |
53 | */ |
54 | Q_REQUIRED_RESULT Syndication::SpecificDocumentPtr parse(const Syndication::DocumentSource &source) const override; |
55 | |
56 | /** |
57 | * returns the format string for this parser implementation, which is |
58 | * @c "atom" |
59 | * @return @c "atom" |
60 | */ |
61 | Q_REQUIRED_RESULT QString format() const override; |
62 | |
63 | private: |
64 | Parser(const Parser &other); |
65 | Parser &operator=(const Parser &other); |
66 | class ParserPrivate; |
67 | std::unique_ptr<ParserPrivate> const d; |
68 | }; |
69 | |
70 | } // namespace Atom |
71 | } // namespace Syndication |
72 | |
73 | #endif // SYNDICATION_ATOM_PARSER_H |
74 | |