io.qt.core.QFunctionPointer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of qtjambi Show documentation
Show all versions of qtjambi Show documentation
QtJambi base module containing QtCore, QtGui and QtWidgets.
package io.qt.core;
import io.qt.*;
/**
* Java wrapper for Qt callable QFunctionPointer
*/
public final class QFunctionPointer extends QtObject {
static {
QtJambi_LibraryUtilities.initialize();
}
private QFunctionPointer(QPrivateConstructor c){
super(c);
}
/**
* Overloaded function for invoke(void.class, arguments)
.
* @param arguments
*/
@QtDeclaredFinal
@QtUninvokable
public void invoke(Object... arguments) throws QUnsuccessfulInvocationException {
invoke_native(this, void.class, arguments);
}
/**
* Overloaded function for invoke(QGenericReturnType.of(returnType), arguments)
.
* @param returnType
* @param arguments
*/
@QtDeclaredFinal
@QtUninvokable
public R invoke(@NonNull Class returnType, Object... arguments) throws QUnsuccessfulInvocationException {
return invoke_native(this, returnType, arguments);
}
/**
* Invokes the underlying function pointer with given arguments.
* Object types are used as pointers, value types as call-by-value. This also applies for the return value.
* Use {@link QGenericArgument} to specify call-by-reference.
* E.g. QGenericArgument.value("any string").asConstRef()
* for const QString&
* Requires Java Native Access library (JNA) in class path.
* @see https://github.com/java-native-access/jna
* @param returnType
* @param arguments argument values or wrapped as QGenericArgument
*/
@QtUninvokable
public R invoke(@NonNull QGenericReturnType returnType, Object... arguments) throws QUnsuccessfulInvocationException {
if(arguments==null) {
return invoke_native(this, returnType, null);
}else {
return invoke_native(this, returnType, arguments);
}
}
/**
* Converts this function pointer into given functional interface type.
* @param functionalInterface
* @return converted function pointer
*/
@QtUninvokable
public T cast(@NonNull Class functionalInterface) {
return cast(this, functionalInterface);
}
/**
* Converts the given function into given functional interface type.
* @param functionalInterface
* @return converted function pointer
*/
@QtUninvokable
public native static T cast(io.qt.@NonNull QtObjectInterface function, @NonNull Class functionalInterface);
@QtUninvokable
static native R invoke_native(QtObjectInterface function, Object returnType, Object[] arguments);
public native void invoke();
}