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_DOCUMENTVISITOR_H
9#define SYNDICATION_DOCUMENTVISITOR_H
10
11#include "syndication_export.h"
12
13namespace Syndication
14{
15class SpecificDocument;
16
17namespace Atom
18{
19class EntryDocument;
20class FeedDocument;
21}
22
23namespace RDF
24{
25class Document;
26}
27
28namespace RSS2
29{
30class Document;
31}
32
33/*!
34 * \class Syndication::DocumentVisitor
35 * \inmodule Syndication
36 * \inheaderfile Syndication/DocumentVisitor
37 *
38 * \brief Visitor interface, following the Visitor design pattern.
39 *
40 * Use this if you
41 * want to process documents and the way how to handle the document depends
42 * on it's concrete type (e.g. RSS2::Document, RDF::Document...).
43 *
44 * TODO: insert code example
45 */
46class SYNDICATION_EXPORT DocumentVisitor // krazy:exclude=dpointer
47{
48public:
49 virtual ~DocumentVisitor();
50
51 /*!
52 * Call this method to handle a document. Depending on the concrete type
53 * of the document, a specialized visit method is called.
54 *
55 * \a document the document to process
56 *
57 * Returns whether this visitor handles the type of the document.
58 */
59 virtual bool visit(SpecificDocument *document);
60
61 /*!
62 * Reimplement this method to handle RSS2-like (RSS 0.9x, 2.0) documents.
63 *
64 * \a document the RSS2 document to visit
65 *
66 * Returns whether the visitor handled the document.
67 *
68 * Reimplementations of this method must return \c true.
69 */
70 virtual bool visitRSS2Document(Syndication::RSS2::Document *document);
71
72 /*!
73 * Reimplement this method to handle RDF (i.e. RSS 1.0) documents.
74 *
75 * \a document the RDF document to visit
76 *
77 * Returns whether the visitor handled the document.
78 *
79 * Reimplementations of this method must return \c true.
80 */
81 virtual bool visitRDFDocument(Syndication::RDF::Document *document);
82
83 /*!
84 * Reimplement this method to handle Atom feed documents (most Atom
85 * feeds are of this type).
86 *
87 * \a document the atom feed document to visit
88 *
89 * Returns whether the visitor handled the document.
90 *
91 * Reimplementations of this method must return \c true.
92 */
93 virtual bool visitAtomFeedDocument(Syndication::Atom::FeedDocument *document);
94
95 /*!
96 * Reimplement this method to handle Atom entry documents.
97 *
98 * \a document the atom entry document to visit
99 *
100 * Returns whether the visitor handled the document.
101 *
102 * Reimplementations of this method must return \c true.
103 */
104 virtual bool visitAtomEntryDocument(Syndication::Atom::EntryDocument *document);
105};
106
107} // namespace Syndication
108
109#endif // SYNDICATION_DOCUMENTVISITOR_H
110

source code of syndication/src/documentvisitor.h