File indexing completed on 2024-04-28 15:34:26

0001 /*
0002     This file is part of the syndication library
0003     SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #include "syndicationvocab.h"
0009 #include "property.h"
0010 
0011 #include <QCoreApplication>
0012 #include <QString>
0013 
0014 namespace Syndication
0015 {
0016 namespace RDF
0017 {
0018 class SYNDICATION_NO_EXPORT SyndicationVocab::SyndicationVocabPrivate
0019 {
0020 public:
0021     QString namespaceURI;
0022     PropertyPtr updatePeriod;
0023     PropertyPtr updateFrequency;
0024     PropertyPtr updateBase;
0025 
0026     static SyndicationVocab *sSelf;
0027     static void cleanupSyndicationVocab()
0028     {
0029         delete sSelf;
0030         sSelf = nullptr;
0031     }
0032 };
0033 SyndicationVocab *SyndicationVocab::SyndicationVocabPrivate::sSelf = nullptr;
0034 
0035 SyndicationVocab::SyndicationVocab()
0036     : d(new SyndicationVocabPrivate)
0037 {
0038     QString ns = QStringLiteral("http://purl.org/rss/1.0/modules/syndication/");
0039 
0040     d->namespaceURI = ns;
0041 
0042     d->updatePeriod = PropertyPtr(new Property(ns + QLatin1String("updatePeriod")));
0043     d->updateFrequency = PropertyPtr(new Property(ns + QLatin1String("updateFrequency")));
0044     d->updateBase = PropertyPtr(new Property(ns + QLatin1String("updateBase")));
0045 }
0046 
0047 SyndicationVocab::~SyndicationVocab()
0048 {
0049     delete d;
0050 }
0051 
0052 SyndicationVocab *SyndicationVocab::self()
0053 {
0054     static SyndicationVocabPrivate p;
0055     if (!p.sSelf) {
0056         p.sSelf = new SyndicationVocab;
0057         qAddPostRoutine(SyndicationVocabPrivate::cleanupSyndicationVocab);
0058     }
0059     return p.sSelf;
0060 }
0061 
0062 const QString &SyndicationVocab::namespaceURI() const
0063 {
0064     return d->namespaceURI;
0065 }
0066 
0067 PropertyPtr SyndicationVocab::updatePeriod() const
0068 {
0069     return d->updatePeriod;
0070 }
0071 
0072 PropertyPtr SyndicationVocab::updateFrequency() const
0073 {
0074     return d->updateFrequency;
0075 }
0076 
0077 PropertyPtr SyndicationVocab::updateBase() const
0078 {
0079     return d->updateBase;
0080 }
0081 
0082 } // namespace RDF
0083 } // namespace Syndication