diff options
Diffstat (limited to 'src/tools/moc')
-rw-r--r-- | src/tools/moc/generator.cpp | 85 | ||||
-rw-r--r-- | src/tools/moc/generator.h | 39 | ||||
-rw-r--r-- | src/tools/moc/keywords.cpp | 29 | ||||
-rw-r--r-- | src/tools/moc/main.cpp | 52 | ||||
-rw-r--r-- | src/tools/moc/moc.cpp | 107 | ||||
-rw-r--r-- | src/tools/moc/moc.h | 57 | ||||
-rw-r--r-- | src/tools/moc/mwerks_mac.cpp | 29 | ||||
-rw-r--r-- | src/tools/moc/mwerks_mac.h | 29 | ||||
-rw-r--r-- | src/tools/moc/outputrevision.h | 29 | ||||
-rw-r--r-- | src/tools/moc/parser.cpp | 29 | ||||
-rw-r--r-- | src/tools/moc/parser.h | 34 | ||||
-rw-r--r-- | src/tools/moc/ppkeywords.cpp | 29 | ||||
-rw-r--r-- | src/tools/moc/preprocessor.cpp | 38 | ||||
-rw-r--r-- | src/tools/moc/preprocessor.h | 29 | ||||
-rw-r--r-- | src/tools/moc/symbols.h | 29 | ||||
-rw-r--r-- | src/tools/moc/token.cpp | 29 | ||||
-rw-r--r-- | src/tools/moc/token.h | 29 | ||||
-rwxr-xr-x | src/tools/moc/util/generate.sh | 29 | ||||
-rw-r--r-- | src/tools/moc/util/generate_keywords.cpp | 29 | ||||
-rw-r--r-- | src/tools/moc/util/licenseheader.txt | 29 | ||||
-rw-r--r-- | src/tools/moc/utils.h | 29 |
21 files changed, 383 insertions, 435 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 99629f0427..2b09cf873a 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -126,7 +121,7 @@ int Generator::stridx(const QByteArray &s) // Returns the sum of all parameters (including return type) for the given // \a list of methods. This is needed for calculating the size of the methods' // parameter type/name meta-data. -static int aggregateParameterCount(const QList<FunctionDef> &list) +static int aggregateParameterCount(const QVector<FunctionDef> &list) { int sum = 0; for (int i = 0; i < list.count(); ++i) @@ -155,16 +150,17 @@ bool Generator::registerableMetaType(const QByteArray &propertyType) #undef STREAM_SMART_POINTER ; - foreach (const QByteArray &smartPointer, smartPointers) + for (const QByteArray &smartPointer : smartPointers) { if (propertyType.startsWith(smartPointer + "<") && !propertyType.endsWith("&")) return knownQObjectClasses.contains(propertyType.mid(smartPointer.size() + 1, propertyType.size() - smartPointer.size() - 1 - 1)); + } static const QVector<QByteArray> oneArgTemplates = QVector<QByteArray>() #define STREAM_1ARG_TEMPLATE(TEMPLATENAME) << #TEMPLATENAME QT_FOR_EACH_AUTOMATIC_TEMPLATE_1ARG(STREAM_1ARG_TEMPLATE) #undef STREAM_1ARG_TEMPLATE ; - foreach (const QByteArray &oneArgTemplateType, oneArgTemplates) + for (const QByteArray &oneArgTemplateType : oneArgTemplates) { if (propertyType.startsWith(oneArgTemplateType + "<") && propertyType.endsWith(">")) { const int argumentSize = propertyType.size() - oneArgTemplateType.size() - 1 // The closing '>' @@ -174,6 +170,7 @@ bool Generator::registerableMetaType(const QByteArray &propertyType) const QByteArray templateArg = propertyType.mid(oneArgTemplateType.size() + 1, argumentSize); return isBuiltinType(templateArg) || registerableMetaType(templateArg); } + } return false; } @@ -197,7 +194,7 @@ void Generator::generateCode() // filter out undeclared enumerators and sets { - QList<EnumDef> enumList; + QVector<EnumDef> enumList; for (int i = 0; i < cdef->enumList.count(); ++i) { EnumDef def = cdef->enumList.at(i); if (cdef->enumDeclarations.contains(def.name)) { @@ -574,7 +571,7 @@ void Generator::generateCode() cname, cname, cdef->classname.constData()); } for (int i = 0; i < cdef->interfaceList.size(); ++i) { - const QList<ClassDef::Interface> &iface = cdef->interfaceList.at(i); + const QVector<ClassDef::Interface> &iface = cdef->interfaceList.at(i); for (int j = 0; j < iface.size(); ++j) { fprintf(out, " if (!strcmp(_clname, %s))\n return ", iface.at(j).interfaceId.constData()); for (int k = j; k >= 0; --k) @@ -631,7 +628,7 @@ void Generator::generateClassInfos() } } -void Generator::registerFunctionStrings(const QList<FunctionDef>& list) +void Generator::registerFunctionStrings(const QVector<FunctionDef>& list) { for (int i = 0; i < list.count(); ++i) { const FunctionDef &f = list.at(i); @@ -651,7 +648,7 @@ void Generator::registerFunctionStrings(const QList<FunctionDef>& list) } } -void Generator::generateFunctions(const QList<FunctionDef>& list, const char *functype, int type, int ¶msIndex) +void Generator::generateFunctions(const QVector<FunctionDef>& list, const char *functype, int type, int ¶msIndex) { if (list.isEmpty()) return; @@ -697,7 +694,7 @@ void Generator::generateFunctions(const QList<FunctionDef>& list, const char *fu } } -void Generator::generateFunctionRevisions(const QList<FunctionDef>& list, const char *functype) +void Generator::generateFunctionRevisions(const QVector<FunctionDef>& list, const char *functype) { if (list.count()) fprintf(out, "\n // %ss: revision\n", functype); @@ -707,7 +704,7 @@ void Generator::generateFunctionRevisions(const QList<FunctionDef>& list, const } } -void Generator::generateFunctionParameters(const QList<FunctionDef>& list, const char *functype) +void Generator::generateFunctionParameters(const QVector<FunctionDef>& list, const char *functype) { if (list.isEmpty()) return; @@ -920,7 +917,7 @@ void Generator::generateMetacall() fprintf(out, " "); bool needElse = false; - QList<FunctionDef> methodList; + QVector<FunctionDef> methodList; methodList += cdef->signalList; methodList += cdef->slotList; methodList += cdef->methodList; @@ -1082,7 +1079,7 @@ QMultiMap<QByteArray, int> Generator::automaticPropertyMetaTypesHelper() return automaticPropertyMetaTypes; } -QMap<int, QMultiMap<QByteArray, int> > Generator::methodsWithAutomaticTypesHelper(const QList<FunctionDef> &methodList) +QMap<int, QMultiMap<QByteArray, int> > Generator::methodsWithAutomaticTypesHelper(const QVector<FunctionDef> &methodList) { QMap<int, QMultiMap<QByteArray, int> > methodsWithAutomaticTypes; for (int i = 0; i < methodList.size(); ++i) { @@ -1136,7 +1133,7 @@ void Generator::generateStaticMetacall() isUsed_a = true; } - QList<FunctionDef> methodList; + QVector<FunctionDef> methodList; methodList += cdef->signalList; methodList += cdef->slotList; methodList += cdef->methodList; @@ -1207,10 +1204,14 @@ void Generator::generateStaticMetacall() fprintf(out, " case %d:\n", it.key()); fprintf(out, " switch (*reinterpret_cast<int*>(_a[1])) {\n"); fprintf(out, " default: *reinterpret_cast<int*>(_a[0]) = -1; break;\n"); - foreach (const QByteArray &key, it->uniqueKeys()) { - foreach (int argumentID, it->values(key)) - fprintf(out, " case %d:\n", argumentID); - fprintf(out, " *reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< %s >(); break;\n", key.constData()); + auto jt = it->begin(); + const auto jend = it->end(); + while (jt != jend) { + fprintf(out, " case %d:\n", jt.value()); + const QByteArray &lastKey = jt.key(); + ++jt; + if (jt == jend || jt.key() != lastKey) + fprintf(out, " *reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< %s >(); break;\n", lastKey.constData()); } fprintf(out, " }\n"); fprintf(out, " break;\n"); @@ -1263,7 +1264,7 @@ void Generator::generateStaticMetacall() needElse = true; } - QMultiMap<QByteArray, int> automaticPropertyMetaTypes = automaticPropertyMetaTypesHelper(); + const QMultiMap<QByteArray, int> automaticPropertyMetaTypes = automaticPropertyMetaTypesHelper(); if (!automaticPropertyMetaTypes.isEmpty()) { if (needElse) @@ -1273,10 +1274,14 @@ void Generator::generateStaticMetacall() fprintf(out, "if (_c == QMetaObject::RegisterPropertyMetaType) {\n"); fprintf(out, " switch (_id) {\n"); fprintf(out, " default: *reinterpret_cast<int*>(_a[0]) = -1; break;\n"); - foreach (const QByteArray &key, automaticPropertyMetaTypes.uniqueKeys()) { - foreach (int propertyID, automaticPropertyMetaTypes.values(key)) - fprintf(out, " case %d:\n", propertyID); - fprintf(out, " *reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< %s >(); break;\n", key.constData()); + auto it = automaticPropertyMetaTypes.begin(); + const auto end = automaticPropertyMetaTypes.end(); + while (it != end) { + fprintf(out, " case %d:\n", it.value()); + const QByteArray &lastKey = it.key(); + ++it; + if (it == end || it.key() != lastKey) + fprintf(out, " *reinterpret_cast<int*>(_a[0]) = qRegisterMetaType< %s >(); break;\n", lastKey.constData()); } fprintf(out, " }\n"); fprintf(out, " }\n"); @@ -1567,8 +1572,8 @@ void Generator::generatePluginMetaData() data.insert(QStringLiteral("MetaData"), cdef->pluginData.metaData.object()); // Add -M args from the command line: - foreach (const QString &key, cdef->pluginData.metaArgs.keys()) - data.insert(key, cdef->pluginData.metaArgs.value(key)); + for (auto it = cdef->pluginData.metaArgs.cbegin(), end = cdef->pluginData.metaArgs.cend(); it != end; ++it) + data.insert(it.key(), it.value()); fputs("\nQT_PLUGIN_METADATA_SECTION const uint qt_section_alignment_dummy = 42;\n\n" "#ifdef QT_NO_DEBUG\n", out); diff --git a/src/tools/moc/generator.h b/src/tools/moc/generator.h index b9cc2bc553..3833148fb3 100644 --- a/src/tools/moc/generator.h +++ b/src/tools/moc/generator.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -50,10 +45,10 @@ private: bool registerableMetaType(const QByteArray &propertyType); void registerClassInfoStrings(); void generateClassInfos(); - void registerFunctionStrings(const QList<FunctionDef> &list); - void generateFunctions(const QList<FunctionDef> &list, const char *functype, int type, int ¶msIndex); - void generateFunctionRevisions(const QList<FunctionDef>& list, const char *functype); - void generateFunctionParameters(const QList<FunctionDef> &list, const char *functype); + void registerFunctionStrings(const QVector<FunctionDef> &list); + void generateFunctions(const QVector<FunctionDef> &list, const char *functype, int type, int ¶msIndex); + void generateFunctionRevisions(const QVector<FunctionDef> &list, const char *functype); + void generateFunctionParameters(const QVector<FunctionDef> &list, const char *functype); void generateTypeInfo(const QByteArray &typeName, bool allowEmptyName = false); void registerEnumStrings(); void generateEnums(int index); @@ -64,7 +59,7 @@ private: void generateSignal(FunctionDef *def, int index); void generatePluginMetaData(); QMultiMap<QByteArray, int> automaticPropertyMetaTypesHelper(); - QMap<int, QMultiMap<QByteArray, int> > methodsWithAutomaticTypesHelper(const QList<FunctionDef> &methodList); + QMap<int, QMultiMap<QByteArray, int> > methodsWithAutomaticTypesHelper(const QVector<FunctionDef> &methodList); void strreg(const QByteArray &); // registers a string int stridx(const QByteArray &); // returns a string's id diff --git a/src/tools/moc/keywords.cpp b/src/tools/moc/keywords.cpp index 75e643df79..4f1d16d2c5 100644 --- a/src/tools/moc/keywords.cpp +++ b/src/tools/moc/keywords.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index a5cbad7668..bdf01c8a62 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -146,7 +141,7 @@ static QStringList argumentsFromCommandLineAndFile(const QStringList &arguments) { QStringList allArguments; allArguments.reserve(arguments.size()); - foreach (const QString &argument, arguments) { + for (const QString &argument : arguments) { // "@file" doesn't start with a '-' so we can't use QCommandLineParser for it if (argument.startsWith(QLatin1Char('@'))) { QString optionsFile = argument; @@ -304,25 +299,30 @@ int runMoc(int argc, char **argv) if (parser.isSet(forceIncludeOption)) { moc.noInclude = false; autoInclude = false; - foreach (const QString &include, parser.values(forceIncludeOption)) { + const auto forceIncludes = parser.values(forceIncludeOption); + for (const QString &include : forceIncludes) { moc.includeFiles.append(QFile::encodeName(include)); defaultInclude = false; } } - foreach (const QString &include, parser.values(prependIncludeOption)) + const auto prependIncludes = parser.values(prependIncludeOption); + for (const QString &include : prependIncludes) moc.includeFiles.prepend(QFile::encodeName(include)); if (parser.isSet(pathPrefixOption)) moc.includePath = QFile::encodeName(parser.value(pathPrefixOption)); } - foreach (const QString &path, parser.values(includePathOption)) + const auto includePaths = parser.values(includePathOption); + for (const QString &path : includePaths) pp.includes += Preprocessor::IncludePath(QFile::encodeName(path)); - foreach (const QString &path, parser.values(macFrameworkOption)) { + const auto macFrameworks = parser.values(macFrameworkOption); + for (const QString &path : macFrameworks) { // minimalistic framework support for the mac Preprocessor::IncludePath p(QFile::encodeName(path)); p.isFrameworkPath = true; pp.includes += p; } - foreach (const QString &arg, parser.values(defineOption)) { + const auto defines = parser.values(defineOption); + for (const QString &arg : defines) { QByteArray name = arg.toLocal8Bit(); QByteArray value("1"); int eq = name.indexOf('='); @@ -339,7 +339,8 @@ int runMoc(int argc, char **argv) macro.symbols.removeLast(); // remove the EOF symbol pp.macros.insert(name, macro); } - foreach (const QString &arg, parser.values(undefineOption)) { + const auto undefines = parser.values(undefineOption); + for (const QString &arg : undefines) { QByteArray macro = arg.toLocal8Bit(); if (macro.isEmpty()) { error("Missing macro name"); @@ -384,7 +385,8 @@ int runMoc(int argc, char **argv) moc.filename = filename.toLocal8Bit(); } - foreach (const QString &md, parser.values(metadataOption)) { + const auto metadata = parser.values(metadataOption); + for (const QString &md : metadata) { int split = md.indexOf(QLatin1Char('=')); QString key = md.left(split); QString value = md.mid(split + 1); diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 726d1972f1..0e689bd5c1 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -543,7 +538,7 @@ bool Moc::parseMaybeFunction(const ClassDef *cdef, FunctionDef *def) void Moc::parse() { - QList<NamespaceDef> namespaceList; + QVector<NamespaceDef> namespaceList; bool templateClass = false; while (hasNext()) { Token t = next(); @@ -806,9 +801,30 @@ void Moc::parse() } } -static void findRequiredContainers(ClassDef *cdef, QSet<QByteArray> *requiredQtContainers) +static bool any_type_contains(const QVector<PropertyDef> &properties, const QByteArray &pattern) +{ + for (const auto &p : properties) { + if (p.type.contains(pattern)) + return true; + } + return false; +} + +static bool any_arg_contains(const QVector<FunctionDef> &functions, const QByteArray &pattern) { - static const QVector<QByteArray> candidates = QVector<QByteArray>() + for (const auto &f : functions) { + for (const auto &arg : f.arguments) { + if (arg.normalizedType.contains(pattern)) + return true; + } + } + return false; +} + +static QByteArrayList make_candidates() +{ + QByteArrayList result; + result #define STREAM_SMART_POINTER(SMART_POINTER) << #SMART_POINTER QT_FOR_EACH_AUTOMATIC_TEMPLATE_SMART_POINTER(STREAM_SMART_POINTER) #undef STREAM_SMART_POINTER @@ -816,26 +832,31 @@ static void findRequiredContainers(ClassDef *cdef, QSet<QByteArray> *requiredQtC QT_FOR_EACH_AUTOMATIC_TEMPLATE_1ARG(STREAM_1ARG_TEMPLATE) #undef STREAM_1ARG_TEMPLATE ; + return result; +} - for (int i = 0; i < cdef->propertyList.count(); ++i) { - const PropertyDef &p = cdef->propertyList.at(i); - foreach (const QByteArray &candidate, candidates) { - if (p.type.contains(candidate + "<")) - requiredQtContainers->insert(candidate); - } - } +static QByteArrayList requiredQtContainers(const QVector<ClassDef> &classes) +{ + static const QByteArrayList candidates = make_candidates(); + + QByteArrayList required; + required.reserve(candidates.size()); - QList<FunctionDef> allFunctions = cdef->slotList + cdef->signalList + cdef->methodList; + for (const auto &candidate : candidates) { + const QByteArray pattern = candidate + '<'; - for (int i = 0; i < allFunctions.count(); ++i) { - const FunctionDef &f = allFunctions.at(i); - foreach (const ArgumentDef &arg, f.arguments) { - foreach (const QByteArray &candidate, candidates) { - if (arg.normalizedType.contains(candidate + "<")) - requiredQtContainers->insert(candidate); + for (const auto &c : classes) { + if (any_type_contains(c.propertyList, pattern) || + any_arg_contains(c.slotList, pattern) || + any_arg_contains(c.signalList, pattern) || + any_arg_contains(c.methodList, pattern)) { + required.push_back(candidate); + break; } } } + + return required; } void Moc::generate(FILE *out) @@ -874,19 +895,9 @@ void Moc::generate(FILE *out) if (mustIncludeQPluginH) fprintf(out, "#include <QtCore/qplugin.h>\n"); - QSet<QByteArray> requiredQtContainers; - for (i = 0; i < classList.size(); ++i) { - findRequiredContainers(&classList[i], &requiredQtContainers); - } - - // after finding the containers, we sort them into a list to avoid - // non-deterministic behavior which may cause rebuilds unnecessarily. - QList<QByteArray> requiredContainerList = requiredQtContainers.toList(); - std::sort(requiredContainerList.begin(), requiredContainerList.end()); - - foreach (const QByteArray &qtContainer, requiredContainerList) { + const auto qtContainers = requiredQtContainers(classList); + for (const QByteArray &qtContainer : qtContainers) fprintf(out, "#include <QtCore/%s>\n", qtContainer.constData()); - } fprintf(out, "#if !defined(Q_MOC_OUTPUT_REVISION)\n" @@ -1308,7 +1319,7 @@ void Moc::parseInterfaces(ClassDef *def) { next(LPAREN); while (test(IDENTIFIER)) { - QList<ClassDef::Interface> iface; + QVector<ClassDef::Interface> iface; iface += ClassDef::Interface(lexem()); while (test(SCOPE)) { iface.last().className += lexem(); @@ -1444,7 +1455,7 @@ bool Moc::until(Token target) { case LPAREN: ++parenCount; break; case RPAREN: --parenCount; break; case LANGLE: - if (parenCount == 0 && braceCount == 0 && parenCount == 0) + if (parenCount == 0 && braceCount == 0) ++angleCount; break; case RANGLE: diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index 8a0c583cd9..843bdeb794 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -64,6 +59,7 @@ struct Type Token firstToken; ReferenceType referenceType; }; +Q_DECLARE_TYPEINFO(Type, Q_MOVABLE_TYPE); struct EnumDef { @@ -72,6 +68,7 @@ struct EnumDef bool isEnumClass; // c++11 enum class EnumDef() : isEnumClass(false) {} }; +Q_DECLARE_TYPEINFO(EnumDef, Q_MOVABLE_TYPE); struct ArgumentDef { @@ -81,6 +78,7 @@ struct ArgumentDef QByteArray typeNameForCast; // type name to be used in cast from void * in metacall bool isDefault; }; +Q_DECLARE_TYPEINFO(ArgumentDef, Q_MOVABLE_TYPE); struct FunctionDef { @@ -94,7 +92,7 @@ struct FunctionDef QByteArray name; bool returnTypeIsVolatile; - QList<ArgumentDef> arguments; + QVector<ArgumentDef> arguments; enum Access { Private, Protected, Public }; Access access; @@ -117,6 +115,7 @@ struct FunctionDef int revision; }; +Q_DECLARE_TYPEINFO(FunctionDef, Q_MOVABLE_TYPE); struct PropertyDef { @@ -135,6 +134,7 @@ struct PropertyDef } int revision; }; +Q_DECLARE_TYPEINFO(PropertyDef, Q_MOVABLE_TYPE); struct ClassInfoDef @@ -142,6 +142,7 @@ struct ClassInfoDef QByteArray name; QByteArray value; }; +Q_DECLARE_TYPEINFO(ClassInfoDef, Q_MOVABLE_TYPE); struct ClassDef { ClassDef(): @@ -149,16 +150,17 @@ struct ClassDef { , revisionedMethods(0), revisionedProperties(0), begin(0), end(0){} QByteArray classname; QByteArray qualified; - QList<QPair<QByteArray, FunctionDef::Access> > superclassList; + QVector<QPair<QByteArray, FunctionDef::Access> > superclassList; struct Interface { + Interface() {} // for QVector, don't use inline explicit Interface(const QByteArray &_className) : className(_className) {} QByteArray className; QByteArray interfaceId; }; - QList<QList<Interface> >interfaceList; + QVector<QVector<Interface> >interfaceList; bool hasQObject; bool hasQGadget; @@ -169,13 +171,13 @@ struct ClassDef { QJsonDocument metaData; } pluginData; - QList<FunctionDef> constructorList; - QList<FunctionDef> signalList, slotList, methodList, publicList; + QVector<FunctionDef> constructorList; + QVector<FunctionDef> signalList, slotList, methodList, publicList; int notifyableProperties; - QList<PropertyDef> propertyList; - QList<ClassInfoDef> classInfoList; + QVector<PropertyDef> propertyList; + QVector<ClassInfoDef> classInfoList; QMap<QByteArray, bool> enumDeclarations; - QList<EnumDef> enumList; + QVector<EnumDef> enumList; QMap<QByteArray, QByteArray> flagAliases; int revisionedMethods; int revisionedProperties; @@ -183,12 +185,15 @@ struct ClassDef { int begin; int end; }; +Q_DECLARE_TYPEINFO(ClassDef, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(ClassDef::Interface, Q_MOVABLE_TYPE); struct NamespaceDef { QByteArray name; int begin; int end; }; +Q_DECLARE_TYPEINFO(NamespaceDef, Q_MOVABLE_TYPE); class Moc : public Parser { @@ -203,7 +208,7 @@ public: bool mustIncludeQPluginH; QByteArray includePath; QList<QByteArray> includeFiles; - QList<ClassDef> classList; + QVector<ClassDef> classList; QMap<QByteArray, QByteArray> interface2IdMap; QList<QByteArray> metaTypes; // map from class name to fully qualified name diff --git a/src/tools/moc/mwerks_mac.cpp b/src/tools/moc/mwerks_mac.cpp index 413b3dbe01..fe8bf680fb 100644 --- a/src/tools/moc/mwerks_mac.cpp +++ b/src/tools/moc/mwerks_mac.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/src/tools/moc/mwerks_mac.h b/src/tools/moc/mwerks_mac.h index b01aca781d..9f6f074036 100644 --- a/src/tools/moc/mwerks_mac.h +++ b/src/tools/moc/mwerks_mac.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/src/tools/moc/outputrevision.h b/src/tools/moc/outputrevision.h index 744600e6cf..594775ca6b 100644 --- a/src/tools/moc/outputrevision.h +++ b/src/tools/moc/outputrevision.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/src/tools/moc/parser.cpp b/src/tools/moc/parser.cpp index 6092e96d0e..b7aefae1ec 100644 --- a/src/tools/moc/parser.cpp +++ b/src/tools/moc/parser.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/src/tools/moc/parser.h b/src/tools/moc/parser.h index 947e472dae..ee8761108b 100644 --- a/src/tools/moc/parser.h +++ b/src/tools/moc/parser.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -34,9 +29,10 @@ #ifndef PARSER_H #define PARSER_H -#include <qstack.h> #include "symbols.h" +#include <stack> + QT_BEGIN_NAMESPACE class Parser @@ -57,7 +53,7 @@ public: }; QList<IncludePath> includes; - QStack<QByteArray> currentFilenames; + std::stack<QByteArray, QByteArrayList> currentFilenames; inline bool hasNext() const { return (index < symbols.size()); } inline Token next() { if (index >= symbols.size()) return NOTOKEN; return symbols.at(index++).token; } diff --git a/src/tools/moc/ppkeywords.cpp b/src/tools/moc/ppkeywords.cpp index 0050d0ae18..b94abf8cd8 100644 --- a/src/tools/moc/ppkeywords.cpp +++ b/src/tools/moc/ppkeywords.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index a2a1a958cf..9d9feb3ebe 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2014 Olivier Goffart <ogoffart@woboq.org> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** @@ -154,6 +149,11 @@ bool Preprocessor::skipBranch() Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocessor::TokenizeMode mode) { Symbols symbols; + // Preallocate some space to speed up the code below. + // The magic divisor value was found by calculating the average ratio between + // input size and the final size of symbols. + // This yielded a value of 16.x when compiling Qt Base. + symbols.reserve(input.size() / 16); const char *begin = input.constData(); const char *data = begin; while (*data) { @@ -1217,6 +1217,10 @@ Symbols Preprocessor::preprocessed(const QByteArray &filename, QFile *file) // phase 3: preprocess conditions and substitute macros Symbols result; + // Preallocate some space to speed up the code below. + // The magic value was found by logging the final size + // and calculating an average when running moc over FOSS projects. + result.reserve(file->size() / 300000); preprocess(filename, result); mergeStringLiterals(&result); diff --git a/src/tools/moc/preprocessor.h b/src/tools/moc/preprocessor.h index 9c81f86f9c..9a49751eb0 100644 --- a/src/tools/moc/preprocessor.h +++ b/src/tools/moc/preprocessor.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/src/tools/moc/symbols.h b/src/tools/moc/symbols.h index 5f442e75ed..af5e90e300 100644 --- a/src/tools/moc/symbols.h +++ b/src/tools/moc/symbols.h @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com> -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/src/tools/moc/token.cpp b/src/tools/moc/token.cpp index 79bbb4641a..cf1aa102c7 100644 --- a/src/tools/moc/token.cpp +++ b/src/tools/moc/token.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/src/tools/moc/token.h b/src/tools/moc/token.h index 5081055ef5..3557da8aa8 100644 --- a/src/tools/moc/token.h +++ b/src/tools/moc/token.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/src/tools/moc/util/generate.sh b/src/tools/moc/util/generate.sh index 0b1e8d6ebb..3894be1309 100755 --- a/src/tools/moc/util/generate.sh +++ b/src/tools/moc/util/generate.sh @@ -1,32 +1,27 @@ #!/bin/sh ############################################################################# ## -## Copyright (C) 2015 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ +## Copyright (C) 2016 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ ## ## This file is the build configuration utility of the Qt Toolkit. ## -## $QT_BEGIN_LICENSE:LGPL21$ +## $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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://www.qt.io/contact-us. +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. ## -## GNU Lesser General Public License Usage -## Alternatively, this file may be used under the terms of the GNU Lesser -## General Public License version 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## 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$ ## diff --git a/src/tools/moc/util/generate_keywords.cpp b/src/tools/moc/util/generate_keywords.cpp index 4041976393..d0f76a4c45 100644 --- a/src/tools/moc/util/generate_keywords.cpp +++ b/src/tools/moc/util/generate_keywords.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/src/tools/moc/util/licenseheader.txt b/src/tools/moc/util/licenseheader.txt index 75cc5f6607..b2b02f82eb 100644 --- a/src/tools/moc/util/licenseheader.txt +++ b/src/tools/moc/util/licenseheader.txt @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** diff --git a/src/tools/moc/utils.h b/src/tools/moc/utils.h index 89d1aadf86..4cb1d90345 100644 --- a/src/tools/moc/utils.h +++ b/src/tools/moc/utils.h @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the tools applications of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** 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$ ** |