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 | #include "qqmltypenamecache_p.h" |
5 | |
6 | QT_BEGIN_NAMESPACE |
7 | |
8 | void QQmlTypeNameCache::add(const QHashedString &name, const QUrl &url, const QHashedString &nameSpace) |
9 | { |
10 | if (nameSpace.size() != 0) { |
11 | QQmlImportRef *i = m_namedImports.value(key: nameSpace); |
12 | Q_ASSERT(i != nullptr); |
13 | i->compositeSingletons.insert(key: name, value: url); |
14 | return; |
15 | } |
16 | |
17 | if (m_anonymousCompositeSingletons.contains(key: name)) |
18 | return; |
19 | |
20 | m_anonymousCompositeSingletons.insert(key: name, value: url); |
21 | } |
22 | |
23 | void QQmlTypeNameCache::add(const QHashedString &name, int importedScriptIndex, const QHashedString &nameSpace) |
24 | { |
25 | QQmlImportRef import; |
26 | import.scriptIndex = importedScriptIndex; |
27 | import.m_qualifier = name; |
28 | |
29 | if (nameSpace.size() != 0) { |
30 | QQmlImportRef *i = m_namedImports.value(key: nameSpace); |
31 | Q_ASSERT(i != nullptr); |
32 | m_namespacedImports[i].insert(key: name, value: import); |
33 | return; |
34 | } |
35 | |
36 | if (m_namedImports.contains(key: name)) |
37 | return; |
38 | |
39 | m_namedImports.insert(key: name, value: import); |
40 | } |
41 | |
42 | QT_END_NAMESPACE |
43 | |
44 |