| 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 | * \class Syndication::SpecificItemVisitor |
| 34 | * \inmodule Syndication |
| 35 | * \inheaderfile Syndication/SpecificItemVisitor |
| 36 | * |
| 37 | * \brief Visitor interface, following the Visitor design pattern. |
| 38 | * |
| 39 | * Use this if you |
| 40 | * want to process items and the way how to handle the items depends |
| 41 | * on it's concrete type (e.g. RSS2::Item, RDF::Item...). |
| 42 | * |
| 43 | * TODO: insert code example |
| 44 | */ |
| 45 | class SYNDICATION_EXPORT SpecificItemVisitor // krazy:exclude=dpointer |
| 46 | { |
| 47 | public: |
| 48 | virtual ~SpecificItemVisitor(); |
| 49 | |
| 50 | /*! |
| 51 | * call this method to handle an item. Depending on the concrete type |
| 52 | * of the item, a specialized visit method is called. |
| 53 | * |
| 54 | * \a item the item to process |
| 55 | * |
| 56 | * Returns whether this visitor handles the type of the item |
| 57 | */ |
| 58 | virtual bool visit(SpecificItem *item); |
| 59 | |
| 60 | /*! |
| 61 | * reimplement this method to handle RSS2 items. |
| 62 | * |
| 63 | * \a item the RSS2 item to visit |
| 64 | * |
| 65 | * Returns whether the visitor handled the item. |
| 66 | * |
| 67 | * Reimplementations of this method must return \c true. |
| 68 | */ |
| 69 | virtual bool (Syndication::RSS2::Item *item); |
| 70 | |
| 71 | /*! |
| 72 | * reimplement this method to handle RDF items. |
| 73 | * |
| 74 | * \a item the RDF item to visit |
| 75 | * |
| 76 | * Returns whether the visitor handled the item. |
| 77 | * |
| 78 | * Reimplementations of this method must return \c true. |
| 79 | */ |
| 80 | virtual bool visitRDFItem(Syndication::RDF::Item *item); |
| 81 | |
| 82 | /*! |
| 83 | * reimplement this method to handle Atom entries. |
| 84 | * |
| 85 | * \a item the Atom entry to visit |
| 86 | * |
| 87 | * Returns whether the visitor handled the entry. |
| 88 | * |
| 89 | * Reimplementations of this method must return \c true. |
| 90 | */ |
| 91 | virtual bool visitAtomEntry(Syndication::Atom::Entry *item); |
| 92 | }; |
| 93 | |
| 94 | } // namespace Syndication |
| 95 | |
| 96 | #endif // SYNDICATION_SPECIFICITEMVISITOR_H |
| 97 | |