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 | //@cond PRIVATE |
21 | typedef QSharedPointer<SpecificItem> SpecificItemPtr; |
22 | //@endcond |
23 | |
24 | /** |
25 | * Interface for all format-specific item-like classes, such as |
26 | * RSS2/RDF items, and Atom entries. To process items based on their |
27 | * format, use a SpecificItemVisitor. |
28 | * |
29 | * @author Frank Osterfeld |
30 | */ |
31 | class SYNDICATION_EXPORT SpecificItem |
32 | { |
33 | public: |
34 | /** |
35 | * virtual dtor |
36 | */ |
37 | virtual ~SpecificItem(); |
38 | |
39 | /** |
40 | * This must be implemented for the double dispatch |
41 | * technique (Visitor pattern). |
42 | * |
43 | * The usual implementation is |
44 | * @code |
45 | * return visitor->visit(this); |
46 | * @endcode |
47 | * |
48 | * See also SpecificItemVisitor. |
49 | * |
50 | * @param visitor the visitor "visiting" this object |
51 | */ |
52 | virtual bool accept(SpecificItemVisitor *visitor) = 0; |
53 | }; |
54 | |
55 | } // namespace Syndication |
56 | |
57 | #endif // SYNDICATION_SPECIFICITEM_H |
58 | |