blob: 8c72bc62afb806012c4bfbac38f4f3d843ee0a4c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#ifndef XMLRPCPENDINGCALL_H
#define XMLRPCPENDINGCALL_H
#include <QtCore/QObject>
#include <QtCore/QXmlStreamReader>
#include <QtNetwork/QNetworkReply>
class XmlRpcInterface;
class XmlRpcPendingCall : public QObject
{
Q_OBJECT
friend class XmlRpcInterface;
protected:
explicit XmlRpcPendingCall(QNetworkReply *reply, XmlRpcInterface *parent);
public:
bool isError() const;
bool isFinished() const;
bool isValid() const;
QVariant value() const;
public slots:
void waitForFinished();
signals:
void finished(XmlRpcPendingCall *self);
private:
bool decodeMethodResponse(QXmlStreamReader* r);
static QVariant decodeValue(QXmlStreamReader* r);
static QDateTime decodeISODate(QString text);
private slots:
void handleRequestFinished();
private:
QNetworkReply *_reply;
QVariant _value;
enum State {
StateWaitingReply,
StateNetworkError,
StateParseError,
StateReplyReceived,
StateFaultReceived
} _state;
};
inline bool XmlRpcPendingCall::isError() const
{
return _state != StateWaitingReply && _state != StateReplyReceived;
}
inline bool XmlRpcPendingCall::isFinished() const
{
return _state != StateWaitingReply;
}
inline bool XmlRpcPendingCall::isValid() const
{
return _state == StateReplyReceived;
}
inline QVariant XmlRpcPendingCall::value() const
{
return _value;
}
#endif // XMLRPCPENDINGCALL_H
|