Syndication

cloud.cpp
1/*
2 This file is part of the syndication library
3 SPDX-FileCopyrightText: 2005 Frank Osterfeld <osterfeld@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#include "cloud.h"
9
10#include <QString>
11
12namespace Syndication
13{
14namespace RSS2
15{
20
22 : ElementWrapper(element)
23{
24}
25
27{
28 return attribute(QStringLiteral("domain"));
29}
30
31int Cloud::port() const
32{
33 if (hasAttribute(QStringLiteral("port"))) {
34 bool ok;
35 int c = attribute(QStringLiteral("port")).toInt(&ok);
36 return ok ? c : -1;
37 }
38
39 return -1;
40}
41
43{
44 return attribute(QStringLiteral("path"));
45}
46
48{
49 return attribute(QStringLiteral("registerProcedure"));
50}
51
53{
54 return attribute(QStringLiteral("protocol"));
55}
56
58{
59 QString info = QLatin1String("### Cloud: ###################\n");
60 if (!domain().isNull()) {
61 info += QLatin1String("domain: #") + domain() + QLatin1String("#\n");
62 }
63 if (port() != -1) {
64 info += QLatin1String("port: #") + QString::number(port()) + QLatin1String("#\n");
65 }
66 if (!path().isNull()) {
67 info += QLatin1String("path: #") + path() + QLatin1String("#\n");
68 }
69 if (!registerProcedure().isNull()) {
70 info += QLatin1String("registerProcedure: #") + registerProcedure() + QLatin1String("#\n");
71 }
72 if (!protocol().isNull()) {
73 info += QLatin1String("protocol: #") + protocol() + QLatin1String("#\n");
74 }
75 info += QLatin1String("### Cloud end ################\n");
76 return info;
77}
78
79} // namespace RSS2
80} // namespace Syndication
A wrapper for XML elements.
bool isNull() const
returns whether the wrapped element is a null element
bool hasAttribute(const QString &name) const
Returns true if this element has an attribute called name; otherwise returns false.
QString attribute(const QString &name, const QString &defValue=QString()) const
Returns the attribute called name.
QString debugInfo() const
Returns a description of the object for debugging purposes.
Definition cloud.cpp:57
QString path() const
the remote path to connect to
Definition cloud.cpp:42
QString domain() const
the remote domain
Definition cloud.cpp:26
int port() const
the remote port to connect to
Definition cloud.cpp:31
QString protocol() const
protocol used for publish-subscribe, e.g.
Definition cloud.cpp:52
Cloud()
Default constructor, creates a null object, for which isNull() is true.
Definition cloud.cpp:16
QString registerProcedure() const
register procedure, e.g.
Definition cloud.cpp:47
QString number(double n, char format, int precision)
int toInt(bool *ok, int base) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:02:22 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.