diff options
Diffstat (limited to 'src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp')
-rw-r--r-- | src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp index 10cc6b9929..083187555d 100644 --- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp +++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.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$ ** @@ -91,8 +86,9 @@ static const char help[] = int qDBusParametersForMethod(const FunctionDef &mm, QVector<int>& metaTypes, QString &errorMsg) { QList<QByteArray> parameterTypes; + parameterTypes.reserve(mm.arguments.size()); - foreach (const ArgumentDef &arg, mm.arguments) + for (const ArgumentDef &arg : mm.arguments) parameterTypes.append(arg.normalizedType); return qDBusParametersForMethod(parameterTypes, metaTypes, errorMsg); @@ -131,7 +127,7 @@ static QString addFunction(const FunctionDef &mm, bool isSignal = false) { return QString(); // wasn't a valid type } } - QList<ArgumentDef> names = mm.arguments; + QVector<ArgumentDef> names = mm.arguments; QVector<int> types; QString errorMsg; int inputCount = qDBusParametersForMethod(mm, types, errorMsg); @@ -205,7 +201,7 @@ static QString generateInterfaceXml(const ClassDef *mo) if (flags & (QDBusConnection::ExportScriptableProperties | QDBusConnection::ExportNonScriptableProperties)) { static const char *accessvalues[] = {0, "read", "write", "readwrite"}; - foreach (const PropertyDef &mp, mo->propertyList) { + for (const PropertyDef &mp : mo->propertyList) { if (!((!mp.scriptable.isEmpty() && (flags & QDBusConnection::ExportScriptableProperties)) || (!mp.scriptable.isEmpty() && (flags & QDBusConnection::ExportNonScriptableProperties)))) continue; @@ -240,7 +236,7 @@ static QString generateInterfaceXml(const ClassDef *mo) // now add methods: if (flags & (QDBusConnection::ExportScriptableSignals | QDBusConnection::ExportNonScriptableSignals)) { - foreach (const FunctionDef &mm, mo->signalList) { + for (const FunctionDef &mm : mo->signalList) { if (mm.wasCloned) continue; if (!mm.isScriptable && !(flags & QDBusConnection::ExportNonScriptableSignals)) @@ -251,13 +247,13 @@ static QString generateInterfaceXml(const ClassDef *mo) } if (flags & (QDBusConnection::ExportScriptableSlots | QDBusConnection::ExportNonScriptableSlots)) { - foreach (const FunctionDef &slot, mo->slotList) { + for (const FunctionDef &slot : mo->slotList) { if (!slot.isScriptable && !(flags & QDBusConnection::ExportNonScriptableSlots)) continue; if (slot.access == FunctionDef::Public) retval += addFunction(slot); } - foreach (const FunctionDef &method, mo->methodList) { + for (const FunctionDef &method : mo->methodList) { if (!method.isScriptable && !(flags & QDBusConnection::ExportNonScriptableSlots)) continue; if (method.access == FunctionDef::Public) @@ -271,7 +267,7 @@ QString qDBusInterfaceFromClassDef(const ClassDef *mo) { QString interface; - foreach (const ClassInfoDef &cid, mo->classInfoList) { + for (const ClassInfoDef &cid : mo->classInfoList) { if (cid.name == QCLASSINFO_DBUS_INTERFACE) return QString::fromUtf8(cid.value); } @@ -294,7 +290,7 @@ QString qDBusInterfaceFromClassDef(const ClassDef *mo) QString qDBusGenerateClassDefXml(const ClassDef *cdef) { - foreach (const ClassInfoDef &cid, cdef->classInfoList) { + for (const ClassInfoDef &cid : cdef->classInfoList) { if (cid.name == QCLASSINFO_DBUS_INTROSPECTION) return QString::fromUtf8(cid.value); } @@ -401,7 +397,7 @@ int main(int argc, char **argv) args.append(QString::fromLocal8Bit(argv[n])); parseCmdLine(args); - QList<ClassDef> classes; + QVector<ClassDef> classes; for (int i = 0; i < args.count(); ++i) { const QString arg = args.at(i); @@ -421,7 +417,7 @@ int main(int argc, char **argv) pp.macros["Q_MOC_RUN"]; pp.macros["__cplusplus"]; - const QByteArray filename = QFile::decodeName(argv[i]).toLatin1(); + const QByteArray filename = arg.toLocal8Bit(); moc.filename = filename; moc.currentFilenames.push(filename); @@ -450,7 +446,7 @@ int main(int argc, char **argv) output.write(docTypeHeader); output.write("<node>\n"); - foreach (const ClassDef &cdef, classes) { + for (const ClassDef &cdef : qAsConst(classes)) { QString xml = qDBusGenerateClassDefXml(&cdef); output.write(xml.toLocal8Bit()); } |