1 | /* |
---|---|
2 | * This file is part of the syndication library |
3 | * |
4 | * Copyright (C) 2006 Frank Osterfeld <osterfeld@kde.org> |
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 <QtCore/QList> |
30 | #include <QtCore/QString> |
31 | |
32 | namespace Syndication { |
33 | |
34 | Feed::~Feed() |
35 | { |
36 | } |
37 | |
38 | QString Feed::debugInfo() const |
39 | { |
40 | QString info; |
41 | |
42 | info += QLatin1String("# Feed begin ######################\n"); |
43 | |
44 | QString dtitle = title(); |
45 | if (!dtitle.isNull()) |
46 | info += QLatin1String("title: #") + dtitle + QLatin1String( "#\n"); |
47 | |
48 | QString dlink = link(); |
49 | if (!dlink.isNull()) |
50 | info += QLatin1String("link: #") + dlink + QLatin1String( "#\n"); |
51 | |
52 | QString ddescription = description(); |
53 | if (!ddescription.isNull()) |
54 | info += QLatin1String("description: #") + ddescription + QLatin1String( "#\n"); |
55 | |
56 | QString dcopyright = copyright(); |
57 | if (!dcopyright.isNull()) |
58 | info += QLatin1String("copyright: #") + dcopyright + QLatin1String( "#\n"); |
59 | |
60 | QString dlanguage = language(); |
61 | if (!dlanguage.isNull()) |
62 | info += QLatin1String("language: #") + dlanguage + QLatin1String( "#\n"); |
63 | |
64 | QList<PersonPtr> dauthors = authors(); |
65 | QList<PersonPtr>::ConstIterator itp = dauthors.constBegin(); |
66 | QList<PersonPtr>::ConstIterator endp = dauthors.constEnd(); |
67 | |
68 | for ( ; itp != endp; ++itp) |
69 | info += (*itp)->debugInfo(); |
70 | |
71 | QList<CategoryPtr> dcategories = categories(); |
72 | QList<CategoryPtr>::ConstIterator itc = dcategories.constBegin(); |
73 | QList<CategoryPtr>::ConstIterator endc = dcategories.constEnd(); |
74 | |
75 | for ( ; itc != endc; ++itc) |
76 | info += (*itc)->debugInfo(); |
77 | |
78 | ImagePtr dimage = image(); |
79 | |
80 | if (!dimage->isNull()) |
81 | info += dimage->debugInfo(); |
82 | |
83 | QList<ItemPtr> ditems = items(); |
84 | QList<ItemPtr>::ConstIterator it = ditems.constBegin(); |
85 | QList<ItemPtr>::ConstIterator end = ditems.constEnd(); |
86 | |
87 | for ( ; it != end; ++it) |
88 | info += (*it)->debugInfo(); |
89 | |
90 | info += QLatin1String("# Feed end ########################\n"); |
91 | |
92 | return info; |
93 | } |
94 | |
95 | } // namespace Syndication |
96 |