QXmpp  Version:1.3.1
QXmppRpcIq.h
1 /*
2  * Copyright (C) 2008-2020 The QXmpp developers
3  *
4  * Authors:
5  * Ian Reinhart Geiser
6  * Jeremy LainĂ©
7  *
8  * Source:
9  * https://github.com/qxmpp-project/qxmpp
10  *
11  * This file is a part of QXmpp library.
12  *
13  * This library is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU Lesser General Public
15  * License as published by the Free Software Foundation; either
16  * version 2.1 of the License, or (at your option) any later version.
17  *
18  * This library is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  * Lesser General Public License for more details.
22  *
23  */
24 
25 #ifndef QXMPPRPCIQ_H
26 #define QXMPPRPCIQ_H
27 
28 #include "QXmppIq.h"
29 
30 #include <QVariant>
31 
32 class QXMPP_EXPORT QXmppRpcMarshaller
33 {
34 public:
35  static void marshall(QXmlStreamWriter *writer, const QVariant &value);
36  static QVariant demarshall(const QDomElement &elem, QStringList &errors);
37 };
38 
43 
44 class QXMPP_EXPORT QXmppRpcResponseIq : public QXmppIq
45 {
46 public:
48 
49  int faultCode() const;
50  void setFaultCode(int faultCode);
51 
52  QString faultString() const;
53  void setFaultString(const QString &faultString);
54 
55  QVariantList values() const;
56  void setValues(const QVariantList &values);
57 
59  static bool isRpcResponseIq(const QDomElement &element);
61 
62 protected:
64  void parseElementFromChild(const QDomElement &element) override;
65  void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
67 
68 private:
69  int m_faultCode;
70  QString m_faultString;
71  QVariantList m_values;
72 };
73 
78 
79 class QXMPP_EXPORT QXmppRpcInvokeIq : public QXmppIq
80 {
81 public:
83 
84  QString method() const;
85  void setMethod(const QString &method);
86 
87  QVariantList arguments() const;
88  void setArguments(const QVariantList &arguments);
89 
91  static bool isRpcInvokeIq(const QDomElement &element);
93 
94 protected:
96  void parseElementFromChild(const QDomElement &element) override;
97  void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
99 
100 private:
101  QVariantList m_arguments;
102  QString m_method;
103 
104  friend class QXmppRpcErrorIq;
105 };
106 
107 class QXMPP_EXPORT QXmppRpcErrorIq : public QXmppIq
108 {
109 public:
110  QXmppRpcErrorIq();
111 
112  QXmppRpcInvokeIq query() const;
113  void setQuery(const QXmppRpcInvokeIq &query);
114 
116  static bool isRpcErrorIq(const QDomElement &element);
118 
119 protected:
121  void parseElementFromChild(const QDomElement &element) override;
122  void toXmlElementFromChild(QXmlStreamWriter *writer) const override;
124 
125 private:
126  QXmppRpcInvokeIq m_query;
127 };
128 
129 #endif // QXMPPRPCIQ_H
QXmppRpcResponseIq
The QXmppRpcResponseIq class represents an IQ used to carry an RPC response as specified by XEP-0009:...
Definition: QXmppRpcIq.h:44
QXmppRpcInvokeIq
The QXmppRpcInvokeIq class represents an IQ used to carry an RPC invocation as specified by XEP-0009:...
Definition: QXmppRpcIq.h:79
QXmppIq
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:41