• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

Syndication Library

  • sources
  • kde-4.14
  • kdepimlibs
  • syndication
item.cpp
1 /*
2  * This file is part of the syndication library
3  *
4  * Copyright (C) 2006 Frank Osterfeld <osterfeld@kde.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include "item.h"
24 #include "category.h"
25 #include "enclosure.h"
26 #include "person.h"
27 #include "tools.h"
28 
29 #include <QtCore/QList>
30 #include <QtCore/QString>
31 
32 namespace Syndication {
33 
34 Item::~Item()
35 {
36 }
37 
38 QString Item::debugInfo() const
39 {
40  QString info;
41 
42  info += QLatin1String("# Item begin ######################\n");
43 
44  QString did = id();
45  if (!did.isNull())
46  info += QLatin1String("id: #") + did + QLatin1String("#\n");
47 
48  QString dtitle = title();
49  if (!dtitle.isNull())
50  info += QLatin1String("title: #") + dtitle + QLatin1String("#\n");
51 
52  QString dlink = link();
53  if (!dlink.isNull())
54  info += QLatin1String("link: #") + dlink + QLatin1String("#\n");
55 
56  QString ddescription = description();
57  if (!ddescription.isNull())
58  info += QLatin1String("description: #") + ddescription + QLatin1String("#\n");
59 
60  QString dcontent = content();
61  if (!dcontent.isNull())
62  info += QLatin1String("content: #") + dcontent + QLatin1String("#\n");
63 
64  QString pubdate = dateTimeToString(datePublished());
65  if (!pubdate.isNull())
66  info += QLatin1String("datePublished: #") + pubdate + QLatin1String("#\n");
67 
68  QString update = dateTimeToString(dateUpdated());
69  if (!update.isNull())
70  info += QLatin1String("dateUpdated: #") + update + QLatin1String("#\n");
71 
72  QString dlanguage = language();
73  if (!dlanguage.isNull())
74  info += QLatin1String("language: #") + dlanguage + QLatin1String("#\n");
75 
76  QList<PersonPtr> dauthors = authors();
77  QList<PersonPtr>::ConstIterator itp = dauthors.constBegin();
78  QList<PersonPtr>::ConstIterator endp = dauthors.constEnd();
79 
80  for ( ; itp != endp; ++itp)
81  info += (*itp)->debugInfo();
82 
83  QList<CategoryPtr> dcategories = categories();
84  QList<CategoryPtr>::ConstIterator itc = dcategories.constBegin();
85  QList<CategoryPtr>::ConstIterator endc = dcategories.constEnd();
86 
87  for ( ; itc != endc; ++itc)
88  info += (*itc)->debugInfo();
89 
90  QList<EnclosurePtr> denclosures = enclosures();
91  QList<EnclosurePtr>::ConstIterator ite = denclosures.constBegin();
92  QList<EnclosurePtr>::ConstIterator ende = denclosures.constEnd();
93 
94  for ( ; ite != ende; ++ite)
95  info += (*ite)->debugInfo();
96 
97  int dcommentsCount = commentsCount();
98  if (dcommentsCount != -1)
99  {
100  info+= QLatin1String("commentsCount: #") + QString::number(dcommentsCount) + QLatin1String("#\n");
101  }
102 
103  QString dcommentsLink = commentsLink();
104  if (!dcommentsLink.isNull())
105  info+= QLatin1String("commentsLink: #") + dcommentsLink + QLatin1String("#\n");
106 
107  QString dcommentsFeed = commentsFeed();
108  if (!dcommentsFeed.isNull())
109  info+= QLatin1String("commentsFeed: #") + dcommentsFeed + QLatin1String("#\n");
110 
111  QString dcommentPostUri = commentPostUri();
112  if (!dcommentPostUri.isNull())
113  info+= QLatin1String("commentPostUri: #") + dcommentPostUri + QLatin1String("#\n");
114 
115  info += QLatin1String("# Item end ########################\n");
116 
117  return info;
118 }
119 
120 } // namespace Syndication
Syndication::Item::commentsCount
virtual int commentsCount() const =0
The number of comments posted for this item.
Syndication::Item::categories
virtual QList< CategoryPtr > categories() const =0
returns a list of categories this item is filed in.
Syndication::Item::authors
virtual QList< PersonPtr > authors() const =0
returns a list of persons who created the item content.
Syndication::Item::link
virtual QString link() const =0
returns a link to the (web) resource described by this item.
Syndication::Item::~Item
virtual ~Item()
destructor
Definition: item.cpp:34
Syndication::Item::id
virtual QString id() const =0
returns an identifier that identifies the item within its feed.
Syndication::Item::debugInfo
virtual QString debugInfo() const
returns a description of the item for debugging purposes
Definition: item.cpp:38
Syndication::Item::dateUpdated
virtual time_t dateUpdated() const =0
returns the date when the item was modified the last time.
Syndication::Item::datePublished
virtual time_t datePublished() const =0
returns the date when the item was initially published.
QString::isNull
bool isNull() const
Syndication::Item::description
virtual QString description() const =0
returns the description of the item.
QString::number
QString number(int n, int base)
Syndication::Item::commentPostUri
virtual QString commentPostUri() const =0
URI that can be used to post comments via an HTTP POST request using the Comment API.
QString
QList
Definition: elementwrapper.h:32
Syndication::Item::content
virtual QString content() const =0
returns the content of the item.
Syndication::Item::language
virtual QString language() const =0
returns the language used in the item's content
QLatin1String
Syndication::Item::enclosures
virtual QList< EnclosurePtr > enclosures() const =0
returns a list of enclosures describing files available on the net.
Syndication::Item::commentsFeed
virtual QString commentsFeed() const =0
URL of feed syndicating comments belonging to this item.
QList::constEnd
const_iterator constEnd() const
QList::constBegin
const_iterator constBegin() const
Syndication::Item::title
virtual QString title() const =0
The title of the item.
Syndication::Item::commentsLink
virtual QString commentsLink() const =0
Link to an HTML site which contains the comments belonging to this item.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:32 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Syndication Library

Skip menu "Syndication Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

Search



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