diff options
Diffstat (limited to 'sources/shiboken6/ApiExtractor/typesystem.h')
-rw-r--r-- | sources/shiboken6/ApiExtractor/typesystem.h | 82 |
1 files changed, 29 insertions, 53 deletions
diff --git a/sources/shiboken6/ApiExtractor/typesystem.h b/sources/shiboken6/ApiExtractor/typesystem.h index 186d82675..a2e4debc8 100644 --- a/sources/shiboken6/ApiExtractor/typesystem.h +++ b/sources/shiboken6/ApiExtractor/typesystem.h @@ -4,15 +4,14 @@ #ifndef TYPESYSTEM_H #define TYPESYSTEM_H -#include "typesystem_enums.h" -#include "typesystem_typedefs.h" #include "include.h" +#include "typesystem_typedefs.h" +#include <QtCore/qobjectdefs.h> #include <QtCore/QString> #include <QtCore/QScopedPointer> class AbstractMetaType; -class CustomConversion; class CustomTypeEntry; class PrimitiveTypeEntry; class SourceLocation; @@ -63,17 +62,14 @@ public: Q_ENUM(CodeGeneration) explicit TypeEntry(const QString &entryName, Type t, const QVersionNumber &vr, - const TypeEntry *parent); + const TypeEntryCPtr &parent); virtual ~TypeEntry(); Type type() const; - const TypeEntry *parent() const; - void setParent(const TypeEntry *p); - bool isChildOf(const TypeEntry *p) const; - const TypeSystemTypeEntry *typeSystemTypeEntry() const; - // cf AbstractMetaClass::targetLangEnclosingClass() - const TypeEntry *targetLangEnclosingEntry() const; + TypeEntryCPtr parent() const; + void setParent(const TypeEntryCPtr &); + bool isChildOf(const TypeEntryCPtr &p) const; bool isPrimitive() const; bool isEnum() const; @@ -134,9 +130,9 @@ public: /// be a JNI name, for Python it should represent the CPython type name. /// \return string representing the target language API name /// Currently used only for PrimitiveTypeEntry (attribute "target"). - const CustomTypeEntry *targetLangApiType() const; + CustomTypeEntryCPtr targetLangApiType() const; bool hasTargetLangApiType() const; - void setTargetLangApiType(CustomTypeEntry *cte); + void setTargetLangApiType(const CustomTypeEntryPtr &cte); QString targetLangApiName() const; // The type's name in TargetLang @@ -153,70 +149,32 @@ public: virtual bool isValue() const; virtual bool isComplex() const; - const CodeSnipList &codeSnips() const; - CodeSnipList &codeSnips(); - void setCodeSnips(const CodeSnipList &codeSnips); - void addCodeSnip(const CodeSnip &codeSnip); - - void setDocModification(const DocModificationList& docMods); - DocModificationList docModifications() const; - const IncludeList &extraIncludes() const; void setExtraIncludes(const IncludeList &includes); void addExtraInclude(const Include &newInclude); - /// Extra includes for function arguments determined by the meta builder. - const IncludeList &argumentIncludes() const; - void addArgumentInclude(const Include &newInclude); - Include include() const; void setInclude(const Include &inc); - // FIXME PYSIDE7: Remove - /// Set the target type conversion rule - void setTargetConversionRule(const QString& conversionRule); - - /// Returns the target type conversion rule - QString targetConversionRule() const; - QVersionNumber version() const; - /// TODO-CONVERTER: mark as deprecated - bool hasTargetConversionRule() const; - - bool isCppPrimitive() const; - - bool hasCustomConversion() const; - void setCustomConversion(CustomConversion* customConversion); - CustomConversion* customConversion() const; - // View on: Type to use for function argument conversion, fex // std::string_view -> std::string for foo(std::string_view). // cf AbstractMetaType::viewOn() - TypeEntry *viewOn() const; - void setViewOn(TypeEntry *v); + TypeEntryPtr viewOn() const; + void setViewOn(const TypeEntryPtr &v); virtual TypeEntry *clone() const; - void useAsTypedef(const TypeEntry *source); + void useAsTypedef(const TypeEntryCPtr &source); 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; /// Returns true if the type passed has a Python wrapper for it. /// Although namespace has a Python wrapper, it's not considered a type. bool isWrapperType() const; - /// Returns true if the type is a C++ integral primitive, - /// i.e. bool, char, int, long, and their unsigned counterparts. - bool isCppIntegralPrimitive() const; - /// Returns true if the type is an extended C++ primitive, a void*, - /// a const char*, or a std::string (cf isCppPrimitive()). - bool isExtendedCppPrimitive() const; #ifndef QT_NO_DEBUG_STREAM virtual void formatDebug(QDebug &d) const; @@ -236,4 +194,22 @@ private: QScopedPointer<TypeEntryPrivate> m_d; }; +TypeSystemTypeEntryCPtr typeSystemTypeEntry(TypeEntryCPtr e); + +// cf AbstractMetaClass::targetLangEnclosingClass() +TypeEntryCPtr targetLangEnclosingEntry(const TypeEntryCPtr &e); + +bool isCppPrimitive(const TypeEntryCPtr &e); + +/// Returns true if the type is a primitive but not a C++ primitive. +bool isUserPrimitive(const TypeEntryCPtr &e); + +/// Returns true if the type is a C++ integral primitive, +/// i.e. bool, char, int, long, and their unsigned counterparts. +bool isCppIntegralPrimitive(const TypeEntryCPtr &e); + +/// Returns true if the type is an extended C++ primitive, a void*, +/// a const char*, or a std::string (cf isCppPrimitive()). +bool isExtendedCppPrimitive(const TypeEntryCPtr &e); + #endif // TYPESYSTEM_H |