aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/abstractmetalang.h
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/ApiExtractor/abstractmetalang.h')
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.h81
1 files changed, 28 insertions, 53 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.h b/sources/shiboken2/ApiExtractor/abstractmetalang.h
index 166e7d0cb..00f137100 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang.h
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang.h
@@ -538,7 +538,7 @@ public:
private:
TypeUsagePattern determineUsagePattern() const;
QString formatSignature(bool minimal) const;
- QString formatPythonSignature(bool minimal) const;
+ QString formatPythonSignature() const;
const TypeEntry *m_typeEntry = nullptr;
AbstractMetaTypeList m_instantiations;
@@ -704,25 +704,26 @@ private:
friend class AbstractMetaClass;
};
+class EnclosingClassMixin {
+public:
+ const AbstractMetaClass *enclosingClass() const { return m_enclosingClass; }
+ void setEnclosingClass(const AbstractMetaClass *cls) { m_enclosingClass = cls; }
+ const AbstractMetaClass *targetLangEnclosingClass() const;
+
+private:
+ const AbstractMetaClass *m_enclosingClass = nullptr;
+};
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const AbstractMetaArgument *aa);
#endif
-class AbstractMetaField : public AbstractMetaVariable, public AbstractMetaAttributes
+class AbstractMetaField : public AbstractMetaVariable, public AbstractMetaAttributes, public EnclosingClassMixin
{
public:
AbstractMetaField();
~AbstractMetaField();
- const AbstractMetaClass *enclosingClass() const
- {
- return m_class;
- }
- void setEnclosingClass(const AbstractMetaClass *cls)
- {
- m_class = cls;
- }
-
const AbstractMetaFunction *getter() const;
const AbstractMetaFunction *setter() const;
@@ -741,7 +742,6 @@ public:
private:
mutable AbstractMetaFunction *m_getter = nullptr;
mutable AbstractMetaFunction *m_setter = nullptr;
- const AbstractMetaClass *m_class = nullptr;
};
#ifndef QT_NO_DEBUG_STREAM
@@ -763,7 +763,9 @@ public:
SignalFunction,
EmptyFunction,
SlotFunction,
- GlobalScopeFunction
+ GlobalScopeFunction,
+ GetAttroFunction,
+ SetAttroFunction
};
Q_ENUM(FunctionType)
@@ -1179,7 +1181,7 @@ private:
Documentation m_doc;
};
-class AbstractMetaEnum : public AbstractMetaAttributes
+class AbstractMetaEnum : public AbstractMetaAttributes, public EnclosingClassMixin
{
public:
AbstractMetaEnum();
@@ -1234,23 +1236,12 @@ public:
m_typeEntry = entry;
}
- AbstractMetaClass *enclosingClass() const
- {
- return m_class;
- }
-
- void setEnclosingClass(AbstractMetaClass *c)
- {
- m_class = c;
- }
-
bool isSigned() const { return m_signed; }
void setSigned(bool s) { m_signed = s; }
private:
AbstractMetaEnumValueList m_enumValues;
EnumTypeEntry *m_typeEntry = nullptr;
- AbstractMetaClass *m_class = nullptr;
EnumKind m_enumKind = CEnum;
uint m_hasQenumsDeclaration : 1;
@@ -1261,7 +1252,7 @@ private:
QDebug operator<<(QDebug d, const AbstractMetaEnum *ae);
#endif
-class AbstractMetaClass : public AbstractMetaAttributes
+class AbstractMetaClass : public AbstractMetaAttributes, public EnclosingClassMixin
{
Q_GADGET
public:
@@ -1282,7 +1273,9 @@ public:
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
- GenerateExceptionHandling = 0x4000000
+ GenerateExceptionHandling = 0x4000000,
+ GetAttroFunction = 0x8000000,
+ SetAttroFunction = 0x10000000
};
Q_DECLARE_FLAGS(FunctionQueryOptions, FunctionQueryOption)
Q_FLAG(FunctionQueryOption)
@@ -1306,7 +1299,6 @@ public:
AbstractMetaClass();
~AbstractMetaClass();
- AbstractMetaClass *extractInterface();
void fixFunctions();
AbstractMetaFunctionList functions() const
@@ -1444,13 +1436,6 @@ public:
AbstractMetaEnum *findEnum(const QString &enumName);
AbstractMetaEnumValue *findEnumValue(const QString &enumName);
- AbstractMetaClassList interfaces() const
- {
- return m_interfaces;
- }
- void addInterface(AbstractMetaClass *interface);
- void setInterfaces(const AbstractMetaClassList &interface);
-
QString fullName() const
{
return package() + QLatin1Char('.') + name();
@@ -1464,32 +1449,24 @@ public:
QString baseClassName() const
{
- return m_baseClass ? m_baseClass->name() : QString();
+ return m_baseClasses.isEmpty() ? QString() : m_baseClasses.constFirst()->name();
}
AbstractMetaClass *baseClass() const
{
- return m_baseClass;
+ return m_baseClasses.value(0, nullptr);
}
+ const AbstractMetaClassList &baseClasses() const { return m_baseClasses; }
+ void addBaseClass(AbstractMetaClass *base_class);
void setBaseClass(AbstractMetaClass *base_class);
- const AbstractMetaClass *enclosingClass() const
- {
- return m_enclosingClass;
- }
-
/**
* \return the namespace from another package which this namespace extends.
*/
AbstractMetaClass *extendedNamespace() const { return m_extendedNamespace; }
void setExtendedNamespace(AbstractMetaClass *e) { m_extendedNamespace = e; }
- void setEnclosingClass(AbstractMetaClass *cl)
- {
- m_enclosingClass = cl;
- }
-
const AbstractMetaClassList& innerClasses() const
{
return m_innerClasses;
@@ -1507,8 +1484,6 @@ public:
QString package() const;
- bool isInterface() const;
-
bool isNamespace() const;
bool isQObject() const;
@@ -1709,6 +1684,8 @@ public:
private:
#ifndef QT_NO_DEBUG_STREAM
+ void format(QDebug &d) const;
+ void formatMembers(QDebug &d) const;
friend QDebug operator<<(QDebug d, const AbstractMetaClass *ac);
#endif
uint m_hasVirtuals : 1;
@@ -1727,21 +1704,19 @@ private:
uint m_hasToStringCapability : 1;
const AbstractMetaClass *m_enclosingClass = nullptr;
- AbstractMetaClass *m_baseClass = nullptr;
+ AbstractMetaClassList m_baseClasses; // Real base classes after setting up inheritance
AbstractMetaClass *m_extendedNamespace = nullptr;
const AbstractMetaClass *m_templateBaseClass = nullptr;
AbstractMetaFunctionList m_functions;
AbstractMetaFieldList m_fields;
AbstractMetaEnumList m_enums;
- AbstractMetaClassList m_interfaces;
- AbstractMetaClass *m_extractedInterface = nullptr;
QVector<QPropertySpec *> m_propertySpecs;
AbstractMetaClassList m_innerClasses;
AbstractMetaFunctionList m_externalConversionOperators;
- QStringList m_baseClassNames;
+ QStringList m_baseClassNames; // Base class names from C++, including rejected
QVector<TypeEntry *> m_templateArgs;
ComplexTypeEntry *m_typeEntry = nullptr;
// FunctionModelItem m_qDebugStreamFunction;