1 | /* |
2 | * This file is part of the syndication library |
3 | * |
4 | * Copyright (C) 2006 Frank Osterfeld <osterfeld@kde.org> |
5 | * |
6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Library General Public |
8 | * License as published by the Free Software Foundation; either |
9 | * version 2 of the License, or (at your option) any later version. |
10 | * |
11 | * This library is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * Library General Public License for more details. |
15 | * |
16 | * You must have received a copy of the GNU Library General Public License |
17 | * along with this library; see the file COPYING.LIB. If not, write to |
18 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | * Boston, MA 02110-1301, USA. |
20 | * |
21 | */ |
22 | #ifndef SYNDICATION_SPECIFICITEMVISITOR_H |
23 | #define SYNDICATION_SPECIFICITEMVISITOR_H |
24 | |
25 | #include "ksyndication_export.h" |
26 | |
27 | namespace Syndication { |
28 | |
29 | class SpecificItem; |
30 | |
31 | namespace Atom |
32 | { |
33 | class Entry; |
34 | } |
35 | |
36 | namespace RDF |
37 | { |
38 | class Item; |
39 | } |
40 | |
41 | namespace RSS2 |
42 | { |
43 | class ; |
44 | } |
45 | |
46 | /** |
47 | * Visitor interface, following the Visitor design pattern. Use this if you |
48 | * want to process items and the way how to handle the items depends |
49 | * on it's concrete type (e.g. RSS2::Item, RDF::Item...). |
50 | * |
51 | * TODO: insert code example |
52 | * |
53 | * @author Frank Osterfeld |
54 | */ |
55 | class SYNDICATION_EXPORT SpecificItemVisitor //krazy:exclude=dpointer |
56 | { |
57 | public: |
58 | |
59 | /** |
60 | * destructor |
61 | */ |
62 | virtual ~SpecificItemVisitor(); |
63 | |
64 | /** |
65 | * call this method to handle an item. Depending on the concrete type |
66 | * of the item, a specialized visit method is called. |
67 | * |
68 | * @param item the item to process |
69 | * @return whether this visitor handles the type of the item |
70 | */ |
71 | virtual bool visit(SpecificItem* item); |
72 | |
73 | /** |
74 | * reimplement this method to handle RSS2 items. |
75 | * |
76 | * @param item the RSS2 item to visit |
77 | * @return whether the visitor handled the item. |
78 | * Reimplementations of this method must return @c true. |
79 | */ |
80 | virtual bool (Syndication::RSS2::Item* item); |
81 | |
82 | /** |
83 | * reimplement this method to handle RDF items. |
84 | * |
85 | * @param item the RDF item to visit |
86 | * @return whether the visitor handled the item. |
87 | * Reimplementations of this method must return @c true. |
88 | */ |
89 | virtual bool visitRDFItem(Syndication::RDF::Item* item); |
90 | |
91 | /** |
92 | * reimplement this method to handle Atom entries. |
93 | * |
94 | * @param item the Atom entry to visit |
95 | * @return whether the visitor handled the entry. |
96 | * Reimplementations of this method must return @c true. |
97 | */ |
98 | virtual bool visitAtomEntry(Syndication::Atom::Entry* item); |
99 | }; |
100 | |
101 | } // namespace Syndication |
102 | |
103 | #endif // SYNDICATION_SPECIFICITEMVISITOR_H |
104 | |