xmlrpc/client.h

    00001 // vim:tabstop=4:shiftwidth=4:expandtab:cinoptions=(s,U1,m1
    00002 // Copyright (C) 2009 Dmytro Poplavskiy <dmitry.poplavsky@gmail.com>
    00003
    00004 #ifndef CLIENT_H
    00005 #define CLIENT_H
    00006
    00007 #include <qobject.h>
    00008 #include <QHttp>
    00009
    00010 #include "variant.h"
    00011 class QAuthenticator;
    00012
    00013 namespace  xmlrpc {
    00014
    00043 class Client : public QObject {
    00044 Q_OBJECT
    00045 public:
    00046     Client(QObject * parent = 0);
    00047     Client(const QString & hostname, quint16 port = 80, QObject * parent = 0L);
    00048
    00049     void setHost ( const QString & hostname, quint16 port = 80, QString path="/" );
    00050     void setProxy ( const QString & host, int port,
    00051                     const QString & username = QString(), const QString & password = QString() );
    00052     void setSocket ( QTcpSocket * socket );
    00053     void setUser ( const QString & userName, const QString & password = QString() );
    00054
    00055     void setUserAgent( const QString & userAgent );
    00056
    00057     virtual ~Client();
    00058
    00059     int request( QList<Variant> params, QString methodName );
    00060
    00061     /* overloaded methods */
    00062     int request( QString methodName );
    00063     int request( QString methodName, Variant param1 );
    00064     int request( QString methodName, Variant param1, Variant param2 );
    00065     int request( QString methodName, Variant param1, Variant param2, Variant param3 );
    00066     int request( QString methodName, Variant param1, Variant param2, Variant param3, Variant param4 );
    00067
    00068 signals:
    00070     void done( int requestId, QVariant res );
    00072     void failed( int requestId, int faultCode, QString faultString );
    00073
    00075     void authenticationRequired ( const QString & hostname, quint16 port, QAuthenticator * );
    00076
    00078     void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *);
    00079
    00080 protected slots:
    00081     void requestFinished(int id, bool error);
    00082
    00083 private:
    00084     class Private;
    00085     Private *d;
    00086 };
    00087
    00088 } // namespace
    00089
    00090 #endif // CLIENT_H
    00091
    00092