File indexing completed on 2024-04-21 04:01:03

0001 /*
0002     This file is part of the syndication library
0003     SPDX-FileCopyrightText: 2005 Frank Osterfeld <osterfeld@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #include "cloud.h"
0009 
0010 #include <QString>
0011 
0012 namespace Syndication
0013 {
0014 namespace RSS2
0015 {
0016 Cloud::Cloud()
0017     : ElementWrapper()
0018 {
0019 }
0020 
0021 Cloud::Cloud(const QDomElement &element)
0022     : ElementWrapper(element)
0023 {
0024 }
0025 
0026 QString Cloud::domain() const
0027 {
0028     return attribute(QStringLiteral("domain"));
0029 }
0030 
0031 int Cloud::port() const
0032 {
0033     if (hasAttribute(QStringLiteral("port"))) {
0034         bool ok;
0035         int c = attribute(QStringLiteral("port")).toInt(&ok);
0036         return ok ? c : -1;
0037     }
0038 
0039     return -1;
0040 }
0041 
0042 QString Cloud::path() const
0043 {
0044     return attribute(QStringLiteral("path"));
0045 }
0046 
0047 QString Cloud::registerProcedure() const
0048 {
0049     return attribute(QStringLiteral("registerProcedure"));
0050 }
0051 
0052 QString Cloud::protocol() const
0053 {
0054     return attribute(QStringLiteral("protocol"));
0055 }
0056 
0057 QString Cloud::debugInfo() const
0058 {
0059     QString info = QLatin1String("### Cloud: ###################\n");
0060     if (!domain().isNull()) {
0061         info += QLatin1String("domain: #") + domain() + QLatin1String("#\n");
0062     }
0063     if (port() != -1) {
0064         info += QLatin1String("port: #") + QString::number(port()) + QLatin1String("#\n");
0065     }
0066     if (!path().isNull()) {
0067         info += QLatin1String("path: #") + path() + QLatin1String("#\n");
0068     }
0069     if (!registerProcedure().isNull()) {
0070         info += QLatin1String("registerProcedure: #") + registerProcedure() + QLatin1String("#\n");
0071     }
0072     if (!protocol().isNull()) {
0073         info += QLatin1String("protocol: #") + protocol() + QLatin1String("#\n");
0074     }
0075     info += QLatin1String("### Cloud end ################\n");
0076     return info;
0077 }
0078 
0079 } // namespace RSS2
0080 } // namespace Syndication