/**************************************************************************** ** ** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtQml module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ****************************************************************************/ #ifndef QQMLDIRPARSER_P_H #define QQMLDIRPARSER_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include #include #include #include #include #include QT_BEGIN_NAMESPACE class QQmlEngine; class Q_QMLCOMPILER_PRIVATE_EXPORT QQmlDirParser { public: void clear(); bool parse(const QString &source); bool hasError() const; void setError(const QQmlJS::DiagnosticMessage &); QList errors(const QString &uri) const; QString typeNamespace() const; void setTypeNamespace(const QString &s); static void checkNonRelative(const char *item, const QString &typeName, const QString &fileName) { if (fileName.startsWith(QLatin1Char('/'))) { qWarning() << item << typeName << "is specified with non-relative URL" << fileName << "in a qmldir file." << "URLs in qmldir files should be relative to the qmldir file's directory."; } } struct Plugin { Plugin() = default; Plugin(const QString &name, const QString &path) : name(name), path(path) { checkNonRelative("Plugin", name, path); } QString name; QString path; }; struct Component { Component() = default; Component(const QString &typeName, const QString &fileName, int majorVersion, int minorVersion) : typeName(typeName), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion), internal(false), singleton(false) { checkNonRelative("Component", typeName, fileName); } QString typeName; QString fileName; int majorVersion = 0; int minorVersion = 0; bool internal = false; bool singleton = false; }; struct Script { Script() = default; Script(const QString &nameSpace, const QString &fileName, int majorVersion, int minorVersion) : nameSpace(nameSpace), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion) { checkNonRelative("Script", nameSpace, fileName); } QString nameSpace; QString fileName; int majorVersion = 0; int minorVersion = 0; }; QMultiHash components() const; QHash dependencies() const; QStringList imports() const; QList