File indexing completed on 2024-04-21 04:01:02

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 #include <memory>
0015 
0016 namespace Syndication
0017 {
0018 class DocumentSource;
0019 
0020 namespace RDF
0021 {
0022 /**
0023  * Parser implementation for RDF-based RSS 0.9 and RSS 1.0 feeds.
0024  *
0025  * @author Frank Osterfeld
0026  */
0027 class Parser : public Syndication::AbstractParser
0028 {
0029 public:
0030     /** default constructor */
0031     Parser();
0032 
0033     /** destructor */
0034     ~Parser() override;
0035 
0036     /**
0037      * returns whether the passed document looks like
0038      * an RSS 0.9 or RSS 1.0 document.
0039      * @param source the document source to check
0040      */
0041     bool accept(const DocumentSource &source) const override;
0042 
0043     /**
0044      * Parses an RSS 0.9/1.0 document from a feed source. RSS 0.9
0045      * documents are converted to RSS 1.0.
0046      *
0047      * @param source The document source to parse
0048      * @return parsed document (a Syndication::RDF::Document), or an
0049      * invalid document if parsing failed.
0050      * @see Document::isValid()
0051      */
0052     SpecificDocumentPtr parse(const DocumentSource &source) const override;
0053 
0054     /**
0055      * format string of this parser, which is @c "rdf".
0056      *
0057      * @return @c "rdf"
0058      */
0059     QString format() const override;
0060 
0061 private:
0062     Parser(const Parser &other);
0063     Parser &operator=(const Parser &other);
0064 
0065     class ParserPrivate;
0066     std::unique_ptr<ParserPrivate> const d;
0067 };
0068 
0069 } // namespace RDF
0070 } // namespace Syndication
0071 
0072 #endif // SYNDICATION_RDF_PARSER_H