QXmpp  Version:0.9.3
QXmppRpcIq.h
00001 /*
00002  * Copyright (C) 2008-2014 The QXmpp developers
00003  *
00004  * Authors:
00005  *  Ian Reinhart Geiser
00006  *  Jeremy Lainé
00007  *
00008  * Source:
00009  *  https://github.com/qxmpp-project/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 QXMPP_EXPORT QXmppRpcMarshaller
00032 {
00033 public:
00034     static void marshall( QXmlStreamWriter *writer, const QVariant &value);
00035     static QVariant demarshall(const QDomElement &elem, QStringList &errors);
00036 };
00037 
00042 
00043 class QXMPP_EXPORT QXmppRpcResponseIq : public QXmppIq
00044 {
00045 public:
00046     QXmppRpcResponseIq();
00047 
00048     int faultCode() const;
00049     void setFaultCode(int faultCode);
00050 
00051     QString faultString() const;
00052     void setFaultString(const QString &faultString);
00053 
00054     QVariantList values() const;
00055     void setValues(const QVariantList &values);
00056 
00058     static bool isRpcResponseIq(const QDomElement &element);
00060 
00061 protected:
00063     void parseElementFromChild(const QDomElement &element);
00064     void toXmlElementFromChild(QXmlStreamWriter *writer) const;
00066 
00067 private:
00068     int m_faultCode;
00069     QString m_faultString;
00070     QVariantList m_values;
00071 };
00072 
00077 
00078 class QXMPP_EXPORT QXmppRpcInvokeIq : public QXmppIq
00079 {
00080 public:
00081     QXmppRpcInvokeIq();
00082 
00083     QString method() const;
00084     void setMethod( const QString &method );
00085 
00086     QVariantList arguments() const;
00087     void setArguments(const QVariantList &arguments);
00088 
00090     static bool isRpcInvokeIq(const QDomElement &element);
00092 
00093 protected:
00095     void parseElementFromChild(const QDomElement &element);
00096     void toXmlElementFromChild(QXmlStreamWriter *writer) const;
00098 
00099 private:
00100     QVariantList m_arguments;
00101     QString m_method;
00102 
00103     friend class QXmppRpcErrorIq;
00104 };
00105 
00106 class QXMPP_EXPORT QXmppRpcErrorIq : public QXmppIq
00107 {
00108 public:
00109     QXmppRpcErrorIq();
00110 
00111     QXmppRpcInvokeIq query() const;
00112     void setQuery(const QXmppRpcInvokeIq &query);
00113 
00115     static bool isRpcErrorIq(const QDomElement &element);
00117 
00118 protected:
00120     void parseElementFromChild(const QDomElement &element);
00121     void toXmlElementFromChild(QXmlStreamWriter *writer) const;
00123 
00124 private:
00125     QXmppRpcInvokeIq m_query;
00126 };
00127 
00128 #endif // QXMPPRPCIQ_H
 All Classes Functions Enumerations Enumerator Properties