7#include "private/qnoncontiguousbytedevice_p.h"
9#include <QtCore/QCoreApplication>
10#include <QtCore/QDateTime>
21#if defined(Q_OS_ANDROID)
44#
if defined(Q_OS_ANDROID)
69 hasUploadFinished(
false)
81 if (url.
host() ==
"localhost"_L1)
102#if defined(Q_OS_ANDROID)
117 QIODevice::OpenMode
mode;
129 Q_ASSERT_X(
false,
"QNetworkAccessFileBackend::open",
130 "Got a request operation I cannot handle!!");
157 if (hasUploadFinished)
163 if (haveRead == -1) {
165 hasUploadFinished =
true;
170 }
else if (haveRead == 0) {
175 data.truncate(haveRead);
178 if (haveWritten < 0) {
203bool QNetworkAccessFileBackend::loadFileInfo()
234 if (actuallyRead <= 0) {
250 totalBytes += actuallyRead;
256#include "moc_qnetworkaccessfilebackend_p.cpp"
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
bool flush()
Flushes any buffered data to the file.
bool atEnd() const override
Returns true if the end of the file has been reached; otherwise returns false.
FileError error() const
Returns the file error status.
bool isSequential() const override
Returns true if the file can only be manipulated sequentially; otherwise returns false.
void close() override
Calls QFileDevice::flush() and closes the file.
QFILE_MAYBE_NODISCARD bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
void setFileName(const QString &name)
Sets the name of the file.
bool exists() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
qint64 peek(char *data, qint64 maxlen)
virtual qint64 bytesAvailable() const
Returns the number of bytes that are available for reading.
qint64 skip(qint64 maxSize)
QString errorString() const
Returns a human-readable description of the last device error that occurred.
void readChannelFinished()
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read.
QNetworkAccessBackend is the base class for implementing support for schemes used by QNetworkAccessMa...
QIODevice * uploadByteDevice()
Returns the upload byte device associated with the current request.
QNetworkAccessManager::Operation operation() const
Returns the operation which was requested when calling QNetworkAccessManager.
void readyRead()
Call this slot when you have more data available to notify the backend that we can attempt to read ag...
void finished()
Call this slot when there will be no more data available, regardless of whether the transfer was succ...
void setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value)
Sets the value of the header to value.
QUrl url() const
Returns the current URL of the reply.
QIODevice * createUploadByteDevice()
Creates a QIODevice for the data provided to upload, if any.
TargetType
Use the values in this enum to specify what type of target the plugin supports.
void metaDataChanged()
Call this slot, if appropriate, after having processed and updated metadata (e.g.
void setUrl(const QUrl &url)
Sets the URL of the reply.
virtual QNetworkAccessBackend * create(QNetworkAccessManager::Operation op, const QNetworkRequest &request) const override
Override this method in your own class and return a heap-allocated instance of your class derived fro...
virtual QStringList supportedSchemes() const override
Override this method in your own derived class to let Qt know what schemes your class can handle.
void close() override
You must implement this function in your derived class.
qint64 bytesAvailable() const override
You must implement this function in your derived class.
virtual ~QNetworkAccessFileBackend()
QNetworkAccessFileBackend()
void open() override
You must implement this in your derived class.
void uploadReadyReadSlot()
qint64 read(char *data, qint64 maxlen) override
Implement this function to support reading from the resource made available by your plugin.
Operation
Indicates the operation this reply is processing.
@ ContentOperationNotPermittedError
@ ProtocolInvalidOperationError
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
QUrl url() const
Returns the URL this network request is referring to.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
qsizetype size() const noexcept
Returns the number of characters in this string.
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QString host(ComponentFormattingOptions=FullyDecoded) const
Returns the host of the URL if it is defined; otherwise an empty string is returned.
QString authority(ComponentFormattingOptions options=PrettyDecoded) const
Returns the authority of the URL if it is defined; otherwise an empty string is returned.
QString scheme() const
Returns the scheme of the URL.
void setHost(const QString &host, ParsingMode mode=DecodedMode)
Sets the host of the URL to host.
void setPath(const QString &path, ParsingMode mode=DecodedMode)
Sets the path of the URL to path.
QString toString(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
QString toLocalFile() const
Returns the path of this URL formatted as a local file path.
QString path(ComponentFormattingOptions options=FullyDecoded) const
Returns the path of the URL.
Combined button and popup list for selecting options.
constexpr Initialization Uninitialized
DBusConnection const char DBusError * error
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define Q_ASSERT_X(cond, x, msg)
#define QStringLiteral(str)
QUrl url("example.com")
[constructor-url-reference]
QNetworkRequest request(url)
char * toString(const MyType &t)
[31]