QJniArrayBase Class

QJniArrayBaseクラスは、QJniArray のための、型に依存しない共通APIを提供します。さらに...

ヘッダー #include <QJniArrayBase>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core
以来:Qt 6.8
継承元:

QJniArray

パブリックな型

パブリック関数

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

静的パブリックメンバ

auto fromContainer(Container &&container)

保護された関数

void swap(QJniArrayBase &other)

詳細説明

メンバ型ドキュメント

[alias] QJniArrayBase::size_type

32ビット整数。

メンバ関数ドキュメント

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

container のデータを保持する Java 配列を作成し、それをラップしたQJniArray インスタンスを返します。

この関数は、Container が、JNI type または同等の C++ 型の要素を格納するコンテナであり、前方イテレータを提供する場合にのみ、オーバーロード解決に参加します。

構築されたQJniArray の特殊化は、container の値型に依存します。Container<T> (例えば、QList<T> )の場合、以下の例外を除いて、通常はQJniArray<T> になります:

コンテナ特殊化
QByteArrayQJniArray<jbyte
QStringListQJniArray<jstring>
コンテナ::value_type特殊化
QJniObjectQJniArray<ジョブジェクト

QJniArray::toContainer()も参照してください

bool QJniArrayBase::isEmpty() const

配列のサイズが 0 の場合はtrue を返し、そうでない場合はfalse を返す。

invalid 配列は常に空である。

isValid() size()

bool QJniArrayBase::isValid() const

QJniArray オブジェクトが有効な `jobject` をラップしているかどうかを返す。無効なQJniArray インスタンスに対しては、object() はnullptr を返す。無効なオブジェクトを繰り返し処理しても安全であり (begin() は end() と同じ値を返す)、無効な配列に対してtoContainer() をコールすると空のコンテナが返される。

QJniObject::isValid()、object()、QJniArray::toContainer()も参照

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

JNI Object Types のいずれかであるQJniArray が保持するオブジェクトを T 型として返す。

QJniArrayBase::size_type QJniArrayBase::size() const

配列のサイズを返します。

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

この配列オブジェクトをother と交換する。この操作は非常に高速で、失敗することはない。

QJniObject QJniArrayBase::operator QJniObject() const

このQJniArray インスタンスと同じjobject をラップしたQJniObject を返す。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.