diff options
Diffstat (limited to 'sources/shiboken6/tests/libsmart')
-rw-r--r-- | sources/shiboken6/tests/libsmart/smart.cpp | 14 | ||||
-rw-r--r-- | sources/shiboken6/tests/libsmart/smart_obj.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/sources/shiboken6/tests/libsmart/smart.cpp b/sources/shiboken6/tests/libsmart/smart.cpp index f5d318e59..f33d2f835 100644 --- a/sources/shiboken6/tests/libsmart/smart.cpp +++ b/sources/shiboken6/tests/libsmart/smart.cpp @@ -133,6 +133,20 @@ int Obj::takeSharedPtrToObj(SharedPtr<Obj> pObj) int Obj::takeSharedPtrToInteger(SharedPtr<Integer> pInt) { + if (pInt.isNull()) { + std::cout << "SharedPtr<Integer>(nullptr) passed!\n"; + return -1; + } + pInt->printInteger(); + return pInt->value(); +} + +int Obj::takeSharedPtrToIntegerByConstRef(const SharedPtr<Integer> &pInt) +{ + if (pInt.isNull()) { + std::cout << "SharedPtr<Integer>(nullptr) passed!\n"; + return -1; + } pInt->printInteger(); return pInt->value(); } diff --git a/sources/shiboken6/tests/libsmart/smart_obj.h b/sources/shiboken6/tests/libsmart/smart_obj.h index 579f3db4a..58611815c 100644 --- a/sources/shiboken6/tests/libsmart/smart_obj.h +++ b/sources/shiboken6/tests/libsmart/smart_obj.h @@ -54,6 +54,7 @@ public: SharedPtr<Smart::Integer2> giveSharedPtrToInteger2(); int takeSharedPtrToObj(SharedPtr<Obj> pObj); int takeSharedPtrToInteger(SharedPtr<Integer> pInt); + int takeSharedPtrToIntegerByConstRef(const SharedPtr<Integer> &pInt); static SharedPtr<Integer> createSharedPtrToInteger(int value); static SharedPtr<Integer> createNullSharedPtrToInteger(); |