QXmpp  Version:0.4.92
 All Classes Functions Enumerations Enumerator Properties Groups
QXmppRpcIq.h
1 /*
2  * Copyright (C) 2008-2011 The QXmpp developers
3  *
4  * Authors:
5  * Ian Reinhart Geiser
6  * Jeremy LainĂ©
7  *
8  * Source:
9  * http://code.google.com/p/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 QXmlStreamWriter;
32 class QDomElement;
33 
34 class QXMPP_EXPORT QXmppRpcMarshaller
35 {
36 public:
37  static void marshall( QXmlStreamWriter *writer, const QVariant &value);
38  static QVariant demarshall(const QDomElement &elem, QStringList &errors);
39 };
40 
45 
46 class QXMPP_EXPORT QXmppRpcResponseIq : public QXmppIq
47 {
48 public:
50 
51  int faultCode() const;
52  void setFaultCode(int faultCode);
53 
54  QString faultString() const;
55  void setFaultString(const QString &faultString);
56 
57  QVariantList values() const;
58  void setValues(const QVariantList &values);
59 
61  static bool isRpcResponseIq(const QDomElement &element);
63 
64 protected:
66  void parseElementFromChild(const QDomElement &element);
67  void toXmlElementFromChild(QXmlStreamWriter *writer) const;
69 
70 private:
71  int m_faultCode;
72  QString m_faultString;
73  QVariantList m_values;
74 };
75 
80 
81 class QXMPP_EXPORT QXmppRpcInvokeIq : public QXmppIq
82 {
83 public:
85 
86  QString method() const;
87  void setMethod( const QString &method );
88 
89  QVariantList arguments() const;
90  void setArguments(const QVariantList &arguments);
91 
93  static bool isRpcInvokeIq(const QDomElement &element);
95 
96 protected:
98  void parseElementFromChild(const QDomElement &element);
99  void toXmlElementFromChild(QXmlStreamWriter *writer) const;
101 
102 private:
103  QVariantList m_arguments;
104  QString m_method;
105 
106  friend class QXmppRpcErrorIq;
107 };
108 
109 class QXMPP_EXPORT QXmppRpcErrorIq : public QXmppIq
110 {
111 public:
112  QXmppRpcErrorIq();
113 
114  QXmppRpcInvokeIq query() const;
115  void setQuery(const QXmppRpcInvokeIq &query);
116 
118  static bool isRpcErrorIq(const QDomElement &element);
120 
121 protected:
123  void parseElementFromChild(const QDomElement &element);
124  void toXmlElementFromChild(QXmlStreamWriter *writer) const;
126 
127 private:
128  QXmppRpcInvokeIq m_query;
129 };
130 
131 #endif // QXMPPRPCIQ_H