1 | /* |
2 | This file is part of the syndication library |
3 | SPDX-FileCopyrightText: 2005 Frank Osterfeld <osterfeld@kde.org> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #ifndef SYNDICATION_SPECIFICDOCUMENT_H |
9 | #define SYNDICATION_SPECIFICDOCUMENT_H |
10 | |
11 | #include "syndication_export.h" |
12 | |
13 | #include <QSharedPointer> |
14 | |
15 | class QString; |
16 | |
17 | namespace Syndication |
18 | { |
19 | class DocumentVisitor; |
20 | class SpecificDocument; |
21 | |
22 | typedef QSharedPointer<SpecificDocument> SpecificDocumentPtr; |
23 | |
24 | /*! |
25 | * \class Syndication::SpecificDocument |
26 | * \inmodule Syndication |
27 | * \inheaderfile Syndication/SpecificDocument |
28 | * |
29 | * \brief Document interface for format-specific feed documents as parsed from a |
30 | * document source (see DocumentSource). |
31 | * |
32 | * The Document classes from the several syndication formats must implement |
33 | * this interface. It's main purpose is to provide access for document visitors |
34 | * (see DocumentVisitor). |
35 | * |
36 | * Usually it is not necessary to access the format-specific document at all, |
37 | * use Feed for a format-agnostic interface to all feed documents supported by |
38 | * the library. |
39 | */ |
40 | class SYNDICATION_EXPORT SpecificDocument |
41 | { |
42 | public: |
43 | virtual ~SpecificDocument(); |
44 | |
45 | /*! |
46 | * This must be implemented for the double dispatch |
47 | * technique (Visitor pattern). |
48 | * |
49 | * The usual implementation is |
50 | * \code |
51 | * return visitor->visit(this); |
52 | * \endcode |
53 | * |
54 | * See also DocumentVisitor. |
55 | * |
56 | * \a visitor the visitor "visiting" this object |
57 | */ |
58 | virtual bool accept(DocumentVisitor *visitor) = 0; |
59 | |
60 | /*! |
61 | * Returns whether this document is valid or not. |
62 | * |
63 | * Invalid documents do not contain any useful |
64 | * information. |
65 | */ |
66 | virtual bool isValid() const = 0; |
67 | |
68 | /*! |
69 | * Returns a description of the document for debugging purposes. |
70 | */ |
71 | virtual QString debugInfo() const = 0; |
72 | }; |
73 | |
74 | } // namespace Syndication |
75 | |
76 | #endif // SYNDICATION_SPECIFICDOCUMENT_H |
77 | |