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 QNETWORKREPLYFILEIMPL_P_H |
5 | #define QNETWORKREPLYFILEIMPL_P_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 <QtNetwork/private/qtnetworkglobal_p.h> |
19 | #include "qnetworkreply.h" |
20 | #include "qnetworkreply_p.h" |
21 | #include "qnetworkaccessmanager.h" |
22 | #include <QFile> |
23 | #include <private/qabstractfileengine_p.h> |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | class QNetworkReplyFileImplPrivate; |
28 | class QNetworkReplyFileImpl: public QNetworkReply |
29 | { |
30 | Q_OBJECT |
31 | public: |
32 | QNetworkReplyFileImpl(QNetworkAccessManager *manager, const QNetworkRequest &req, const QNetworkAccessManager::Operation op); |
33 | ~QNetworkReplyFileImpl(); |
34 | virtual void abort() override; |
35 | |
36 | // reimplemented from QNetworkReply |
37 | virtual void close() override; |
38 | virtual qint64 bytesAvailable() const override; |
39 | virtual bool isSequential () const override; |
40 | qint64 size() const override; |
41 | |
42 | virtual qint64 readData(char *data, qint64 maxlen) override; |
43 | |
44 | private Q_SLOTS: |
45 | void fileOpenFinished(bool isOpen); |
46 | |
47 | private: |
48 | Q_DECLARE_PRIVATE(QNetworkReplyFileImpl) |
49 | }; |
50 | |
51 | class QNetworkReplyFileImplPrivate: public QNetworkReplyPrivate |
52 | { |
53 | public: |
54 | QNetworkReplyFileImplPrivate(); |
55 | |
56 | QNetworkAccessManagerPrivate *managerPrivate; |
57 | QPointer<QFile> realFile; |
58 | |
59 | Q_DECLARE_PUBLIC(QNetworkReplyFileImpl) |
60 | }; |
61 | |
62 | QT_END_NAMESPACE |
63 | |
64 | // ### move to qnetworkrequest.h |
65 | QT_DECL_METATYPE_EXTERN_TAGGED(QNetworkRequest::KnownHeaders, |
66 | QNetworkRequest__KnownHeaders, Q_NETWORK_EXPORT) |
67 | |
68 | #endif // QNETWORKREPLYFILEIMPL_P_H |
69 |