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

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()
0044 {
0045     delete d;
0046 }
0047 
0048 ContentVocab *ContentVocab::self()
0049 {
0050     static ContentVocabPrivate p;
0051     if (!p.sSelf) {
0052         p.sSelf = new ContentVocab;
0053         qAddPostRoutine(ContentVocabPrivate::cleanupContentVocab);
0054     }
0055     return p.sSelf;
0056 }
0057 
0058 const QString &ContentVocab::namespaceURI() const
0059 {
0060     return d->namespaceURI;
0061 }
0062 
0063 PropertyPtr ContentVocab::encoded() const
0064 {
0065     return d->encoded;
0066 }
0067 
0068 } // namespace RDF
0069 } // namespace Syndication