deCONZ C++ API v2.6.1
Loading...
Searching...
No Matches
qhttprequest_compat.h
1#ifndef QHTTPREQUEST_COMPAT_H
2#define QHTTPREQUEST_COMPAT_H
3
4/*
5 * Copyright (c) 2012-2023 dresden elektronik ingenieurtechnik gmbh.
6 * All rights reserved.
7 *
8 * The software in this package is published under the terms of the BSD
9 * style license a copy of which has been included with this distribution in
10 * the LICENSE.txt file.
11 *
12 */
13
14#include <QLatin1String>
15#include "deconz/declspec.h"
16
17class QString;
19
20namespace Http {
21
22 enum HttpStatus
23 {
24 HttpStatusOk = 200,
25 HttpStatusBadRequest = 400,
26 HttpStatusMethodNotAllowed = 405,
27 HttpStatusPayloadTooLarge = 413,
28 HttpStatusUriTooLong = 414,
29 HttpStatusRequestHeaderFieldsTooLarge = 431
30 };
31}
32
33enum HttpMethod
34{
35 HttpUnkown = 0,
36 HttpGet = 1,
37 HttpPut = 2,
38 HttpPost = 3,
39 HttpPatch = 4,
40 HttpDelete = 5,
41 HttpOptions = 6,
42 HttpHead = 6
43};
44
45class DECONZ_DLLSPEC QHttpRequestHeader
46{
47public:
48 QHttpRequestHeader();
49 QHttpRequestHeader(const QHttpRequestHeader &other);
54 QHttpRequestHeader(const char *buf, size_t size);
55 QHttpRequestHeader(const QString &method, const QString &path);
56 QHttpRequestHeader& operator=(const QHttpRequestHeader &other);
57 ~QHttpRequestHeader();
58 bool hasKey(const QLatin1String &key) const;
59 size_t contentLength() const;
60 QLatin1String path() const;
61 QLatin1String pathAt(size_t i) const;
62 size_t pathComponentsCount() const;
63 QLatin1String method() const;
64 HttpMethod httpMethod() const;
65 QLatin1String value(const QLatin1String &key) const;
66 QLatin1String url() const;
67
71 bool update(const char *buf, size_t size);
72
73 Http::HttpStatus parseStatus() const;
74
75private:
76 QHttpRequestHeaderPrivate *d_ptr = nullptr;
77};
78
79#endif // QHTTPREQUEST_COMPAT_H
80
Definition qhttprequest_compat.cpp:139