TreeFrogFramework  1.18
thttpresponse.h
Go to the documentation of this file.
1 #ifndef THTTPRESPONSE_H
2 #define THTTPRESPONSE_H
3 
4 #include <QByteArray>
5 #include <QDateTime>
6 #include <TGlobal>
7 #include <THttpResponseHeader>
8 
9 class QIODevice;
10 
11 
13 {
14 public:
15  THttpResponse();
16  THttpResponse(const THttpResponseHeader &header, const QByteArray &body);
17  ~THttpResponse();
18 
19  THttpResponseHeader &header() { return resHeader; }
20  const THttpResponseHeader &header() const { return resHeader; }
21  bool isBodyNull() const;
22  void setBody(const QByteArray &body);
23  void setBodyFile(const QString &filePath);
24  QIODevice *bodyIODevice() { return bodyDevice; }
25  qint64 bodyLength() const { return (bodyDevice) ? bodyDevice->size() : 0; }
26 
27 private:
28  THttpResponseHeader resHeader;
29  QByteArray tmpByteArray;
30  QIODevice *bodyDevice;
31 
34 };
35 
36 
37 inline THttpResponse::THttpResponse() : bodyDevice(0)
38 { }
39 
40 #endif // THTTPRESPONSE_H
#define T_CORE_EXPORT
Definition: tglobal.h:81
The THttpResponse class contains response information for HTTP.
Definition: thttpresponse.h:12
THttpResponse()
Constructor.
Definition: thttpresponse.h:37
THttpResponseHeader & header()
Return the HTTP header.
Definition: thttpresponse.h:19
const THttpResponseHeader & header() const
Return the HTTP header.
Definition: thttpresponse.h:20
#define T_DISABLE_COPY(Class)
Definition: tglobal.h:137
#define T_DISABLE_MOVE(Class)
Definition: tglobal.h:141
qint64 bodyLength() const
Returns the number of bytes of the body.
Definition: thttpresponse.h:25
The THttpResponseHeader class contains response header information for HTTP.
Definition: thttpheader.h:48
QIODevice * bodyIODevice()
Returns the IO device of the body currently set.
Definition: thttpresponse.h:24