TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
qhttpresponse.h
Go to the documentation of this file.
1 #ifndef QHTTPRESPONSE_H
2 #define QHTTPRESPONSE_H
3 
4 /***************************************************************************
5  * This file is part of the TTK Music Player project
6  * Copyright (C) 2015 - 2024 Greedysky Studio
7 
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12 
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17 
18  * You should have received a copy of the GNU General Public License along
19  * with this program; If not, see <http://www.gnu.org/licenses/>.
20  ***************************************************************************/
21 
22 #include "qhttpserverfwd.h"
23 
25 
29 class TTK_MODULE_EXPORT QHttpResponse : public QObject
30 {
31  Q_OBJECT
32 public:
34  enum StatusCode {
35  STATUS_CONTINUE = 100,
36  STATUS_SWITCH_PROTOCOLS = 101,
37  STATUS_OK = 200,
38  STATUS_CREATED = 201,
39  STATUS_ACCEPTED = 202,
40  STATUS_NON_AUTHORITATIVE_INFORMATION = 203,
41  STATUS_NO_CONTENT = 204,
42  STATUS_RESET_CONTENT = 205,
43  STATUS_PARTIAL_CONTENT = 206,
44  STATUS_MULTIPLE_CHOICES = 300,
45  STATUS_MOVED_PERMANENTLY = 301,
46  STATUS_FOUND = 302,
47  STATUS_SEE_OTHER = 303,
48  STATUS_NOT_MODIFIED = 304,
49  STATUS_USE_PROXY = 305,
50  STATUS_TEMPORARY_REDIRECT = 307,
51  STATUS_BAD_REQUEST = 400,
52  STATUS_UNAUTHORIZED = 401,
53  STATUS_PAYMENT_REQUIRED = 402,
54  STATUS_FORBIDDEN = 403,
55  STATUS_NOT_FOUND = 404,
56  STATUS_METHOD_NOT_ALLOWED = 405,
57  STATUS_NOT_ACCEPTABLE = 406,
58  STATUS_PROXY_AUTHENTICATION_REQUIRED = 407,
59  STATUS_REQUEST_TIMEOUT = 408,
60  STATUS_CONFLICT = 409,
61  STATUS_GONE = 410,
62  STATUS_LENGTH_REQUIRED = 411,
63  STATUS_PRECONDITION_FAILED = 412,
64  STATUS_REQUEST_ENTITY_TOO_LARGE = 413,
65  STATUS_REQUEST_URI_TOO_LONG = 414,
66  STATUS_REQUEST_UNSUPPORTED_MEDIA_TYPE = 415,
67  STATUS_REQUESTED_RANGE_NOT_SATISFIABLE = 416,
68  STATUS_EXPECTATION_FAILED = 417,
69  STATUS_INTERNAL_SERVER_ERROR = 500,
70  STATUS_NOT_IMPLEMENTED = 501,
71  STATUS_BAD_GATEWAY = 502,
72  STATUS_SERVICE_UNAVAILABLE = 503,
73  STATUS_GATEWAY_TIMEOUT = 504,
74  STATUS_HTTP_VERSION_NOT_SUPPORTED = 505
75  };
76 
78  friend class QHttpConnection;
79  friend class QHttpConnectionPrivate;
81 
82 public Q_SLOTS:
84 
88  void setHeader(const QString &field, const QString &value);
89 
92 
95  void writeHead(int statusCode);
96 
98  void writeHead(StatusCode statusCode);
99 
101 
102  void write(const QByteArray &data);
103 
105 
106  void flush();
107 
109 
110  void waitForBytesWritten();
111 
113 
120  void end(const QByteArray &data = "");
121 
122 Q_SIGNALS:
124 
128  void allBytesWritten();
129 
131 
134  void done();
135 
136 private Q_SLOTS:
137  void connectionClosed();
138 
139 private:
140  explicit QHttpResponse(QHttpConnection *connection);
141 
143  void setKeepAlive(bool alive);
145  bool isLast() const;
146 
147 private:
149 
150 };
151 
152 #endif
#define TTK_MODULE_EXPORT
The class of the http response.
Definition: qhttpresponse.h:29
The class of the http connection.
The class of the http connection private.
void write(const QByteArray &data)
#define TTK_DECLARE_PRIVATE(Class)
Definition: ttkprivate.h:26
StatusCode
HTTP status code.
Definition: qhttpresponse.h:34
The class of the http response private.