7#include <QtCore/qurl.h>
8#include <QtCore/qcoreapplication.h>
9#include <QtCore/qloggingcategory.h>
10#include <QtCore/qset.h>
11#include <QtCore/qstringlist.h>
12#include <QtQml/qqmlengine.h>
13#include <QtQml/qqmlerror.h>
14#include <QtQml/qqmlfile.h>
15#include <private/qqmldirparser_p.h>
16#include <private/qqmltype_p.h>
17#include <private/qstringhash_p.h>
18#include <private/qv4compileddata_p.h>
19#include <private/qfieldlist_p.h>
52 Lowest = std::numeric_limits<quint8>::max(),
80 const QString *
base =
nullptr,
bool *typeRecursionDetected =
nullptr,
100 bool *typeRecursionDeteced =
nullptr);
126 ImportIncomplete = 0x1,
144 bool *typeRecursionDetected =
nullptr)
const;
152 const ImportFlags
flags =
153 ImportFlags(!isLocal(
baseUrl()) ? ImportIncomplete : ImportNoFlag);
154 return addFileImport(
159 bool addInlineComponentImport(
211 static QUrl urlFromLocalFileOrQrcOrUrl(
const QString &);
213 static void setDesignerSupportRequired(
bool b);
225 bool *typeRecursionDetected =
nullptr)
const;
237 bool getQmldirContent(
298 template<
typename Callback>
311 void clearDirCache();
332template<
typename Callback>
340 QmldirCache *cacheTail =
nullptr;
342 QmldirCache **cachePtr = qmldirCache.
value(uri);
343 QmldirCache *cacheHead = cachePtr ? *cachePtr :
nullptr;
345 cacheTail = cacheHead;
347 if (cacheTail->version == version) {
348 if (cacheTail->qmldirFilePath.isEmpty()) {
349 return cacheTail->qmldirPathUrl.isEmpty()
353 if (callback(cacheTail->qmldirFilePath, cacheTail->qmldirPathUrl))
357 }
while (cacheTail->next && (cacheTail = cacheTail->next));
373 uri, localImportPaths, version);
375 QString qmldirAbsoluteFilePath;
376 for (
QString qmldirPath : qmlDirPaths) {
377 if (hasInterceptors) {
383 && qmldirPath.isEmpty()
389 qmldirAbsoluteFilePath = absoluteFilePath(qmldirPath);
390 if (!qmldirAbsoluteFilePath.
isEmpty()) {
407 QmldirCache *
cache =
new QmldirCache;
408 cache->version = version;
409 cache->qmldirFilePath = qmldirAbsoluteFilePath;
411 cache->next =
nullptr;
413 cacheTail->next =
cache;
427 QmldirCache *
cache =
new QmldirCache;
428 cache->version = version;
429 cache->next = cacheHead;
439 <<
"locateLocalQmldir:" <<
qPrintable(uri) <<
"module's qmldir file not found";
443 <<
"locateLocalQmldir:" <<
qPrintable(uri) <<
"module's qmldir found at"
444 << qmldirAbsoluteFilePath;
bool isEmpty() const noexcept
The QQmlEngine class provides an environment for instantiating QML components.
QList< QQmlAbstractUrlInterceptor * > urlInterceptors() const
Returns the list of currently active URL interceptors.
QUrl interceptUrl(const QUrl &url, QQmlAbstractUrlInterceptor::DataType type) const
Run the current URL interceptors on the given url of the given type and return the result.
static bool isLocalFile(const QString &url)
Returns true if url is a local file that can be opened with QFile.
static QString urlToLocalFileOrQrc(const QString &)
If url is a local file returns a path suitable for passing to QFile.
The QQmlImportDatabase class manages the QML imports for a QQmlEngine.
void addPluginPath(const QString &path)
QStringList dynamicPlugins() const
LocalQmldirSearchLocation
QStringList importPathList(PathType type=LocalOrRemote) const
bool removeDynamicPlugin(const QString &pluginId)
void setPluginPathList(const QStringList &paths)
void addImportPath(const QString &dir)
QStringList pluginPathList() const
static QTypeRevision lockModule(const QString &uri, const QString &typeNamespace, QTypeRevision version, QList< QQmlError > *errors)
LocalQmldirResult locateLocalQmldir(const QString &uri, QTypeRevision version, LocalQmldirSearchLocation location, const Callback &callback)
@ QmldirInterceptedToRemote
void setImportPathList(const QStringList &paths)
bool needsSorting() const
QQmlImportNamespace * nextNamespace
QQmlImportInstance * findImport(const QString &uri) const
bool resolveType(QQmlTypeLoader *typeLoader, const QHashedStringRef &type, QTypeRevision *version_return, QQmlType *type_return, const QString *base=nullptr, QList< QQmlError > *errors=nullptr, QQmlType::RegistrationType registrationType=QQmlType::AnyRegistrationType, bool *typeRecursionDeteced=nullptr)
QList< QQmlImportInstance * > imports
void setNeedsSorting(bool needsSorting)
The QQmlImports class encapsulates one QML document's import statements.
QTypeRevision addImplicitImport(QQmlImportDatabase *importDb, QString *localQmldir, QList< QQmlError > *errors)
static QUrl urlFromLocalFileOrQrcOrUrl(const QString &)
static bool isLocal(const QString &url)
static QStringList completeQmldirPaths(const QString &uri, const QStringList &basePaths, QTypeRevision version)
Forms complete paths to a qmldir file, from a base URL, a module URI and version specification.
static bool isLocal(const QUrl &url)
The QQmlTypeLoader class abstracts loading files and their dependencies over the network.
void insert(const K &, const T &)
T * value(const K &) const
\macro QT_RESTRICTED_CAST_FROM_ASCII
qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QString left(qsizetype n) const
Returns a substring that contains the n leftmost characters of the string.
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
QString toString(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
qDeleteAll(list.begin(), list.end())
QCache< int, Employee > cache
[0]
Combined button and popup list for selecting options.
#define Q_DECLARE_TR_FUNCTIONS(context)
#define Q_DECLARE_FLAGS(Flags, Enum)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
#define qCDebug(category,...)
GLboolean GLboolean GLboolean b
GLsizei const GLuint * paths
GLsizei const GLchar *const * path
const QLoggingCategory & lcQmlImport()
void qmlClearEnginePlugins()
const QLoggingCategory & lcQmlImport()
QT_BEGIN_NAMESPACE typedef void(* Callback)(QQmlNotifierEndpoint *, void **)
static QString absolutePath(const QString &path)
static QUrl resolvedUrl(const QUrl &url, const QQmlRefPointer< QQmlContextData > &context)
#define qPrintable(string)
QLatin1StringView QLatin1String
#define QStringLiteral(str)
static QString absoluteFilePath(const Options *options, const QString &relativeFileName)
QUrl url("example.com")
[constructor-url-reference]
char * toString(const MyType &t)
[31]
QQmlDirComponents qmlDirComponents
bool resolveType(QQmlTypeLoader *typeLoader, const QHashedStringRef &type, QTypeRevision *version_return, QQmlType *type_return, const QString *base=nullptr, bool *typeRecursionDetected=nullptr, QQmlType::RegistrationType=QQmlType::AnyRegistrationType, QQmlImport::RecursionRestriction recursionRestriction=QQmlImport::PreventRecursion, QList< QQmlError > *errors=nullptr) const
bool setQmldirContent(const QString &resolvedUrl, const QQmlTypeLoaderQmldirContent &qmldir, QQmlImportNamespace *nameSpace, QList< QQmlError > *errors)
QQmlDirScripts qmlDirScripts
static QQmlDirScripts getVersionedScripts(const QQmlDirScripts &qmldirscripts, QTypeRevision version)