File indexing completed on 2024-03-24 04:03:46
0001 /* 0002 This file is part of the syndication library 0003 SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef SYNDICATION_ATOM_PARSER_H 0009 #define SYNDICATION_ATOM_PARSER_H 0010 0011 #include <syndication/abstractparser.h> 0012 0013 #include <memory> 0014 0015 class QString; 0016 template<class T, class U> 0017 class QHash; 0018 0019 namespace Syndication 0020 { 0021 class SpecificDocument; 0022 class DocumentSource; 0023 0024 namespace Atom 0025 { 0026 /** 0027 * parser implementation for Atom 1.0 and 0.3. 0028 * 0029 * @author Frank Osterfeld 0030 */ 0031 class SYNDICATION_EXPORT Parser : public Syndication::AbstractParser 0032 { 0033 public: 0034 /** default constructor */ 0035 Parser(); 0036 0037 /** destructor */ 0038 ~Parser() override; 0039 0040 /** 0041 * returns whether the source looks like an Atom 1.0 or 0.3 0042 * document, by checking the root element. 0043 * @param source document source to check 0044 */ 0045 bool accept(const Syndication::DocumentSource &source) const override; 0046 0047 /** 0048 * parses either an EntryDocument or a FeedDocument from a 0049 * document source. If the source is not an atom document, 0050 * an invalid FeedDocument is returned. 0051 * @see SpecificDocument::isValid() 0052 * @param source the document source to parse 0053 */ 0054 Q_REQUIRED_RESULT Syndication::SpecificDocumentPtr parse(const Syndication::DocumentSource &source) const override; 0055 0056 /** 0057 * returns the format string for this parser implementation, which is 0058 * @c "atom" 0059 * @return @c "atom" 0060 */ 0061 Q_REQUIRED_RESULT QString format() const override; 0062 0063 private: 0064 Parser(const Parser &other); 0065 Parser &operator=(const Parser &other); 0066 class ParserPrivate; 0067 std::unique_ptr<ParserPrivate> const d; 0068 }; 0069 0070 } // namespace Atom 0071 } // namespace Syndication 0072 0073 #endif // SYNDICATION_ATOM_PARSER_H