diff options
Diffstat (limited to 'src/qmlcompiler/qqmljsloadergenerator.cpp')
-rw-r--r-- | src/qmlcompiler/qqmljsloadergenerator.cpp | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/src/qmlcompiler/qqmljsloadergenerator.cpp b/src/qmlcompiler/qqmljsloadergenerator.cpp index 829b33dabb..494ecdadd0 100644 --- a/src/qmlcompiler/qqmljsloadergenerator.cpp +++ b/src/qmlcompiler/qqmljsloadergenerator.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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:GPL-EXCEPT$ -** 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. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "qqmljsloadergenerator_p.h" @@ -74,7 +49,7 @@ QString mangledIdentifier(const QString &str) } } - for (int ei = str.length(); i != ei; ++i) { + for (int ei = str.size(); i != ei; ++i) { auto c = str.at(i).unicode(); if ((c >= QLatin1Char('0') && c <= QLatin1Char('9')) || (c >= QLatin1Char('a') && c <= QLatin1Char('z')) @@ -93,7 +68,7 @@ QString qQmlJSSymbolNamespaceForPath(const QString &relativePath) { QFileInfo fi(relativePath); QString symbol = fi.path(); - if (symbol.length() == 1 && symbol.startsWith(QLatin1Char('.'))) { + if (symbol.size() == 1 && symbol.startsWith(QLatin1Char('.'))) { symbol.clear(); } else { symbol.replace(QLatin1Char('/'), QLatin1Char('_')); @@ -125,10 +100,12 @@ bool qQmlJSGenerateLoader(const QStringList &compiledFiles, const QString &outpu stream << "#include <QtQml/qqmlprivate.h>\n"; stream << "#include <QtCore/qdir.h>\n"; stream << "#include <QtCore/qurl.h>\n"; + stream << "#include <QtCore/qhash.h>\n"; + stream << "#include <QtCore/qstring.h>\n"; stream << "\n"; stream << "namespace QmlCacheGeneratedCode {\n"; - for (int i = 0; i < compiledFiles.count(); ++i) { + for (int i = 0; i < compiledFiles.size(); ++i) { const QString compiledFile = compiledFiles.at(i); const QString ns = qQmlJSSymbolNamespaceForPath(compiledFile); stream << "namespace " << ns << " { \n"; @@ -154,10 +131,10 @@ bool qQmlJSGenerateLoader(const QStringList &compiledFiles, const QString &outpu stream << "Registry::Registry() {\n"; - for (int i = 0; i < compiledFiles.count(); ++i) { + for (int i = 0; i < compiledFiles.size(); ++i) { const QString qrcFile = compiledFiles.at(i); const QString ns = qQmlJSSymbolNamespaceForPath(qrcFile); - stream << " resourcePathToCachedUnit.insert(QStringLiteral(\"" << qrcFile << "\"), &QmlCacheGeneratedCode::" << ns << "::unit);\n"; + stream << " resourcePathToCachedUnit.insert(QStringLiteral(\"" << qrcFile << "\"), &QmlCacheGeneratedCode::" << ns << "::unit);\n"; } stream << " QQmlPrivate::RegisterQmlUnitCacheHook registration;\n"; |