File indexing completed on 2024-04-21 04:01:03

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() = default;
0048 
0049 SyndicationVocab *SyndicationVocab::self()
0050 {
0051     static SyndicationVocabPrivate p;
0052     if (!p.sSelf) {
0053         p.sSelf = new SyndicationVocab;
0054         qAddPostRoutine(SyndicationVocabPrivate::cleanupSyndicationVocab);
0055     }
0056     return p.sSelf;
0057 }
0058 
0059 const QString &SyndicationVocab::namespaceURI() const
0060 {
0061     return d->namespaceURI;
0062 }
0063 
0064 PropertyPtr SyndicationVocab::updatePeriod() const
0065 {
0066     return d->updatePeriod;
0067 }
0068 
0069 PropertyPtr SyndicationVocab::updateFrequency() const
0070 {
0071     return d->updateFrequency;
0072 }
0073 
0074 PropertyPtr SyndicationVocab::updateBase() const
0075 {
0076     return d->updateBase;
0077 }
0078 
0079 } // namespace RDF
0080 } // namespace Syndication