File indexing completed on 2024-04-28 15:34:25

0001 /*
0002     This file is part of the syndication library
0003     SPDX-FileCopyrightText: 2005 Frank Osterfeld <osterfeld@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef SYNDICATION_RDF_PARSER_H
0009 #define SYNDICATION_RDF_PARSER_H
0010 
0011 #include <syndication/abstractparser.h>
0012 #include <syndication/rdf/document.h>
0013 
0014 namespace Syndication
0015 {
0016 class DocumentSource;
0017 
0018 namespace RDF
0019 {
0020 /**
0021  * Parser implementation for RDF-based RSS 0.9 and RSS 1.0 feeds.
0022  *
0023  * @author Frank Osterfeld
0024  */
0025 class SYNDICATION_EXPORT Parser : public Syndication::AbstractParser
0026 {
0027 public:
0028     /** default constructor */
0029     Parser();
0030 
0031     /** destructor */
0032     ~Parser() override;
0033 
0034     /**
0035      * returns whether the passed document looks like
0036      * an RSS 0.9 or RSS 1.0 document.
0037      * @param source the document source to check
0038      */
0039     bool accept(const DocumentSource &source) const override;
0040 
0041     /**
0042      * Parses an RSS 0.9/1.0 document from a feed source. RSS 0.9
0043      * documents are converted to RSS 1.0.
0044      *
0045      * @param source The document source to parse
0046      * @return parsed document (a Syndication::RDF::Document), or an
0047      * invalid document if parsing failed.
0048      * @see Document::isValid()
0049      */
0050     SpecificDocumentPtr parse(const DocumentSource &source) const override;
0051 
0052     /**
0053      * format string of this parser, which is @c "rdf".
0054      *
0055      * @return @c "rdf"
0056      */
0057     QString format() const override;
0058 
0059 private:
0060     Parser(const Parser &other);
0061     Parser &operator=(const Parser &other);
0062 
0063     class ParserPrivate;
0064     ParserPrivate *const d;
0065 };
0066 
0067 } // namespace RDF
0068 } // namespace Syndication
0069 
0070 #endif // SYNDICATION_RDF_PARSER_H