aboutsummaryrefslogtreecommitdiffstats
path: root/ApiExtractor
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-03-29 12:44:43 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-04-06 08:36:07 +0000
commit4517c70f43a6eac7aae0d632320ca127837011f5 (patch)
treed977d79e1802ec5afa0d2b670cfe19e43e6aaf61 /ApiExtractor
parent69d28aa054cb43cbc0f68b2cc18fbedcbca1e0d5 (diff)
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 <alexandru.croitor@qt.io>
Diffstat (limited to 'ApiExtractor')
-rw-r--r--ApiExtractor/apiextractor.h1
-rw-r--r--ApiExtractor/typedatabase.cpp24
-rw-r--r--ApiExtractor/typedatabase.h9
-rw-r--r--ApiExtractor/typedatabase_typedefs.h49
-rw-r--r--ApiExtractor/typesystem_typedefs.h10
5 files changed, 67 insertions, 26 deletions
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 <QStringList>
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<TypeEntry *> &entries = findTypes(name);
+ const TypeEntryList &entries = findTypes(name);
for (TypeEntry *entry : entries) {
if (entry &&
(!entry->isPrimitive() || static_cast<PrimitiveTypeEntry *>(entry)->preferredTargetLangType())) {
@@ -185,7 +185,7 @@ TypeEntry* TypeDatabase::findType(const QString& name) const
return 0;
}
-QList<TypeEntry *> 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<const PrimitiveTypeEntry*> TypeDatabase::primitiveTypes() const
+PrimitiveTypeEntryList TypeDatabase::primitiveTypes() const
{
TypeEntryHash entries = allEntries();
- QList<const PrimitiveTypeEntry*> 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<const PrimitiveTypeEntry*> TypeDatabase::primitiveTypes() const
return returned;
}
-QList<const ContainerTypeEntry*> TypeDatabase::containerTypes() const
+ContainerTypeEntryList TypeDatabase::containerTypes() const
{
TypeEntryHash entries = allEntries();
- QList<const ContainerTypeEntry*> 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<TypeEntry *> &entries = findTypes(name);
+ const TypeEntryList &entries = findTypes(name);
for (TypeEntry *entry : entries) {
if (entry && entry->isPrimitive() && static_cast<PrimitiveTypeEntry*>(entry)->preferredTargetLangType())
@@ -447,7 +447,7 @@ PrimitiveTypeEntry *TypeDatabase::findPrimitiveType(const QString& name) const
ComplexTypeEntry* TypeDatabase::findComplexType(const QString& name) const
{
- const QList<TypeEntry *> &entries = findTypes(name);
+ const TypeEntryList &entries = findTypes(name);
for (TypeEntry *entry : entries) {
if (entry && entry->isComplex())
return static_cast<ComplexTypeEntry*>(entry);
@@ -457,7 +457,7 @@ ComplexTypeEntry* TypeDatabase::findComplexType(const QString& name) const
ObjectTypeEntry* TypeDatabase::findObjectType(const QString& name) const
{
- const QList<TypeEntry*> &entries = findTypes(name);
+ const TypeEntryList &entries = findTypes(name);
for (TypeEntry *entry : entries) {
if (entry && entry->isObject())
return static_cast<ObjectTypeEntry*>(entry);
@@ -467,7 +467,7 @@ ObjectTypeEntry* TypeDatabase::findObjectType(const QString& name) const
NamespaceTypeEntry* TypeDatabase::findNamespaceType(const QString& name) const
{
- const QList<TypeEntry *> &entries = findTypes(name);
+ const TypeEntryList &entries = findTypes(name);
for (TypeEntry *entry : entries) {
if (entry && entry->isNamespace())
return static_cast<NamespaceTypeEntry*>(entry);
@@ -513,7 +513,7 @@ static bool compareTypeEntriesByName(const TypeEntry* t1, const TypeEntry* t2)
static void _computeTypeIndexes()
{
TypeDatabase* tdb = TypeDatabase::instance();
- typedef QMap<int, QList<TypeEntry*> > GroupedTypeEntries;
+ typedef QMap<int, TypeEntryList> 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<TypeEntry*>::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<const PrimitiveTypeEntry*> primitiveTypes() const;
+ PrimitiveTypeEntryList primitiveTypes() const;
- QList<const ContainerTypeEntry*> 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<TypeEntry *> 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<QString, bool> m_parsedTypesystemFiles;
- QList<TypeRejection> m_rejections;
+ QVector<TypeRejection> 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 <QtCore/QHash>
+#include <QtCore/QString>
+#include <QtCore/QVector>
+
+class ContainerTypeEntry;
+class PrimitiveTypeEntry;
+class TemplateEntry;
+class TypeEntry;
+
+typedef QVector<TypeEntry *> TypeEntryList;
+typedef QHash<QString, TypeEntryList> TypeEntryHash;
+typedef QHash<QString, TypeEntry *> SingleTypeEntryHash;
+typedef QHash<QString, TemplateEntry *> TemplateEntryHash;
+
+typedef QVector<const ContainerTypeEntry *> ContainerTypeEntryList;
+typedef QVector<const PrimitiveTypeEntry *> 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 <QtCore/QVector>
class CodeSnip;
-class ContainerTypeEntry;
class DocModification;
-class PrimitiveTypeEntry;
-class TemplateEntry;
-class TypeEntry;
struct AddedFunction;
struct FieldModification;
struct FunctionModification;
-typedef QHash<QString, QList<TypeEntry *> > TypeEntryHash;
-typedef QHash<QString, TypeEntry *> SingleTypeEntryHash;
-typedef QHash<QString, TemplateEntry *> TemplateEntryHash;
-
typedef QVector<AddedFunction> AddedFunctionList;
typedef QVector<CodeSnip> CodeSnipList;
-typedef QList<const ContainerTypeEntry *> ContainerTypeEntryList;
typedef QVector<DocModification> DocModificationList;
typedef QVector<FieldModification> FieldModificationList;
typedef QVector<FunctionModification> FunctionModificationList;
-typedef QList<const PrimitiveTypeEntry *> PrimitiveTypeEntryList;
#endif // TYPESYSTEM_TYPEDEFS_H