NuriaProject Framework
0.1
The NuriaProject Framework
|
Abstract class for readers of the body of HTTP POST requests. More...
#include <httppostbodyreader.hpp>
Signals | |
void | completed (bool success) |
void | fieldCompleted (const QString &fieldName) |
void | fieldFound (const QString &fieldName) |
Public Member Functions | |
HttpPostBodyReader (QObject *parent=0) | |
~HttpPostBodyReader () | |
virtual qint64 | fieldBytesTransferred (const QString &field) const =0 |
virtual qint64 | fieldLength (const QString &field) const =0 |
virtual QString | fieldMimeType (const QString &field) const =0 |
virtual QStringList | fieldNames () const =0 |
virtual QIODevice * | fieldStream (const QString &field)=0 |
virtual QByteArray | fieldValue (const QString &field) |
virtual bool | hasFailed () const =0 |
virtual bool | hasField (const QString &field) const |
virtual bool | isComplete () const =0 |
virtual bool | isFieldComplete (const QString &field) const |
Abstract class for readers of the body of HTTP POST requests.
When a client sends a POST request, the body may be in various formats. This abstract class offers a abstraction layer around this, so implementations don't have to deal with the differences.
Implementations of this abstract class will most likely use a QIODevice as input. Please be aware that the device is thought to be sequential, thus large amounts of data may be copied.
|
explicit |
Constructor.
Nuria::HttpPostBodyReader::~HttpPostBodyReader | ( | ) |
Destructor.
|
signal |
Emitted when the body has been completely processed. If success is true
, parsing was successful. Else it failed.
|
pure virtual |
Returns the amount of bytes transferred of field.
Implemented in Nuria::HttpMultiPartReader, and Nuria::HttpUrlEncodedReader.
|
signal |
Emitted when a field called fieldName has been completely received.
|
signal |
Emitted when a field called fieldName has been started to be transferred. Information about it may not be complete yet.
|
pure virtual |
Returns the total length of field. If field is unknown or the length is unknown, returns -1
.
Implemented in Nuria::HttpMultiPartReader, and Nuria::HttpUrlEncodedReader.
|
pure virtual |
Returns the MIME-Type of field. If field does not exist or the MIME-Type is unknown, returns an empty string.
Implemented in Nuria::HttpMultiPartReader, and Nuria::HttpUrlEncodedReader.
|
pure virtual |
Returns the list of known field names.
Implemented in Nuria::HttpMultiPartReader, and Nuria::HttpUrlEncodedReader.
|
pure virtual |
Returns a QIODevice which reads contents from field in a streaming fashion. If field has not been found, nullptr
is returned instead.
If field is a known field but is currently been transferred, then the returned stream will operate upon the already received data and new received data is put into it.
Implemented in Nuria::HttpMultiPartReader, and Nuria::HttpUrlEncodedReader.
|
virtual |
Returns the value of field. If the field has not been received completely yet or there's no field, then a empty QByteArray is returned.
The default implementation uses infoStream() to obtain the device and read all of its content, if isFieldComplete() returns true
.
Reimplemented in Nuria::HttpUrlEncodedReader.
|
pure virtual |
Returns true
if parsing has failed.
Implemented in Nuria::HttpMultiPartReader, and Nuria::HttpUrlEncodedReader.
|
virtual |
Returns true
if field exists. The default implementation looks for field in the result of fieldNames().
Reimplemented in Nuria::HttpMultiPartReader, and Nuria::HttpUrlEncodedReader.
|
pure virtual |
Returns true
if the body has been read completely. Also returns true
if parsing has failed.
Implemented in Nuria::HttpMultiPartReader, and Nuria::HttpUrlEncodedReader.
|
virtual |
Returns true
if transfer of field is complete. If it is not, or if field does not exist, false
is returned.
The default implementation compares the result of fieldLength() to the one of fieldBytesTransferred().
Reimplemented in Nuria::HttpMultiPartReader, and Nuria::HttpUrlEncodedReader.