Add implict constructor, treat the list like any other container.
Simplify the test code, and explicitly constructor-initialize when
we want an array and might have an array, so that we don't end up
with constructing arrays of arrays.
Change-Id: I14615f897cf8a2188510cfe1085ffc70a2396d5d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Since we support QString and QList specializations, we should also
support QStringList directly. That's a bit more involved as we need
to specialize the code path for QString, which is not convertible to
or from jobject. But once we have mapped the type to jstring it
follows the implementation for lists of objects.
We now need to generate temporary local references when
converting a QString to a jstring, so manage a local frame. We do
so explicitly in chunks of 100 local references.
Change-Id: I7ae5cf7d0ba0099992c36f3677980c346526804b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
According to QUIP-18 [1], all tests file should be
LicenseRef-Qt-Commercial OR GPL-3.0-only
[1]: https://contribute.qt-project.org/quips/18
Pick-to: 6.7
Task-number: QTBUG-121787
Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Add rbeing/rend overload, relevant typedefs, and decrement operators.
As a drive-by, add noexcept to begin/end functions.
Found during header review.
Pick-to: 6.7
Task-number: QTBUG-119952
Change-Id: I32d9a7d50a1f03550944c2247516c455d4822fe7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Augment test case. Found during header review.
Pick-to: 6.7
Task-number: QTBUG-119952
Change-Id: I326395397167edb05ff1f45f7151614c02b7e7eb
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Add missing nested typedefs for both the QJniArray container and
the QJniArrayIterator. Expand test case to make sure that some standard
algorithms (such as std::distance and ranged for) work with those
types.
Found during header review.
Pick-to: 6.7
Task-number: QTBUG-119952
Change-Id: I96f348215c6f1e0e1ce777d9bdd2f172d7e52974
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Iterators are required to be default-constructible and
value-initialized iterators must compare equal.
In a const_iterator, the pointee should be const, not
the iterator itself.
Found during header review.
Pick-to: 6.7
Task-number: QTBUG-119952
Change-Id: I036c0a62ade8c59dc5d62c0823b375223719af3f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Fix build of the test by removing the reference from the
container type before accessing the nested typedef.
Pick-to: 6.7
Change-Id: Ic35f312bac70b8f8f80149a3432329070c8c8c7d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Implements an iterator API and other standard member access functions
for sequential containers so that we can use ranged-for over an object
that is a jarray. Provides read-only access to individual elements
(which is mostly relevant for arrays of objects), or the entire data()
as a contiguous memory block (which is useful for arrays of primitive
types).
QJniObject call functions can return QJniArray<T> when the return type
is either explicitly QJniArray<T> or T[], or their Qt equivalent (e.g.
a jbyteArray can be taken or returned as a QByteArray). If the return
type is a jarray type, then a QJniObject is returned as before.
Arrays can be created from a Qt container through a constructor or the
generic fromData named constructor in the QJniArrayBase class, which
implements the generic logic.
Not documented as public API yet.
Added a compile-time test to verify that types are mapped correctly.
The function test coverage is added to the QJniObject auto-test, as
that already provides the Java test class with functions taking and
returning arrays of different types.
Change-Id: I0750fc4f4cce7314df3b10e122eafbcfd68297b6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>