diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-09-21 20:38:35 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-09-22 09:55:14 +0200 |
commit | d50cf744b8de18d9b3756712cdd07f270512fa91 (patch) | |
tree | 33a8b03b9417ec20d1a1e602bdb6f3cb548a2d42 /sources/shiboken6/ApiExtractor/typesystem.h | |
parent | 01a8e9f30d4396378e97a31e4b6d2ee489cb0ac9 (diff) |
shiboken6: Refactor PrimitiveTypeEntry::basicReferencedTypeEntry()
Change it to always return "this" or the referenced type and add
another getter referencesType() to check whether it actually
references another entry.
Also add another convenience function TypeEntry::asPrimitive().
This saves a lot of if's.
Also remove
ShibokenGenerator::pythonPrimitiveTypeName(PrimitiveTypeEntry *).
Task-number: PYSIDE-1660
Change-Id: I7b3c2f32e67d64176bf0b9f11a2c4dea2d6273ba
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/typesystem.h')
-rw-r--r-- | sources/shiboken6/ApiExtractor/typesystem.h | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/sources/shiboken6/ApiExtractor/typesystem.h b/sources/shiboken6/ApiExtractor/typesystem.h index f6a00cab5..38b8c0143 100644 --- a/sources/shiboken6/ApiExtractor/typesystem.h +++ b/sources/shiboken6/ApiExtractor/typesystem.h @@ -41,6 +41,7 @@ class CustomConversion; class EnumValueTypeEntry; class FlagsTypeEntry; class SourceLocation; +class PrimitiveTypeEntry; class TypeSystemTypeEntry; class TypeEntryPrivate; @@ -251,6 +252,8 @@ public: SourceLocation sourceLocation() const; void setSourceLocation(const SourceLocation &sourceLocation); + const PrimitiveTypeEntry *asPrimitive() const; + // Query functions for generators /// Returns true if the type is a primitive but not a C++ primitive. bool isUserPrimitive() const; @@ -380,24 +383,25 @@ public: /** * The PrimitiveTypeEntry pointed by this type entry if it * represents a typedef). - * /return the type referenced by the typedef, or a null pointer + * \return the type referenced by the typedef, or a null pointer * if the current object is not an typedef */ PrimitiveTypeEntry *referencedTypeEntry() const; /** * Defines type referenced by this entry. - * /param referencedTypeEntry type referenced by this entry + * \param referencedTypeEntry type referenced by this entry */ void setReferencedTypeEntry(PrimitiveTypeEntry* referencedTypeEntry); - /** - * Finds the most basic primitive type that the typedef represents, - * i.e. a type that is not an typedef'ed. - * /return the most basic non-typedef'ed primitive type represented - * by this typedef - */ - PrimitiveTypeEntry* basicReferencedTypeEntry() const; + /// Finds the most basic primitive type that the typedef represents, + /// i.e. a type that is not an typedef'ed. + /// \return the most basic non-typedef'ed primitive type represented + /// by this typedef or self in case it is not a reference. + const PrimitiveTypeEntry* basicReferencedTypeEntry() const; + + /// Returns whether this entry references another entry. + bool referencesType() const; bool preferredTargetLangType() const; void setPreferredTargetLangType(bool b); |