Syndication

cloud.cpp
1 /*
2  * This file is part of the syndication library
3  *
4  * Copyright (C) 2005 Frank Osterfeld <[email protected]>
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 "cloud.h"
24 
25 #include <QString>
26 
27 namespace Syndication
28 {
29 namespace RSS2
30 {
31 
33 {
34 }
35 
37 {
38 }
39 
41 {
42  return attribute(QStringLiteral("domain"));
43 }
44 
45 int Cloud::port() const
46 {
47  if (hasAttribute(QStringLiteral("port"))) {
48  bool ok;
49  int c = attribute(QStringLiteral("port")).toInt(&ok);
50  return ok ? c : -1;
51  }
52 
53  return -1;
54 }
55 
57 {
58  return attribute(QStringLiteral("path"));
59 }
60 
62 {
63  return attribute(QStringLiteral("registerProcedure"));
64 }
65 
67 {
68 
69  return attribute(QStringLiteral("protocol"));
70 }
71 
73 {
74  QString info = QLatin1String("### Cloud: ###################\n");
75  if (!domain().isNull()) {
76  info += QLatin1String("domain: #") + domain() + QLatin1String("#\n");
77  }
78  if (port() != -1) {
79  info += QLatin1String("port: #") + QString::number(port()) + QLatin1String("#\n");
80  }
81  if (!path().isNull()) {
82  info += QLatin1String("path: #") + path() + QLatin1String("#\n");
83  }
84  if (!registerProcedure().isNull()) {
85  info += QLatin1String("registerProcedure: #") + registerProcedure() + QLatin1String("#\n");
86  }
87  if (!protocol().isNull()) {
88  info += QLatin1String("protocol: #") + protocol() + QLatin1String("#\n");
89  }
90  info += QLatin1String("### Cloud end ################\n");
91  return info;
92 }
93 
94 } // namespace RSS2
95 } // namespace Syndication
96 
QString attribute(const QString &name, const QString &defValue=QString()) const
Returns the attribute called name.
QString registerProcedure() const
register procedure, e.g.
Definition: cloud.cpp:61
A wrapper for XML elements.
QString debugInfo() const
Returns a description of the object for debugging purposes.
Definition: cloud.cpp:72
QString path() const
the remote path to connect to
Definition: cloud.cpp:56
Cloud()
Default constructor, creates a null object, for which isNull() is true.
Definition: cloud.cpp:32
bool hasAttribute(const QString &name) const
Returns true if this element has an attribute called name; otherwise returns false.
QString protocol() const
protocol used for publish-subscribe, e.g.
Definition: cloud.cpp:66
QString domain() const
the remote domain
Definition: cloud.cpp:40
QString number(int n, int base)
int toInt(bool *ok, int base) const const
bool isNull() const
returns whether the wrapped element is a null element
int port() const
the remote port to connect to
Definition: cloud.cpp:45
const QDomElement & element() const
returns the wrapped resource.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun May 24 2020 23:09:03 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.