1 | /* |
2 | This file is part of the syndication library |
3 | SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #ifndef SYNDICATION_SPECIFICITEMVISITOR_H |
9 | #define SYNDICATION_SPECIFICITEMVISITOR_H |
10 | |
11 | #include "syndication_export.h" |
12 | |
13 | namespace Syndication |
14 | { |
15 | class SpecificItem; |
16 | |
17 | namespace Atom |
18 | { |
19 | class Entry; |
20 | } |
21 | |
22 | namespace RDF |
23 | { |
24 | class Item; |
25 | } |
26 | |
27 | namespace RSS2 |
28 | { |
29 | class ; |
30 | } |
31 | |
32 | /** |
33 | * Visitor interface, following the Visitor design pattern. Use this if you |
34 | * want to process items and the way how to handle the items depends |
35 | * on it's concrete type (e.g. RSS2::Item, RDF::Item...). |
36 | * |
37 | * TODO: insert code example |
38 | * |
39 | * @author Frank Osterfeld |
40 | */ |
41 | class SYNDICATION_EXPORT SpecificItemVisitor // krazy:exclude=dpointer |
42 | { |
43 | public: |
44 | /** |
45 | * destructor |
46 | */ |
47 | virtual ~SpecificItemVisitor(); |
48 | |
49 | /** |
50 | * call this method to handle an item. Depending on the concrete type |
51 | * of the item, a specialized visit method is called. |
52 | * |
53 | * @param item the item to process |
54 | * @return whether this visitor handles the type of the item |
55 | */ |
56 | virtual bool visit(SpecificItem *item); |
57 | |
58 | /** |
59 | * reimplement this method to handle RSS2 items. |
60 | * |
61 | * @param item the RSS2 item to visit |
62 | * @return whether the visitor handled the item. |
63 | * Reimplementations of this method must return @c true. |
64 | */ |
65 | virtual bool (Syndication::RSS2::Item *item); |
66 | |
67 | /** |
68 | * reimplement this method to handle RDF items. |
69 | * |
70 | * @param item the RDF item to visit |
71 | * @return whether the visitor handled the item. |
72 | * Reimplementations of this method must return @c true. |
73 | */ |
74 | virtual bool visitRDFItem(Syndication::RDF::Item *item); |
75 | |
76 | /** |
77 | * reimplement this method to handle Atom entries. |
78 | * |
79 | * @param item the Atom entry to visit |
80 | * @return whether the visitor handled the entry. |
81 | * Reimplementations of this method must return @c true. |
82 | */ |
83 | virtual bool visitAtomEntry(Syndication::Atom::Entry *item); |
84 | }; |
85 | |
86 | } // namespace Syndication |
87 | |
88 | #endif // SYNDICATION_SPECIFICITEMVISITOR_H |
89 | |