QXmpp  Version:1.0.0
QXmppRpcIq.h
1 /*
2  * Copyright (C) 2008-2019 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 #include <QVariant>
30 
31 class QXMPP_EXPORT QXmppRpcMarshaller
32 {
33 public:
34  static void marshall( QXmlStreamWriter *writer, const QVariant &value);
35  static QVariant demarshall(const QDomElement &elem, QStringList &errors);
36 };
37 
42 
43 class QXMPP_EXPORT QXmppRpcResponseIq : public QXmppIq
44 {
45 public:
47 
48  int faultCode() const;
49  void setFaultCode(int faultCode);
50 
51  QString faultString() const;
52  void setFaultString(const QString &faultString);
53 
54  QVariantList values() const;
55  void setValues(const QVariantList &values);
56 
58  static bool isRpcResponseIq(const QDomElement &element);
60 
61 protected:
63  void parseElementFromChild(const QDomElement &element);
64  void toXmlElementFromChild(QXmlStreamWriter *writer) const;
66 
67 private:
68  int m_faultCode;
69  QString m_faultString;
70  QVariantList m_values;
71 };
72 
77 
78 class QXMPP_EXPORT QXmppRpcInvokeIq : public QXmppIq
79 {
80 public:
82 
83  QString method() const;
84  void setMethod( const QString &method );
85 
86  QVariantList arguments() const;
87  void setArguments(const QVariantList &arguments);
88 
90  static bool isRpcInvokeIq(const QDomElement &element);
92 
93 protected:
95  void parseElementFromChild(const QDomElement &element);
96  void toXmlElementFromChild(QXmlStreamWriter *writer) const;
98 
99 private:
100  QVariantList m_arguments;
101  QString m_method;
102 
103  friend class QXmppRpcErrorIq;
104 };
105 
106 class QXMPP_EXPORT QXmppRpcErrorIq : public QXmppIq
107 {
108 public:
109  QXmppRpcErrorIq();
110 
111  QXmppRpcInvokeIq query() const;
112  void setQuery(const QXmppRpcInvokeIq &query);
113 
115  static bool isRpcErrorIq(const QDomElement &element);
117 
118 protected:
120  void parseElementFromChild(const QDomElement &element);
121  void toXmlElementFromChild(QXmlStreamWriter *writer) const;
123 
124 private:
125  QXmppRpcInvokeIq m_query;
126 };
127 
128 #endif // QXMPPRPCIQ_H
QXmppRpcResponseIq
The QXmppRpcResponseIq class represents an IQ used to carry an RPC response as specified by XEP-0009:...
Definition: QXmppRpcIq.h:43
QXmppRpcInvokeIq
The QXmppRpcInvokeIq class represents an IQ used to carry an RPC invocation as specified by XEP-0009:...
Definition: QXmppRpcIq.h:78
QXmppIq
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:42