Syndication

item.cpp
1/*
2 This file is part of the syndication library
3 SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org>
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
16namespace Syndication
17{
19{
20}
21
23{
24 QString info = QLatin1String("# Item begin ######################\n");
25
26 QString did = id();
27 if (!did.isNull()) {
28 info += QLatin1String("id: #") + did + QLatin1String("#\n");
29 }
30
31 QString dtitle = title();
32 if (!dtitle.isNull()) {
33 info += QLatin1String("title: #") + dtitle + QLatin1String("#\n");
34 }
35
36 QString dlink = link();
37 if (!dlink.isNull()) {
38 info += QLatin1String("link: #") + dlink + QLatin1String("#\n");
39 }
40
41 QString ddescription = description();
42 if (!ddescription.isNull()) {
43 info += QLatin1String("description: #") + ddescription + QLatin1String("#\n");
44 }
45
46 QString dcontent = content();
47 if (!dcontent.isNull()) {
48 info += QLatin1String("content: #") + dcontent + QLatin1String("#\n");
49 }
50
51 QString pubdate = dateTimeToString(datePublished());
52 if (!pubdate.isNull()) {
53 info += QLatin1String("datePublished: #") + pubdate + QLatin1String("#\n");
54 }
55
56 QString update = dateTimeToString(dateUpdated());
57 if (!update.isNull()) {
58 info += QLatin1String("dateUpdated: #") + update + QLatin1String("#\n");
59 }
60
61 QString dlanguage = language();
62 if (!dlanguage.isNull()) {
63 info += QLatin1String("language: #") + dlanguage + QLatin1String("#\n");
64 }
65
66 const QList<PersonPtr> dauthors = authors();
67 for (const auto &author : dauthors) {
68 info += author->debugInfo();
69 }
70
71 const QList<CategoryPtr> dcategories = categories();
72 for (const auto &cat : dcategories) {
73 info += cat->debugInfo();
74 }
75
76 const QList<EnclosurePtr> denclosures = enclosures();
77 for (const auto &e : denclosures) {
78 info += e->debugInfo();
79 }
80
81 int dcommentsCount = commentsCount();
82 if (dcommentsCount != -1) {
83 info += QLatin1String("commentsCount: #") + QString::number(dcommentsCount) + QLatin1String("#\n");
84 }
85
86 QString dcommentsLink = commentsLink();
87 if (!dcommentsLink.isNull()) {
88 info += QLatin1String("commentsLink: #") + dcommentsLink + QLatin1String("#\n");
89 }
90
91 QString dcommentsFeed = commentsFeed();
92 if (!dcommentsFeed.isNull()) {
93 info += QLatin1String("commentsFeed: #") + dcommentsFeed + QLatin1String("#\n");
94 }
95
96 QString dcommentPostUri = commentPostUri();
97 if (!dcommentPostUri.isNull()) {
98 info += QLatin1String("commentPostUri: #") + dcommentPostUri + QLatin1String("#\n");
99 }
100
101 info += QLatin1String("# Item end ########################\n");
102
103 return info;
104}
105
106} // namespace Syndication
virtual QString title() const =0
The title of the item.
virtual QString language() const =0
returns the language used in the item's content
virtual ~Item()
destructor
Definition item.cpp:18
virtual time_t datePublished() const =0
returns the date when the item was initially published.
virtual QString content() const =0
returns the content of the item.
virtual QString description() const =0
returns the description of the item.
virtual QString commentsFeed() const =0
URL of feed syndicating comments belonging to this item.
virtual QList< EnclosurePtr > enclosures() const =0
returns a list of enclosures describing files available on the net.
virtual int commentsCount() const =0
The number of comments posted for this item.
virtual QList< PersonPtr > authors() const =0
returns a list of persons who created the item content.
virtual QString debugInfo() const
returns a description of the item for debugging purposes
Definition item.cpp:22
virtual QString link() const =0
returns a link to the (web) resource described by this item.
virtual time_t dateUpdated() const =0
returns the date when the item was modified the last time.
virtual QList< CategoryPtr > categories() const =0
returns a list of categories this item is filed in.
virtual QString commentPostUri() const =0
URI that can be used to post comments via an HTTP POST request using the Comment API.
virtual QString id() const =0
returns an identifier that identifies the item within its feed.
virtual QString commentsLink() const =0
Link to an HTML site which contains the comments belonging to this item.
bool isNull() const const
QString number(double n, char format, int precision)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:15 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.