All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.qt.core.QtFuture Maven / Gradle / Ivy

There is a newer version: 6.8.1
Show newest version
package io.qt.core;


/**
 * 

Contains miscellaneous identifiers used by the QFuture class

*

Java wrapper for Qt class QtFuture

*/ public final class QtFuture { static { QtJambi_LibraryUtilities.initialize(); } private QtFuture() throws java.lang.InstantiationError { throw new java.lang.InstantiationError("Cannot instantiate namespace QtFuture."); } /** *

Java wrapper for Qt enum QtFuture::Launch

*/ public enum Launch implements io.qt.QtEnumerator { Sync(0), Async(1), Inherit(2); private Launch(int value) { this.value = value; } /** * {@inheritDoc} */ public int value() { return value; } /** * Returns the corresponding enum entry for the given value. * @param value * @return enum entry */ public static Launch resolve(int value) { switch (value) { case 0: return Sync; case 1: return Async; case 2: return Inherit; default: throw new io.qt.QNoSuchEnumValueException(value); } } private final int value; } @io.qt.QtUninvokable public static QFuture connect(QMetaObject.AbstractPrivateSignal0 signal) { if(signal.containingObject() instanceof QObject) { QObject sender = (QObject)signal.containingObject(); QFutureInterface promise = QFutureInterface.createVoidFutureInterface(); promise.reportStarted(); QMetaObject.Connection[] connections = {null, null}; connections[0] = signal.connect(()->{ promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); connections[1] = sender.destroyed.connect(()->{ promise.reportCanceled(); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); return promise.future(); } return null; } @io.qt.QtUninvokable public static QFuture connect(QMetaObject.AbstractPrivateSignal1 signal) { if(signal.containingObject() instanceof QObject) { QObject sender = (QObject)signal.containingObject(); QFutureInterface promise = new QFutureInterface<>(); promise.reportStarted(); QMetaObject.Connection[] connections = {null, null}; connections[0] = signal.connect(value->{ promise.reportResult(value); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); connections[1] = sender.destroyed.connect(()->{ promise.reportCanceled(); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); return promise.future(); } return null; } @io.qt.QtUninvokable public static QFuture> connect(QMetaObject.AbstractPrivateSignal2 signal) { if(signal.containingObject() instanceof QObject) { QObject sender = (QObject)signal.containingObject(); QFutureInterface> promise = new QFutureInterface<>(); promise.reportStarted(); QMetaObject.Connection[] connections = {null, null}; connections[0] = signal.connect((a,b)->{ promise.reportResult(new QPair<>(a,b)); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); connections[1] = sender.destroyed.connect(()->{ promise.reportCanceled(); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); return promise.future(); } return null; } @io.qt.QtUninvokable public static QFuture connect(QMetaObject.AbstractPrivateSignal3 signal) { if(signal.containingObject() instanceof QObject) { QObject sender = (QObject)signal.containingObject(); QFutureInterface promise = new QFutureInterface<>(); promise.reportStarted(); QMetaObject.Connection[] connections = {null, null}; connections[0] = signal.connect((a,b,c)->{ promise.reportResult(new Object[] {a,b,c}); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); connections[1] = sender.destroyed.connect(()->{ promise.reportCanceled(); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); return promise.future(); } return null; } @io.qt.QtUninvokable public static QFuture connect(QMetaObject.AbstractPrivateSignal4 signal) { if(signal.containingObject() instanceof QObject) { QObject sender = (QObject)signal.containingObject(); QFutureInterface promise = new QFutureInterface<>(); promise.reportStarted(); QMetaObject.Connection[] connections = {null, null}; connections[0] = signal.connect((a,b,c,d)->{ promise.reportResult(new Object[] {a,b,c,d}); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); connections[1] = sender.destroyed.connect(()->{ promise.reportCanceled(); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); return promise.future(); } return null; } @io.qt.QtUninvokable public static QFuture connect(QMetaObject.AbstractPrivateSignal5 signal) { if(signal.containingObject() instanceof QObject) { QObject sender = (QObject)signal.containingObject(); QFutureInterface promise = new QFutureInterface<>(); promise.reportStarted(); QMetaObject.Connection[] connections = {null, null}; connections[0] = signal.connect((a,b,c,d,e)->{ promise.reportResult(new Object[] {a,b,c,d,e}); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); connections[1] = sender.destroyed.connect(()->{ promise.reportCanceled(); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); return promise.future(); } return null; } @io.qt.QtUninvokable public static QFuture connect(QMetaObject.AbstractPrivateSignal6 signal) { if(signal.containingObject() instanceof QObject) { QObject sender = (QObject)signal.containingObject(); QFutureInterface promise = new QFutureInterface<>(); promise.reportStarted(); QMetaObject.Connection[] connections = {null, null}; connections[0] = signal.connect((a,b,c,d,e,f)->{ promise.reportResult(new Object[] {a,b,c,d,e,f}); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); connections[1] = sender.destroyed.connect(()->{ promise.reportCanceled(); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); return promise.future(); } return null; } @io.qt.QtUninvokable public static QFuture connect(QMetaObject.AbstractPrivateSignal7 signal) { if(signal.containingObject() instanceof QObject) { QObject sender = (QObject)signal.containingObject(); QFutureInterface promise = new QFutureInterface<>(); promise.reportStarted(); QMetaObject.Connection[] connections = {null, null}; connections[0] = signal.connect((a,b,c,d,e,f,g)->{ promise.reportResult(new Object[] {a,b,c,d,e,f,g}); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); connections[1] = sender.destroyed.connect(()->{ promise.reportCanceled(); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); return promise.future(); } return null; } @io.qt.QtUninvokable public static QFuture connect(QMetaObject.AbstractPrivateSignal8 signal) { if(signal.containingObject() instanceof QObject) { QObject sender = (QObject)signal.containingObject(); QFutureInterface promise = new QFutureInterface<>(); promise.reportStarted(); QMetaObject.Connection[] connections = {null, null}; connections[0] = signal.connect((a,b,c,d,e,f,g,h)->{ promise.reportResult(new Object[] {a,b,c,d,e,f,g,h}); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); connections[1] = sender.destroyed.connect(()->{ promise.reportCanceled(); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); return promise.future(); } return null; } @io.qt.QtUninvokable public static QFuture connect(QMetaObject.AbstractPrivateSignal9 signal) { if(signal.containingObject() instanceof QObject) { QObject sender = (QObject)signal.containingObject(); QFutureInterface promise = new QFutureInterface<>(); promise.reportStarted(); QMetaObject.Connection[] connections = {null, null}; connections[0] = signal.connect((a,b,c,d,e,f,g,h,i)->{ promise.reportResult(new Object[] {a,b,c,d,e,f,g,h,i}); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); connections[1] = sender.destroyed.connect(()->{ promise.reportCanceled(); promise.reportFinished(); QObject.disconnect(connections[0]); QObject.disconnect(connections[1]); }); return promise.future(); } return null; } @io.qt.QtUninvokable public static QFuture makeReadyFuture(java.util.Collection values) { QFutureInterface promise = new QFutureInterface<>(); promise.reportStarted(); promise.reportResults(values); promise.reportFinished(); return promise.future(); } @io.qt.QtUninvokable public static QFuture makeReadyFuture() { QFutureInterface promise = QFutureInterface.createVoidFutureInterface(); promise.reportStarted(); promise.reportFinished(); return promise.future(); } @io.qt.QtUninvokable public static QFuture makeExceptionalFuture(Throwable exception) { QFutureInterface promise = QFutureInterface.createVoidFutureInterface(); promise.reportStarted(); promise.reportException(exception); promise.reportFinished(); return promise.future(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy