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 "contentvocab.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 ContentVocab::ContentVocabPrivate |
19 | { |
20 | public: |
21 | QString namespaceURI; |
22 | PropertyPtr encoded; |
23 | |
24 | static ContentVocab *sSelf; |
25 | static void cleanupContentVocab() |
26 | { |
27 | delete sSelf; |
28 | sSelf = nullptr; |
29 | } |
30 | }; |
31 | ContentVocab *ContentVocab::ContentVocabPrivate::sSelf = nullptr; |
32 | |
33 | ContentVocab::ContentVocab() |
34 | : d(new ContentVocabPrivate) |
35 | { |
36 | QString ns = QStringLiteral("http://purl.org/rss/1.0/modules/content/"); |
37 | |
38 | d->namespaceURI = ns; |
39 | |
40 | d->encoded = PropertyPtr(new Property(ns + QLatin1String("encoded"))); |
41 | } |
42 | |
43 | ContentVocab::~ContentVocab() = default; |
44 | |
45 | ContentVocab *ContentVocab::self() |
46 | { |
47 | static ContentVocabPrivate p; |
48 | if (!p.sSelf) { |
49 | p.sSelf = new ContentVocab; |
50 | qAddPostRoutine(ContentVocabPrivate::cleanupContentVocab); |
51 | } |
52 | return p.sSelf; |
53 | } |
54 | |
55 | const QString &ContentVocab::namespaceURI() const |
56 | { |
57 | return d->namespaceURI; |
58 | } |
59 | |
60 | PropertyPtr ContentVocab::encoded() const |
61 | { |
62 | return d->encoded; |
63 | } |
64 | |
65 | } // namespace RDF |
66 | } // namespace Syndication |
67 |