-
Notifications
You must be signed in to change notification settings - Fork 1
/
qparsereply.h
83 lines (71 loc) · 2.3 KB
/
qparsereply.h
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
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef QPARSEREPLY_H
#define QPARSEREPLY_H
#include <QObject>
#include <QJsonObject>
#include <QUrl>
class QParseRequest;
class QParse;
/*! This object is returned by QParse when a QParseRequest has been submitted.
*
* Bind the signal finished to the proper slot delegate to handle the data returned
* by PARSE
*
* \warning Never create by yourself
*/
class QParseReply : public QObject {
Q_OBJECT
//! The request corresponding to this reply
Q_PROPERTY( QParseRequest* request MEMBER request CONSTANT )
/*! If it's true, then the returned data is a JSON object
* \warning it can be an error, because in case of error Parse.com return a JSON message
*/
Q_PROPERTY( bool isJson MEMBER isJson )
//! the Json object containing the reply in case of isJson is true
Q_PROPERTY( QJsonObject json MEMBER json )
//! the local URL where the file is stored
Q_PROPERTY( QUrl localUrl MEMBER localUrl )
//! if true means that an error occurred during the request on PARSE
Q_PROPERTY( bool hasError MEMBER hasError )
//! the error message, if any
Q_PROPERTY( QString errorMessage MEMBER errorMessage )
//! the error code, if any
Q_PROPERTY( int errorCode MEMBER errorCode )
public:
/*! Constructor
* the parent is always QParse singleton instance because
* this object is created by QParse singleton
*/
QParseReply( QParseRequest* request, QParse* parent );
QParseRequest* getRequest() const;
bool getIsJson() const;
void setIsJson(bool value);
QJsonObject getJson() const;
void setJson(const QJsonObject &value);
QUrl getLocalUrl() const;
void setLocalUrl(const QUrl &value);
bool getHasError() const;
void setHasError(bool value);
QString getErrorMessage() const;
void setErrorMessage(const QString &value);
int getErrorCode() const;
void setErrorCode(int value);
signals:
//! emitted when the reply has been arrived and prepared to be processed
void finished( QParseReply* reply);
private:
//! the request
QParseRequest* request;
//! true means the data is a JSON object
bool isJson;
//! the Json object containing the reply
QJsonObject json;
//! it point to a local file on cache
QUrl localUrl;
//! true means there was an error during the request
bool hasError;
//! the error message, if any
QString errorMessage;
//! the error code, if any
int errorCode;
};
#endif // QPARSEREPLY