blob: c88f5abe846d762bb945b6a803f4ca404ce5544a (
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
|
#pragma once
#include <QMetaType>
namespace mixxx {
namespace network {
typedef int HttpStatusCode;
const HttpStatusCode kHttpStatusCodeInvalid = -1;
const HttpStatusCode kHttpStatusCodeOk = 200;
const HttpStatusCode kHttpStatusCodeCreated = 201;
const HttpStatusCode kHttpStatusCodeAccepted = 202;
const HttpStatusCode kHttpStatusCodeNoContent = 204;
inline bool HttpStatusCode_isInformational(
int statusCode) {
return statusCode >= 100 && statusCode < 200;
}
inline bool HttpStatusCode_isSuccess(
int statusCode) {
return statusCode >= 200 && statusCode < 300;
}
inline bool HttpStatusCode_isRedirection(
int statusCode) {
return statusCode >= 300 && statusCode < 400;
}
inline bool HttpStatusCode_isClientError(
int statusCode) {
return statusCode >= 400 && statusCode < 500;
}
inline bool HttpStatusCode_isServerError(
int statusCode) {
return statusCode >= 500 && statusCode < 600;
}
inline bool HttpStatusCode_isCustomError(
int statusCode) {
return statusCode >= 900 && statusCode < 1000;
}
inline bool HttpStatusCode_isError(
int statusCode) {
return HttpStatusCode_isClientError(statusCode) ||
HttpStatusCode_isServerError(statusCode) ||
HttpStatusCode_isCustomError(statusCode);
}
inline bool HttpStatusCode_isValid(
int statusCode) {
return (statusCode >= 100 && statusCode < 600) ||
HttpStatusCode_isCustomError(statusCode);
}
} // namespace network
} // namespace mixxx
Q_DECLARE_METATYPE(mixxx::network::HttpStatusCode);
|