TreeFrogFramework  2.8
thttpresponse.h
Go to the documentation of this file.
1 #pragma once
2 #include <QByteArray>
3 #include <QDateTime>
4 #include <TGlobal>
5 #include <THttpResponseHeader>
6 
7 class QIODevice;
8 
9 
11 public:
13  THttpResponse(const THttpResponseHeader &header, const QByteArray &body);
14  ~THttpResponse();
15 
16  THttpResponseHeader &header() { return resHeader; }
17  const THttpResponseHeader &header() const { return resHeader; }
18  bool isBodyNull() const;
19  void setBody(const QByteArray &body);
20  QByteArray body() const;
21  void setBodyFile(const QString &filePath);
22  QIODevice *bodyIODevice() { return bodyDevice; }
23  int64_t bodyLength() const { return (bodyDevice) ? bodyDevice->size() : 0; }
24  void clear();
25 
26 private:
27  THttpResponseHeader resHeader;
28  QByteArray tmpByteArray;
29  QIODevice *bodyDevice {nullptr};
30 
33 };
34 
The THttpResponseHeader class contains response header information for HTTP.
Definition: thttpheader.h:44
The THttpResponse class contains response information for HTTP.
Definition: thttpresponse.h:10
const THttpResponseHeader & header() const
Return the HTTP header.
Definition: thttpresponse.h:17
THttpResponse()
Constructor.
Definition: thttpresponse.h:12
QIODevice * bodyIODevice()
Returns the IO device of the body currently set.
Definition: thttpresponse.h:22
THttpResponseHeader & header()
Return the HTTP header.
Definition: thttpresponse.h:16
int64_t bodyLength() const
Returns the number of bytes of the body.
Definition: thttpresponse.h:23
#define T_CORE_EXPORT
Definition: tdeclexport.h:28
#define T_DISABLE_COPY(Class)
Definition: tdeclexport.h:37
#define T_DISABLE_MOVE(Class)
Definition: tdeclexport.h:41