QXmpp Version:0.3.91
|
00001 /* 00002 * Copyright (C) 2008-2011 The QXmpp developers 00003 * 00004 * Authors: 00005 * Ian Reinhart Geiser 00006 * Jeremy Lainé 00007 * 00008 * Source: 00009 * http://code.google.com/p/qxmpp 00010 * 00011 * This file is a part of QXmpp library. 00012 * 00013 * This library is free software; you can redistribute it and/or 00014 * modify it under the terms of the GNU Lesser General Public 00015 * License as published by the Free Software Foundation; either 00016 * version 2.1 of the License, or (at your option) any later version. 00017 * 00018 * This library is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00021 * Lesser General Public License for more details. 00022 * 00023 */ 00024 00025 #ifndef QXMPPRPCIQ_H 00026 #define QXMPPRPCIQ_H 00027 00028 #include "QXmppIq.h" 00029 #include <QVariant> 00030 00031 class QXmlStreamWriter; 00032 class QDomElement; 00033 00034 namespace XMLRPC 00035 { 00036 void marshall( QXmlStreamWriter *writer, const QVariant &value); 00037 QVariant demarshall(const QDomElement &elem, QStringList &errors); 00038 } 00039 00044 00045 class QXmppRpcResponseIq : public QXmppIq 00046 { 00047 public: 00048 QXmppRpcResponseIq(); 00049 00050 int faultCode() const; 00051 void setFaultCode(int faultCode); 00052 00053 QString faultString() const; 00054 void setFaultString(const QString &faultString); 00055 00056 QVariantList values() const; 00057 void setValues(const QVariantList &values); 00058 00060 static bool isRpcResponseIq(const QDomElement &element); 00062 00063 protected: 00065 void parseElementFromChild(const QDomElement &element); 00066 void toXmlElementFromChild(QXmlStreamWriter *writer) const; 00068 00069 private: 00070 int m_faultCode; 00071 QString m_faultString; 00072 QVariantList m_values; 00073 }; 00074 00079 00080 class QXmppRpcInvokeIq : public QXmppIq 00081 { 00082 public: 00083 QXmppRpcInvokeIq(); 00084 00085 QString method() const; 00086 void setMethod( const QString &method ); 00087 00088 QVariantList arguments() const; 00089 void setArguments(const QVariantList &arguments); 00090 00092 static bool isRpcInvokeIq(const QDomElement &element); 00094 00095 protected: 00097 void parseElementFromChild(const QDomElement &element); 00098 void toXmlElementFromChild(QXmlStreamWriter *writer) const; 00100 00101 private: 00102 QVariantList m_arguments; 00103 QString m_method; 00104 00105 friend class QXmppRpcErrorIq; 00106 }; 00107 00108 class QXmppRpcErrorIq : public QXmppIq 00109 { 00110 public: 00111 QXmppRpcErrorIq(); 00112 00113 QXmppRpcInvokeIq query() const; 00114 void setQuery(const QXmppRpcInvokeIq &query); 00115 00117 static bool isRpcErrorIq(const QDomElement &element); 00119 00120 protected: 00122 void parseElementFromChild(const QDomElement &element); 00123 void toXmlElementFromChild(QXmlStreamWriter *writer) const; 00125 00126 private: 00127 QXmppRpcInvokeIq m_query; 00128 }; 00129 00130 #endif // QXMPPRPCIQ_H