From 4517c70f43a6eac7aae0d632320ca127837011f5 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 29 Mar 2017 12:44:43 +0200 Subject: TypeDatabase: Replace QList by QVector QList will be deprecated in Qt. Split out a new header typedatabase_typedefs.h with typedefs from typesystem_typedefs.h. Change-Id: I15fc1f7edcdc682c32b2e9b935858681e02d35c6 Reviewed-by: Alexandru Croitor --- ApiExtractor/apiextractor.h | 1 + ApiExtractor/typedatabase.cpp | 24 +++++++++--------- ApiExtractor/typedatabase.h | 9 ++++--- ApiExtractor/typedatabase_typedefs.h | 49 ++++++++++++++++++++++++++++++++++++ ApiExtractor/typesystem_typedefs.h | 10 -------- 5 files changed, 67 insertions(+), 26 deletions(-) create mode 100644 ApiExtractor/typedatabase_typedefs.h (limited to 'ApiExtractor') diff --git a/ApiExtractor/apiextractor.h b/ApiExtractor/apiextractor.h index 1080ff5..ea46e1b 100644 --- a/ApiExtractor/apiextractor.h +++ b/ApiExtractor/apiextractor.h @@ -33,6 +33,7 @@ #include "dependency.h" #include "abstractmetalang_typedefs.h" #include "apiextractormacros.h" +#include "typedatabase_typedefs.h" #include "typesystem_typedefs.h" #include diff --git a/ApiExtractor/typedatabase.cpp b/ApiExtractor/typedatabase.cpp index 005f93d..d9a741f 100644 --- a/ApiExtractor/typedatabase.cpp +++ b/ApiExtractor/typedatabase.cpp @@ -175,7 +175,7 @@ FunctionTypeEntry* TypeDatabase::findFunctionType(const QString& name) const TypeEntry* TypeDatabase::findType(const QString& name) const { - const QList &entries = findTypes(name); + const TypeEntryList &entries = findTypes(name); for (TypeEntry *entry : entries) { if (entry && (!entry->isPrimitive() || static_cast(entry)->preferredTargetLangType())) { @@ -185,7 +185,7 @@ TypeEntry* TypeDatabase::findType(const QString& name) const return 0; } -QList TypeDatabase::findTypes(const QString &name) const +TypeEntryList TypeDatabase::findTypes(const QString &name) const { return m_entries.value(name); } @@ -201,10 +201,10 @@ SingleTypeEntryHash TypeDatabase::entries() const return returned; } -QList TypeDatabase::primitiveTypes() const +PrimitiveTypeEntryList TypeDatabase::primitiveTypes() const { TypeEntryHash entries = allEntries(); - QList returned; + PrimitiveTypeEntryList returned; for (TypeEntryHash::const_iterator it = entries.cbegin(), end = entries.cend(); it != end; ++it) { for (TypeEntry *typeEntry : it.value()) { if (typeEntry->isPrimitive()) @@ -214,10 +214,10 @@ QList TypeDatabase::primitiveTypes() const return returned; } -QList TypeDatabase::containerTypes() const +ContainerTypeEntryList TypeDatabase::containerTypes() const { TypeEntryHash entries = allEntries(); - QList returned; + ContainerTypeEntryList returned; for (TypeEntryHash::const_iterator it = entries.cbegin(), end = entries.cend(); it != end; ++it) { for (TypeEntry *typeEntry : it.value()) { if (typeEntry->isContainer()) @@ -435,7 +435,7 @@ bool TypeDatabase::parseFile(QIODevice* device, bool generate) PrimitiveTypeEntry *TypeDatabase::findPrimitiveType(const QString& name) const { - const QList &entries = findTypes(name); + const TypeEntryList &entries = findTypes(name); for (TypeEntry *entry : entries) { if (entry && entry->isPrimitive() && static_cast(entry)->preferredTargetLangType()) @@ -447,7 +447,7 @@ PrimitiveTypeEntry *TypeDatabase::findPrimitiveType(const QString& name) const ComplexTypeEntry* TypeDatabase::findComplexType(const QString& name) const { - const QList &entries = findTypes(name); + const TypeEntryList &entries = findTypes(name); for (TypeEntry *entry : entries) { if (entry && entry->isComplex()) return static_cast(entry); @@ -457,7 +457,7 @@ ComplexTypeEntry* TypeDatabase::findComplexType(const QString& name) const ObjectTypeEntry* TypeDatabase::findObjectType(const QString& name) const { - const QList &entries = findTypes(name); + const TypeEntryList &entries = findTypes(name); for (TypeEntry *entry : entries) { if (entry && entry->isObject()) return static_cast(entry); @@ -467,7 +467,7 @@ ObjectTypeEntry* TypeDatabase::findObjectType(const QString& name) const NamespaceTypeEntry* TypeDatabase::findNamespaceType(const QString& name) const { - const QList &entries = findTypes(name); + const TypeEntryList &entries = findTypes(name); for (TypeEntry *entry : entries) { if (entry && entry->isNamespace()) return static_cast(entry); @@ -513,7 +513,7 @@ static bool compareTypeEntriesByName(const TypeEntry* t1, const TypeEntry* t2) static void _computeTypeIndexes() { TypeDatabase* tdb = TypeDatabase::instance(); - typedef QMap > GroupedTypeEntries; + typedef QMap GroupedTypeEntries; GroupedTypeEntries groupedEntries; // Group type entries by revision numbers @@ -538,7 +538,7 @@ static void _computeTypeIndexes() GroupedTypeEntries::iterator it = groupedEntries.begin(); for (; it != groupedEntries.end(); ++it) { // Remove duplicates - QList::iterator newEnd = std::unique(it.value().begin(), it.value().end()); + TypeEntryList::iterator newEnd = std::unique(it.value().begin(), it.value().end()); it.value().erase(newEnd, it.value().end()); // Sort the type entries by name qSort(it.value().begin(), newEnd, compareTypeEntriesByName); diff --git a/ApiExtractor/typedatabase.h b/ApiExtractor/typedatabase.h index 4255cf4..870002b 100644 --- a/ApiExtractor/typedatabase.h +++ b/ApiExtractor/typedatabase.h @@ -31,6 +31,7 @@ #include "apiextractormacros.h" #include "include.h" +#include "typedatabase_typedefs.h" #include "typesystem_enums.h" #include "typesystem_typedefs.h" @@ -95,9 +96,9 @@ public: SingleTypeEntryHash entries() const; - QList primitiveTypes() const; + PrimitiveTypeEntryList primitiveTypes() const; - QList containerTypes() const; + ContainerTypeEntryList containerTypes() const; void addRejection(const QString& className, const QString& functionName, const QString& fieldName, const QString& enumName); @@ -150,7 +151,7 @@ public: void formatDebug(QDebug &d) const; #endif private: - QList findTypes(const QString &name) const; + TypeEntryList findTypes(const QString &name) const; QString modifiedTypesystemFilepath(const QString &tsFile) const; bool m_suppressWarnings; @@ -167,7 +168,7 @@ private: QStringList m_typesystemPaths; QHash m_parsedTypesystemFiles; - QList m_rejections; + QVector m_rejections; QStringList m_dropTypeEntries; }; diff --git a/ApiExtractor/typedatabase_typedefs.h b/ApiExtractor/typedatabase_typedefs.h new file mode 100644 index 0000000..95859a3 --- /dev/null +++ b/ApiExtractor/typedatabase_typedefs.h @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of PySide2. +** +** $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$ +** +****************************************************************************/ + +#ifndef TYPEDATABASE_TYPEDEFS_H +#define TYPEDATABASE_TYPEDEFS_H + +#include +#include +#include + +class ContainerTypeEntry; +class PrimitiveTypeEntry; +class TemplateEntry; +class TypeEntry; + +typedef QVector TypeEntryList; +typedef QHash TypeEntryHash; +typedef QHash SingleTypeEntryHash; +typedef QHash TemplateEntryHash; + +typedef QVector ContainerTypeEntryList; +typedef QVector PrimitiveTypeEntryList; + +#endif // TYPEDATABASE_TYPEDEFS_H diff --git a/ApiExtractor/typesystem_typedefs.h b/ApiExtractor/typesystem_typedefs.h index 4849ee3..4f29dec 100644 --- a/ApiExtractor/typesystem_typedefs.h +++ b/ApiExtractor/typesystem_typedefs.h @@ -34,26 +34,16 @@ #include class CodeSnip; -class ContainerTypeEntry; class DocModification; -class PrimitiveTypeEntry; -class TemplateEntry; -class TypeEntry; struct AddedFunction; struct FieldModification; struct FunctionModification; -typedef QHash > TypeEntryHash; -typedef QHash SingleTypeEntryHash; -typedef QHash TemplateEntryHash; - typedef QVector AddedFunctionList; typedef QVector CodeSnipList; -typedef QList ContainerTypeEntryList; typedef QVector DocModificationList; typedef QVector FieldModificationList; typedef QVector FunctionModificationList; -typedef QList PrimitiveTypeEntryList; #endif // TYPESYSTEM_TYPEDEFS_H -- cgit v1.2.3