Syndication

rdf/item.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_ITEM_H
9#define SYNDICATION_RDF_ITEM_H
10
11#include <syndication/rdf/document.h>
12#include <syndication/rdf/resourcewrapper.h>
13
14#include <syndication/specificitem.h>
15
16#include <memory>
17
18class QString;
19
20namespace Syndication
21{
22class SpecificItemVisitor;
23
24namespace RDF
25{
26class DublinCore;
27class Item;
28
29/**
30 * An RSS 1.0 item.
31 * (It is a convenience wrapper for the
32 * underlying RDF resource, which can be accessed via resource()).
33 *
34 * @author Frank Osterfeld
35 */
36class Item : public ResourceWrapper, public SpecificItem
37{
38public:
39 /**
40 * creates an item object wrapping a null resource, isNull() is
41 * @c true.
42 */
43 Item();
44
45 /**
46 * Creates an item wrapping the given resource
47 * @param resource resource to wrap, should be of type
48 * of rss1:item, otherwise the wrapper will not return useful
49 * information.
50 * @param doc the document this item is part of. Used by Document
51 */
52 explicit Item(ResourcePtr resource, DocumentPtr doc = DocumentPtr());
53
54 /**
55 * copies an item
56 *
57 * @param other item to copy
58 */
59 Item(const Item &other);
60
61 /**
62 * virtual destructor
63 */
64 ~Item() override;
65
66 /**
67 * assigns another item
68 *
69 * @param other the item to assign
70 */
71 Item &operator=(const Item &other);
72
73 /**
74 * compares two item instances. Two instances are equal,
75 * if the wrapped resources are equal. See ResourceWrapper::operator==()
76 * for details.
77 *
78 * @param other the item to compare this item to
79 */
80 bool operator==(const Item &other) const;
81
82 /**
83 * interface for item visitors. See SpecificItemVisitor for
84 * more information.
85 *
86 * @param visitor a visitor visiting this object
87 */
88 bool accept(SpecificItemVisitor *visitor) override;
89
90 /**
91 * The item's title (required).
92 *
93 * @return The item's title as HTML, or a null string if not specified
94 */
95 QString title() const;
96
97 /**
98 * A brief description/abstract of the item.
99 * if encodedContent() is not provided, this can also contain the full
100 * content.
101 *
102 * @return description as HTML, or a null string if not specified
103 */
104 QString description() const;
105
106 /**
107 * The item's URL, usually pointing to a website containing the
108 * full content (news article, blog entry etc.).
109 *
110 * @return the link
111 */
112 QString link() const;
113
114 /**
115 * returns a dublin core description of this
116 * item (including metadata such as item author
117 * or subject)
118 */
119 DublinCore dc() const;
120
121 /**
122 * returns content (@c content:encoded) as HTML.
123 *
124 * @return content as HTML, or a null string if not specified
125 */
126 QString encodedContent() const;
127
128 //@cond PRIVATE
129 /**
130 * @internal
131 * returns the title unmodified
132 * used by Document
133 */
134 QString originalTitle() const;
135
136 /**
137 * @internal
138 * returns the description unmodified
139 * used by Document
140 */
141 QString originalDescription() const;
142
143 //@endcond
144
145 /**
146 * Returns a description of the item for debugging purposes.
147 *
148 * @return debug string
149 */
150 QString debugInfo() const;
151
152private:
153 class Private;
154 std::unique_ptr<Private> const d;
155};
156
157} // namespace RDF
158} // namespace Syndication
159
160#endif // SYNDICATION_RDF_ITEM_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:39:48 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.