forked from Cutehacks/duperagent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
response.h
84 lines (67 loc) · 2.08 KB
/
response.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
84
// Copyright 2016 Cutehacks AS. All rights reserved.
// License can be found in the LICENSE file.
#ifndef RESPONSE_H
#define RESPONSE_H
#include <QtCore/QObject>
#include <QtQml/QJSValue>
#include<QVariant>
class QQmlEngine;
class QNetworkReply;
#include "qpm.h"
namespace com { namespace cutehacks { namespace duperagent {
class ResponsePrototype : public QObject {
Q_OBJECT
Q_PROPERTY(bool info READ info)
Q_PROPERTY(bool ok READ ok)
Q_PROPERTY(bool clientError READ clientError)
Q_PROPERTY(bool serverError READ serverError)
Q_PROPERTY(bool error READ error)
Q_PROPERTY(bool accepted READ accepted)
Q_PROPERTY(bool noContent READ noContent)
Q_PROPERTY(bool badRequest READ badRequest)
Q_PROPERTY(bool unauthorized READ unauthorized)
Q_PROPERTY(bool notAcceptable READ notAcceptable)
Q_PROPERTY(bool notFound READ notFound)
Q_PROPERTY(bool forbidden READ forbidden)
Q_PROPERTY(bool fromCache READ fromCache)
Q_PROPERTY(int status READ statusCode)
Q_PROPERTY(int statusType READ statusType)
Q_PROPERTY(QString text READ text)
Q_PROPERTY(QString charset READ charset)
Q_PROPERTY(QJSValue body READ body)
Q_PROPERTY(QJSValue header READ header)
public:
ResponsePrototype(QQmlEngine *, QNetworkReply *, int);
~ResponsePrototype();
bool info() const;
bool ok() const;
bool clientError() const;
bool serverError() const;
bool error() const;
bool accepted() const;
bool noContent() const;
bool badRequest() const;
bool unauthorized() const;
bool notAcceptable() const;
bool notFound() const;
bool forbidden() const;
bool fromCache() const;
int statusCode() const;
int statusType() const;
QString text() const;
QString charset() const;
QJSValue body() const;
QJSValue header() const;
protected:
bool typeEquals(int code) const;
bool statusEquals(int code) const;
private:
QQmlEngine *m_engine;
QNetworkReply *m_reply;
QString m_text;
QString m_charset;
QJSValue m_body;
QJSValue m_header;
};
} } }
#endif // RESPONSE_H