Syndication

rssvocab.cpp
1 /*
2  This file is part of the syndication library
3  SPDX-FileCopyrightText: 2006 Frank Osterfeld <[email protected]>
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 
14 namespace Syndication
15 {
16 namespace RDF
17 {
18 class SYNDICATION_NO_EXPORT RSSVocab::RSSVocabPrivate
19 {
20 public:
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 };
40 RSSVocab *RSSVocab::RSSVocabPrivate::sSelf = nullptr;
41 
42 RSSVocab::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 
61 RSSVocab::~RSSVocab()
62 {
63  delete d;
64 }
65 
66 RSSVocab *RSSVocab::self()
67 {
68  static RSSVocabPrivate p;
69  if (!p.sSelf) {
70  p.sSelf = new RSSVocab;
71  qAddPostRoutine(RSSVocabPrivate::cleanupRSSVocab);
72  }
73  return p.sSelf;
74 }
75 
76 const QString &RSSVocab::namespaceURI() const
77 {
78  return d->namespaceURI;
79 }
80 
81 PropertyPtr RSSVocab::title() const
82 {
83  return d->title;
84 }
85 
86 PropertyPtr RSSVocab::description() const
87 {
88  return d->description;
89 }
90 
91 PropertyPtr RSSVocab::link() const
92 {
93  return d->link;
94 }
95 
96 PropertyPtr RSSVocab::name() const
97 {
98  return d->name;
99 }
100 
101 PropertyPtr RSSVocab::url() const
102 {
103  return d->url;
104 }
105 
106 PropertyPtr RSSVocab::image() const
107 {
108  return d->image;
109 }
110 
111 PropertyPtr RSSVocab::textinput() const
112 {
113  return d->textinput;
114 }
115 
116 PropertyPtr RSSVocab::items() const
117 {
118  return d->items;
119 }
120 
121 ResourcePtr RSSVocab::item() const
122 {
123  return d->item;
124 }
125 
126 ResourcePtr RSSVocab::channel() const
127 {
128  return d->channel;
129 }
130 
131 class SYNDICATION_NO_EXPORT RSS09Vocab::RSS09VocabPrivate
132 {
133 public:
134  QString namespaceURI;
135  PropertyPtr title;
136  PropertyPtr link;
137  PropertyPtr description;
138  PropertyPtr name;
139  PropertyPtr url;
140  PropertyPtr image;
141  ResourcePtr channel;
142  ResourcePtr item;
143  PropertyPtr textinput;
145  QStringList classes;
146 
147  static RSS09Vocab *sSelf;
148  static void cleanupRSS09Vocab()
149  {
150  delete sSelf;
151  sSelf = nullptr;
152  }
153 };
154 RSS09Vocab *RSS09Vocab::RSS09VocabPrivate::sSelf = nullptr;
155 
156 RSS09Vocab::RSS09Vocab()
157  : d(new RSS09VocabPrivate)
158 {
159  QString ns = QStringLiteral("http://my.netscape.com/rdf/simple/0.9/");
160 
161  d->namespaceURI = ns;
162 
163  d->title = PropertyPtr(new Property(ns + QLatin1String("title")));
164  d->properties.append(d->title->uri());
165  d->link = PropertyPtr(new Property(ns + QLatin1String("link")));
166  d->properties.append(d->link->uri());
167  d->description = PropertyPtr(new Property(ns + QLatin1String("description")));
168  d->properties.append(d->description->uri());
169  d->name = PropertyPtr(new Property(ns + QLatin1String("name")));
170  d->properties.append(d->name->uri());
171  d->url = PropertyPtr(new Property(ns + QLatin1String("url")));
172  d->properties.append(d->url->uri());
173  d->image = PropertyPtr(new Property(ns + QLatin1String("image")));
174  d->properties.append(d->image->uri());
175  d->textinput = PropertyPtr(new Property(ns + QLatin1String("textinput")));
176  d->properties.append(d->textinput->uri());
177  d->item = ResourcePtr(new Resource(ns + QLatin1String("item")));
178  d->classes.append(d->item->uri());
179  d->channel = ResourcePtr(new Resource(ns + QLatin1String("channel")));
180  d->classes.append(d->channel->uri());
181 }
182 
183 RSS09Vocab::~RSS09Vocab()
184 {
185  delete d;
186 }
187 
188 RSS09Vocab *RSS09Vocab::self()
189 {
190  if (!RSS09VocabPrivate::sSelf) {
191  RSS09VocabPrivate::sSelf = new RSS09Vocab;
192  qAddPostRoutine(RSS09VocabPrivate::cleanupRSS09Vocab);
193  }
194  return RSS09VocabPrivate::sSelf;
195 }
196 
197 const QString &RSS09Vocab::namespaceURI() const
198 {
199  return d->namespaceURI;
200 }
201 
202 PropertyPtr RSS09Vocab::title() const
203 {
204  return d->title;
205 }
206 
207 PropertyPtr RSS09Vocab::description() const
208 {
209  return d->description;
210 }
211 
212 PropertyPtr RSS09Vocab::link() const
213 {
214  return d->link;
215 }
216 
217 PropertyPtr RSS09Vocab::name() const
218 {
219  return d->name;
220 }
221 
222 PropertyPtr RSS09Vocab::url() const
223 {
224  return d->url;
225 }
226 
227 PropertyPtr RSS09Vocab::image() const
228 {
229  return d->image;
230 }
231 
232 PropertyPtr RSS09Vocab::textinput() const
233 {
234  return d->textinput;
235 }
236 
237 ResourcePtr RSS09Vocab::item() const
238 {
239  return d->item;
240 }
241 
242 ResourcePtr RSS09Vocab::channel() const
243 {
244  return d->channel;
245 }
246 
247 QStringList RSS09Vocab::classes() const
248 {
249  return d->classes;
250 }
251 
252 QStringList RSS09Vocab::properties() const
253 {
254  return d->properties;
255 }
256 
257 } // namespace RDF
258 } // namespace Syndication
KGuiItem properties()
KIOCORE_EXPORT CopyJob * link(const QList< QUrl > &src, const QUrl &destDir, JobFlags flags=DefaultFlags)
const char * name(StandardAction id)
Property()
creates a null property
Definition: property.cpp:15
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Dec 1 2023 03:52:05 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.