Syndication

rss2/parser.h
1 /*
2  This file is part of the syndication library
3  SPDX-FileCopyrightText: 2005 Frank Osterfeld <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef SYNDICATION_RSS2_PARSER_H
9 #define SYNDICATION_RSS2_PARSER_H
10 
11 #include <syndication/abstractparser.h>
12 #include <syndication/rss2/document.h>
13 
14 namespace Syndication
15 {
16 class DocumentSource;
17 
18 namespace RSS2
19 {
20 class Document;
21 
22 /**
23  * Parser implementation for the RSS 0.9x/2.0 format family
24  *
25  * @author Frank Osterfeld
26  */
27 class SYNDICATION_EXPORT Parser : public Syndication::AbstractParser
28 {
29 public:
30  /** default constructor */
31  Parser();
32 
33  /** destructor */
34  ~Parser() override;
35 
36  /**
37  * checks whether a document source looks like an RSS0.9x/2.0 document
38  *
39  * @param source a document source to check
40  * @return @c true if the source looks like an RSS2 document
41  */
42  bool accept(const DocumentSource &source) const override;
43 
44  /**
45  * creates an RSS2 wrapper for a document source.
46  * The wrapper will only return useful values if the source is really
47  * RSS 0.9x/2.0, so call accept() before to check.
48  *
49  * @param source the source to wrap
50  * @return A Syndication::RSS2::Document instance wrapping the XML
51  * source, or a null document (not a null pointer!) if there is no @c
52  * &lt;channel> root element in the source.
53  */
54  Syndication::SpecificDocumentPtr parse(const DocumentSource &source) const override;
55 
56  /**
57  * returns the format string of this parser implementation, which is
58  * "rss2".
59  *
60  * @return @c "rss2"
61  */
62  QString format() const override;
63 
64 private:
65  Parser(const Parser &other);
66  Parser &operator=(const Parser &other);
67 
68  class ParserPrivate;
69  ParserPrivate *const d;
70 };
71 
72 } // namespace RSS2
73 } // namespace Syndication
74 
75 #endif // SYNDICATION_RSS2_PARSER_H
FeedPtr parse(const DocumentSource &src, const QString &formatHint)
parses a document from a source and returns a new Feed object wrapping the feed content.
Definition: global.cpp:54
Interface for all parsers.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Dec 3 2023 03:52:05 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.