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

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 "rdfvocab.h"
0009 #include "model.h"
0010 #include "property.h"
0011 
0012 #include <QCoreApplication>
0013 #include <QString>
0014 
0015 namespace Syndication
0016 {
0017 namespace RDF
0018 {
0019 class SYNDICATION_NO_EXPORT RDFVocab::RDFVocabPrivate
0020 {
0021 public:
0022     QString namespaceURI;
0023     ResourcePtr seq;
0024     PropertyPtr type;
0025     PropertyPtr li;
0026 
0027     static RDFVocab *sSelf;
0028     static void cleanupRDFVocab()
0029     {
0030         delete sSelf;
0031         sSelf = nullptr;
0032     }
0033 };
0034 RDFVocab *RDFVocab::RDFVocabPrivate::sSelf = nullptr;
0035 
0036 RDFVocab *RDFVocab::self()
0037 {
0038     static RDFVocabPrivate p;
0039     if (!p.sSelf) {
0040         p.sSelf = new RDFVocab;
0041         qAddPostRoutine(RDFVocabPrivate::cleanupRDFVocab);
0042     }
0043     return p.sSelf;
0044 }
0045 
0046 RDFVocab::RDFVocab()
0047     : d(new RDFVocabPrivate)
0048 {
0049     QString ns = QStringLiteral("http://www.w3.org/1999/02/22-rdf-syntax-ns#");
0050 
0051     d->namespaceURI = ns;
0052 
0053     d->seq = ResourcePtr(new Resource(ns + QLatin1String("Seq")));
0054     d->type = PropertyPtr(new Property(ns + QLatin1String("type")));
0055     d->li = PropertyPtr(new Property(ns + QLatin1String("li")));
0056 }
0057 
0058 RDFVocab::~RDFVocab()
0059 {
0060     delete d;
0061 }
0062 
0063 ResourcePtr RDFVocab::seq()
0064 {
0065     return d->seq;
0066 }
0067 
0068 PropertyPtr RDFVocab::type()
0069 {
0070     return d->type;
0071 }
0072 
0073 PropertyPtr RDFVocab::li()
0074 {
0075     return d->li;
0076 }
0077 
0078 QString RDFVocab::namespaceURI()
0079 {
0080     return d->namespaceURI;
0081 }
0082 
0083 } // namespace RDF
0084 } // namespace Syndication