| 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 "dublincorevocab.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 DublinCoreVocab::DublinCoreVocabPrivate |
| 19 | { |
| 20 | public: |
| 21 | QString namespaceURI; |
| 22 | PropertyPtr contributor; |
| 23 | PropertyPtr coverage; |
| 24 | PropertyPtr creator; |
| 25 | PropertyPtr date; |
| 26 | PropertyPtr description; |
| 27 | PropertyPtr format; |
| 28 | PropertyPtr identifier; |
| 29 | PropertyPtr language; |
| 30 | PropertyPtr publisher; |
| 31 | PropertyPtr relation; |
| 32 | PropertyPtr rights; |
| 33 | PropertyPtr source; |
| 34 | PropertyPtr subject; |
| 35 | PropertyPtr title; |
| 36 | PropertyPtr type; |
| 37 | |
| 38 | static DublinCoreVocab *sSelf; |
| 39 | static void cleanupDublinCoreVocab() |
| 40 | { |
| 41 | delete sSelf; |
| 42 | sSelf = nullptr; |
| 43 | } |
| 44 | }; |
| 45 | DublinCoreVocab *DublinCoreVocab::DublinCoreVocabPrivate::sSelf = nullptr; |
| 46 | |
| 47 | DublinCoreVocab::DublinCoreVocab() |
| 48 | : d(new DublinCoreVocabPrivate) |
| 49 | { |
| 50 | QString ns = QStringLiteral("http://purl.org/dc/elements/1.1/"); |
| 51 | |
| 52 | d->namespaceURI = ns; |
| 53 | |
| 54 | d->contributor = PropertyPtr(new Property(ns + QLatin1String("contributor"))); |
| 55 | d->coverage = PropertyPtr(new Property(ns + QLatin1String("coverage"))); |
| 56 | d->creator = PropertyPtr(new Property(ns + QLatin1String("creator"))); |
| 57 | d->date = PropertyPtr(new Property(ns + QLatin1String("date"))); |
| 58 | d->description = PropertyPtr(new Property(ns + QLatin1String("description"))); |
| 59 | d->format = PropertyPtr(new Property(ns + QLatin1String("format"))); |
| 60 | d->identifier = PropertyPtr(new Property(ns + QLatin1String("identifier"))); |
| 61 | d->language = PropertyPtr(new Property(ns + QLatin1String("language"))); |
| 62 | d->publisher = PropertyPtr(new Property(ns + QLatin1String("publisher"))); |
| 63 | d->relation = PropertyPtr(new Property(ns + QLatin1String("relation"))); |
| 64 | d->rights = PropertyPtr(new Property(ns + QLatin1String("rights"))); |
| 65 | d->source = PropertyPtr(new Property(ns + QLatin1String("source"))); |
| 66 | d->subject = PropertyPtr(new Property(ns + QLatin1String("subject"))); |
| 67 | d->title = PropertyPtr(new Property(ns + QLatin1String("title"))); |
| 68 | d->type = PropertyPtr(new Property(ns + QLatin1String("type"))); |
| 69 | } |
| 70 | |
| 71 | DublinCoreVocab::~DublinCoreVocab() = default; |
| 72 | |
| 73 | DublinCoreVocab *DublinCoreVocab::self() |
| 74 | { |
| 75 | static DublinCoreVocabPrivate p; |
| 76 | if (!p.sSelf) { |
| 77 | p.sSelf = new DublinCoreVocab; |
| 78 | qAddPostRoutine(DublinCoreVocabPrivate::cleanupDublinCoreVocab); |
| 79 | } |
| 80 | return p.sSelf; |
| 81 | } |
| 82 | |
| 83 | const QString &DublinCoreVocab::namespaceURI() const |
| 84 | { |
| 85 | return d->namespaceURI; |
| 86 | } |
| 87 | |
| 88 | PropertyPtr DublinCoreVocab::contributor() const |
| 89 | { |
| 90 | return d->contributor; |
| 91 | } |
| 92 | |
| 93 | PropertyPtr DublinCoreVocab::creator() const |
| 94 | { |
| 95 | return d->creator; |
| 96 | } |
| 97 | |
| 98 | PropertyPtr DublinCoreVocab::coverage() const |
| 99 | { |
| 100 | return d->coverage; |
| 101 | } |
| 102 | |
| 103 | PropertyPtr DublinCoreVocab::date() const |
| 104 | { |
| 105 | return d->date; |
| 106 | } |
| 107 | |
| 108 | PropertyPtr DublinCoreVocab::description() const |
| 109 | { |
| 110 | return d->description; |
| 111 | } |
| 112 | |
| 113 | PropertyPtr DublinCoreVocab::format() const |
| 114 | { |
| 115 | return d->format; |
| 116 | } |
| 117 | |
| 118 | PropertyPtr DublinCoreVocab::identifier() const |
| 119 | { |
| 120 | return d->identifier; |
| 121 | } |
| 122 | |
| 123 | PropertyPtr DublinCoreVocab::language() const |
| 124 | { |
| 125 | return d->language; |
| 126 | } |
| 127 | |
| 128 | PropertyPtr DublinCoreVocab::publisher() const |
| 129 | { |
| 130 | return d->publisher; |
| 131 | } |
| 132 | |
| 133 | PropertyPtr DublinCoreVocab::relation() const |
| 134 | { |
| 135 | return d->relation; |
| 136 | } |
| 137 | |
| 138 | PropertyPtr DublinCoreVocab::rights() const |
| 139 | { |
| 140 | return d->rights; |
| 141 | } |
| 142 | |
| 143 | PropertyPtr DublinCoreVocab::source() const |
| 144 | { |
| 145 | return d->source; |
| 146 | } |
| 147 | |
| 148 | PropertyPtr DublinCoreVocab::subject() const |
| 149 | { |
| 150 | return d->subject; |
| 151 | } |
| 152 | |
| 153 | PropertyPtr DublinCoreVocab::title() const |
| 154 | { |
| 155 | return d->title; |
| 156 | } |
| 157 | |
| 158 | PropertyPtr DublinCoreVocab::type() const |
| 159 | { |
| 160 | return d->type; |
| 161 | } |
| 162 | |
| 163 | } // namespace RDF |
| 164 | } // namespace Syndication |
| 165 |
