From b550b4feb7b6009c1a9d18a604a16844bb9afbc0 Mon Sep 17 00:00:00 2001 From: Tilman Roeder Date: Mon, 23 Jul 2018 14:19:25 +0200 Subject: Expose Shiboken generated Python module object This change exposes the module object (a PyObject*) to the global namespace as Sbk[TYPESYSTEM NAME]ModuleObject. This is useful when generating bindings for cases where Python will run embedded into a host application. This variable is also included in the headers, where it is declared as `extern PyObject* Sbk[TYPESYSTEM NAME]ModuleObject;` for the convenience of developers reading the generated sources. Change-Id: Iaaa38b66b5d3aabc0fb8f995f964cd7aef2a11da Reviewed-by: Friedemann Kleint --- sources/shiboken2/generator/shiboken2/shibokengenerator.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sources/shiboken2/generator/shiboken2/shibokengenerator.h') diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.h b/sources/shiboken2/generator/shiboken2/shibokengenerator.h index ed8f1bbfb..d2ae55926 100644 --- a/sources/shiboken2/generator/shiboken2/shibokengenerator.h +++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.h @@ -428,6 +428,7 @@ public: /// Returns true if the generated code should use the "#define protected public" hack. bool avoidProtectedHack() const; QString cppApiVariableName(const QString& moduleName = QString()) const; + QString pythonModuleObjectName(const QString& moduleName = QString()) const; QString convertersVariableName(const QString& moduleName = QString()) const; /** * Returns the type index variable name for a given class. If \p alternativeTemplateName is true @@ -501,6 +502,9 @@ protected: /// Returns a list of converters for the non wrapper types of the current module. QVector getPrimitiveCustomConversions(); + /// Return a prefix with '_' suitable for names in C++ + QString moduleCppPrefix(const QString& moduleName = QString()) const; + /// Returns true if the Python wrapper for the received OverloadData must accept a list of arguments. static bool pythonFunctionWrapperUsesListOfArguments(const OverloadData& overloadData); -- cgit v1.2.3