syndication/rdf
contentvocab.cpp
00001 /* 00002 * This file is part of the syndication library 00003 * 00004 * Copyright (C) 2006 Frank Osterfeld <osterfeld@kde.org> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 * 00021 */ 00022 00023 #include "contentvocab.h" 00024 #include "property.h" 00025 00026 #include <QtCore/QCoreApplication> 00027 #include <QtCore/QString> 00028 00029 namespace Syndication { 00030 namespace RDF { 00031 00032 class ContentVocab::ContentVocabPrivate 00033 { 00034 public: 00035 00036 QString namespaceURI; 00037 PropertyPtr encoded; 00038 00039 static ContentVocab *sSelf; 00040 static void cleanupContentVocab() 00041 { 00042 delete sSelf; 00043 sSelf = 0; 00044 } 00045 }; 00046 ContentVocab *ContentVocab::ContentVocabPrivate::sSelf = 0; 00047 00048 ContentVocab::ContentVocab() : d(new ContentVocabPrivate) 00049 { 00050 QString ns = QString::fromUtf8("http://purl.org/rss/1.0/modules/content/"); 00051 00052 d->namespaceURI = ns; 00053 00054 d->encoded = PropertyPtr( new Property(ns + QString::fromUtf8("encoded")) ); 00055 00056 } 00057 00058 ContentVocab::~ContentVocab() 00059 { 00060 delete d; 00061 } 00062 00063 ContentVocab* ContentVocab::self() 00064 { 00065 static ContentVocabPrivate p; 00066 if(!p.sSelf) { 00067 p.sSelf = new ContentVocab; 00068 qAddPostRoutine(ContentVocabPrivate::cleanupContentVocab); 00069 } 00070 return p.sSelf; 00071 } 00072 00073 const QString& ContentVocab::namespaceURI() const 00074 { 00075 return d->namespaceURI; 00076 } 00077 00078 PropertyPtr ContentVocab::encoded() const 00079 { 00080 return d->encoded; 00081 } 00082 00083 } // namespace RDF 00084 } // namespace Syndication