Syndication

feed.cpp
1 /*
2  * This file is part of the syndication library
3  *
4  * Copyright (C) 2006 Frank Osterfeld <[email protected]>
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 "feed.h"
24 #include "category.h"
25 #include "image.h"
26 #include "item.h"
27 #include "person.h"
28 
29 #include <QList>
30 #include <QString>
31 
32 namespace Syndication
33 {
34 
36 {
37 }
38 
40 {
41  QString info = QLatin1String("# Feed begin ######################\n");
42 
43  const QString dtitle = title();
44  if (!dtitle.isNull()) {
45  info += QLatin1String("title: #") + dtitle + QLatin1String("#\n");
46  }
47 
48  const QString dlink = link();
49  if (!dlink.isNull()) {
50  info += QLatin1String("link: #") + dlink + QLatin1String("#\n");
51  }
52 
53  const QString ddescription = description();
54  if (!ddescription.isNull()) {
55  info += QLatin1String("description: #") + ddescription + QLatin1String("#\n");
56  }
57 
58  const QString dcopyright = copyright();
59  if (!dcopyright.isNull()) {
60  info += QLatin1String("copyright: #") + dcopyright + QLatin1String("#\n");
61  }
62 
63  const 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  ImagePtr dimage = image();
85 
86  if (!dimage->isNull()) {
87  info += dimage->debugInfo();
88  }
89 
90  ImagePtr dicon = icon();
91 
92  if (!dicon->isNull()) {
93  info += dicon->debugInfo();
94  }
95 
96  QList<ItemPtr> ditems = items();
99 
100  for (; it != end; ++it) {
101  info += (*it)->debugInfo();
102  }
103 
104  info += QLatin1String("# Feed end ########################\n");
105 
106  return info;
107 }
108 
109 } // namespace Syndication
virtual QString copyright() const =0
returns copyright information about the feed
virtual QString title() const =0
The title of the feed.
virtual ~Feed()
destructor
Definition: feed.cpp:35
virtual QList< PersonPtr > authors() const =0
returns a list of persons who created the feed content.
virtual ImagePtr image() const =0
returns an image associated with this item.
bool isNull() const const
virtual QString link() const =0
returns a link pointing to a website associated with this channel.
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 ImagePtr icon() const =0
returns an icon associated with this item.
virtual QString description() const =0
A description of the feed.
virtual QList< CategoryPtr > categories() const =0
returns a list of categories this feed is associated with.
virtual QString debugInfo() const
returns a description of the feed for debugging purposes
Definition: feed.cpp:39
QList::const_iterator constEnd() const const
QList::const_iterator constBegin() const const
bool isNull() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jul 10 2020 23:00:44 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.