OpenCoverage

qqmlimport_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmlimport_p.h
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQml module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#ifndef QQMLIMPORT_P_H-
41#define QQMLIMPORT_P_H-
42-
43#include <QtCore/qurl.h>-
44#include <QtCore/qcoreapplication.h>-
45#include <QtCore/qset.h>-
46#include <QtCore/qstringlist.h>-
47#include <private/qqmldirparser_p.h>-
48#include <private/qqmlmetatype_p.h>-
49#include <private/qhashedstring_p.h>-
50-
51//-
52// W A R N I N G-
53// --------------
54//-
55// This file is not part of the Qt API. It exists purely as an-
56// implementation detail. This header file may change from version to-
57// version without notice, or even be removed.-
58//-
59// We mean it.-
60//-
61-
62QT_BEGIN_NAMESPACE-
63-
64class QQmlTypeNameCache;-
65class QQmlEngine;-
66class QDir;-
67class QQmlImportNamespace;-
68class QQmlImportsPrivate;-
69class QQmlImportDatabase;-
70class QQmlTypeLoader;-
71class QQmlTypeLoaderQmldirContent;-
72-
73namespace QQmlImport {-
74 enum RecursionRestriction { PreventRecursion, AllowRecursion };-
75}-
76-
77struct QQmlImportInstance-
78{-
79 QString uri; // e.g. QtQuick-
80 QString url; // the base path of the import-
81 int majversion; // the major version imported-
82 int minversion; // the minor version imported-
83 bool isLibrary; // true means that this is not a file import-
84 bool implicitlyImported = false;-
85 QQmlDirComponents qmlDirComponents; // a copy of the components listed in the qmldir-
86 QQmlDirScripts qmlDirScripts; // a copy of the scripts in the qmldir-
87-
88 bool setQmldirContent(const QString &resolvedUrl, const QQmlTypeLoaderQmldirContent &qmldir,-
89 QQmlImportNamespace *nameSpace, QList<QQmlError> *errors);-
90-
91 static QQmlDirScripts getVersionedScripts(const QQmlDirScripts &qmldirscripts, int vmaj, int vmin);-
92-
93 bool resolveType(QQmlTypeLoader *typeLoader, const QHashedStringRef &type,-
94 int *vmajor, int *vminor, QQmlType* type_return,-
95 QString *base = nullptr, bool *typeRecursionDetected = nullptr,-
96 QQmlType::RegistrationType = QQmlType::AnyRegistrationType,-
97 QQmlImport::RecursionRestriction recursionRestriction = QQmlImport::PreventRecursion,-
98 QList<QQmlError> *errors = nullptr) const;-
99};-
100-
101class QQmlImportNamespace-
102{-
103public:-
104 QQmlImportNamespace() : nextNamespace(nullptr) {}
executed 56775 times by 142 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qjsengine
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlinstantiator
  • ...
56775
105 ~QQmlImportNamespace() { qDeleteAll(imports); }
executed 14861 times by 135 tests: end of block
Executed by:
  • tst_bindingdependencyapi
  • tst_drawingmodes
  • tst_examples
  • tst_flickableinterop
  • tst_multipointtoucharea_interop
  • tst_parserstress
  • tst_qmlcachegen
  • tst_qmldiskcache
  • tst_qqmlapplicationengine
  • tst_qqmlbinding
  • tst_qqmlcomponent
  • tst_qqmlconnections
  • tst_qqmlconsole
  • tst_qqmlcontext
  • tst_qqmldebugjs
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qqmlenginedebugservice
  • tst_qqmlexpression
  • tst_qqmlfileselector
  • tst_qqmlimport
  • tst_qqmlincubator
  • tst_qqmlinfo
  • tst_qqmlitemmodels
  • tst_qqmllistmodel
  • ...
14861
106-
107 QList<QQmlImportInstance *> imports;-
108-
109 QQmlImportInstance *findImport(const QString &uri) const;-
110-
111 bool resolveType(QQmlTypeLoader *typeLoader, const QHashedStringRef& type,-
112 int *vmajor, int *vminor, QQmlType* type_return,-
113 QString *base = nullptr, QList<QQmlError> *errors = nullptr,-
114 QQmlType::RegistrationType registrationType = QQmlType::AnyRegistrationType,-
115 QQmlImport::RecursionRestriction recursionRestriction = QQmlImport::PreventRecursion);-
116-
117 // Prefix when used as a qualified import. Otherwise empty.-
118 QHashedString prefix;-
119-
120 // Used by QQmlImportsPrivate::qualifiedSets-
121 QQmlImportNamespace *nextNamespace;-
122};-
123-
124class Q_QML_PRIVATE_EXPORT QQmlImports-
125{-
126public:-
127 enum ImportVersion { FullyVersioned, PartiallyVersioned, Unversioned };-
128-
129 QQmlImports(QQmlTypeLoader *);-
130 QQmlImports(const QQmlImports &);-
131 ~QQmlImports();-
132 QQmlImports &operator=(const QQmlImports &);-
133-
134 void setBaseUrl(const QUrl &url, const QString &urlString = QString());-
135 QUrl baseUrl() const;-
136-
137 bool resolveType(const QHashedStringRef &type,-
138 QQmlType *type_return,-
139 int *version_major, int *version_minor,-
140 QQmlImportNamespace **ns_return,-
141 QList<QQmlError> *errors = nullptr,-
142 QQmlType::RegistrationType registrationType = QQmlType::AnyRegistrationType,-
143 QQmlImport::RecursionRestriction recursionRestriction-
144 = QQmlImport::PreventRecursion) const;-
145 bool resolveType(QQmlImportNamespace *,-
146 const QHashedStringRef& type,-
147 QQmlType *type_return, int *version_major, int *version_minor,-
148 QQmlType::RegistrationType registrationType-
149 = QQmlType::AnyRegistrationType) const;-
150-
151 bool addImplicitImport(QQmlImportDatabase *importDb, QList<QQmlError> *errors);-
152-
153 bool addFileImport(QQmlImportDatabase *,-
154 const QString& uri, const QString& prefix, int vmaj, int vmin, bool incomplete,-
155 QList<QQmlError> *errors);-
156-
157 bool addLibraryImport(QQmlImportDatabase *importDb,-
158 const QString &uri, const QString &prefix, int vmaj, int vmin,-
159 const QString &qmldirIdentifier, const QString &qmldirUrl, bool incomplete, QList<QQmlError> *errors);-
160-
161 bool updateQmldirContent(QQmlImportDatabase *importDb,-
162 const QString &uri, const QString &prefix,-
163 const QString &qmldirIdentifier, const QString &qmldirUrl, QList<QQmlError> *errors);-
164-
165 bool locateQmldir(QQmlImportDatabase *,-
166 const QString &uri, int vmaj, int vmin,-
167 QString *qmldirFilePath, QString *url);-
168-
169 void populateCache(QQmlTypeNameCache *cache) const;-
170-
171 struct ScriptReference-
172 {-
173 QString nameSpace;-
174 QString qualifier;-
175 QUrl location;-
176 };-
177-
178 QList<ScriptReference> resolvedScripts() const;-
179-
180 struct CompositeSingletonReference-
181 {-
182 QString typeName;-
183 QString prefix;-
184 int majorVersion;-
185 int minorVersion;-
186 };-
187-
188 QList<CompositeSingletonReference> resolvedCompositeSingletons() const;-
189-
190 static QStringList completeQmldirPaths(const QString &uri, const QStringList &basePaths, int vmaj, int vmin);-
191 static QString versionString(int vmaj, int vmin, ImportVersion version);-
192-
193 static bool isLocal(const QString &url);-
194 static bool isLocal(const QUrl &url);-
195 static QUrl urlFromLocalFileOrQrcOrUrl(const QString &);-
196-
197 static void setDesignerSupportRequired(bool b);-
198-
199private:-
200 friend class QQmlImportDatabase;-
201 QQmlImportsPrivate *d;-
202};-
203-
204class QQmlImportDatabase-
205{-
206 Q_DECLARE_TR_FUNCTIONS(QQmlImportDatabase)-
207public:-
208 enum PathType { Local, Remote, LocalOrRemote };-
209-
210 QQmlImportDatabase(QQmlEngine *);-
211 ~QQmlImportDatabase();-
212-
213 bool importDynamicPlugin(const QString &filePath, const QString &uri, const QString &importNamespace, int vmaj, QList<QQmlError> *errors);-
214-
215 QStringList importPathList(PathType type = LocalOrRemote) const;-
216 void setImportPathList(const QStringList &paths);-
217 void addImportPath(const QString& dir);-
218-
219 QStringList pluginPathList() const;-
220 void setPluginPathList(const QStringList &paths);-
221 void addPluginPath(const QString& path);-
222-
223private:-
224 friend class QQmlImportsPrivate;-
225 QString resolvePlugin(QQmlTypeLoader *typeLoader,-
226 const QString &qmldirPath, const QString &qmldirPluginPath,-
227 const QString &baseName, const QStringList &suffixes,-
228 const QString &prefix = QString());-
229 QString resolvePlugin(QQmlTypeLoader *typeLoader,-
230 const QString &qmldirPath, const QString &qmldirPluginPath,-
231 const QString &baseName);-
232 bool importStaticPlugin(QObject *instance, const QString &basePath, const QString &uri,-
233 const QString &typeNamespace, int vmaj, QList<QQmlError> *errors);-
234 bool registerPluginTypes(QObject *instance, const QString &basePath,-
235 const QString &uri, const QString &typeNamespace, int vmaj, QList<QQmlError> *errors);-
236 void clearDirCache();-
237-
238 struct QmldirCache {-
239 int versionMajor;-
240 int versionMinor;-
241 QString qmldirFilePath;-
242 QString qmldirPathUrl;-
243 QmldirCache *next;-
244 };-
245 // Maps from an import to a linked list of qmldir info.-
246 // Used in QQmlImportsPrivate::locateQmldir()-
247 QStringHash<QmldirCache *> qmldirCache;-
248-
249 // XXX thread-
250 QStringList filePluginPath;-
251 QStringList fileImportPath;-
252-
253 QSet<QString> qmlDirFilesForWhichPluginsHaveBeenLoaded;-
254 QSet<QString> initializedPlugins;-
255 QQmlEngine *engine;-
256};-
257-
258void qmlClearEnginePlugins();// For internal use by qmlClearRegisteredProperties-
259-
260QT_END_NAMESPACE-
261-
262#endif // QQMLIMPORT_P_H-
263-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0