Syndication

documentvisitor.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_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 * Visitor interface, following the Visitor design pattern. Use this if you
35 * want to process documents and the way how to handle the document depends
36 * on it's concrete type (e.g. RSS2::Document, RDF::Document...).
37 *
38 * TODO: insert code example
39 *
40 * @author Frank Osterfeld
41 */
42class SYNDICATION_EXPORT DocumentVisitor // krazy:exclude=dpointer
43{
44public:
45 /**
46 * destructor
47 */
48 virtual ~DocumentVisitor();
49
50 /**
51 * call this method to handle a document. Depending on the concrete type
52 * of the document, a specialized visit method is called.
53 *
54 * @param document the document to process
55 * @return whether this visitor handles the type of the document.
56 */
57 virtual bool visit(SpecificDocument *document);
58
59 /**
60 * reimplement this method to handle RSS2-like (RSS 0.9x, 2.0) documents.
61 *
62 * @param document the RSS2 document to visit
63 * @return whether the visitor handled the document.
64 * Reimplementations of this method must return @c true.
65 */
66 virtual bool visitRSS2Document(Syndication::RSS2::Document *document);
67
68 /**
69 * reimplement this method to handle RDF (i.e. RSS 1.0) documents.
70 *
71 * @param document the RDF document to visit
72 * @return whether the visitor handled the document.
73 * Reimplementations of this method must return @c true.
74 */
75 virtual bool visitRDFDocument(Syndication::RDF::Document *document);
76
77 /**
78 * reimplement this method to handle Atom feed documents (most Atom
79 * feeds are of this type).
80 *
81 * @param document the atom feed document to visit
82 * @return whether the visitor handled the document.
83 * Reimplementations of this method must return @c true.
84 */
85 virtual bool visitAtomFeedDocument(Syndication::Atom::FeedDocument *document);
86
87 /**
88 * reimplement this method to handle Atom entry documents.
89 *
90 * @param document the atom entry document to visit
91 * @return whether the visitor handled the document.
92 * Reimplementations of this method must return @c true.
93 */
94 virtual bool visitAtomEntryDocument(Syndication::Atom::EntryDocument *document);
95};
96
97} // namespace Syndication
98
99#endif // SYNDICATION_DOCUMENTVISITOR_H
An Atom 1.0 Entry Document, containing a single Atom entry outside of the context of a feed.
An Atom 1.0 Feed Document, containing metadata describing the feed and a number of entries.
Visitor interface, following the Visitor design pattern.
Document interface for format-specific feed documents as parsed from a document source (see DocumentS...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:56:56 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.