forked from cpeditor/qhttp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qhttpserverresponse.hpp
70 lines (55 loc) · 2.13 KB
/
qhttpserverresponse.hpp
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
/** HTTP response from a server.
* https://github.com/azadkuh/qhttp
*
* @author amir zamani
* @version 2.0.0
* @date 2014-07-11
*/
#ifndef QHTTPSERVER_RESPONSE_HPP
#define QHTTPSERVER_RESPONSE_HPP
///////////////////////////////////////////////////////////////////////////////
#include "qhttpabstracts.hpp"
///////////////////////////////////////////////////////////////////////////////
namespace qhttp {
namespace server {
///////////////////////////////////////////////////////////////////////////////
/** The QHttpResponse class handles sending data back to the client as a response to a request.
* @sa QHttpConnection
*/
class QHttpResponse : public QHttpAbstractOutput
{
Q_OBJECT
public:
virtual ~QHttpResponse();
public:
/** set the response HTTP status code. @sa TStatusCode.
* default value is ESTATUS_BAD_REQUEST.
* @sa write()
*/
void setStatusCode(TStatusCode code);
public: // QHttpAbstractOutput methods:
/** @see QHttpAbstractOutput::setVersion(). */
void setVersion(const QString& versionString) override;
/** @see QHttpAbstractOutput::addHeader(). */
void addHeader(const QByteArray& field, const QByteArray& value) override;
/** @see QHttpAbstractOutput::headers(). */
THeaderHash& headers() override;
/** @see QHttpAbstractOutput::write(). */
void write(const QByteArray &data) override;
/** @see QHttpAbstractOutput::end(). */
void end(const QByteArray &data = QByteArray()) override;
public:
/** returns the parent QHttpConnection object. */
QHttpConnection* connection() const;
protected:
explicit QHttpResponse(QHttpConnection*);
explicit QHttpResponse(QHttpResponsePrivate&, QHttpConnection*);
friend class QHttpConnectionPrivate;
Q_DECLARE_PRIVATE(QHttpResponse)
QScopedPointer<QHttpResponsePrivate> d_ptr;
};
///////////////////////////////////////////////////////////////////////////////
} // namespace server
} // namespace qhttp
///////////////////////////////////////////////////////////////////////////////
#endif // define QHTTPSERVER_RESPONSE_HPP