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{
18Item::~Item()
19{
20}
21
22QString Item::debugInfo() const
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
107

source code of syndication/src/item.cpp