From 194df4ac3203546193dc7fb03267ede5d112009f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 6 Aug 2018 09:01:19 +0200 Subject: shiboken: Add clone() to the typesystem entry classes This is a prerequisite for adding a typedef entry. Add copy constructors and clone() methods. Task-number: PYSIDE-725 Change-Id: I7cee679432be70e2349071f1dd62335fda564fe3 Reviewed-by: Christian Tismer Reviewed-by: Cristian Maureira-Fredes --- sources/shiboken2/ApiExtractor/typesystem.cpp | 126 ++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) (limited to 'sources/shiboken2/ApiExtractor/typesystem.cpp') diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp index d08fed7f9..586a20cd9 100644 --- a/sources/shiboken2/ApiExtractor/typesystem.cpp +++ b/sources/shiboken2/ApiExtractor/typesystem.cpp @@ -2723,6 +2723,13 @@ PrimitiveTypeEntry *PrimitiveTypeEntry::basicReferencedTypeEntry() const return baseReferencedTypeEntry ? baseReferencedTypeEntry : m_referencedTypeEntry; } +TypeEntry *PrimitiveTypeEntry::clone() const +{ + return new PrimitiveTypeEntry(*this); +} + +PrimitiveTypeEntry::PrimitiveTypeEntry(const PrimitiveTypeEntry &) = default; + CodeSnipList TypeEntry::codeSnips() const { return m_codeSnips; @@ -2778,6 +2785,13 @@ bool ComplexTypeEntry::hasDefaultConstructor() const return !m_defaultConstructor.isEmpty(); } +TypeEntry *ComplexTypeEntry::clone() const +{ + return new ComplexTypeEntry(*this); +} + +ComplexTypeEntry::ComplexTypeEntry(const ComplexTypeEntry &) = default; + QString ContainerTypeEntry::targetLangName() const { @@ -2808,6 +2822,13 @@ QString ContainerTypeEntry::qualifiedCppName() const return ComplexTypeEntry::qualifiedCppName(); } +TypeEntry *ContainerTypeEntry::clone() const +{ + return new ContainerTypeEntry(*this); +} + +ContainerTypeEntry::ContainerTypeEntry(const ContainerTypeEntry &) = default; + QString EnumTypeEntry::targetLangQualifier() const { TypeEntry *te = TypeDatabase::instance()->findType(m_qualifier); @@ -2839,6 +2860,20 @@ QString FlagsTypeEntry::targetLangApiName() const return QLatin1String("jint"); } +TypeEntry *EnumTypeEntry::clone() const +{ + return new EnumTypeEntry(*this); +} + +EnumTypeEntry::EnumTypeEntry(const EnumTypeEntry &) = default; + +TypeEntry *FlagsTypeEntry::clone() const +{ + return new FlagsTypeEntry(*this); +} + +FlagsTypeEntry::FlagsTypeEntry(const FlagsTypeEntry &) = default; + QString FlagsTypeEntry::qualifiedTargetLangName() const { return targetLangPackage() + QLatin1Char('.') + m_enum->targetLangQualifier() @@ -3201,26 +3236,61 @@ CustomConversion* TypeEntry::customConversion() const return m_customConversion; } +TypeEntry *TypeEntry::clone() const +{ + return new TypeEntry(*this); +} + +TypeEntry::TypeEntry(const TypeEntry &) = default; + TypeSystemTypeEntry::TypeSystemTypeEntry(const QString &name, const QVersionNumber &vr) : TypeEntry(name, TypeSystemType, vr) { } +TypeEntry *TypeSystemTypeEntry::clone() const +{ + return new TypeSystemTypeEntry(*this); +} + +TypeSystemTypeEntry::TypeSystemTypeEntry(const TypeSystemTypeEntry &) = default; + VoidTypeEntry::VoidTypeEntry() : TypeEntry(QLatin1String("void"), VoidType, QVersionNumber(0, 0)) { } +TypeEntry *VoidTypeEntry::clone() const +{ + return new VoidTypeEntry(*this); +} + +VoidTypeEntry::VoidTypeEntry(const VoidTypeEntry &) = default; + VarargsTypeEntry::VarargsTypeEntry() : TypeEntry(QLatin1String("..."), VarargsType, QVersionNumber(0, 0)) { } +TypeEntry *VarargsTypeEntry::clone() const +{ + return new VarargsTypeEntry(*this); +} + +VarargsTypeEntry::VarargsTypeEntry(const VarargsTypeEntry &) = default; + TemplateArgumentEntry::TemplateArgumentEntry(const QString &name, const QVersionNumber &vr) : TypeEntry(name, TemplateArgumentType, vr) { } +TypeEntry *TemplateArgumentEntry::clone() const +{ + return new TemplateArgumentEntry(*this); +} + +TemplateArgumentEntry::TemplateArgumentEntry(const TemplateArgumentEntry &) = default; + ArrayTypeEntry::ArrayTypeEntry(const TypeEntry *nested_type, const QVersionNumber &vr) : TypeEntry(QLatin1String("Array"), ArrayType, vr), m_nestedType(nested_type) @@ -3240,6 +3310,13 @@ QString ArrayTypeEntry::targetLangApiName() const : QLatin1String("jobjectArray"); } +TypeEntry *ArrayTypeEntry::clone() const +{ + return new ArrayTypeEntry(*this); +} + +ArrayTypeEntry::ArrayTypeEntry(const ArrayTypeEntry &) = default; + EnumTypeEntry::EnumTypeEntry(const QString &nspace, const QString &enumName, const QVersionNumber &vr) : TypeEntry(nspace.isEmpty() ? enumName : nspace + QLatin1String("::") + enumName, @@ -3263,6 +3340,13 @@ EnumValueTypeEntry::EnumValueTypeEntry(const QString &name, const QString &value { } +TypeEntry *EnumValueTypeEntry::clone() const +{ + return new EnumValueTypeEntry(*this); +} + +EnumValueTypeEntry::EnumValueTypeEntry(const EnumValueTypeEntry &) = default; + FlagsTypeEntry::FlagsTypeEntry(const QString &name, const QVersionNumber &vr) : TypeEntry(name, FlagsType, vr) { @@ -3288,11 +3372,25 @@ SmartPointerTypeEntry::SmartPointerTypeEntry(const QString &name, { } +TypeEntry *SmartPointerTypeEntry::clone() const +{ + return new SmartPointerTypeEntry(*this); +} + +SmartPointerTypeEntry::SmartPointerTypeEntry(const SmartPointerTypeEntry &) = default; + NamespaceTypeEntry::NamespaceTypeEntry(const QString &name, const QVersionNumber &vr) : ComplexTypeEntry(name, NamespaceType, vr) { } +TypeEntry *NamespaceTypeEntry::clone() const +{ + return new NamespaceTypeEntry(*this); +} + +NamespaceTypeEntry::NamespaceTypeEntry(const NamespaceTypeEntry &) = default; + ValueTypeEntry::ValueTypeEntry(const QString &name, const QVersionNumber &vr) : ComplexTypeEntry(name, BasicValueType, vr) { @@ -3308,6 +3406,13 @@ bool ValueTypeEntry::isNativeIdBased() const return true; } +TypeEntry *ValueTypeEntry::clone() const +{ + return new ValueTypeEntry(*this); +} + +ValueTypeEntry::ValueTypeEntry(const ValueTypeEntry &) = default; + ValueTypeEntry::ValueTypeEntry(const QString &name, Type t, const QVersionNumber &vr) : ComplexTypeEntry(name, t, vr) { @@ -3463,6 +3568,13 @@ QString InterfaceTypeEntry::qualifiedCppName() const return ComplexTypeEntry::qualifiedCppName().left(len); } +TypeEntry *InterfaceTypeEntry::clone() const +{ + return new InterfaceTypeEntry(*this); +} + +InterfaceTypeEntry::InterfaceTypeEntry(const InterfaceTypeEntry &) = default; + FunctionTypeEntry::FunctionTypeEntry(const QString &name, const QString &signature, const QVersionNumber &vr) : TypeEntry(name, FunctionType, vr) @@ -3470,6 +3582,13 @@ FunctionTypeEntry::FunctionTypeEntry(const QString &name, const QString &signatu addSignature(signature); } +TypeEntry *FunctionTypeEntry::clone() const +{ + return new FunctionTypeEntry(*this); +} + +FunctionTypeEntry::FunctionTypeEntry(const FunctionTypeEntry &) = default; + ObjectTypeEntry::ObjectTypeEntry(const QString &name, const QVersionNumber &vr) : ComplexTypeEntry(name, ObjectType, vr) { @@ -3484,3 +3603,10 @@ bool ObjectTypeEntry::isNativeIdBased() const { return true; } + +TypeEntry *ObjectTypeEntry::clone() const +{ + return new ObjectTypeEntry(*this); +} + +ObjectTypeEntry::ObjectTypeEntry(const ObjectTypeEntry &) = default; -- cgit v1.2.3