Syndication

feed.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 "feed.h"
9 #include "category.h"
10 #include "image.h"
11 #include "item.h"
12 #include "person.h"
13 
14 #include <QList>
15 #include <QString>
16 
17 namespace Syndication
18 {
20 {
21 }
22 
24 {
25  QString info = QLatin1String("# Feed begin ######################\n");
26 
27  const QString dtitle = title();
28  if (!dtitle.isNull()) {
29  info += QLatin1String("title: #") + dtitle + QLatin1String("#\n");
30  }
31 
32  const QString dlink = link();
33  if (!dlink.isNull()) {
34  info += QLatin1String("link: #") + dlink + QLatin1String("#\n");
35  }
36 
37  const QString ddescription = description();
38  if (!ddescription.isNull()) {
39  info += QLatin1String("description: #") + ddescription + QLatin1String("#\n");
40  }
41 
42  const QString dcopyright = copyright();
43  if (!dcopyright.isNull()) {
44  info += QLatin1String("copyright: #") + dcopyright + QLatin1String("#\n");
45  }
46 
47  const QString dlanguage = language();
48  if (!dlanguage.isNull()) {
49  info += QLatin1String("language: #") + dlanguage + QLatin1String("#\n");
50  }
51 
52  const QList<PersonPtr> dauthors = authors();
53  for (const auto &author : dauthors) {
54  info += author->debugInfo();
55  }
56 
57  const QList<CategoryPtr> dcategories = categories();
58  for (const auto &catPtr : dcategories) {
59  info += catPtr->debugInfo();
60  }
61 
62  ImagePtr dimage = image();
63 
64  if (!dimage->isNull()) {
65  info += dimage->debugInfo();
66  }
67 
68  ImagePtr dicon = icon();
69 
70  if (!dicon->isNull()) {
71  info += dicon->debugInfo();
72  }
73 
74  const QList<ItemPtr> ditems = items();
75 
76  for (const auto &item : ditems) {
77  info += item->debugInfo();
78  }
79 
80  info += QLatin1String("# Feed end ########################\n");
81 
82  return info;
83 }
84 
85 } // namespace Syndication
bool isNull() const const
virtual QString copyright() const =0
returns copyright information about the feed
virtual QString link() const =0
returns a link pointing to a website associated with this channel.
bool isNull() const const
virtual ImagePtr image() const =0
returns an image associated with this item.
virtual QString description() const =0
A description of the feed.
virtual QString title() const =0
The title of the feed.
virtual QString debugInfo() const
returns a description of the feed for debugging purposes
Definition: feed.cpp:23
virtual QList< ItemPtr > items() const =0
A list of items, in the order they were parsed from the feed source.
virtual QString language() const =0
The language used in the feed.
virtual ~Feed()
destructor
Definition: feed.cpp:19
virtual ImagePtr icon() const =0
returns an icon associated with this item.
virtual QList< CategoryPtr > categories() const =0
returns a list of categories this feed is associated with.
virtual QList< PersonPtr > authors() const =0
returns a list of persons who created the feed content.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Jun 6 2023 03:56:27 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.