diff options
Diffstat (limited to 'sources/shiboken2/ApiExtractor/abstractmetalang.h')
-rw-r--r-- | sources/shiboken2/ApiExtractor/abstractmetalang.h | 99 |
1 files changed, 71 insertions, 28 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.h b/sources/shiboken2/ApiExtractor/abstractmetalang.h index d1a0fbf88..aaefa32d5 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetalang.h +++ b/sources/shiboken2/ApiExtractor/abstractmetalang.h @@ -288,6 +288,7 @@ class AbstractMetaType { Q_GADGET public: + typedef QVector<Indirection> Indirections; enum TypeUsagePattern { InvalidPattern, @@ -436,6 +437,9 @@ public: m_constant = constant; } + bool isVolatile() const { return m_volatile; } + void setVolatile(bool v) { m_volatile = v; } + bool isConstRef() const; ReferenceType referenceType() const { return m_referenceType; } @@ -443,16 +447,21 @@ public: int actualIndirections() const { - return m_indirections + (m_referenceType == LValueReference ? 1 : 0); - } - int indirections() const - { - return m_indirections; + return m_indirections.size() + (m_referenceType == LValueReference ? 1 : 0); } + + Indirections indirectionsV() const { return m_indirections; } + void setIndirectionsV(const Indirections &i) { m_indirections = i; } + void clearIndirections() { m_indirections.clear(); } + + // "Legacy"? + int indirections() const { return m_indirections.size(); } void setIndirections(int indirections) { - m_indirections = indirections; + m_indirections = Indirections(indirections, Indirection::Pointer); } + void addIndirection(Indirection i = Indirection::Pointer) + { m_indirections.append(i); } void setArrayElementCount(int n) { @@ -527,6 +536,8 @@ public: bool hasTemplateChildren() const; + bool equals(const AbstractMetaType &rhs) const; + private: TypeUsagePattern determineUsagePattern() const; QString formatSignature(bool minimal) const; @@ -541,18 +552,25 @@ private: int m_arrayElementCount = -1; const AbstractMetaType *m_arrayElementType = nullptr; const AbstractMetaType *m_originalTemplateType = nullptr; + Indirections m_indirections; TypeUsagePattern m_pattern = InvalidPattern; uint m_constant : 1; + uint m_volatile : 1; uint m_cppInstantiation : 1; - int m_indirections : 4; - uint m_reserved : 26; // unused + uint m_reserved : 29; // unused + ReferenceType m_referenceType = NoReference; AbstractMetaTypeList m_children; Q_DISABLE_COPY(AbstractMetaType) }; +inline bool operator==(const AbstractMetaType &t1, const AbstractMetaType &t2) +{ return t1.equals(t2); } +inline bool operator!=(const AbstractMetaType &t1, const AbstractMetaType &t2) +{ return !t1.equals(t2); } + #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug d, const AbstractMetaType *at); #endif @@ -650,6 +668,13 @@ public: m_originalExpression = expr; } + bool hasDefaultValueExpression() const + { return !m_originalExpression.isEmpty() || !m_expression.isEmpty(); } + bool hasUnmodifiedDefaultValueExpression() const + { return !m_originalExpression.isEmpty() && m_originalExpression == m_expression; } + bool hasModifiedDefaultValueExpression() const + { return !m_expression.isEmpty() && m_originalExpression != m_expression; } + QString toString() const { return type()->name() + QLatin1Char(' ') + AbstractMetaVariable::name() + @@ -709,6 +734,9 @@ public: AbstractMetaField *copy() const; + static AbstractMetaField * + find(const AbstractMetaFieldList &haystack, const QString &needle); + private: mutable AbstractMetaFunction *m_getter = nullptr; mutable AbstractMetaFunction *m_setter = nullptr; @@ -816,13 +844,20 @@ public: return m_explicit; } - static bool isConversionOperator(QString funcName); + static bool isConversionOperator(const QString& funcName); + + ExceptionSpecification exceptionSpecification() const; + void setExceptionSpecification(ExceptionSpecification e); + + bool generateExceptionHandling() const { return m_generateExceptionHandling; } + void setGenerateExceptionHandling(bool g) { m_generateExceptionHandling = g; } + bool isConversionOperator() const { return isConversionOperator(originalName()); } - static bool isOperatorOverload(QString funcName); + static bool isOperatorOverload(const QString& funcName); bool isOperatorOverload() const { return isOperatorOverload(originalName()); @@ -1000,9 +1035,8 @@ public: // Returns the ownership rules for the given argument in the given context TypeSystem::Ownership ownership(const AbstractMetaClass *cls, TypeSystem::Language language, int idx) const; - bool isVirtualSlot() const; - QString typeReplaced(int argument_index) const; + bool isModifiedToArray(int argumentIndex) const; bool isRemovedFromAllLanguages(const AbstractMetaClass *) const; bool isRemovedFrom(const AbstractMetaClass *, TypeSystem::Language language) const; bool argumentRemoved(int) const; @@ -1057,11 +1091,16 @@ public: bool isCallOperator() const; + static AbstractMetaFunction * + find(const AbstractMetaFunctionList &haystack, const QString &needle); + #ifndef QT_NO_DEBUG_STREAM void formatDebugVerbose(QDebug &d) const; #endif private: + bool autoDetectAllowThread() const; + QString m_name; QString m_originalName; mutable QString m_cachedMinimalSignature; @@ -1082,6 +1121,9 @@ private: uint m_explicit : 1; uint m_pointerOperator : 1; uint m_isCallOperator : 1; + uint m_generateExceptionHandling: 1; + mutable int m_cachedAllowThread = -1; + ExceptionSpecification m_exceptionSpecification = ExceptionSpecification::Unknown; }; Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractMetaFunction::CompareResult) @@ -1246,7 +1288,8 @@ public: VirtualInCppFunctions = 0x0020000, // Only functions that are virtual in C++ VirtualInTargetLangFunctions = 0x0080000, // Only functions which are virtual in TargetLang NotRemovedFromTargetLang = 0x0400000, // Only functions that have not been removed from TargetLang - OperatorOverloads = 0x2000000 // Only functions that are operator overloads + OperatorOverloads = 0x2000000, // Only functions that are operator overloads + GenerateExceptionHandling = 0x4000000 }; Q_DECLARE_FLAGS(FunctionQueryOptions, FunctionQueryOption) Q_FLAG(FunctionQueryOption) @@ -1286,7 +1329,8 @@ public: bool hasSignal(const AbstractMetaFunction *f) const; bool hasConstructors() const; - bool hasCopyConstructor() const; + const AbstractMetaFunction *copyConstructor() const; + bool hasCopyConstructor() const { return copyConstructor() != nullptr; } bool hasPrivateCopyConstructor() const; void addDefaultConstructor(); @@ -1347,10 +1391,18 @@ public: return (hasNonPrivateConstructor() || !hasPrivateConstructor()) && !hasPrivateDestructor(); } + bool generateExceptionHandling() const; + AbstractMetaFunctionList queryFunctionsByName(const QString &name) const; + static bool queryFunction(const AbstractMetaFunction *f, FunctionQueryOptions query); + static AbstractMetaFunctionList queryFunctionList(const AbstractMetaFunctionList &list, + FunctionQueryOptions query); + static const AbstractMetaFunction *queryFirstFunction(const AbstractMetaFunctionList &list, + FunctionQueryOptions query); + AbstractMetaFunctionList queryFunctions(FunctionQueryOptions query) const; AbstractMetaFunctionList functionsInTargetLang() const; - inline AbstractMetaFunctionList cppSignalFunctions() const; + AbstractMetaFunctionList cppSignalFunctions() const; AbstractMetaFunctionList implicitConversions() const; /** @@ -1383,6 +1435,8 @@ public: m_fields << field; } + AbstractMetaField *findField(const QString &name) const; + AbstractMetaEnumList enums() const { return m_enums; @@ -1478,11 +1532,6 @@ public: m_forceShellClass = on; } - bool hasVirtualSlots() const - { - return m_hasVirtualSlots; - } - /** * Says if the class that declares or inherits a virtual function. * \return true if the class implements or inherits any virtual methods @@ -1650,6 +1699,8 @@ public: return m_hasToStringCapability; } + bool deleteInMainThread() const; + static AbstractMetaClass *findClass(const AbstractMetaClassList &classes, const QString &name); static AbstractMetaClass *findClass(const AbstractMetaClassList &classes, @@ -1666,7 +1717,6 @@ private: uint m_hasVirtuals : 1; uint m_isPolymorphic : 1; uint m_hasNonpublic : 1; - uint m_hasVirtualSlots : 1; uint m_hasNonPrivateConstructor : 1; uint m_hasPrivateConstructor : 1; uint m_functionsFixed : 1; @@ -1784,11 +1834,4 @@ private: int m_index = -1; }; -inline AbstractMetaFunctionList AbstractMetaClass::cppSignalFunctions() const -{ - return queryFunctions(Signals - | Visible - | NotRemovedFromTargetLang); -} - #endif // ABSTRACTMETALANG_H |