Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qnetworkreplywasmimpl_p.h
Go to the documentation of this file.
1// Copyright (C) 2018 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 QNETWORKREPLYWASMIMPL_H
5#define QNETWORKREPLYWASMIMPL_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of the Network Access API. This header file may change from
13// version to version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qnetworkreply.h"
19#include "qnetworkreply_p.h"
21
22#include <QtCore/qfile.h>
23
24#include <private/qtnetworkglobal_p.h>
25#include <private/qabstractfileengine_p.h>
26
27#include <emscripten.h>
28#include <emscripten/fetch.h>
29
30#include <memory>
31
33
34class QIODevice;
35
38{
40public:
43 virtual void abort() override;
44
45 // reimplemented from QNetworkReply
46 virtual void close() override;
47 virtual qint64 bytesAvailable() const override;
48 virtual bool isSequential () const override;
49 qint64 size() const override;
50
51 virtual qint64 readData(char *data, qint64 maxlen) override;
52
54 QIODevice *outgoingData);
55
56 Q_DECLARE_PRIVATE(QNetworkReplyWasmImpl)
57
58 Q_PRIVATE_SLOT(d_func(), void emitReplyError(QNetworkReply::NetworkError errorCode, const QString &errorString))
60 Q_PRIVATE_SLOT(d_func(), void dataReceived(char *buffer, int bufferSize))
61
63 QByteArray methodName() const;
64};
65
67{
68public:
71
73 void doSendRequest();
74 static void setReplyAttributes(quintptr data, int statusCode, const QString &statusReason);
75
76 void emitReplyError(QNetworkReply::NetworkError errorCode, const QString &);
78 void dataReceived(const QByteArray &buffer, int bufferSize);
79 void headersReceived(const QByteArray &buffer);
80
81 void setStatusCode(int status, const QByteArray &statusText);
82
84 QIODevice *outgoingData);
85
87 void _q_bufferOutgoingData();
88 void _q_bufferOutgoingDataFinished();
89
90 std::shared_ptr<QAtomicInt> pendingDownloadData;
91 std::shared_ptr<QAtomicInt> pendingDownloadProgress;
92
95
101
103 std::shared_ptr<QRingBuffer> outgoingDataBuffer;
105
106 static void downloadProgress(emscripten_fetch_t *fetch);
107 static void downloadFailed(emscripten_fetch_t *fetch);
108 static void downloadSucceeded(emscripten_fetch_t *fetch);
109 static void stateChange(emscripten_fetch_t *fetch);
110
111 static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const QUrl &url);
112
113 emscripten_fetch_t *m_fetch;
114 void setReplyFinished();
115 void setCanceled();
116
117 Q_DECLARE_PUBLIC(QNetworkReplyWasmImpl)
118};
119
121
122#endif // QNETWORKREPLYWASMIMPL_H
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore \reentrant
Definition qiodevice.h:34
QString errorString() const
Returns a human-readable description of the last device error that occurred.
Operation
Indicates the operation this reply is processing.
std::shared_ptr< QRingBuffer > outgoingDataBuffer
std::shared_ptr< QAtomicInt > pendingDownloadData
std::shared_ptr< QAtomicInt > pendingDownloadProgress
QNetworkAccessManagerPrivate * managerPrivate
qint64 size() const override
For open random-access devices, this function returns the size of the device.
virtual qint64 bytesAvailable() const override
Returns the number of bytes that are available for reading.
void emitDataReadProgress(qint64 done, qint64 total)) Q_PRIVATE_SLOT(d_func()
virtual void abort() override
Aborts the operation immediately and close down any network connections still open.
void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
virtual bool isSequential() const override
virtual void close() override
Closes this device for reading.
The QNetworkReply class contains the data and headers for a request sent with QNetworkAccessManager.
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
This signal is emitted to indicate the progress of the download part of this network request,...
NetworkError
Indicates all possible error conditions found during the processing of the request.
QNetworkRequest request() const
Returns the request that was posted for this reply.
QUrl url() const
Returns the URL of the content downloaded or uploaded.
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
\inmodule QtCore
Definition qobject.h:90
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:311
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\inmodule QtCore
Definition qurl.h:94
Combined button and popup list for selecting options.
static QString methodName(const QDBusIntrospection::Method &method)
static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const QUrl &url)
GLenum GLuint buffer
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define Q_OBJECT
#define Q_PRIVATE_SLOT(d, signature)
size_t quintptr
Definition qtypes.h:72
long long qint64
Definition qtypes.h:55
QByteArray readData()