aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator/shiboken2/shibokengenerator.h
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/generator/shiboken2/shibokengenerator.h')
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.h25
1 files changed, 17 insertions, 8 deletions
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.h b/sources/shiboken2/generator/shiboken2/shibokengenerator.h
index 24c1374ae..d8259d245 100644
--- a/sources/shiboken2/generator/shiboken2/shibokengenerator.h
+++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.h
@@ -69,10 +69,12 @@ public:
None = 0x0,
GetattroOverloads = 0x01,
GetattroSmartPointer = 0x02,
+ GetattroUser = 0x04, // Injected code
GetattroMask = 0x0F,
SetattroQObject = 0x10,
SetattroSmartPointer = 0x20,
SetattroMethodOverride = 0x40,
+ SetattroUser = 0x80, // Injected code
SetattroMask = 0xF0,
};
Q_DECLARE_FLAGS(AttroCheck, AttroCheckFlag);
@@ -105,6 +107,8 @@ protected:
const AbstractMetaFunction *func,
Options options = NoOption) const override;
+ GeneratorContext contextForClass(const AbstractMetaClass *c) const override;
+
/**
* Returns a map with all functions grouped, the function name is used as key.
* Example of return value: { "foo" -> ["foo(int)", "foo(int, long)], "bar" -> "bar(double)"}
@@ -122,11 +126,15 @@ protected:
AbstractMetaFunctionList getFunctionAndInheritedOverloads(const AbstractMetaFunction *func, QSet<QString> *seen);
/// Write user's custom code snippets at class or module level.
+ void writeClassCodeSnips(QTextStream &s,
+ const QVector<CodeSnip> & codeSnips,
+ TypeSystem::CodeSnipPosition position,
+ TypeSystem::Language language,
+ const GeneratorContext &context);
void writeCodeSnips(QTextStream &s,
const QVector<CodeSnip> & codeSnips,
TypeSystem::CodeSnipPosition position,
- TypeSystem::Language language,
- const AbstractMetaClass *context = nullptr);
+ TypeSystem::Language language);
/// Write user's custom code snippets at function level.
void writeCodeSnips(QTextStream &s,
const QVector<CodeSnip> & codeSnips,
@@ -136,7 +144,8 @@ protected:
const AbstractMetaArgument *lastArg = nullptr);
/// Replaces variables for the user's custom code at global or class level.
- void processCodeSnip(QString &code, const AbstractMetaClass *context = nullptr);
+ void processCodeSnip(QString &code);
+ void processClassCodeSnip(QString &code, const GeneratorContext &context);
/**
* Verifies if any of the function's code injections of the "native"
@@ -153,7 +162,8 @@ protected:
* \param func the function to check
* \return true if the function's code snippets call the wrapped C++ function
*/
- bool injectedCodeCallsCppFunction(const AbstractMetaFunction *func);
+ bool injectedCodeCallsCppFunction(const GeneratorContext &context,
+ const AbstractMetaFunction *func);
/**
* Verifies if any of the function's code injections of the "native" class makes a
@@ -219,16 +229,14 @@ protected:
/// Adds enums eligible for generation from classes/namespaces marked not to be generated.
static void lookForEnumsInClassesNotToBeGenerated(AbstractMetaEnumList &enumList, const AbstractMetaClass *metaClass);
- /// Returns the enclosing class for an enum, or nullptr if it should be global.
- const AbstractMetaClass *getProperEnclosingClassForEnum(const AbstractMetaEnum *metaEnum);
QString wrapperName(const AbstractMetaClass *metaClass) const;
- QString wrapperName(const AbstractMetaType *metaType) const;
- QString wrapperName(const TypeEntry *type) const;
QString fullPythonClassName(const AbstractMetaClass *metaClass);
QString fullPythonFunctionName(const AbstractMetaFunction *func);
+ bool wrapperDiagnostics() const { return m_wrapperDiagnostics; }
+
static QString protectedEnumSurrogateName(const AbstractMetaEnum *metaEnum);
static QString protectedFieldGetterName(const AbstractMetaField *field);
static QString protectedFieldSetterName(const AbstractMetaField *field);
@@ -550,6 +558,7 @@ private:
bool m_verboseErrorMessagesDisabled = false;
bool m_useIsNullAsNbNonZero = false;
bool m_avoidProtectedHack = false;
+ bool m_wrapperDiagnostics = false;
using AbstractMetaTypeCache = QHash<QString, AbstractMetaType *>;
AbstractMetaTypeCache m_metaTypeFromStringCache;