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 인스턴스를 반환합니다.

이 함수는 ContainerJNI type 또는 이와 동등한 C++ 유형의 요소를 저장하는 컨테이너이고 정방향 반복자를 제공하는 경우에만 과부하 해결에 참여합니다.

구성된 QJniArray 의 특수화는 container 의 값 유형에 따라 달라집니다. Container<T> (예: QList<T>)의 경우 일반적으로 QJniArray<T> 이 되지만 다음과 같은 예외가 있습니다:

컨테이너특수화
QByteArrayQJniArray<jbyte>
QStringListQJniArray<jstring>
컨테이너::value_type전문화
QJniObjectQJniArray<jobject>

QJniArray::toContainer()도 참조하세요 .

bool QJniArrayBase::isEmpty() const

배열의 크기가 0이면 true 을 반환하고, 그렇지 않으면 false 을 반환합니다.

invalid 배열은 항상 비어 있습니다.

isValid(), size()

bool QJniArrayBase::isValid() const

QJniArray 객체가 유효한 `jobject`를 래핑하는지 여부를 반환합니다. 잘못된 QJniArray 인스턴스의 경우 object()은 nullptr 를 반환합니다. 유효하지 않은 객체를 반복해도 안전하며(시작()은 끝()과 동일한 값을 반환합니다), 유효하지 않은 배열에서 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.