aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/generator/shiboken/shibokengenerator.h
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/generator/shiboken/shibokengenerator.h')
-rw-r--r--sources/shiboken6/generator/shiboken/shibokengenerator.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.h b/sources/shiboken6/generator/shiboken/shibokengenerator.h
index 7febd1c0e..ade6e2d56 100644
--- a/sources/shiboken6/generator/shiboken/shibokengenerator.h
+++ b/sources/shiboken6/generator/shiboken/shibokengenerator.h
@@ -14,6 +14,7 @@
#include <QtCore/QRegularExpression>
#include <array>
+#include <optional>
class EnumTypeEntry;
class FlagsTypeEntry;
@@ -28,6 +29,15 @@ struct ShibokenGeneratorOptions;
QT_FORWARD_DECLARE_CLASS(TextStream)
+// Function to be used for implementing nb_bool
+struct BoolCastFunction
+{
+ AbstractMetaFunctionCPtr function;
+ bool invert = false; // Function is "isNull()", (invert result).
+};
+
+using BoolCastFunctionOptional = std::optional<BoolCastFunction>;
+
/**
* Abstract generator that contains common methods used in CppGenerator and HeaderGenerator.
*/
@@ -98,6 +108,8 @@ protected:
static QList<AbstractMetaFunctionCList>
numberProtocolOperators(const AbstractMetaClassCPtr &scope);
+ static BoolCastFunctionOptional boolCast(const AbstractMetaClassCPtr &scope);
+
/**
* Returns all different inherited overloads of func, and includes func as well.
* The function can be called multiple times without duplication.
@@ -352,6 +364,7 @@ private:
static FunctionGroups getFunctionGroupsImpl(const AbstractMetaClassCPtr &scope);
static QList<AbstractMetaFunctionCList>
getNumberProtocolOperators(const AbstractMetaClassCPtr &metaClass);
+ static BoolCastFunctionOptional getBoolCast(const AbstractMetaClassCPtr &metaClass);
static bool classNeedsGetattroFunctionImpl(const AbstractMetaClassCPtr &metaClass);
QString translateTypeForWrapperMethod(const AbstractMetaType &cType,