syndication/rdf
rssvocab.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 "rssvocab.h" 00024 #include "property.h" 00025 00026 #include <QtCore/QCoreApplication> 00027 #include <QtCore/QString> 00028 #include <QtCore/QStringList> 00029 00030 namespace Syndication { 00031 namespace RDF { 00032 00033 class RSSVocab::RSSVocabPrivate 00034 { 00035 public: 00036 00037 QString namespaceURI; 00038 PropertyPtr title; 00039 PropertyPtr link; 00040 PropertyPtr description; 00041 PropertyPtr name; 00042 PropertyPtr url; 00043 PropertyPtr image; 00044 ResourcePtr channel; 00045 ResourcePtr item; 00046 PropertyPtr items; 00047 PropertyPtr textinput; 00048 00049 static RSSVocab *sSelf; 00050 static void cleanupRSSVocab() 00051 { 00052 delete sSelf; 00053 sSelf = 0; 00054 } 00055 }; 00056 RSSVocab *RSSVocab::RSSVocabPrivate::sSelf = 0; 00057 00058 RSSVocab::RSSVocab() : d(new RSSVocabPrivate) 00059 { 00060 QString ns = QString::fromUtf8("http://purl.org/rss/1.0/"); 00061 00062 d->namespaceURI = ns; 00063 00064 d->title = PropertyPtr( new Property(ns + QString::fromUtf8("title")) ); 00065 d->link = PropertyPtr( new Property(ns + QString::fromUtf8("link")) ); 00066 d->description = PropertyPtr( new Property(ns + QString::fromUtf8("description")) ); 00067 d->name = PropertyPtr( new Property(ns + QString::fromUtf8("name")) ); 00068 d->url = PropertyPtr( new Property(ns + QString::fromUtf8("url")) ); 00069 d->image = PropertyPtr( new Property(ns + QString::fromUtf8("image")) ); 00070 d->textinput = PropertyPtr( new Property(ns + QString::fromUtf8("textinput")) ); 00071 d->items = PropertyPtr( new Property(ns + QString::fromUtf8("items")) ); 00072 d->channel = ResourcePtr( new Resource(ns + QString::fromUtf8("channel")) ); 00073 d->item = ResourcePtr( new Resource(ns + QString::fromUtf8("item")) ); 00074 } 00075 00076 RSSVocab::~RSSVocab() 00077 { 00078 delete d; 00079 } 00080 00081 RSSVocab* RSSVocab::self() 00082 { 00083 static RSSVocabPrivate p; 00084 if(!p.sSelf) { 00085 p.sSelf = new RSSVocab; 00086 qAddPostRoutine(RSSVocabPrivate::cleanupRSSVocab); 00087 } 00088 return p.sSelf; 00089 } 00090 00091 const QString& RSSVocab::namespaceURI() const 00092 { 00093 return d->namespaceURI; 00094 } 00095 00096 PropertyPtr RSSVocab::title() const 00097 { 00098 return d->title; 00099 } 00100 00101 PropertyPtr RSSVocab::description() const 00102 { 00103 return d->description; 00104 } 00105 00106 PropertyPtr RSSVocab::link() const 00107 { 00108 return d->link; 00109 } 00110 00111 PropertyPtr RSSVocab::name() const 00112 { 00113 return d->name; 00114 } 00115 00116 PropertyPtr RSSVocab::url() const 00117 { 00118 return d->url; 00119 } 00120 00121 PropertyPtr RSSVocab::image() const 00122 { 00123 return d->image; 00124 } 00125 00126 PropertyPtr RSSVocab::textinput() const 00127 { 00128 return d->textinput; 00129 } 00130 00131 00132 PropertyPtr RSSVocab::items() const 00133 { 00134 return d->items; 00135 } 00136 00137 ResourcePtr RSSVocab::item() const 00138 { 00139 return d->item; 00140 } 00141 00142 ResourcePtr RSSVocab::channel() const 00143 { 00144 return d->channel; 00145 } 00146 00147 class RSS09Vocab::RSS09VocabPrivate 00148 { 00149 public: 00150 00151 QString namespaceURI; 00152 PropertyPtr title; 00153 PropertyPtr link; 00154 PropertyPtr description; 00155 PropertyPtr name; 00156 PropertyPtr url; 00157 PropertyPtr image; 00158 ResourcePtr channel; 00159 ResourcePtr item; 00160 PropertyPtr textinput; 00161 QStringList properties; 00162 QStringList classes; 00163 00164 static RSS09Vocab *sSelf; 00165 static void cleanupRSS09Vocab() 00166 { 00167 delete sSelf; 00168 sSelf = 0; 00169 } 00170 }; 00171 RSS09Vocab *RSS09Vocab::RSS09VocabPrivate::sSelf = 0; 00172 00173 RSS09Vocab::RSS09Vocab() : d(new RSS09VocabPrivate) 00174 { 00175 QString ns = QString::fromUtf8("http://my.netscape.com/rdf/simple/0.9/"); 00176 00177 d->namespaceURI = ns; 00178 00179 d->title = PropertyPtr( new Property(ns + QString::fromUtf8("title")) ); 00180 d->properties.append(d->title->uri()); 00181 d->link = PropertyPtr( new Property(ns + QString::fromUtf8("link")) ); 00182 d->properties.append(d->link->uri()); 00183 d->description = PropertyPtr( new Property(ns + QString::fromUtf8("description")) ); 00184 d->properties.append(d->description->uri()); 00185 d->name = PropertyPtr( new Property(ns + QString::fromUtf8("name")) ); 00186 d->properties.append(d->name->uri()); 00187 d->url = PropertyPtr( new Property(ns + QString::fromUtf8("url")) ); 00188 d->properties.append(d->url->uri()); 00189 d->image = PropertyPtr( new Property(ns + QString::fromUtf8("image")) ); 00190 d->properties.append(d->image->uri()); 00191 d->textinput = PropertyPtr( new Property(ns + QString::fromUtf8("textinput")) ); 00192 d->properties.append(d->textinput->uri()); 00193 d->item = ResourcePtr( new Resource(ns + QString::fromUtf8("item")) ); 00194 d->classes.append(d->item->uri()); 00195 d->channel = ResourcePtr( new Resource(ns + QString::fromUtf8("channel")) ); 00196 d->classes.append(d->channel->uri()); 00197 } 00198 00199 RSS09Vocab::~RSS09Vocab() 00200 { 00201 delete d; 00202 } 00203 00204 RSS09Vocab* RSS09Vocab::self() 00205 { 00206 if(!RSS09VocabPrivate::sSelf) { 00207 RSS09VocabPrivate::sSelf = new RSS09Vocab; 00208 qAddPostRoutine(RSS09VocabPrivate::cleanupRSS09Vocab); 00209 } 00210 return RSS09VocabPrivate::sSelf; 00211 } 00212 00213 const QString& RSS09Vocab::namespaceURI() const 00214 { 00215 return d->namespaceURI; 00216 } 00217 00218 PropertyPtr RSS09Vocab::title() const 00219 { 00220 return d->title; 00221 } 00222 00223 PropertyPtr RSS09Vocab::description() const 00224 { 00225 return d->description; 00226 } 00227 00228 PropertyPtr RSS09Vocab::link() const 00229 { 00230 return d->link; 00231 } 00232 00233 PropertyPtr RSS09Vocab::name() const 00234 { 00235 return d->name; 00236 } 00237 00238 PropertyPtr RSS09Vocab::url() const 00239 { 00240 return d->url; 00241 } 00242 00243 PropertyPtr RSS09Vocab::image() const 00244 { 00245 return d->image; 00246 } 00247 00248 PropertyPtr RSS09Vocab::textinput() const 00249 { 00250 return d->textinput; 00251 } 00252 00253 ResourcePtr RSS09Vocab::item() const 00254 { 00255 return d->item; 00256 } 00257 00258 ResourcePtr RSS09Vocab::channel() const 00259 { 00260 return d->channel; 00261 } 00262 00263 QStringList RSS09Vocab::classes() const 00264 { 00265 return d->classes; 00266 } 00267 00268 QStringList RSS09Vocab::properties() const 00269 { 00270 return d->properties; 00271 } 00272 00273 } // namespace RDF 00274 } // namespace Syndication