Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qhttpmultipart.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QHTTPMULTIPART_H
5#define QHTTPMULTIPART_H
6
7#include <QtNetwork/qtnetworkglobal.h>
8#include <QtCore/QSharedDataPointer>
9#include <QtCore/QByteArray>
10#include <QtCore/QIODevice>
11#include <QtNetwork/QNetworkRequest>
12
13#ifndef Q_OS_WASM
15#endif
16
18
19
21class QHttpMultiPart;
22class QDebug;
23
24class Q_NETWORK_EXPORT QHttpPart
25{
26public:
27 QHttpPart();
29 ~QHttpPart();
30 QHttpPart &operator=(QHttpPart &&other) noexcept { swap(other); return *this; }
31 QHttpPart &operator=(const QHttpPart &other);
32
33 void swap(QHttpPart &other) noexcept { d.swap(other.d); }
34
35 bool operator==(const QHttpPart &other) const;
36 inline bool operator!=(const QHttpPart &other) const
37 { return !operator==(other); }
38
40 void setRawHeader(const QByteArray &headerName, const QByteArray &headerValue);
41
42 void setBody(const QByteArray &body);
44
45private:
46 QSharedDataPointer<QHttpPartPrivate> d;
47
49#ifndef QT_NO_DEBUG_STREAM
50 friend Q_NETWORK_EXPORT QDebug operator<<(QDebug debug, const QHttpPart &httpPart);
51#endif
52};
53
54Q_DECLARE_SHARED(QHttpPart)
55
57
58class Q_NETWORK_EXPORT QHttpMultiPart : public QObject
59{
61
62public:
63
70
71 explicit QHttpMultiPart(QObject *parent = nullptr);
72 explicit QHttpMultiPart(ContentType contentType, QObject *parent = nullptr);
74
75 void append(const QHttpPart &httpPart);
76
77 void setContentType(ContentType contentType);
78
79 QByteArray boundary() const;
80 void setBoundary(const QByteArray &boundary);
81
82private:
83 Q_DECLARE_PRIVATE(QHttpMultiPart)
84 Q_DISABLE_COPY(QHttpMultiPart)
85
88};
89
91
92#endif // QHTTPMULTIPART_H
IOBluetoothDevice * device
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
The QHttpMultiPart class resembles a MIME multipart message to be sent over HTTP.
ContentType
List of known content types for a multipart subtype as described in RFC 2046 and others.
The QHttpPart class holds a body part to be used inside a HTTP multipart MIME message.
bool operator!=(const QHttpPart &other) const
Returns true if this object is not the same as other.
QHttpPart & operator=(QHttpPart &&other) noexcept
void swap(QHttpPart &other) noexcept
\inmodule QtCore \reentrant
Definition qiodevice.h:34
The QNetworkAccessManager class allows the application to send network requests and receive replies.
KnownHeaders
List of known header types that QNetworkRequest parses.
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore
Definition qvariant.h:65
list append(new Employee("Blackpool", "Stephen"))
Combined button and popup list for selecting options.
static QString header(const QString &name)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static QByteArray headerValue(QNetworkRequest::KnownHeaders header, const QVariant &value)
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
#define QT_REQUIRE_CONFIG(feature)
#define Q_OBJECT
QDataStream & operator<<(QDataStream &out, const MyClass &myObj)
[4]
QSharedPointer< T > other(t)
[5]
this swap(other)
imagePart setBodyDevice(file)
textPart setBody("my text")
textPart setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"text\""))
imagePart setRawHeader("Content-ID", "my@content.id")