Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qnetworkaccessfilebackend_p.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// Qt-Security score:significant reason:default
4
5#ifndef QNETWORKACCESSFILEBACKEND_P_H
6#define QNETWORKACCESSFILEBACKEND_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists for the convenience
13// of the Network Access API. This header file may change from
14// version to version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtNetwork/private/qtnetworkglobal_p.h>
22#include "qnetworkreply.h"
23#include "QtCore/qfile.h"
24
25QT_BEGIN_NAMESPACE
26
27class QNetworkAccessFileBackend: public QNetworkAccessBackend
28{
29 Q_OBJECT
30public:
31 QNetworkAccessFileBackend();
32 virtual ~QNetworkAccessFileBackend();
33
34 void open() override;
35 void close() override;
36
37 qint64 bytesAvailable() const override;
38 qint64 read(char *data, qint64 maxlen) override;
39
40public slots:
41 void uploadReadyReadSlot();
42private:
43 QFile file;
44 qint64 totalBytes;
45 bool hasUploadFinished;
46
47 bool loadFileInfo();
48};
49
51{
52public:
53 virtual QStringList supportedSchemes() const override;
54 virtual QNetworkAccessBackend *create(QNetworkAccessManager::Operation op,
55 const QNetworkRequest &request) const override;
56};
57
58QT_END_NAMESPACE
59
60#endif
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.