| 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 "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 | { |
| 19 | Feed::~Feed() |
| 20 | { |
| 21 | } |
| 22 | |
| 23 | QString Feed::debugInfo() const |
| 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 |
| 86 |
