QJniArrayBase Class

The QJniArrayBase class provides common, type-independent APIs for QJniArray . 更多...

头: #include <QJniArrayBase>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
Since: Qt 6.8
继承者:

QJniArray

公共类型

size_type

公共函数

bool isEmpty () const
bool isValid () const
T 对象 () const
QJniArrayBase::size_type size () const
QJniObject operator QJniObject () const

静态公共成员

auto fromContainer (Container && container )

保护函数

void swap (QJniArrayBase & other )

详细描述

成员类型文档编制

[alias] QJniArrayBase:: size_type

A 32 bit integer.

成员函数文档编制

[static] template <typename Container, QJniArrayBase::if_compatible_source_container<Container> = true> auto QJniArrayBase:: fromContainer ( 容器 && container )

Creates a Java array holding the data in container , and returns a QJniArray instance that wraps it.

This function only participates in overload resolution if Container is a container that stores elements of a JNI type or equivalent C++ type, and provides a forward iterator.

The specialization of the constructed QJniArray depends on the value type of the container . For a Container<T> (such as e.g. QList<T> ) it will typically be QJniArray<T> , with the following exceptions:

容器 Specialization
QByteArray QJniArray <jbyte>
QStringList QJniArray <jstring>
Container::value_type Specialization
QJniObject QJniArray <jobject>

另请参阅 QJniArray::toContainer ().

bool QJniArrayBase:: isEmpty () const

返回 true if the array has size 0; otherwise returns false .

An 无效 array is always empty.

isValid() , size ()

bool QJniArrayBase:: isValid () const

Returns whether the QJniArray object wraps a valid `jobject`. For invalid QJniArray instances, 对象 () 返回 nullptr . Iterating over an invalid object is safe (begin() will return the same as end()), and calling toContainer () on an invalid array will return an empty container.

另请参阅 QJniObject::isValid (), 对象 (),和 QJniArray::toContainer ().

template <typename T = jobject> T QJniArrayBase:: 对象 () const

Returns the object held by the QJniArray as type T, which can be one of the JNI Object Types .

QJniArrayBase::size_type QJniArrayBase:: size () const

Returns the size of the array.

[noexcept protected] void QJniArrayBase:: swap ( QJniArrayBase & other )

Swaps this array object with other 。此操作非常快且从不失败。

QJniObject QJniArrayBase:: operator QJniObject () const

返回 QJniObject wrapping the same jobject as this QJniArray 实例。