1 | /* |
2 | * This file is part of the syndication library |
3 | * |
4 | * Copyright (C) 2005 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_SPECIFICDOCUMENT_H |
23 | #define SYNDICATION_SPECIFICDOCUMENT_H |
24 | |
25 | #include "ksyndication_export.h" |
26 | |
27 | #include <boost/shared_ptr.hpp> |
28 | |
29 | class QString; |
30 | |
31 | namespace Syndication { |
32 | |
33 | class DocumentVisitor; |
34 | class SpecificDocument; |
35 | |
36 | //@cond PRIVATE |
37 | typedef boost::shared_ptr<SpecificDocument> SpecificDocumentPtr; |
38 | //@endcond |
39 | |
40 | /** |
41 | * Document interface for format-specific feed documents as parsed from a |
42 | * document source (see DocumentSource). |
43 | * The Document classes from the several syndication formats must implement |
44 | * this interface. It's main purpose is to provide access for document visitors |
45 | * (see DocumentVisitor). |
46 | * Usually it is not necessary to access the format-specific document at all, |
47 | * use Feed for a format-agnostic interface to all feed documents supported by |
48 | * the library. |
49 | * |
50 | * @author Frank Osterfeld |
51 | */ |
52 | class SYNDICATION_EXPORT SpecificDocument |
53 | { |
54 | public: |
55 | |
56 | /** |
57 | * virtual dtor |
58 | */ |
59 | virtual ~SpecificDocument(); |
60 | |
61 | /** |
62 | * This must be implemented for the double dispatch |
63 | * technique (Visitor pattern). |
64 | * |
65 | * The usual implementation is |
66 | * @code |
67 | * return visitor->visit(this); |
68 | * @endcode |
69 | * |
70 | * See also DocumentVisitor. |
71 | * |
72 | * @param visitor the visitor "visiting" this object |
73 | */ |
74 | virtual bool accept(DocumentVisitor* visitor) = 0; |
75 | |
76 | /** |
77 | * Returns whether this document is valid or not. |
78 | * Invalid documents do not contain any useful |
79 | * information. |
80 | */ |
81 | virtual bool isValid() const = 0; |
82 | |
83 | /** |
84 | * Returns a description of the document for debugging purposes. |
85 | * |
86 | * @return debug string |
87 | */ |
88 | virtual QString debugInfo() const = 0; |
89 | }; |
90 | |
91 | } // namespace Syndication |
92 | |
93 | #endif // SYNDICATION_SPECIFICDOCUMENT_H |
94 | |
95 | |