File indexing completed on 2024-10-06 06:46:13
0001 /* 0002 This file is part of the syndication library 0003 SPDX-FileCopyrightText: 2005 Frank Osterfeld <osterfeld@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef SYNDICATION_SPECIFICDOCUMENT_H 0009 #define SYNDICATION_SPECIFICDOCUMENT_H 0010 0011 #include "syndication_export.h" 0012 0013 #include <QSharedPointer> 0014 0015 class QString; 0016 0017 namespace Syndication 0018 { 0019 class DocumentVisitor; 0020 class SpecificDocument; 0021 0022 //@cond PRIVATE 0023 typedef QSharedPointer<SpecificDocument> SpecificDocumentPtr; 0024 //@endcond 0025 0026 /** 0027 * Document interface for format-specific feed documents as parsed from a 0028 * document source (see DocumentSource). 0029 * The Document classes from the several syndication formats must implement 0030 * this interface. It's main purpose is to provide access for document visitors 0031 * (see DocumentVisitor). 0032 * Usually it is not necessary to access the format-specific document at all, 0033 * use Feed for a format-agnostic interface to all feed documents supported by 0034 * the library. 0035 * 0036 * @author Frank Osterfeld 0037 */ 0038 class SYNDICATION_EXPORT SpecificDocument 0039 { 0040 public: 0041 /** 0042 * virtual dtor 0043 */ 0044 virtual ~SpecificDocument(); 0045 0046 /** 0047 * This must be implemented for the double dispatch 0048 * technique (Visitor pattern). 0049 * 0050 * The usual implementation is 0051 * @code 0052 * return visitor->visit(this); 0053 * @endcode 0054 * 0055 * See also DocumentVisitor. 0056 * 0057 * @param visitor the visitor "visiting" this object 0058 */ 0059 virtual bool accept(DocumentVisitor *visitor) = 0; 0060 0061 /** 0062 * Returns whether this document is valid or not. 0063 * Invalid documents do not contain any useful 0064 * information. 0065 */ 0066 virtual bool isValid() const = 0; 0067 0068 /** 0069 * Returns a description of the document for debugging purposes. 0070 * 0071 * @return debug string 0072 */ 0073 virtual QString debugInfo() const = 0; 0074 }; 0075 0076 } // namespace Syndication 0077 0078 #endif // SYNDICATION_SPECIFICDOCUMENT_H