Syndication

rss2/parser.h
1/*
2 This file is part of the syndication library
3 SPDX-FileCopyrightText: 2005 Frank Osterfeld <osterfeld@kde.org>
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#include <memory>
15
16namespace Syndication
17{
18class DocumentSource;
19
20namespace RSS2
21{
22class Document;
23
24/**
25 * Parser implementation for the RSS 0.9x/2.0 format family
26 *
27 * @author Frank Osterfeld
28 */
30{
31public:
32 /** default constructor */
33 Parser();
34
35 /** destructor */
36 ~Parser() override;
37
38 /**
39 * checks whether a document source looks like an RSS0.9x/2.0 document
40 *
41 * @param source a document source to check
42 * @return @c true if the source looks like an RSS2 document
43 */
44 bool accept(const DocumentSource &source) const override;
45
46 /**
47 * creates an RSS2 wrapper for a document source.
48 * The wrapper will only return useful values if the source is really
49 * RSS 0.9x/2.0, so call accept() before to check.
50 *
51 * @param source the source to wrap
52 * @return A Syndication::RSS2::Document instance wrapping the XML
53 * source, or a null document (not a null pointer!) if there is no @c
54 * &lt;channel> root element in the source.
55 */
56 Syndication::SpecificDocumentPtr parse(const DocumentSource &source) const override;
57
58 /**
59 * returns the format string of this parser implementation, which is
60 * "rss2".
61 *
62 * @return @c "rss2"
63 */
64 QString format() const override;
65
66private:
67 Parser(const Parser &other);
68 Parser &operator=(const Parser &other);
69
70 class ParserPrivate;
71 std::unique_ptr<ParserPrivate> const d;
72};
73
74} // namespace RSS2
75} // namespace Syndication
76
77#endif // SYNDICATION_RSS2_PARSER_H
Interface for all parsers.
Represents the source of a syndication document, as read from the downloaded file.
Parser implementation for the RSS 0.9x/2.0 format family.
Definition rss2/parser.h:30
Parser()
default constructor
Syndication::SpecificDocumentPtr parse(const DocumentSource &source) const override
creates an RSS2 wrapper for a document source.
QString format() const override
returns the format string of this parser implementation, which is "rss2".
~Parser() override
destructor
bool accept(const DocumentSource &source) const override
checks whether a document source looks like an RSS0.9x/2.0 document
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:03:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.