java.lang.Object
io.qt.core.QScopedArrayPointer<O>
- All Implemented Interfaces:
AutoCloseable
Java wrapper for Qt class QScopedArrayPointer to be used inside a try-with-resource block.
Example:
try(var pointer = QScopedArrayPointer.disposing(new QDialog(), new QColor())){
QDialog dialog = pointer.get(0);
dialog.exec();
}
// dialog is disposed
-
Method Summary
Modifier and TypeMethodDescriptionstatic <O> QScopedArrayPointer<O>
Creates a scoped array pointer for the given objects performing the given operation on each object at cleanup.void
close()
performs the cleanup operationO []
data()
Returns the array stored by this scoped pointerdata
(int i) Returns the object at index i in the array stored by this scoped pointerstatic <O extends QtObjectInterface>
QScopedArrayPointer<O>disposing
(O ... data) Creates a scoped pointer for the given objects performingQtObjectInterface.dispose()
on each object at cleanup.static <O extends QObject>
QScopedArrayPointer<O>disposingLater
(O ... data) Creates a scoped pointer for the given objects performingQObject.disposeLater()
on each object at cleanup.O []
get()
get
(int i) boolean
isNull()
checks if the array is nullstatic <O> void
performAndCleanup
(Consumer<O> cleanup, Consumer<O[]> action, O... data) Performs an action on resources which will be cleaned up subsequently.static <O,
R> R performAndCleanup
(Consumer<O> cleanup, Function<O[], R> action, O... data) Performs an action on resources which will be cleaned up subsequently.static <O> double
performAndCleanup
(Consumer<O> cleanup, ToDoubleFunction<O[]> action, O... data) Performs an action on resources which will be cleaned up subsequently.static <O> int
performAndCleanup
(Consumer<O> cleanup, ToIntFunction<O[]> action, O... data) Performs an action on resources which will be cleaned up subsequently.static <O> long
performAndCleanup
(Consumer<O> cleanup, ToLongFunction<O[]> action, O... data) Performs an action on resources which will be cleaned up subsequently.static <O extends QtObjectInterface>
voidperformAndDispose
(Consumer<O[]> action, O... data) Performs an action on resources which will be disposes subsequently.static <O extends QtObjectInterface,
R>
RperformAndDispose
(Function<O[], R> action, O... data) Performs an action on resources which will be disposes subsequently.static <O extends QtObjectInterface>
doubleperformAndDispose
(ToDoubleFunction<O[]> action, O... data) Performs an action on resources which will be disposes subsequently.static <O extends QtObjectInterface>
intperformAndDispose
(ToIntFunction<O[]> action, O... data) Performs an action on resources which will be disposes subsequently.static <O extends QtObjectInterface>
longperformAndDispose
(ToLongFunction<O[]> action, O... data) Performs an action on resources which will be disposes subsequently.static <O extends QObject>
voidperformAndDisposeLater
(Consumer<O[]> action, O... data) Performs an action on multipleQObject
resources which will be calledQObject.disposeLater()
subsequently.static <O extends QObject,
R>
RperformAndDisposeLater
(Function<O[], R> action, O... data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.static <O extends QObject>
doubleperformAndDisposeLater
(ToDoubleFunction<O[]> action, O... data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.static <O extends QObject>
intperformAndDisposeLater
(ToIntFunction<O[]> action, O... data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.static <O extends QObject>
longperformAndDisposeLater
(ToLongFunction<O[]> action, O... data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.final void
performs cleanup operation on all objects of the contained array and sets new array.void
swap
(QScopedArrayPointer<O> other) O []
take()
take
(int i) Removes and returns the array stored by this scoped pointer without cleanup
-
Method Details
-
data
Returns the array stored by this scoped pointer
- Returns:
- data
-
get
- See Also:
-
data
Returns the object at index i in the array stored by this scoped pointer
- Parameters:
i
- index- Returns:
- data
-
get
- See Also:
-
take
-
take
Removes and returns the array stored by this scoped pointer without cleanup
- Returns:
- data
-
reset
performs cleanup operation on all objects of the contained array and sets new array.
-
isNull
checks if the array is null -
swap
-
close
performs the cleanup operation- Specified by:
close
in interfaceAutoCloseable
-
disposing
@SafeVarargs @QtUninvokable public static <O extends QtObjectInterface> QScopedArrayPointer<O> disposing(O ... data) Creates a scoped pointer for the given objects performingQtObjectInterface.dispose()
on each object at cleanup.- Parameters:
data
- the contained objects- Returns:
- scoped pointer
-
disposingLater
@SafeVarargs @QtUninvokable public static <O extends QObject> QScopedArrayPointer<O> disposingLater(O ... data) Creates a scoped pointer for the given objects performingQObject.disposeLater()
on each object at cleanup.- Parameters:
data
- the contained objects- Returns:
- scoped pointer
-
cleanup
@SafeVarargs @QtUninvokable public static <O> QScopedArrayPointer<O> cleanup(Consumer<O> cleanup, O ... data) Creates a scoped array pointer for the given objects performing the given operation on each object at cleanup.- Parameters:
cleanup
- operation performed at cleanupdata
- the contained objects- Returns:
- scoped pointer
-
performAndDispose
@SafeVarargs @QtUninvokable public static <O extends QtObjectInterface> void performAndDispose(Consumer<O[]> action, O... data) Performs an action on resources which will be disposes subsequently.- Parameters:
action
- the actiondata
- multiple resources
-
performAndDisposeLater
@SafeVarargs @QtUninvokable public static <O extends QObject> void performAndDisposeLater(Consumer<O[]> action, O... data) Performs an action on multipleQObject
resources which will be calledQObject.disposeLater()
subsequently.- Parameters:
action
- the actiondata
- multiple resources
-
performAndCleanup
@SafeVarargs @QtUninvokable public static <O> void performAndCleanup(Consumer<O> cleanup, Consumer<O[]> action, O... data) Performs an action on resources which will be cleaned up subsequently.- Parameters:
action
- the actiondata
- multiple resources
-
performAndDispose
@SafeVarargs @QtUninvokable public static <O extends QtObjectInterface,R> R performAndDispose(Function<O[], R> action, O... data) Performs an action on resources which will be disposes subsequently.- Parameters:
action
- the actiondata
- multiple resources- Returns:
- result
-
performAndDisposeLater
@QtUninvokable @SafeVarargs public static <O extends QObject,R> R performAndDisposeLater(Function<O[], R> action, O... data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.- Parameters:
action
- the actiondata
- multiple resources- Returns:
- result
-
performAndCleanup
@QtUninvokable @SafeVarargs public static <O,R> R performAndCleanup(Consumer<O> cleanup, Function<O[], R> action, O... data) Performs an action on resources which will be cleaned up subsequently.- Parameters:
action
- the actiondata
- multiple resources- Returns:
- result
-
performAndDispose
@QtUninvokable @SafeVarargs public static <O extends QtObjectInterface> int performAndDispose(ToIntFunction<O[]> action, O... data) Performs an action on resources which will be disposes subsequently.- Parameters:
action
- the actiondata
- multiple resources- Returns:
- result
-
performAndDisposeLater
@QtUninvokable @SafeVarargs public static <O extends QObject> int performAndDisposeLater(ToIntFunction<O[]> action, O... data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.- Parameters:
action
- the actiondata
- multiple resources- Returns:
- result
-
performAndCleanup
@QtUninvokable @SafeVarargs public static <O> int performAndCleanup(Consumer<O> cleanup, ToIntFunction<O[]> action, O... data) Performs an action on resources which will be cleaned up subsequently.- Parameters:
action
- the actiondata
- multiple resources- Returns:
- result
-
performAndDispose
@QtUninvokable @SafeVarargs public static <O extends QtObjectInterface> double performAndDispose(ToDoubleFunction<O[]> action, O... data) Performs an action on resources which will be disposes subsequently.- Parameters:
action
- the actiondata
- multiple resources- Returns:
- result
-
performAndDisposeLater
@QtUninvokable @SafeVarargs public static <O extends QObject> double performAndDisposeLater(ToDoubleFunction<O[]> action, O... data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.- Parameters:
action
- the actiondata
- multiple resources- Returns:
- result
-
performAndCleanup
@QtUninvokable @SafeVarargs public static <O> double performAndCleanup(Consumer<O> cleanup, ToDoubleFunction<O[]> action, O... data) Performs an action on resources which will be cleaned up subsequently.- Parameters:
action
- the actiondata
- multiple resources- Returns:
- result
-
performAndDispose
@QtUninvokable @SafeVarargs public static <O extends QtObjectInterface> long performAndDispose(ToLongFunction<O[]> action, O... data) Performs an action on resources which will be disposes subsequently.- Parameters:
action
- the actiondata
- multiple resources- Returns:
- result
-
performAndDisposeLater
@QtUninvokable @SafeVarargs public static <O extends QObject> long performAndDisposeLater(ToLongFunction<O[]> action, O... data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.- Parameters:
action
- the actiondata
- multiple resources- Returns:
- result
-
performAndCleanup
@QtUninvokable @SafeVarargs public static <O> long performAndCleanup(Consumer<O> cleanup, ToLongFunction<O[]> action, O... data) Performs an action on resources which will be cleaned up subsequently.- Parameters:
action
- the actiondata
- multiple resources- Returns:
- result
-