aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libsmart/smart.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2025-12-10 09:09:14 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2025-12-19 18:40:11 +0100
commitd237738f8f1e01c27f433e63d38c1166e3299dad (patch)
tree4d36c7a4c3a25556a02620fe94780be8dcb08476 /sources/shiboken6/tests/libsmart/smart.cpp
parent73b36dd9c5c8275fdb3cb2b4bfb365968f520e5c (diff)
shiboken6: Add an option to convert null smart pointers to NoneHEADdev
Introduce a type system attribute that specifies whether a null smart pointer is converted to None. Introduce an enumeration on the type entry that can be later used to make std::optional transparent. Fixes: PYSIDE-3253 Task-number: PYSIDE-3107 Change-Id: If1e16fde8adef0c5941bacdcfe8eb8a53561e85d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/tests/libsmart/smart.cpp')
-rw-r--r--sources/shiboken6/tests/libsmart/smart.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/sources/shiboken6/tests/libsmart/smart.cpp b/sources/shiboken6/tests/libsmart/smart.cpp
index 2273040f9..6dd4c3c6b 100644
--- a/sources/shiboken6/tests/libsmart/smart.cpp
+++ b/sources/shiboken6/tests/libsmart/smart.cpp
@@ -147,6 +147,18 @@ SharedPtr<const Integer> Obj::createSharedPtrConstInteger()
return co;
}
+SharedPtr2<Integer> Obj::createNullSharedPtr2Integer()
+{
+ return {};
+}
+
+SharedPtr2<Integer> Obj::createSharedPtr2Integer(int value)
+{
+ auto *i = new Integer;
+ i->setValue(value);
+ return SharedPtr2<Integer>(i);
+}
+
int Obj::takeSharedPtrToConstInteger(SharedPtr<const Integer> pInt)
{
return pInt->m_int;