File indexing completed on 2024-07-14 03:59:06

0001 /*
0002     This file is part of the syndication library
0003     SPDX-FileCopyrightText: 2006 Frank Osterfeld <osterfeld@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #include "feed.h"
0009 #include "category.h"
0010 #include "image.h"
0011 #include "item.h"
0012 #include "person.h"
0013 
0014 #include <QList>
0015 #include <QString>
0016 
0017 namespace Syndication
0018 {
0019 Feed::~Feed()
0020 {
0021 }
0022 
0023 QString Feed::debugInfo() const
0024 {
0025     QString info = QLatin1String("# Feed begin ######################\n");
0026 
0027     const QString dtitle = title();
0028     if (!dtitle.isNull()) {
0029         info += QLatin1String("title: #") + dtitle + QLatin1String("#\n");
0030     }
0031 
0032     const QString dlink = link();
0033     if (!dlink.isNull()) {
0034         info += QLatin1String("link: #") + dlink + QLatin1String("#\n");
0035     }
0036 
0037     const QString ddescription = description();
0038     if (!ddescription.isNull()) {
0039         info += QLatin1String("description: #") + ddescription + QLatin1String("#\n");
0040     }
0041 
0042     const QString dcopyright = copyright();
0043     if (!dcopyright.isNull()) {
0044         info += QLatin1String("copyright: #") + dcopyright + QLatin1String("#\n");
0045     }
0046 
0047     const QString dlanguage = language();
0048     if (!dlanguage.isNull()) {
0049         info += QLatin1String("language: #") + dlanguage + QLatin1String("#\n");
0050     }
0051 
0052     const QList<PersonPtr> dauthors = authors();
0053     for (const auto &author : dauthors) {
0054         info += author->debugInfo();
0055     }
0056 
0057     const QList<CategoryPtr> dcategories = categories();
0058     for (const auto &catPtr : dcategories) {
0059         info += catPtr->debugInfo();
0060     }
0061 
0062     ImagePtr dimage = image();
0063 
0064     if (!dimage->isNull()) {
0065         info += dimage->debugInfo();
0066     }
0067 
0068     ImagePtr dicon = icon();
0069 
0070     if (!dicon->isNull()) {
0071         info += dicon->debugInfo();
0072     }
0073 
0074     const QList<ItemPtr> ditems = items();
0075 
0076     for (const auto &item : ditems) {
0077         info += item->debugInfo();
0078     }
0079 
0080     info += QLatin1String("# Feed end ########################\n");
0081 
0082     return info;
0083 }
0084 
0085 } // namespace Syndication