![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QFormDataPartBuilder class is a convenience class to simplify the construction of QHttpPart objects. More...
#include <qformdatabuilder.h>
Public Member Functions | |
void | swap (QFormDataPartBuilder &other) noexcept |
QFormDataPartBuilder ()=default | |
Q_WEAK_OVERLOAD QFormDataPartBuilder | setBody (const QByteArray &data, QAnyStringView fileName={}, QAnyStringView mimeType={}) |
Q_NETWORK_EXPORT QFormDataPartBuilder | setBody (QByteArrayView data, QAnyStringView fileName={}, QAnyStringView mimeType={}) |
Sets data as the body of this MIME part and, if given, fileName as the file name parameter in the content disposition header. | |
Q_NETWORK_EXPORT QFormDataPartBuilder | setBodyDevice (QIODevice *body, QAnyStringView fileName={}, QAnyStringView mimeType={}) |
Sets body as the body device of this part and fileName as the file name parameter in the content disposition header. | |
Q_NETWORK_EXPORT QFormDataPartBuilder | setHeaders (const QHttpHeaders &headers) |
Sets the headers specified in headers. |
Friends | |
class | QFormDataBuilder |
The QFormDataPartBuilder class is a convenience class to simplify the construction of QHttpPart objects.
\inmodule QtNetwork
The QFormDataPartBuilder class can be used to build a QHttpPart object with the content disposition header set to be form-data by default. Then the generated object can be used as part of a multipart message (which is represented by the QHttpMultiPart class).
Definition at line 33 of file qformdatabuilder.h.
|
default |
|
inline |
Definition at line 46 of file qformdatabuilder.h.
QFormDataPartBuilder QFormDataPartBuilder::setBody | ( | QByteArrayView | data, |
QAnyStringView | fileName = {}, | ||
QAnyStringView | mimeType = {} ) |
Sets data as the body of this MIME part and, if given, fileName as the file name parameter in the content disposition header.
If mimeType is not given (is empty), then QFormDataPartBuilder tries to auto-detect the mime-type of data using QMimeDatabase.
A subsequent call to setBodyDevice() discards the body and the device will be used instead.
For a large amount of data (e.g. an image), setBodyDevice() is preferred, which will not copy the data internally.
Definition at line 196 of file qformdatabuilder.cpp.
QFormDataPartBuilder QFormDataPartBuilder::setBodyDevice | ( | QIODevice * | body, |
QAnyStringView | fileName = {}, | ||
QAnyStringView | mimeType = {} ) |
Sets body as the body device of this part and fileName as the file name parameter in the content disposition header.
If mimeType is not given (is empty), then QFormDataPartBuilder tries to auto-detect the mime-type of body using QMimeDatabase.
A subsequent call to setBody() discards the body device and the data set by setBody() will be used instead.
For large amounts of data this method should be preferred over setBody(), because the content is not copied when using this method, but read directly from the device.
body must be open and readable. QFormDataPartBuilder does not take ownership of body, i.e. the device must be closed and destroyed if necessary.
Definition at line 228 of file qformdatabuilder.cpp.
QFormDataPartBuilder QFormDataPartBuilder::setHeaders | ( | const QHttpHeaders & | headers | ) |
Sets the headers specified in headers.
Definition at line 246 of file qformdatabuilder.cpp.
|
inlinenoexcept |
Definition at line 37 of file qformdatabuilder.h.
|
friend |
Definition at line 69 of file qformdatabuilder.h.