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;
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
182RSS09Vocab *RSS09Vocab::self()
183{
184 if (!RSS09VocabPrivate::sSelf) {
185 RSS09VocabPrivate::sSelf = new RSS09Vocab;
186 qAddPostRoutine(RSS09VocabPrivate::cleanupRSS09Vocab);
187 }
188 return RSS09VocabPrivate::sSelf;
189}
190
191const QString &RSS09Vocab::namespaceURI() const
192{
193 return d->namespaceURI;
194}
195
196PropertyPtr RSS09Vocab::title() const
197{
198 return d->title;
199}
200
201PropertyPtr RSS09Vocab::description() const
202{
203 return d->description;
204}
205
206PropertyPtr RSS09Vocab::link() const
207{
208 return d->link;
209}
210
211PropertyPtr RSS09Vocab::name() const
212{
213 return d->name;
214}
215
216PropertyPtr RSS09Vocab::url() const
217{
218 return d->url;
219}
220
221PropertyPtr RSS09Vocab::image() const
222{
223 return d->image;
224}
225
226PropertyPtr RSS09Vocab::textinput() const
227{
228 return d->textinput;
229}
230
231ResourcePtr RSS09Vocab::item() const
232{
233 return d->item;
234}
235
236ResourcePtr RSS09Vocab::channel() const
237{
238 return d->channel;
239}
240
241QStringList RSS09Vocab::classes() const
242{
243 return d->classes;
244}
245
246QStringList RSS09Vocab::properties() const
247{
248 return d->properties;
249}
250
251} // namespace RDF
252} // namespace Syndication
KIOCORE_EXPORT CopyJob * link(const QList< QUrl > &src, const QUrl &destDir, JobFlags flags=DefaultFlags)
KGuiItem properties()
QString name(StandardShortcut id)
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.