File indexing completed on 2024-04-14 03:58: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 "contentvocab.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 ContentVocab::ContentVocabPrivate
0019 {
0020 public:
0021     QString namespaceURI;
0022     PropertyPtr encoded;
0023 
0024     static ContentVocab *sSelf;
0025     static void cleanupContentVocab()
0026     {
0027         delete sSelf;
0028         sSelf = nullptr;
0029     }
0030 };
0031 ContentVocab *ContentVocab::ContentVocabPrivate::sSelf = nullptr;
0032 
0033 ContentVocab::ContentVocab()
0034     : d(new ContentVocabPrivate)
0035 {
0036     QString ns = QStringLiteral("http://purl.org/rss/1.0/modules/content/");
0037 
0038     d->namespaceURI = ns;
0039 
0040     d->encoded = PropertyPtr(new Property(ns + QLatin1String("encoded")));
0041 }
0042 
0043 ContentVocab::~ContentVocab() = default;
0044 
0045 ContentVocab *ContentVocab::self()
0046 {
0047     static ContentVocabPrivate p;
0048     if (!p.sSelf) {
0049         p.sSelf = new ContentVocab;
0050         qAddPostRoutine(ContentVocabPrivate::cleanupContentVocab);
0051     }
0052     return p.sSelf;
0053 }
0054 
0055 const QString &ContentVocab::namespaceURI() const
0056 {
0057     return d->namespaceURI;
0058 }
0059 
0060 PropertyPtr ContentVocab::encoded() const
0061 {
0062     return d->encoded;
0063 }
0064 
0065 } // namespace RDF
0066 } // namespace Syndication