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 QQMLFILE_H |
5 | #define QQMLFILE_H |
6 | |
7 | #include <QtQml/qtqmlglobal.h> |
8 | |
9 | QT_BEGIN_NAMESPACE |
10 | |
11 | class QUrl; |
12 | class QString; |
13 | class QObject; |
14 | class QQmlEngine; |
15 | class QQmlFilePrivate; |
16 | |
17 | class Q_QML_EXPORT QQmlFile |
18 | { |
19 | public: |
20 | QQmlFile(); |
21 | QQmlFile(QQmlEngine *, const QUrl &); |
22 | QQmlFile(QQmlEngine *, const QString &); |
23 | ~QQmlFile(); |
24 | |
25 | enum Status { Null, Ready, Error, Loading }; |
26 | |
27 | bool isNull() const; |
28 | bool isReady() const; |
29 | bool isError() const; |
30 | bool isLoading() const; |
31 | |
32 | QUrl url() const; |
33 | |
34 | Status status() const; |
35 | QString error() const; |
36 | |
37 | qint64 size() const; |
38 | const char *data() const; |
39 | QByteArray dataByteArray() const; |
40 | |
41 | void load(QQmlEngine *, const QUrl &); |
42 | void load(QQmlEngine *, const QString &); |
43 | |
44 | void clear(); |
45 | void clear(QObject *); |
46 | |
47 | #if QT_CONFIG(qml_network) |
48 | bool connectFinished(QObject *, const char *); |
49 | bool connectFinished(QObject *, int); |
50 | bool connectDownloadProgress(QObject *, const char *); |
51 | bool connectDownloadProgress(QObject *, int); |
52 | #endif |
53 | |
54 | static bool isSynchronous(const QString &url); |
55 | static bool isSynchronous(const QUrl &url); |
56 | |
57 | static bool isLocalFile(const QString &url); |
58 | static bool isLocalFile(const QUrl &url); |
59 | |
60 | static QString urlToLocalFileOrQrc(const QString &); |
61 | static QString urlToLocalFileOrQrc(const QUrl &); |
62 | private: |
63 | Q_DISABLE_COPY(QQmlFile) |
64 | QQmlFilePrivate *d; |
65 | }; |
66 | |
67 | QT_END_NAMESPACE |
68 | |
69 | #endif // QQMLFILE_H |
70 | |