diff options
Diffstat (limited to 'sources/shiboken6/tests/libminimal')
-rw-r--r-- | sources/shiboken6/tests/libminimal/CMakeLists.txt | 21 | ||||
-rw-r--r-- | sources/shiboken6/tests/libminimal/containeruser.cpp | 55 | ||||
-rw-r--r-- | sources/shiboken6/tests/libminimal/containeruser.h | 36 | ||||
-rw-r--r-- | sources/shiboken6/tests/libminimal/libminimalmacros.h | 49 | ||||
-rw-r--r-- | sources/shiboken6/tests/libminimal/listuser.cpp | 133 | ||||
-rw-r--r-- | sources/shiboken6/tests/libminimal/listuser.h | 72 | ||||
-rw-r--r-- | sources/shiboken6/tests/libminimal/minbool.h | 48 | ||||
-rw-r--r-- | sources/shiboken6/tests/libminimal/obj.cpp | 16 | ||||
-rw-r--r-- | sources/shiboken6/tests/libminimal/obj.h | 34 | ||||
-rw-r--r-- | sources/shiboken6/tests/libminimal/spanuser.cpp | 58 | ||||
-rw-r--r-- | sources/shiboken6/tests/libminimal/spanuser.h | 35 | ||||
-rw-r--r-- | sources/shiboken6/tests/libminimal/typedef.cpp | 50 | ||||
-rw-r--r-- | sources/shiboken6/tests/libminimal/typedef.h | 29 | ||||
-rw-r--r-- | sources/shiboken6/tests/libminimal/val.h | 36 |
14 files changed, 672 insertions, 0 deletions
diff --git a/sources/shiboken6/tests/libminimal/CMakeLists.txt b/sources/shiboken6/tests/libminimal/CMakeLists.txt new file mode 100644 index 000000000..4a10f96bf --- /dev/null +++ b/sources/shiboken6/tests/libminimal/CMakeLists.txt @@ -0,0 +1,21 @@ +# Copyright (C) 2023 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +project(libminimal) + +set(libminimal_SRC +containeruser.cpp containeruser.h +libminimalmacros.h +listuser.cpp listuser.h +minbool.h +obj.cpp obj.h +spanuser.cpp spanuser.h +typedef.cpp typedef.h +val.h +) + +add_library(libminimal SHARED ${libminimal_SRC}) +target_include_directories(libminimal PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_compile_definitions(libminimal PRIVATE LIBMINIMAL_BUILD) +set_property(TARGET libminimal PROPERTY PREFIX "") + diff --git a/sources/shiboken6/tests/libminimal/containeruser.cpp b/sources/shiboken6/tests/libminimal/containeruser.cpp new file mode 100644 index 000000000..29af52aef --- /dev/null +++ b/sources/shiboken6/tests/libminimal/containeruser.cpp @@ -0,0 +1,55 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#include "containeruser.h" + +#include <algorithm> +#include <numeric> + +ContainerUser::ContainerUser() : m_intVector{1, 2, 3}, m_intArray{1, 2, 3} +{ +} + +ContainerUser::~ContainerUser() = default; + +std::vector<int> ContainerUser::createIntVector(int num) +{ + std::vector<int> retval(num); + std::iota(retval.begin(), retval.end(), 0); + return retval; +} + +int ContainerUser::sumIntVector(const std::vector<int> &intVector) +{ + return std::accumulate(intVector.cbegin(), intVector.cend(), 0); +} + +std::vector<int> &ContainerUser::intVector() +{ + return m_intVector; +} + +void ContainerUser::setIntVector(const std::vector<int> &v) +{ + m_intVector = v; +} + +std::array<int, 3> ContainerUser::createIntArray() +{ + return {1, 2, 3}; +} + +int ContainerUser::sumIntArray(const std::array<int, 3> &intArray) +{ + return std::accumulate(intArray.cbegin(), intArray.cend(), 0); +} + +std::array<int, 3> &ContainerUser::intArray() +{ + return m_intArray; +} + +void ContainerUser::setIntArray(const std::array<int, 3> &a) +{ + m_intArray = a; +} diff --git a/sources/shiboken6/tests/libminimal/containeruser.h b/sources/shiboken6/tests/libminimal/containeruser.h new file mode 100644 index 000000000..55e4020ec --- /dev/null +++ b/sources/shiboken6/tests/libminimal/containeruser.h @@ -0,0 +1,36 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#ifndef CONTAINERUSER_H +#define CONTAINERUSER_H + +#include "libminimalmacros.h" + +#include <array> +#include <vector> + +/// Exercise simple, sequential containers. More advanced tests are in ListUser +class LIBMINIMAL_API ContainerUser +{ +public: + ContainerUser(); + ~ContainerUser(); + + static std::vector<int> createIntVector(int num); + static int sumIntVector(const std::vector<int> &intVector); + + std::vector<int> &intVector(); + void setIntVector(const std::vector<int> &); + + static std::array<int, 3> createIntArray(); + static int sumIntArray(const std::array<int, 3> &intArray); + + std::array<int, 3> &intArray(); + void setIntArray(const std::array<int, 3> &); + +private: + std::vector<int> m_intVector; + std::array<int, 3> m_intArray; +}; + +#endif // CONTAINERUSER_H diff --git a/sources/shiboken6/tests/libminimal/libminimalmacros.h b/sources/shiboken6/tests/libminimal/libminimalmacros.h new file mode 100644 index 000000000..099c1f1de --- /dev/null +++ b/sources/shiboken6/tests/libminimal/libminimalmacros.h @@ -0,0 +1,49 @@ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#ifndef LIBMINIMALMACROS_H +#define LIBMINIMALMACROS_H + +#if defined _WIN32 +# define LIBMINIMAL_EXPORT __declspec(dllexport) +# ifdef _MSC_VER +# define LIBMINIMAL_IMPORT __declspec(dllimport) +# else +# define LIBMINIMAL_IMPORT +# endif +#else +# define LIBMINIMAL_EXPORT __attribute__ ((visibility("default"))) +# define LIBMINIMAL_IMPORT +#endif + +#ifdef LIBMINIMAL_BUILD +# define LIBMINIMAL_API LIBMINIMAL_EXPORT +#else +# define LIBMINIMAL_API LIBMINIMAL_IMPORT +#endif + +#define LIBMINIMAL_DEFAULT_COPY(Class) \ + Class(const Class &) noexcept = default; \ + Class &operator=(const Class &) noexcept = default; + +#define LIBMINIMAL_DISABLE_COPY(Class) \ + Class(const Class &) = delete;\ + Class &operator=(const Class &) = delete; + +#define LIBMINIMAL_DEFAULT_MOVE(Class) \ + Class(Class &&) noexcept = default; \ + Class &operator=(Class &&) noexcept = default; + +#define LIBMINIMAL_DEFAULT_COPY_MOVE(Class) \ + LIBMINIMAL_DEFAULT_COPY(Class) \ + LIBMINIMAL_DEFAULT_MOVE(Class) + +#define LIBMINIMAL_DISABLE_MOVE(Class) \ + Class(Class &&) = delete; \ + Class &operator=(Class &&) = delete; + +#define LIBMINIMAL_DISABLE_COPY_MOVE(Class) \ + LIBMINIMAL_DISABLE_COPY(Class) \ + LIBMINIMAL_DISABLE_MOVE(Class) + +#endif // LIBMINIMALMACROS_H diff --git a/sources/shiboken6/tests/libminimal/listuser.cpp b/sources/shiboken6/tests/libminimal/listuser.cpp new file mode 100644 index 000000000..93c399542 --- /dev/null +++ b/sources/shiboken6/tests/libminimal/listuser.cpp @@ -0,0 +1,133 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#include "listuser.h" + +#include <algorithm> +#include <cstdlib> +#include <numeric> + +std::list<int> ListUser::createIntList(int num) +{ + std::list<int> retval(num); + std::iota(retval.begin(), retval.end(), 0); + return retval; +} + +int ListUser::sumIntList(std::list<int> intList) +{ + return std::accumulate(intList.begin(), intList.end(), 0); +} + +int ListUser::sumIntListDefaultParamConstRef(const std::list<int> &intList) +{ + return sumIntList(intList); +} + +int ListUser::sumIntListDefaultParam(std::list<int> intList) +{ + return sumIntList(intList); +} + +std::list<MinBool> ListUser::createMinBoolList(MinBool mb1, MinBool mb2) +{ + std::list<MinBool> retval; + retval.push_back(mb1); + retval.push_back(mb2); + return retval; +} + +MinBool ListUser::oredMinBoolList(std::list<MinBool> minBoolList) +{ + MinBool result(false); + for (const auto &m : minBoolList) + result |= m; + return result; +} + +std::list<Val> ListUser::createValList(int num) +{ + std::list<Val> retval; + for (int i = 0; i < num; ++i) + retval.push_back(Val(i)); + return retval; +} + +int ListUser::sumValList(std::list<Val> valList) +{ + int total = 0; + for (const auto &v : valList) + total += v.valId(); + return total; +} +std::list<Obj*> ListUser::createObjList(Obj* o1, Obj* o2) +{ + std::list<Obj*> retval; + retval.push_back(o1); + retval.push_back(o2); + return retval; +} + +int ListUser::sumObjList(std::list<Obj*> objList) +{ + int total = 0; + for (const auto *obj : objList) + total += obj->objId(); + return total; +} + +std::list<std::list<int> > ListUser::createListOfIntLists(int num) +{ + std::list<std::list<int> > retval; + for (int i = 0; i < num; ++i) + retval.push_back(createIntList(num)); + return retval; +} + +int ListUser::sumListOfIntLists(std::list<std::list<int> > intListList) +{ + int total = 0; + for (const auto &list : intListList) + total += std::accumulate(list.begin(), list.end(), 0); + return total; +} + +void ListUser::setStdIntList(const std::list<int> &l) +{ + m_stdIntList = l; +} + +std::list<int> &ListUser::getIntList() +{ + return m_stdIntList; +} + +const std::list<int> &ListUser::getConstIntList() const +{ + return m_stdIntList; +} + +int ListUser::modifyIntListPtr(std::list<int> *list) const +{ + const int oldSize = int(list->size()); + list->push_back(42); + return oldSize; +} + +std::list<int> *ListUser::returnIntListByPtr() const +{ + return nullptr; +} + +int ListUser::callReturnIntListByPtr() const +{ + auto *list = returnIntListByPtr(); + return list != nullptr ? int(list->size()) : 0; +} + +int ListUser::modifyDoubleListPtr(std::list<double> *list) const +{ + const int oldSize = int(list->size()); + list->push_back(42); + return oldSize; +} diff --git a/sources/shiboken6/tests/libminimal/listuser.h b/sources/shiboken6/tests/libminimal/listuser.h new file mode 100644 index 000000000..9904ef27d --- /dev/null +++ b/sources/shiboken6/tests/libminimal/listuser.h @@ -0,0 +1,72 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#ifndef LISTUSER_H +#define LISTUSER_H + +#include "obj.h" +#include "val.h" +#include "minbool.h" + +#include "libminimalmacros.h" + +#include <list> + +struct LIBMINIMAL_API ListUser +{ + LIBMINIMAL_DEFAULT_COPY(ListUser) + LIBMINIMAL_DISABLE_MOVE(ListUser) + + ListUser() noexcept = default; + virtual ~ListUser() = default; + + // List of C++ primitive type items + virtual std::list<int> createIntList(int num); + std::list<int> callCreateIntList(int num) { return createIntList(num); } + virtual int sumIntList(std::list<int> intList); + int callSumIntList(std::list<int> intList) { return sumIntList(intList); } + + int sumIntListDefaultParamConstRef(const std::list<int> &intList = {1, 2, 3}); + int sumIntListDefaultParam(std::list<int> intList = {1, 2, 3}); + + // List of C++ MinBool objects used as primitives in Python + virtual std::list<MinBool> createMinBoolList(MinBool mb1, MinBool mb2); + std::list<MinBool> callCreateMinBoolList(MinBool mb1, MinBool mb2) { return createMinBoolList(mb1, mb2); } + virtual MinBool oredMinBoolList(std::list<MinBool> minBoolList); + MinBool callOredMinBoolList(std::list<MinBool> minBoolList) { return oredMinBoolList(minBoolList); } + + // List of C++ value types + virtual std::list<Val> createValList(int num); + std::list<Val> callCreateValList(int num) { return createValList(num); } + virtual int sumValList(std::list<Val> valList); + int callSumValList(std::list<Val> valList) { return sumValList(valList); } + + // List of C++ object types + virtual std::list<Obj*> createObjList(Obj* o1, Obj* o2); + std::list<Obj*> callCreateObjList(Obj* o1, Obj* o2) { return createObjList(o1, o2); } + virtual int sumObjList(std::list<Obj*> objList); + int callSumObjList(std::list<Obj*> objList) { return sumObjList(objList); } + + // List of lists of C++ primitive type items + virtual std::list<std::list<int> > createListOfIntLists(int num); + std::list<std::list<int> > callCreateListOfIntLists(int num) { return createListOfIntLists(num); } + virtual int sumListOfIntLists(std::list<std::list<int> > intListList); + int callSumListOfIntLists(std::list<std::list<int> > intListList) { return sumListOfIntLists(intListList); } + + void setStdIntList(const std::list<int> &l); + std::list<int> &getIntList(); + const std::list<int> &getConstIntList() const; + + int modifyIntListPtr(std::list<int> *list) const; + + virtual std::list<int> *returnIntListByPtr() const; + + int callReturnIntListByPtr() const; + + int modifyDoubleListPtr(std::list<double> *list) const; + + std::list<int> m_stdIntList; +}; + +#endif // LISTUSER_H + diff --git a/sources/shiboken6/tests/libminimal/minbool.h b/sources/shiboken6/tests/libminimal/minbool.h new file mode 100644 index 000000000..e460f466b --- /dev/null +++ b/sources/shiboken6/tests/libminimal/minbool.h @@ -0,0 +1,48 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#ifndef MINBOOL_H +#define MINBOOL_H + +#include "libminimalmacros.h" + +class LIBMINIMAL_API MinBool +{ +public: + inline explicit MinBool(bool b) : m_value(b) {} + bool value() const { return m_value; } + inline MinBool operator!() const { return MinBool(!m_value); } + inline MinBool& operator|=(const MinBool& other) { + m_value |= other.m_value; + return *this; + } + +private: + bool m_value; +}; + +inline bool operator==(MinBool b1, bool b2) { return (!b1).value() == !b2; } +inline bool operator==(bool b1, MinBool b2) { return (!b1) == (!b2).value(); } +inline bool operator==(MinBool b1, MinBool b2) { return (!b1).value() == (!b2).value(); } +inline bool operator!=(MinBool b1, bool b2) { return (!b1).value() != !b2; } +inline bool operator!=(bool b1, MinBool b2) { return (!b1) != (!b2).value(); } +inline bool operator!=(MinBool b1, MinBool b2) { return (!b1).value() != (!b2).value(); } + +class LIBMINIMAL_API MinBoolUser +{ +public: + LIBMINIMAL_DEFAULT_COPY(MinBoolUser) + LIBMINIMAL_DISABLE_MOVE(MinBoolUser) + + MinBoolUser() noexcept : m_minbool(MinBool(false)) {} + virtual ~MinBoolUser() = default; + inline MinBool minBool() { return m_minbool; } + inline void setMinBool(MinBool minBool) { m_minbool = minBool; } + virtual MinBool invertedMinBool() { return !m_minbool; } + inline MinBool callInvertedMinBool() { return invertedMinBool(); } + +private: + MinBool m_minbool; +}; + +#endif diff --git a/sources/shiboken6/tests/libminimal/obj.cpp b/sources/shiboken6/tests/libminimal/obj.cpp new file mode 100644 index 000000000..a63a9c3c9 --- /dev/null +++ b/sources/shiboken6/tests/libminimal/obj.cpp @@ -0,0 +1,16 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#include "obj.h" + +Obj::Obj(int objId) noexcept : m_objId(objId) +{ +} + +Obj::~Obj() = default; + +bool Obj::virtualMethod(int val) +{ + return !bool(val%2); +} + diff --git a/sources/shiboken6/tests/libminimal/obj.h b/sources/shiboken6/tests/libminimal/obj.h new file mode 100644 index 000000000..be0bfb52b --- /dev/null +++ b/sources/shiboken6/tests/libminimal/obj.h @@ -0,0 +1,34 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#ifndef OBJ_H +#define OBJ_H + +#include "libminimalmacros.h" + +class LIBMINIMAL_API Obj +{ +public: + LIBMINIMAL_DISABLE_COPY_MOVE(Obj) + + explicit Obj(int objId) noexcept; + virtual ~Obj(); + + int objId() const { return m_objId; } + void setObjId(int objId) { m_objId = objId; } + + virtual bool virtualMethod(int val); + bool callVirtualMethod(int val) { return virtualMethod(val); } + + virtual Obj* passObjectType(Obj* obj) { return obj; } + Obj* callPassObjectType(Obj* obj) { return passObjectType(obj); } + + virtual Obj* passObjectTypeReference(Obj& obj) { return &obj; } + Obj* callPassObjectTypeReference(Obj& obj) { return passObjectTypeReference(obj); } + +private: + int m_objId; +}; + +#endif // OBJ_H + diff --git a/sources/shiboken6/tests/libminimal/spanuser.cpp b/sources/shiboken6/tests/libminimal/spanuser.cpp new file mode 100644 index 000000000..fea9cd68e --- /dev/null +++ b/sources/shiboken6/tests/libminimal/spanuser.cpp @@ -0,0 +1,58 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#include "spanuser.h" + +#include <numeric> + +SpanUser::SpanUser() = default; + +bool SpanUser::enabled() +{ +#if __cplusplus >= 202002L + return true; +#else + return false; +#endif +} + +#if __cplusplus >= 202002L +IntSpan3 SpanUser::getIntSpan3() +{ + static int iv[] = {1, 2, 3}; + return IntSpan3(iv); +} + +IntSpan SpanUser::getIntSpan() +{ + static int iv[] = {1, 2, 3}; + return IntSpan(iv); +} + +ConstIntSpan3 SpanUser::getConstIntSpan3() +{ + static const int civ[] = {1, 2, 3}; + return ConstIntSpan3(civ); +} + +IntSpan3 SpanUser::getIntSpan3_OpaqueContainer() +{ + static int iv[] = {1, 2, 3}; + return IntSpan3(iv); +} + +int SpanUser::sumIntSpan3(IntSpan3 isp3) +{ + return std::accumulate(isp3.begin(), isp3.end(), 0); +} + +int SpanUser::sumIntSpan(IntSpan isp) +{ + return std::accumulate(isp.begin(), isp.end(), 0); +} + +int SpanUser::sumConstIntSpan3(ConstIntSpan3 ispc3) +{ + return std::accumulate(ispc3.begin(), ispc3.end(), 0); +} +#endif // C++ 20 diff --git a/sources/shiboken6/tests/libminimal/spanuser.h b/sources/shiboken6/tests/libminimal/spanuser.h new file mode 100644 index 000000000..c78ba35e7 --- /dev/null +++ b/sources/shiboken6/tests/libminimal/spanuser.h @@ -0,0 +1,35 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#ifndef SPANUSER_H +#define SPANUSER_H + +#include "libminimalmacros.h" + +#if __cplusplus >= 202002L +# include <span> + +using IntSpan3 = std::span<int, 3>; +using IntSpan = std::span<int>; +using ConstIntSpan3 = std::span<const int, 3>; +#endif + +struct LIBMINIMAL_API SpanUser +{ + SpanUser(); + + static bool enabled(); + +#if __cplusplus >= 202002L + static IntSpan3 getIntSpan3(); + static IntSpan getIntSpan(); + static ConstIntSpan3 getConstIntSpan3(); + static IntSpan3 getIntSpan3_OpaqueContainer(); + + static int sumIntSpan3(IntSpan3 isp3); + static int sumIntSpan(IntSpan isp); + static int sumConstIntSpan3(ConstIntSpan3 ispc3); +#endif // C++ 20 +}; + +#endif // SPANUSER_H diff --git a/sources/shiboken6/tests/libminimal/typedef.cpp b/sources/shiboken6/tests/libminimal/typedef.cpp new file mode 100644 index 000000000..115b7be0a --- /dev/null +++ b/sources/shiboken6/tests/libminimal/typedef.cpp @@ -0,0 +1,50 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#include "typedef.h" + +// +// Test wrapping of a typedef +// +bool arrayFuncInt(std::vector<int> a) +{ + return a.empty(); +} + +bool arrayFuncIntTypedef(MyArray a) +{ + return arrayFuncInt(a); +} + +std::vector<int> arrayFuncIntReturn(int size) +{ + return std::vector<int>(size); +} + +MyArray arrayFuncIntReturnTypedef(int size) +{ + return arrayFuncIntReturn(size); +} + +// +// Test wrapping of a typedef of a typedef +// +bool arrayFunc(std::vector<int> a) +{ + return a.empty(); +} + +bool arrayFuncTypedef(MyArray a) +{ + return arrayFunc(a); +} + +std::vector<int> arrayFuncReturn(int size) +{ + return std::vector<int>(size); +} + +MyArray arrayFuncReturnTypedef(int size) +{ + return arrayFuncReturn(size); +} diff --git a/sources/shiboken6/tests/libminimal/typedef.h b/sources/shiboken6/tests/libminimal/typedef.h new file mode 100644 index 000000000..7116db1b8 --- /dev/null +++ b/sources/shiboken6/tests/libminimal/typedef.h @@ -0,0 +1,29 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#ifndef TYPEDEF_H +#define TYPEDEF_H + +#include "libminimalmacros.h" + +#include <vector> + +// Test wrapping of a typedef +using MyArrayInt = std::vector<int>; + +LIBMINIMAL_API bool arrayFuncInt(std::vector<int> a); +LIBMINIMAL_API bool arrayFuncIntTypedef(MyArrayInt a); + +LIBMINIMAL_API std::vector<int> arrayFuncIntReturn(int size); +LIBMINIMAL_API MyArrayInt arrayFuncIntReturnTypedef(int size); + +// Test wrapping of a typedef of a typedef +using MyArray = MyArrayInt; + +LIBMINIMAL_API bool arrayFunc(std::vector<int> a); +LIBMINIMAL_API bool arrayFuncTypedef(MyArray a); + +LIBMINIMAL_API std::vector<int> arrayFuncReturn(int size); +LIBMINIMAL_API MyArray arrayFuncReturnTypedef(int size); + +#endif diff --git a/sources/shiboken6/tests/libminimal/val.h b/sources/shiboken6/tests/libminimal/val.h new file mode 100644 index 000000000..50f090a7d --- /dev/null +++ b/sources/shiboken6/tests/libminimal/val.h @@ -0,0 +1,36 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#ifndef VAL_H +#define VAL_H + +#include "libminimalmacros.h" + +class LIBMINIMAL_API Val +{ +public: + explicit Val(int valId) noexcept : m_valId(valId) {} + LIBMINIMAL_DEFAULT_COPY_MOVE(Val) + + virtual ~Val() = default; + + int valId() const { return m_valId; } + void setValId(int valId) { m_valId = valId; } + + virtual Val passValueType(Val val) { return val; } + Val callPassValueType(Val val) { return passValueType(val); } + + virtual Val* passValueTypePointer(Val* val) { return val; } + Val* callPassValueTypePointer(Val* val) { return passValueTypePointer(val); } + + virtual Val* passValueTypeReference(Val& val) { return &val; } + Val* callPassValueTypeReference(Val& val) { return passValueTypeReference(val); } + + enum ValEnum { One, Other }; + ValEnum oneOrTheOtherEnumValue(ValEnum enumValue) { return enumValue == One ? Other : One; } +private: + int m_valId; +}; + +#endif // VAL_H + |