| 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_SPECIFICITEM_H |
| 9 | #define SYNDICATION_SPECIFICITEM_H |
| 10 | |
| 11 | #include <QSharedPointer> |
| 12 | |
| 13 | #include "syndication_export.h" |
| 14 | |
| 15 | namespace Syndication |
| 16 | { |
| 17 | class SpecificItemVisitor; |
| 18 | class SpecificItem; |
| 19 | |
| 20 | typedef QSharedPointer<SpecificItem> SpecificItemPtr; |
| 21 | |
| 22 | /*! |
| 23 | * \class Syndication::SpecificItem |
| 24 | * \inmodule Syndication |
| 25 | * \inheaderfile Syndication/SpecificItem |
| 26 | * |
| 27 | * \brief Interface for all format-specific item-like classes, such as |
| 28 | * RSS2/RDF items, and Atom entries. |
| 29 | * |
| 30 | * To process items based on their format, use a SpecificItemVisitor. |
| 31 | */ |
| 32 | class SYNDICATION_EXPORT SpecificItem |
| 33 | { |
| 34 | public: |
| 35 | virtual ~SpecificItem(); |
| 36 | |
| 37 | /*! |
| 38 | * This must be implemented for the double dispatch |
| 39 | * technique (Visitor pattern). |
| 40 | * |
| 41 | * The usual implementation is |
| 42 | * \code |
| 43 | * return visitor->visit(this); |
| 44 | * \endcode |
| 45 | * |
| 46 | * See also SpecificItemVisitor. |
| 47 | * |
| 48 | * \a visitor the visitor "visiting" this object |
| 49 | */ |
| 50 | virtual bool accept(SpecificItemVisitor *visitor) = 0; |
| 51 | }; |
| 52 | |
| 53 | } // namespace Syndication |
| 54 | |
| 55 | #endif // SYNDICATION_SPECIFICITEM_H |
| 56 | |