Syndication

rssvocab.cpp
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#include "rssvocab.h"
9#include "property.h"
10
11#include <QCoreApplication>
12#include <QString>
13
14namespace Syndication
15{
16namespace RDF
17{
18class SYNDICATION_NO_EXPORT RSSVocab::RSSVocabPrivate
19{
20public:
21 QString namespaceURI;
22 PropertyPtr title;
23 PropertyPtr link;
24 PropertyPtr description;
25 PropertyPtr name;
26 PropertyPtr url;
27 PropertyPtr image;
28 ResourcePtr channel;
29 ResourcePtr item;
30 PropertyPtr items;
31 PropertyPtr textinput;
32
33 static RSSVocab *sSelf;
34 static void cleanupRSSVocab()
35 {
36 delete sSelf;
37 sSelf = nullptr;
38 }
39};
40RSSVocab *RSSVocab::RSSVocabPrivate::sSelf = nullptr;
41
42RSSVocab::RSSVocab()
43 : d(new RSSVocabPrivate)
44{
45 QString ns = QStringLiteral("http://purl.org/rss/1.0/");
46
47 d->namespaceURI = ns;
48
49 d->title = PropertyPtr(new Property(ns + QLatin1String("title")));
50 d->link = PropertyPtr(new Property(ns + QLatin1String("link")));
51 d->description = PropertyPtr(new Property(ns + QLatin1String("description")));
52 d->name = PropertyPtr(new Property(ns + QLatin1String("name")));
53 d->url = PropertyPtr(new Property(ns + QLatin1String("url")));
54 d->image = PropertyPtr(new Property(ns + QLatin1String("image")));
55 d->textinput = PropertyPtr(new Property(ns + QLatin1String("textinput")));
56 d->items = PropertyPtr(new Property(ns + QLatin1String("items")));
57 d->channel = ResourcePtr(new Resource(ns + QLatin1String("channel")));
58 d->item = ResourcePtr(new Resource(ns + QLatin1String("item")));
59}
60
61RSSVocab::~RSSVocab() = default;
62
63RSSVocab *RSSVocab::self()
64{
65 static RSSVocabPrivate p;
66 if (!p.sSelf) {
67 p.sSelf = new RSSVocab;
68 qAddPostRoutine(RSSVocabPrivate::cleanupRSSVocab);
69 }
70 return p.sSelf;
71}
72
73const QString &RSSVocab::namespaceURI() const
74{
75 return d->namespaceURI;
76}
77
78PropertyPtr RSSVocab::title() const
79{
80 return d->title;
81}
82
83PropertyPtr RSSVocab::description() const
84{
85 return d->description;
86}
87
88PropertyPtr RSSVocab::link() const
89{
90 return d->link;
91}
92
93PropertyPtr RSSVocab::name() const
94{
95 return d->name;
96}
97
98PropertyPtr RSSVocab::url() const
99{
100 return d->url;
101}
102
103PropertyPtr RSSVocab::image() const
104{
105 return d->image;
106}
107
108PropertyPtr RSSVocab::textinput() const
109{
110 return d->textinput;
111}
112
113PropertyPtr RSSVocab::items() const
114{
115 return d->items;
116}
117
118ResourcePtr RSSVocab::item() const
119{
120 return d->item;
121}
122
123ResourcePtr RSSVocab::channel() const
124{
125 return d->channel;
126}
127
128class SYNDICATION_NO_EXPORT RSS09Vocab::RSS09VocabPrivate
129{
130public:
131 QString namespaceURI;
132 PropertyPtr title;
133 PropertyPtr link;
134 PropertyPtr description;
135 PropertyPtr name;
136 PropertyPtr url;
137 PropertyPtr image;
138 ResourcePtr channel;
139 ResourcePtr item;
140 PropertyPtr textinput;
141 QStringList properties;
142 QStringList classes;
143
144 static RSS09Vocab *sSelf;
145 static void cleanupRSS09Vocab()
146 {
147 delete sSelf;
148 sSelf = nullptr;
149 }
150};
151RSS09Vocab *RSS09Vocab::RSS09VocabPrivate::sSelf = nullptr;
152
153RSS09Vocab::RSS09Vocab()
154 : d(new RSS09VocabPrivate)
155{
156 QString ns = QStringLiteral("http://my.netscape.com/rdf/simple/0.9/");
157
158 d->namespaceURI = ns;
159
160 d->title = PropertyPtr(new Property(ns + QLatin1String("title")));
161 d->properties.append(d->title->uri());
162 d->link = PropertyPtr(new Property(ns + QLatin1String("link")));
163 d->properties.append(d->link->uri());
164 d->description = PropertyPtr(new Property(ns + QLatin1String("description")));
165 d->properties.append(d->description->uri());
166 d->name = PropertyPtr(new Property(ns + QLatin1String("name")));
167 d->properties.append(d->name->uri());
168 d->url = PropertyPtr(new Property(ns + QLatin1String("url")));
169 d->properties.append(d->url->uri());
170 d->image = PropertyPtr(new Property(ns + QLatin1String("image")));
171 d->properties.append(d->image->uri());
172 d->textinput = PropertyPtr(new Property(ns + QLatin1String("textinput")));
173 d->properties.append(d->textinput->uri());
174 d->item = ResourcePtr(new Resource(ns + QLatin1String("item")));
175 d->classes.append(d->item->uri());
176 d->channel = ResourcePtr(new Resource(ns + QLatin1String("channel")));
177 d->classes.append(d->channel->uri());
178}
179
180RSS09Vocab::~RSS09Vocab() = default;
181
183{
184 if (!RSS09VocabPrivate::sSelf) {
185 RSS09VocabPrivate::sSelf = new RSS09Vocab;
186 qAddPostRoutine(RSS09VocabPrivate::cleanupRSS09Vocab);
187 }
188 return RSS09VocabPrivate::sSelf;
189}
190
192{
193 return d->namespaceURI;
194}
195
197{
198 return d->title;
199}
200
202{
203 return d->description;
204}
205
207{
208 return d->link;
209}
210
212{
213 return d->name;
214}
215
217{
218 return d->url;
219}
220
222{
223 return d->image;
224}
225
227{
228 return d->textinput;
229}
230
232{
233 return d->item;
234}
235
237{
238 return d->channel;
239}
240
242{
243 return d->classes;
244}
245
247{
248 return d->properties;
249}
250
251} // namespace RDF
252} // namespace Syndication
Singleton holding RDF class and property constants of the RSS 0.9 vocabulary.
Definition rssvocab.h:131
const QString & namespaceURI() const
namespace URI of the RSS 0.9 vocabulary, "http://web.resource.org/rss/0.9/"
Definition rssvocab.cpp:191
PropertyPtr textinput() const
RSS 0.9 textinput property, see Document::textinput() for more details.
Definition rssvocab.cpp:226
QStringList classes() const
returns a list containing all URIs representing classes in this vocabulary
Definition rssvocab.cpp:241
PropertyPtr name() const
RSS 0.9 name property, see Document::name() for more details.
Definition rssvocab.cpp:211
ResourcePtr item() const
RSS 0.9 item class, see Document::items() for more details.
Definition rssvocab.cpp:231
ResourcePtr channel() const
RSS 0.9 channel class, the instance is represented by Syndication::RDF::Document.
Definition rssvocab.cpp:236
PropertyPtr description() const
RSS 0.9 description property, see Document::description() for more details.
Definition rssvocab.cpp:201
QStringList properties() const
returns a list containing all URIs representing properties in this vocabulary
Definition rssvocab.cpp:246
PropertyPtr title() const
RSS 0.9 title property, see Document::title() for more details.
Definition rssvocab.cpp:196
PropertyPtr url() const
RSS 0.9 url property, see Document::url() for more details.
Definition rssvocab.cpp:216
PropertyPtr link() const
RSS 0.9 link property, see Document::link() for more details.
Definition rssvocab.cpp:206
static RSS09Vocab * self()
returns the singleton instance
Definition rssvocab.cpp:182
PropertyPtr image() const
RSS 0.9 image property, see Document::image() for more details.
Definition rssvocab.cpp:221
Singleton holding RDF class and property constants of the RSS 1.0 vocabulary.
Definition rssvocab.h:38
KIOCORE_EXPORT CopyJob * link(const QList< QUrl > &src, const QUrl &destDir, JobFlags flags=DefaultFlags)
QString name(StandardAction id)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.