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