Syndication

rdf/document.h
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_RDF_DOCUMENT_H
9#define SYNDICATION_RDF_DOCUMENT_H
10
11#include <syndication/rdf/resourcewrapper.h>
12
13#include <syndication/specificdocument.h>
14
15#include <memory>
16
17template<class T>
18class QList;
19
20namespace Syndication
21{
22namespace RDF
23{
24class Document;
25class Model;
26class DublinCore;
27class Image;
28class Item;
29class SyndicationInfo;
30class TextInput;
31//@cond PRIVATE
32typedef QSharedPointer<Document> DocumentPtr;
33//@endcond
34
35/**
36 * Document implementation for RDF, representing an RSS 1.0 feed.
37 *
38 * @author Frank Osterfeld
39 */
40class Document : public Syndication::SpecificDocument, public ResourceWrapper
41{
42 friend class ::Syndication::RDF::Model;
43
44public:
45 /**
46 * creates a wrapper wrapping a null resource
47 */
48 Document();
49
50 /**
51 * creates a document by wrapping a channel resource
52 *
53 * @param resource the channel resource to wrap
54 */
55 explicit Document(ResourcePtr resource);
56
57 /**
58 * creates a copy of another document
59 *
60 * @param other the document to copy
61 */
62 Document(const Document &other);
63
64 /**
65 * destructor
66 */
67 ~Document() override;
68
69 /**
70 * compares two documents. Two documents are equal if they wrap
71 * the same resource. See ResourceWrapper::operator==()
72 *
73 * @param other the document to compare to
74 */
75 bool operator==(const Document &other) const;
76
77 /**
78 * assigns another document
79 *
80 * @param other the document to assign
81 */
82 Document &operator=(const Document &other);
83
84 /**
85 * Used by visitors for double dispatch. See DocumentVisitor
86 * for more information.
87 * @param visitor the visitor calling the method
88 */
89 bool accept(DocumentVisitor *visitor) override;
90
91 /**
92 * returns whether this document is valid or not.
93 * Invalid documents do not contain any useful
94 * information.
95 */
96 bool isValid() const override;
97
98 /**
99 * title of the feed (required)
100 *
101 * @return feed title as TODO: define format
102 */
103 QString title() const;
104
105 /**
106 * A brief description of the channel's content, function, source, etc.
107 *
108 * @return TODO: define format etc.
109 */
110 QString description() const;
111
112 /**
113 * The URL to which an HTML rendering of the channel title will link,
114 * commonly the parent site's home or news page.
115 */
116 QString link() const;
117
118 /**
119 * returns a dublin core description of the document.
120 */
121 DublinCore dc() const;
122
123 /**
124 * returns syndication information describing how often this feed
125 * is updated.
126 */
127 SyndicationInfo syn() const;
128
129 /**
130 * list of items contained in this feed
131 */
132 QList<Item> items() const;
133
134 /**
135 * An image to be associated with an HTML rendering of the channel.
136 */
137 Image image() const;
138
139 /**
140 * An optional text input element associated with the channel
141 */
142 TextInput textInput() const;
143 //@cond PRIVATE
144 /**
145 * @internal
146 * checks the format of titles and returns the results
147 *
148 * @param containsMarkup whether the heuristic found HTML markup in
149 * titles
150 */
151 void getItemTitleFormatInfo(bool *containsMarkup) const;
152
153 /**
154 * @internal
155 * checks the format of descriptions and returns the results
156 *
157 * @param containsMarkup whether the heuristic found HTML markup in
158 * descriptions
159 */
160 void getItemDescriptionFormatInfo(bool *containsMarkup) const;
161 //@endcond PRIVATE
162
163 /**
164 * Returns a description of the document for debugging purposes.
165 *
166 * @return debug string
167 */
168 QString debugInfo() const override;
169
170private:
171 class Private;
172 std::unique_ptr<Private> const d;
173};
174
175} // namespace RDF
176} // namespace Syndication
177
178#endif // SYNDICATION_RDF_DOCUMENT_H
Document interface for format-specific feed documents as parsed from a document source (see DocumentS...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:15 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.