File indexing completed on 2024-12-08 06:45:00
0001 /* 0002 This file is part of the syndication library 0003 SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef SYNDICATION_SPECIFICITEMVISITOR_H 0009 #define SYNDICATION_SPECIFICITEMVISITOR_H 0010 0011 #include "syndication_export.h" 0012 0013 namespace Syndication 0014 { 0015 class SpecificItem; 0016 0017 namespace Atom 0018 { 0019 class Entry; 0020 } 0021 0022 namespace RDF 0023 { 0024 class Item; 0025 } 0026 0027 namespace RSS2 0028 { 0029 class Item; 0030 } 0031 0032 /** 0033 * Visitor interface, following the Visitor design pattern. Use this if you 0034 * want to process items and the way how to handle the items depends 0035 * on it's concrete type (e.g. RSS2::Item, RDF::Item...). 0036 * 0037 * TODO: insert code example 0038 * 0039 * @author Frank Osterfeld 0040 */ 0041 class SYNDICATION_EXPORT SpecificItemVisitor // krazy:exclude=dpointer 0042 { 0043 public: 0044 /** 0045 * destructor 0046 */ 0047 virtual ~SpecificItemVisitor(); 0048 0049 /** 0050 * call this method to handle an item. Depending on the concrete type 0051 * of the item, a specialized visit method is called. 0052 * 0053 * @param item the item to process 0054 * @return whether this visitor handles the type of the item 0055 */ 0056 virtual bool visit(SpecificItem *item); 0057 0058 /** 0059 * reimplement this method to handle RSS2 items. 0060 * 0061 * @param item the RSS2 item to visit 0062 * @return whether the visitor handled the item. 0063 * Reimplementations of this method must return @c true. 0064 */ 0065 virtual bool visitRSS2Item(Syndication::RSS2::Item *item); 0066 0067 /** 0068 * reimplement this method to handle RDF items. 0069 * 0070 * @param item the RDF item to visit 0071 * @return whether the visitor handled the item. 0072 * Reimplementations of this method must return @c true. 0073 */ 0074 virtual bool visitRDFItem(Syndication::RDF::Item *item); 0075 0076 /** 0077 * reimplement this method to handle Atom entries. 0078 * 0079 * @param item the Atom entry to visit 0080 * @return whether the visitor handled the entry. 0081 * Reimplementations of this method must return @c true. 0082 */ 0083 virtual bool visitAtomEntry(Syndication::Atom::Entry *item); 0084 }; 0085 0086 } // namespace Syndication 0087 0088 #endif // SYNDICATION_SPECIFICITEMVISITOR_H