aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-19 11:21:47 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-19 16:55:23 +0200
commit62692a6f0df7ce14e0cb8808545ab80f04d417cf (patch)
tree2dc506fbc6a93776952b20eb5e937ea11979c3a0
parenteb3313989a5a93f66067042dd5a8ed516e5febe7 (diff)
shiboken: Rename enum ContainerTypeEntry::Type to ContainerKind
As it is, it clashes with TypeEntry::Type. Task-number: PYSIDE-904 Change-Id: I51b269f188b39dc18412b83c3d659cbf61a99608 Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testcontainer.cpp6
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testtemplates.cpp6
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp8
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.h14
-rw-r--r--sources/shiboken2/ApiExtractor/typesystemparser.cpp4
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.cpp11
7 files changed, 28 insertions, 23 deletions
diff --git a/sources/shiboken2/ApiExtractor/tests/testcontainer.cpp b/sources/shiboken2/ApiExtractor/tests/testcontainer.cpp
index 2234fb4c3..aaa72238c 100644
--- a/sources/shiboken2/ApiExtractor/tests/testcontainer.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testcontainer.cpp
@@ -57,8 +57,10 @@ void TestContainer::testContainerType()
//search for class A
AbstractMetaClass* classA = AbstractMetaClass::findClass(classes, QLatin1String("A"));
QVERIFY(classA);
- QVERIFY(classA->typeEntry()->baseContainerType());
- QCOMPARE(reinterpret_cast<const ContainerTypeEntry*>(classA->typeEntry()->baseContainerType())->type(), ContainerTypeEntry::ListContainer);
+ auto baseContainer = classA->typeEntry()->baseContainerType();
+ QVERIFY(baseContainer);
+ QCOMPARE(reinterpret_cast<const ContainerTypeEntry*>(baseContainer)->containerKind(),
+ ContainerTypeEntry::ListContainer);
}
void TestContainer::testListOfValueType()
diff --git a/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp b/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp
index f0f60f316..ec3ddb8b2 100644
--- a/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp
@@ -428,8 +428,10 @@ typedef Vector<int> IntVector;
AbstractMetaClass* vector = AbstractMetaClass::findClass(classes, QLatin1String("IntVector"));
QVERIFY(vector);
- QVERIFY(vector->typeEntry()->baseContainerType());
- QCOMPARE(reinterpret_cast<const ContainerTypeEntry*>(vector->typeEntry()->baseContainerType())->type(), ContainerTypeEntry::VectorContainer);
+ auto baseContainer = vector->typeEntry()->baseContainerType();
+ QVERIFY(baseContainer);
+ QCOMPARE(reinterpret_cast<const ContainerTypeEntry*>(baseContainer)->containerKind(),
+ ContainerTypeEntry::VectorContainer);
QCOMPARE(vector->functions().count(), 4);
const AbstractMetaFunction* method = vector->findFunction(QLatin1String("method"));
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.cpp b/sources/shiboken2/ApiExtractor/typedatabase.cpp
index 43d05fb78..4a29a25c9 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.cpp
+++ b/sources/shiboken2/ApiExtractor/typedatabase.cpp
@@ -954,7 +954,7 @@ void NamespaceTypeEntry::formatDebug(QDebug &d) const
void ContainerTypeEntry::formatDebug(QDebug &d) const
{
ComplexTypeEntry::formatDebug(d);
- d << ", type=" << m_type << ",\"" << typeName() << '"';
+ d << ", type=" << m_containerKind << ",\"" << typeName() << '"';
}
void SmartPointerTypeEntry::formatDebug(QDebug &d) const
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index 0ec158ae1..920da9e10 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystem.cpp
@@ -144,7 +144,7 @@ ComplexTypeEntry::ComplexTypeEntry(const ComplexTypeEntry &) = default;
QString ContainerTypeEntry::qualifiedCppName() const
{
- if (m_type == StringListContainer)
+ if (m_containerKind == StringListContainer)
return QLatin1String("QStringList");
return ComplexTypeEntry::qualifiedCppName();
}
@@ -595,7 +595,7 @@ QString ComplexTypeEntry::targetLangApiName() const
QString ContainerTypeEntry::typeName() const
{
- switch(m_type) {
+ switch (m_containerKind) {
case LinkedListContainer:
return QLatin1String("linked-list");
case ListContainer:
@@ -928,11 +928,11 @@ TypeEntry *TypedefEntry::clone() const
TypedefEntry::TypedefEntry(const TypedefEntry &) = default;
-ContainerTypeEntry::ContainerTypeEntry(const QString &entryName, Type type,
+ContainerTypeEntry::ContainerTypeEntry(const QString &entryName, ContainerKind containerKind,
const QVersionNumber &vr,
const TypeEntry *parent) :
ComplexTypeEntry(entryName, ContainerType, vr, parent),
- m_type(type)
+ m_containerKind(containerKind)
{
setCodeGeneration(GenerateForSubclass);
}
diff --git a/sources/shiboken2/ApiExtractor/typesystem.h b/sources/shiboken2/ApiExtractor/typesystem.h
index 790fb95cb..6d2d4bb44 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.h
+++ b/sources/shiboken2/ApiExtractor/typesystem.h
@@ -1406,7 +1406,7 @@ class ContainerTypeEntry : public ComplexTypeEntry
{
Q_GADGET
public:
- enum Type {
+ enum ContainerKind {
NoContainer,
ListContainer,
StringListContainer,
@@ -1421,14 +1421,14 @@ public:
MultiHashContainer,
PairContainer,
};
- Q_ENUM(Type)
+ Q_ENUM(ContainerKind)
- explicit ContainerTypeEntry(const QString &entryName, Type type, const QVersionNumber &vr,
- const TypeEntry *parent);
+ explicit ContainerTypeEntry(const QString &entryName, ContainerKind containerKind,
+ const QVersionNumber &vr, const TypeEntry *parent);
- Type type() const
+ ContainerKind containerKind() const
{
- return m_type;
+ return m_containerKind;
}
QString typeName() const;
@@ -1443,7 +1443,7 @@ protected:
ContainerTypeEntry(const ContainerTypeEntry &);
private:
- Type m_type;
+ ContainerKind m_containerKind;
};
class SmartPointerTypeEntry : public ComplexTypeEntry
diff --git a/sources/shiboken2/ApiExtractor/typesystemparser.cpp b/sources/shiboken2/ApiExtractor/typesystemparser.cpp
index 45f624762..9fdf81821 100644
--- a/sources/shiboken2/ApiExtractor/typesystemparser.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystemparser.cpp
@@ -297,7 +297,7 @@ ENUM_LOOKUP_BEGIN(TypeSystem::DocModificationMode, Qt::CaseInsensitive,
};
ENUM_LOOKUP_LINEAR_SEARCH()
-ENUM_LOOKUP_BEGIN(ContainerTypeEntry::Type, Qt::CaseSensitive,
+ENUM_LOOKUP_BEGIN(ContainerTypeEntry::ContainerKind, Qt::CaseSensitive,
containerTypeFromAttribute, ContainerTypeEntry::NoContainer)
{
{u"list", ContainerTypeEntry::ListContainer},
@@ -1278,7 +1278,7 @@ ContainerTypeEntry *
return nullptr;
}
const QStringRef typeName = attributes->takeAt(typeIndex).value();
- ContainerTypeEntry::Type containerType = containerTypeFromAttribute(typeName);
+ ContainerTypeEntry::ContainerKind containerType = containerTypeFromAttribute(typeName);
if (containerType == ContainerTypeEntry::NoContainer) {
m_error = QLatin1String("there is no container of type ") + typeName.toString();
return nullptr;
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
index 5478acb2a..0e8809e97 100644
--- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
@@ -789,7 +789,7 @@ QString ShibokenGenerator::cpythonBaseName(const TypeEntry *type)
baseName = cpythonFlagsName(static_cast<const FlagsTypeEntry *>(type));
} else if (type->isContainer()) {
const auto *ctype = static_cast<const ContainerTypeEntry *>(type);
- switch (ctype->type()) {
+ switch (ctype->containerKind()) {
case ContainerTypeEntry::ListContainer:
case ContainerTypeEntry::StringListContainer:
case ContainerTypeEntry::LinkedListContainer:
@@ -1164,10 +1164,11 @@ QString ShibokenGenerator::cpythonCheckFunction(const AbstractMetaType *metaType
return QLatin1String("PyObject_Check");
return cpythonCheckFunction(metaType->typeEntry(), genericNumberType);
}
- if (metaType->typeEntry()->isContainer()) {
+ auto typeEntry = metaType->typeEntry();
+ if (typeEntry->isContainer()) {
QString typeCheck = QLatin1String("Shiboken::Conversions::");
- ContainerTypeEntry::Type type =
- static_cast<const ContainerTypeEntry *>(metaType->typeEntry())->type();
+ ContainerTypeEntry::ContainerKind type =
+ static_cast<const ContainerTypeEntry *>(typeEntry)->containerKind();
if (type == ContainerTypeEntry::ListContainer
|| type == ContainerTypeEntry::StringListContainer
|| type == ContainerTypeEntry::LinkedListContainer
@@ -1206,7 +1207,7 @@ QString ShibokenGenerator::cpythonCheckFunction(const AbstractMetaType *metaType
}
return typeCheck;
}
- return cpythonCheckFunction(metaType->typeEntry(), genericNumberType);
+ return cpythonCheckFunction(typeEntry, genericNumberType);
}
QString ShibokenGenerator::cpythonCheckFunction(const TypeEntry *type, bool genericNumberType)