• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

syndication/rdf

item.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 "item.h"
00024 #include "contentvocab.h"
00025 #include "document.h"
00026 #include "dublincore.h"
00027 #include "model.h"
00028 #include "rssvocab.h"
00029 #include "statement.h"
00030 
00031 #include <specificitemvisitor.h>
00032 #include <tools.h>
00033 
00034 #include <QtCore/QString>
00035 
00036 namespace Syndication {
00037 namespace RDF {
00038 
00039 class Item::Private
00040 {
00041     public:
00042     DocumentPtr doc;
00043 };
00044 
00045 Item::Item() : ResourceWrapper(), d(new Private)
00046 {
00047 }
00048 
00049 Item::Item(ResourcePtr resource, DocumentPtr doc) : ResourceWrapper(resource),
00050                                                     d(new Private)
00051 {
00052     d->doc = doc;
00053 }
00054 
00055 Item::Item(const Item& other) : ResourceWrapper(other), 
00056                                 SpecificItem(other),
00057                                 d(new Private)
00058 {
00059     *d = *(other.d);
00060 }
00061 
00062 Item::~Item()
00063 {
00064     delete d;
00065     d = 0;
00066 }
00067 
00068 Item& Item::operator=(const Item& other)
00069 {
00070     ResourceWrapper::operator=(other);
00071     *d = *(other.d);
00072     return *this;
00073 }
00074         
00075 bool Item::operator==(const Item& other) const
00076 {
00077     return ResourceWrapper::operator==(other);
00078 }
00079         
00080         
00081 QString Item::title() const
00082 {
00083     if (!d->doc)
00084         return originalTitle();
00085     
00086     bool containsMarkup = false;
00087     d->doc->getItemTitleFormatInfo(&containsMarkup);
00088     
00089     return normalize(originalTitle(), false, containsMarkup);
00090 }
00091 
00092 QString Item::description() const
00093 {
00094     if (!d->doc)
00095         return originalDescription();
00096 
00097     bool containsMarkup = false;
00098     d->doc->getItemDescriptionFormatInfo(&containsMarkup);
00099     
00100     return normalize(originalDescription(), false, containsMarkup);
00101 }
00102 
00103 QString Item::link() const
00104 {
00105     return resource()->property(RSSVocab::self()->link())->asString();
00106 }
00107 
00108 DublinCore Item::dc() const
00109 {
00110     return DublinCore(resource());
00111 }
00112 
00113 QString Item::encodedContent() const
00114 {
00115     return resource()->property(ContentVocab::self()->encoded())->asString();
00116 }
00117 
00118 QString Item::originalTitle() const
00119 {
00120     return resource()->property(RSSVocab::self()->title())->asString();
00121 }
00122 
00123 QString Item::originalDescription() const
00124 {
00125     return resource()->property(RSSVocab::self()->description())->asString();
00126 }
00127         
00128 QString Item::debugInfo() const
00129 {
00130     QString info;
00131     info += "### Item: ###################\n";
00132     info += "title: #" + title() + "#\n";
00133     info += "link: #" + link() + "#\n";
00134     info += "description: #" + description() + "#\n";
00135     info += "content:encoded: #" + encodedContent() + "#\n";
00136     info += dc().debugInfo();
00137     info += "### Item end ################\n";
00138     return info;
00139 }
00140 
00141 bool Item::accept(SpecificItemVisitor* visitor)
00142 {
00143     return visitor->visitRDFItem(this);
00144 }
00145 
00146 } // namespace RDF
00147 } // namespace Syndication

syndication/rdf

Skip menu "syndication/rdf"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.5
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal