Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qqmldirdata_p.h
Go to the documentation of this file.
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 QQMLDIRDATA_P_H
5#define QQMLDIRDATA_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
21
23{
24private:
25 friend class QQmlTypeLoader;
26
28
29public:
30 const QString &content() const;
31 QV4::CompiledData::Location importLocation(Blob *blob) const;
32
33 template<typename Callback>
34 bool processImports(Blob *blob, const Callback &callback) const
35 {
36 bool result = true;
37 const auto range = m_imports.equal_range(blob);
38 for (auto it = range.first; it != range.second; ++it) {
39 // Do we need to resolve this import?
40 if ((it->import->priority == 0) || (it->import->priority > it->priority)) {
41 // This is the (current) best resolution for this import
42 if (!callback(it->import))
43 result = false;
44 it->import->priority = it->priority;
45 }
46 }
47 return result;
48 }
49
50 void setPriority(Blob *, PendingImportPtr, int);
51
52protected:
53 void dataReceived(const SourceCodeData &) override;
55
56private:
57 struct PrioritizedImport {
58 PendingImportPtr import;
59 int priority = 0;
60 };
61
62 QString m_content;
63 QMultiHash<Blob *, PrioritizedImport> m_imports;
64};
65
67
68#endif // QQMLDIRDATA_P_H
virtual void dataReceived(const SourceCodeData &)=0
Invoked when data for the blob is received.
virtual void initializeFromCachedUnit(const QQmlPrivate::CachedQmlUnit *)=0
bool processImports(Blob *blob, const Callback &callback) const
The QQmlTypeLoader class abstracts loading files and their dependencies over the network.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qurl.h:94
myinstance setPriority(MyClass::VeryHigh)
QSet< QString >::iterator it
Combined button and popup list for selecting options.
GLsizei range
GLuint64EXT * result
[6]
#define Q_AUTOTEST_EXPORT