diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-07-14 14:15:02 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-09-24 13:52:35 +0200 |
commit | bce1bfb3af99aeb24259df34d662e8fcf072d3fd (patch) | |
tree | ef36333a2b059f4278cc5aad4efa860f9e4cd30b /sources/shiboken6/tests/libminimal | |
parent | 79b32f4d4b5154ba8001bafc481fb6edacc10280 (diff) |
shiboken6: Add opaque containers for C++ sequence containers
Add a class that directly wraps a C++ sequence container,
allow for modifying them.
For all instantiated containers, generate a special (sequence) type
that wraps the C++ container directly. For example, it will be
accessible as a QList_int.
This is achieved via providing a template for a type private
that relies on a conversion traits template for conversion.
Only the conversion traits specialization code needs to be generated.
Use cases:
- Allowing for modifying Fields of such container types
(non-owning)
- Pass it into functions taking such containers instead of converting
back and forth from a PyList (constructed in Python, owning)
[ChangeLog][shiboken6] Support for opaque C++ sequence scontainers
has been added, allowing to pass a wrapped C++ container
directly instead of converting it back and forth from
Python sequences.
Task-number: PYSIDE-1605
Change-Id: I49d378eb1a0151730d817d5bdd4b71a7c3b5cdda
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/tests/libminimal')
-rw-r--r-- | sources/shiboken6/tests/libminimal/listuser.cpp | 4 | ||||
-rw-r--r-- | sources/shiboken6/tests/libminimal/listuser.h | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/sources/shiboken6/tests/libminimal/listuser.cpp b/sources/shiboken6/tests/libminimal/listuser.cpp index 0d7721c3c..402696acd 100644 --- a/sources/shiboken6/tests/libminimal/listuser.cpp +++ b/sources/shiboken6/tests/libminimal/listuser.cpp @@ -119,3 +119,7 @@ ListUser::sumListOfIntLists(std::list<std::list<int> > intListList) return total; } +void ListUser::setStdIntList(const std::list<int> &l) +{ + m_stdIntList = l; +} diff --git a/sources/shiboken6/tests/libminimal/listuser.h b/sources/shiboken6/tests/libminimal/listuser.h index 6c7e6aedd..31c4efbd1 100644 --- a/sources/shiboken6/tests/libminimal/listuser.h +++ b/sources/shiboken6/tests/libminimal/listuser.h @@ -69,6 +69,10 @@ struct LIBMINIMAL_API ListUser 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> m_stdIntList; }; #endif // LISTUSER_H |