• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.8.5 API Reference
  • KDE Home
  • 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 }
00066 
00067 Item& Item::operator=(const Item& other)
00068 {
00069     ResourceWrapper::operator=(other);
00070     *d = *(other.d);
00071     return *this;
00072 }
00073         
00074 bool Item::operator==(const Item& other) const
00075 {
00076     return ResourceWrapper::operator==(other);
00077 }
00078         
00079         
00080 QString Item::title() const
00081 {
00082     if (!d->doc)
00083         return originalTitle();
00084     
00085     bool containsMarkup = false;
00086     d->doc->getItemTitleFormatInfo(&containsMarkup);
00087     
00088     return normalize(originalTitle(), false, containsMarkup);
00089 }
00090 
00091 QString Item::description() const
00092 {
00093     if (!d->doc)
00094         return originalDescription();
00095 
00096     bool containsMarkup = false;
00097     d->doc->getItemDescriptionFormatInfo(&containsMarkup);
00098     
00099     return normalize(originalDescription(), false, containsMarkup);
00100 }
00101 
00102 QString Item::link() const
00103 {
00104     return resource()->property(RSSVocab::self()->link())->asString();
00105 }
00106 
00107 DublinCore Item::dc() const
00108 {
00109     return DublinCore(resource());
00110 }
00111 
00112 QString Item::encodedContent() const
00113 {
00114     return resource()->property(ContentVocab::self()->encoded())->asString();
00115 }
00116 
00117 QString Item::originalTitle() const
00118 {
00119     return resource()->property(RSSVocab::self()->title())->asString();
00120 }
00121 
00122 QString Item::originalDescription() const
00123 {
00124     return resource()->property(RSSVocab::self()->description())->asString();
00125 }
00126         
00127 QString Item::debugInfo() const
00128 {
00129     QString info;
00130     info += QLatin1String("### Item: ###################\n");
00131     info += QLatin1String("title: #") + title() + QLatin1String("#\n");
00132     info += QLatin1String("link: #") + link() + QLatin1String("#\n");
00133     info += QLatin1String("description: #") + description() + QLatin1String("#\n");
00134     info += QLatin1String("content:encoded: #") + encodedContent() + QLatin1String("#\n");
00135     info += dc().debugInfo();
00136     info += QLatin1String("### Item end ################\n");
00137     return info;
00138 }
00139 
00140 bool Item::accept(SpecificItemVisitor* visitor)
00141 {
00142     return visitor->visitRDFItem(this);
00143 }
00144 
00145 } // namespace RDF
00146 } // namespace Syndication
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Aug 27 2012 22:08:52 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

syndication/rdf

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

kdepimlibs-4.8.5 API Reference

Skip menu "kdepimlibs-4.8.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal