Qt 4.8
Public Functions | Protected Variables | Properties | List of all members
QHttpNormalRequest Class Reference
Inheritance diagram for QHttpNormalRequest:
QHttpRequest QHttpPGHRequest

Public Functions

QIODevicedestinationDevice ()
 
bool hasRequestHeader ()
 
 QHttpNormalRequest (const QHttpRequestHeader &h, QIODevice *d, QIODevice *t)
 
 QHttpNormalRequest (const QHttpRequestHeader &h, QByteArray *d, QIODevice *t)
 
QHttpRequestHeader requestHeader ()
 
void setRequestHeader (const QHttpRequestHeader &h)
 
QIODevicesourceDevice ()
 
void start (QHttp *)
 
 ~QHttpNormalRequest ()
 
- Public Functions inherited from QHttpRequest
 QHttpRequest ()
 
virtual ~QHttpRequest ()
 

Protected Variables

QHttpRequestHeader header
 

Properties

union {
   QByteArray *   ba
 
   QIODevice *   dev
 
data
 
bool is_ba
 
QIODeviceto
 

Additional Inherited Members

- Public Variables inherited from QHttpRequest
bool finished
 
int id
 

Detailed Description

Definition at line 201 of file qhttp.cpp.

Constructors and Destructors

◆ QHttpNormalRequest() [1/2]

QHttpNormalRequest::QHttpNormalRequest ( const QHttpRequestHeader h,
QIODevice d,
QIODevice t 
)
inline

Definition at line 204 of file qhttp.cpp.

204  :
205  header(h), to(t)
206  {
207  is_ba = false;
208  data.dev = d;
209  }
double d
Definition: qnumeric_p.h:62
QIODevice * to
Definition: qhttp.cpp:241
QHttpRequestHeader header
Definition: qhttp.cpp:233
union QHttpNormalRequest::@312 data

◆ QHttpNormalRequest() [2/2]

QHttpNormalRequest::QHttpNormalRequest ( const QHttpRequestHeader h,
QByteArray d,
QIODevice t 
)
inline

Definition at line 211 of file qhttp.cpp.

211  :
212  header(h), to(t)
213  {
214  is_ba = true;
215  data.ba = d;
216  }
double d
Definition: qnumeric_p.h:62
QIODevice * to
Definition: qhttp.cpp:241
QHttpRequestHeader header
Definition: qhttp.cpp:233
union QHttpNormalRequest::@312 data

◆ ~QHttpNormalRequest()

QHttpNormalRequest::~QHttpNormalRequest ( )
inline

Definition at line 218 of file qhttp.cpp.

219  {
220  if (is_ba)
221  delete data.ba;
222  }
union QHttpNormalRequest::@312 data

Functions

◆ destinationDevice()

QIODevice * QHttpNormalRequest::destinationDevice ( )
virtual

Implements QHttpRequest.

Definition at line 294 of file qhttp.cpp.

295 {
296  return to;
297 }
QIODevice * to
Definition: qhttp.cpp:241

◆ hasRequestHeader()

bool QHttpNormalRequest::hasRequestHeader ( )
virtual

Reimplemented from QHttpRequest.

Definition at line 277 of file qhttp.cpp.

278 {
279  return true;
280 }

◆ requestHeader()

QHttpRequestHeader QHttpNormalRequest::requestHeader ( )
virtual

Reimplemented from QHttpRequest.

Definition at line 282 of file qhttp.cpp.

Referenced by QHttpPrivate::addRequest().

283 {
284  return header;
285 }
QHttpRequestHeader header
Definition: qhttp.cpp:233

◆ setRequestHeader()

void QHttpNormalRequest::setRequestHeader ( const QHttpRequestHeader h)
inline

Definition at line 227 of file qhttp.cpp.

Referenced by QHttpPrivate::addRequest().

227 { header = h; }
QHttpRequestHeader header
Definition: qhttp.cpp:233

◆ sourceDevice()

QIODevice * QHttpNormalRequest::sourceDevice ( )
virtual

Implements QHttpRequest.

Definition at line 287 of file qhttp.cpp.

288 {
289  if (is_ba)
290  return 0;
291  return data.dev;
292 }
union QHttpNormalRequest::@312 data

◆ start()

void QHttpNormalRequest::start ( QHttp http)
virtual

Implements QHttpRequest.

Reimplemented in QHttpPGHRequest.

Definition at line 244 of file qhttp.cpp.

Referenced by QHttpPGHRequest::start().

245 {
246  if (!http->d_func()->socket)
247  http->d_func()->setSock(0);
248  http->d_func()->header = header;
249 
250  if (is_ba) {
251  http->d_func()->buffer = *data.ba;
252  if (http->d_func()->buffer.size() >= 0)
253  http->d_func()->header.setContentLength(http->d_func()->buffer.size());
254 
255  http->d_func()->postDevice = 0;
256  } else {
257  http->d_func()->buffer = QByteArray();
258 
259  if (data.dev && (data.dev->isOpen() || data.dev->open(QIODevice::ReadOnly))) {
260  http->d_func()->postDevice = data.dev;
261  if (http->d_func()->postDevice->size() >= 0)
262  http->d_func()->header.setContentLength(http->d_func()->postDevice->size());
263  } else {
264  http->d_func()->postDevice = 0;
265  }
266  }
267 
268  if (to && (to->isOpen() || to->open(QIODevice::WriteOnly)))
269  http->d_func()->toDevice = to;
270  else
271  http->d_func()->toDevice = 0;
272 
273  http->d_func()->reconnectAttempts = 2;
274  http->d_func()->_q_slotSendRequest();
275 }
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
bool isOpen() const
Returns true if the device is open; otherwise returns false.
Definition: qiodevice.cpp:530
QIODevice * to
Definition: qhttp.cpp:241
QHttpRequestHeader header
Definition: qhttp.cpp:233
union QHttpNormalRequest::@312 data
virtual bool open(OpenMode mode)
Opens the device and sets its OpenMode to mode.
Definition: qiodevice.cpp:570

Properties

◆ ba

QByteArray* QHttpNormalRequest::ba

Definition at line 237 of file qhttp.cpp.

◆ data

union { ... } QHttpNormalRequest::data

◆ dev

QIODevice* QHttpNormalRequest::dev

Definition at line 238 of file qhttp.cpp.

◆ header

QHttpRequestHeader QHttpNormalRequest::header
protected

Definition at line 233 of file qhttp.cpp.

◆ is_ba

bool QHttpNormalRequest::is_ba
private

Definition at line 240 of file qhttp.cpp.

◆ to

QIODevice* QHttpNormalRequest::to
private

Definition at line 241 of file qhttp.cpp.


The documentation for this class was generated from the following file: