Syndication

item.cpp
1 /*
2  This file is part of the syndication library
3  SPDX-FileCopyrightText: 2006 Frank Osterfeld <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #include "item.h"
9 #include "category.h"
10 #include "enclosure.h"
11 #include "person.h"
12 #include "tools.h"
13 
14 #include <QList>
15 #include <QString>
16 
17 namespace Syndication
18 {
19 
21 {
22 }
23 
25 {
26  QString info = QLatin1String("# Item begin ######################\n");
27 
28  QString did = id();
29  if (!did.isNull()) {
30  info += QLatin1String("id: #") + did + QLatin1String("#\n");
31  }
32 
33  QString dtitle = title();
34  if (!dtitle.isNull()) {
35  info += QLatin1String("title: #") + dtitle + QLatin1String("#\n");
36  }
37 
38  QString dlink = link();
39  if (!dlink.isNull()) {
40  info += QLatin1String("link: #") + dlink + QLatin1String("#\n");
41  }
42 
43  QString ddescription = description();
44  if (!ddescription.isNull()) {
45  info += QLatin1String("description: #") + ddescription + QLatin1String("#\n");
46  }
47 
48  QString dcontent = content();
49  if (!dcontent.isNull()) {
50  info += QLatin1String("content: #") + dcontent + QLatin1String("#\n");
51  }
52 
54  if (!pubdate.isNull()) {
55  info += QLatin1String("datePublished: #") + pubdate + QLatin1String("#\n");
56  }
57 
59  if (!update.isNull()) {
60  info += QLatin1String("dateUpdated: #") + update + QLatin1String("#\n");
61  }
62 
63  QString dlanguage = language();
64  if (!dlanguage.isNull()) {
65  info += QLatin1String("language: #") + dlanguage + QLatin1String("#\n");
66  }
67 
68  QList<PersonPtr> dauthors = authors();
70  QList<PersonPtr>::ConstIterator endp = dauthors.constEnd();
71 
72  for (; itp != endp; ++itp) {
73  info += (*itp)->debugInfo();
74  }
75 
76  QList<CategoryPtr> dcategories = categories();
78  QList<CategoryPtr>::ConstIterator endc = dcategories.constEnd();
79 
80  for (; itc != endc; ++itc) {
81  info += (*itc)->debugInfo();
82  }
83 
84  QList<EnclosurePtr> denclosures = enclosures();
86  QList<EnclosurePtr>::ConstIterator ende = denclosures.constEnd();
87 
88  for (; ite != ende; ++ite) {
89  info += (*ite)->debugInfo();
90  }
91 
92  int dcommentsCount = commentsCount();
93  if (dcommentsCount != -1) {
94  info += QLatin1String("commentsCount: #") + QString::number(dcommentsCount) + QLatin1String("#\n");
95  }
96 
97  QString dcommentsLink = commentsLink();
98  if (!dcommentsLink.isNull()) {
99  info += QLatin1String("commentsLink: #") + dcommentsLink + QLatin1String("#\n");
100  }
101 
102  QString dcommentsFeed = commentsFeed();
103  if (!dcommentsFeed.isNull()) {
104  info += QLatin1String("commentsFeed: #") + dcommentsFeed + QLatin1String("#\n");
105  }
106 
107  QString dcommentPostUri = commentPostUri();
108  if (!dcommentPostUri.isNull()) {
109  info += QLatin1String("commentPostUri: #") + dcommentPostUri + QLatin1String("#\n");
110  }
111 
112  info += QLatin1String("# Item end ########################\n");
113 
114  return info;
115 }
116 
117 } // namespace Syndication
virtual QList< EnclosurePtr > enclosures() const =0
returns a list of enclosures describing files available on the net.
virtual ~Item()
destructor
Definition: item.cpp:20
virtual QString debugInfo() const
returns a description of the item for debugging purposes
Definition: item.cpp:24
virtual QString link() const =0
returns a link to the (web) resource described by this item.
virtual QString commentsFeed() const =0
URL of feed syndicating comments belonging to this item.
virtual time_t datePublished() const =0
returns the date when the item was initially published.
virtual QString id() const =0
returns an identifier that identifies the item within its feed.
bool isNull() const const
QString number(int n, int base)
virtual QString commentPostUri() const =0
URI that can be used to post comments via an HTTP POST request using the Comment API.
virtual QString commentsLink() const =0
Link to an HTML site which contains the comments belonging to this item.
KCALUTILS_EXPORT QString dateTimeToString(const QDateTime &date, bool dateOnly=false, bool shortfmt=true)
virtual QString description() const =0
returns the description of the item.
virtual QString language() const =0
returns the language used in the item&#39;s content
virtual time_t dateUpdated() const =0
returns the date when the item was modified the last time.
virtual QString content() const =0
returns the content of the item.
virtual QList< CategoryPtr > categories() const =0
returns a list of categories this item is filed in.
virtual QList< PersonPtr > authors() const =0
returns a list of persons who created the item content.
QList::const_iterator constEnd() const const
virtual QString title() const =0
The title of the item.
QList::const_iterator constBegin() const const
virtual int commentsCount() const =0
The number of comments posted for this item.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Aug 12 2020 23:02:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.