File indexing completed on 2023-09-24 04:15:33
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 class QString; 0014 template<class T, class U> 0015 class QHash; 0016 0017 namespace Syndication 0018 { 0019 class SpecificDocument; 0020 class DocumentSource; 0021 0022 namespace Atom 0023 { 0024 /** 0025 * parser implementation for Atom 1.0 and 0.3. 0026 * 0027 * @author Frank Osterfeld 0028 */ 0029 class SYNDICATION_EXPORT Parser : public Syndication::AbstractParser 0030 { 0031 public: 0032 /** default constructor */ 0033 Parser(); 0034 0035 /** destructor */ 0036 ~Parser() override; 0037 0038 /** 0039 * returns whether the source looks like an Atom 1.0 or 0.3 0040 * document, by checking the root element. 0041 * @param source document source to check 0042 */ 0043 bool accept(const Syndication::DocumentSource &source) const override; 0044 0045 /** 0046 * parses either an EntryDocument or a FeedDocument from a 0047 * document source. If the source is not an atom document, 0048 * an invalid FeedDocument is returned. 0049 * @see SpecificDocument::isValid() 0050 * @param source the document source to parse 0051 */ 0052 Q_REQUIRED_RESULT Syndication::SpecificDocumentPtr parse(const Syndication::DocumentSource &source) const override; 0053 0054 /** 0055 * returns the format string for this parser implementation, which is 0056 * @c "atom" 0057 * @return @c "atom" 0058 */ 0059 Q_REQUIRED_RESULT QString format() const override; 0060 0061 private: 0062 Parser(const Parser &other); 0063 Parser &operator=(const Parser &other); 0064 class ParserPrivate; 0065 ParserPrivate *const d; 0066 }; 0067 0068 } // namespace Atom 0069 } // namespace Syndication 0070 0071 #endif // SYNDICATION_ATOM_PARSER_H