| 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 "syndicationvocab.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 SyndicationVocab::SyndicationVocabPrivate |
| 19 | { |
| 20 | public: |
| 21 | QString namespaceURI; |
| 22 | PropertyPtr updatePeriod; |
| 23 | PropertyPtr updateFrequency; |
| 24 | PropertyPtr updateBase; |
| 25 | |
| 26 | static SyndicationVocab *sSelf; |
| 27 | static void cleanupSyndicationVocab() |
| 28 | { |
| 29 | delete sSelf; |
| 30 | sSelf = nullptr; |
| 31 | } |
| 32 | }; |
| 33 | SyndicationVocab *SyndicationVocab::SyndicationVocabPrivate::sSelf = nullptr; |
| 34 | |
| 35 | SyndicationVocab::SyndicationVocab() |
| 36 | : d(new SyndicationVocabPrivate) |
| 37 | { |
| 38 | QString ns = QStringLiteral("http://purl.org/rss/1.0/modules/syndication/"); |
| 39 | |
| 40 | d->namespaceURI = ns; |
| 41 | |
| 42 | d->updatePeriod = PropertyPtr(new Property(ns + QLatin1String("updatePeriod"))); |
| 43 | d->updateFrequency = PropertyPtr(new Property(ns + QLatin1String("updateFrequency"))); |
| 44 | d->updateBase = PropertyPtr(new Property(ns + QLatin1String("updateBase"))); |
| 45 | } |
| 46 | |
| 47 | SyndicationVocab::~SyndicationVocab() = default; |
| 48 | |
| 49 | SyndicationVocab *SyndicationVocab::self() |
| 50 | { |
| 51 | static SyndicationVocabPrivate p; |
| 52 | if (!p.sSelf) { |
| 53 | p.sSelf = new SyndicationVocab; |
| 54 | qAddPostRoutine(SyndicationVocabPrivate::cleanupSyndicationVocab); |
| 55 | } |
| 56 | return p.sSelf; |
| 57 | } |
| 58 | |
| 59 | const QString &SyndicationVocab::namespaceURI() const |
| 60 | { |
| 61 | return d->namespaceURI; |
| 62 | } |
| 63 | |
| 64 | PropertyPtr SyndicationVocab::updatePeriod() const |
| 65 | { |
| 66 | return d->updatePeriod; |
| 67 | } |
| 68 | |
| 69 | PropertyPtr SyndicationVocab::updateFrequency() const |
| 70 | { |
| 71 | return d->updateFrequency; |
| 72 | } |
| 73 | |
| 74 | PropertyPtr SyndicationVocab::updateBase() const |
| 75 | { |
| 76 | return d->updateBase; |
| 77 | } |
| 78 | |
| 79 | } // namespace RDF |
| 80 | } // namespace Syndication |
| 81 |
