1// Copyright (C) 2019 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 QQMLSCRIPTBLOB_P_H
5#define QQMLSCRIPTBLOB_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 purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <private/qqmltypeloader_p.h>
19
20QT_BEGIN_NAMESPACE
21
22class QQmlScriptData;
23class Q_AUTOTEST_EXPORT QQmlScriptBlob : public QQmlTypeLoader::Blob
24{
25private:
26 friend class QQmlTypeLoader;
27
28 QQmlScriptBlob(const QUrl &, QQmlTypeLoader *);
29
30public:
31 ~QQmlScriptBlob() override;
32
33 struct ScriptReference
34 {
35 QV4::CompiledData::Location location;
36 QString qualifier;
37 QString nameSpace;
38 QQmlRefPointer<QQmlScriptBlob> script;
39 };
40
41 QQmlRefPointer<QQmlScriptData> scriptData() const;
42
43protected:
44 void dataReceived(const SourceCodeData &) override;
45 void initializeFromCachedUnit(const QQmlPrivate::CachedQmlUnit *unit) override;
46 void done() override;
47
48 QString stringAt(int index) const override;
49
50private:
51 void scriptImported(const QQmlRefPointer<QQmlScriptBlob> &blob, const QV4::CompiledData::Location &location, const QString &qualifier, const QString &nameSpace) override;
52 void initializeFromCompilationUnit(const QQmlRefPointer<QV4::ExecutableCompilationUnit> &unit);
53 void initializeFromNative(const QV4::Value &value);
54
55 QList<ScriptReference> m_scripts;
56 QQmlRefPointer<QQmlScriptData> m_scriptData;
57 const bool m_isModule;
58};
59
60QT_END_NAMESPACE
61
62#endif // QQMLSCRIPTBLOB_P_H
63

source code of qtdeclarative/src/qml/qml/qqmlscriptblob_p.h