70 QFutureInterfaceBase(State initialState = NoState);
71 QFutureInterfaceBase(
const QFutureInterfaceBase &other);
72 QFutureInterfaceBase(QFutureInterfaceBase &&other)
noexcept
73 : d(std::exchange(other.d,
nullptr)) {}
74 QFutureInterfaceBase &operator=(
const QFutureInterfaceBase &other);
75 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QFutureInterfaceBase)
76 virtual ~QFutureInterfaceBase();
80 void reportFinished();
81 void reportCanceled();
82#ifndef QT_NO_EXCEPTIONS
83 void reportException(
const QException &e);
84#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
85 void reportException(std::exception_ptr e);
87 void reportException(
const std::exception_ptr &e);
90 void reportResultsReady(
int beginIndex,
int endIndex);
92 void setRunnable(QRunnable *runnable);
93 void setThreadPool(QThreadPool *pool);
94 QThreadPool *threadPool()
const;
95 void setFilterMode(
bool enable);
96 void setProgressRange(
int minimum,
int maximum);
97 int progressMinimum()
const;
98 int progressMaximum()
const;
99 bool isProgressUpdateNeeded()
const;
100 void setProgressValue(
int progressValue);
101 int progressValue()
const;
102 void setProgressValueAndText(
int progressValue,
const QString &progressText);
103 QString progressText()
const;
105 void setExpectedResultCount(
int resultCount);
106 int expectedResultCount();
107 int resultCount()
const;
109 bool queryState(State state)
const;
110 bool isRunning()
const;
111 bool isStarted()
const;
112 bool isCanceled()
const;
113 bool isFinished()
const;
114#if QT_DEPRECATED_SINCE(6
, 0
)
115 QT_DEPRECATED_VERSION_X_6_0(
"Use isSuspending() or isSuspended() instead.")
116 bool isPaused()
const;
118 QT_DEPRECATED_VERSION_X_6_0(
"Use setSuspended() instead.")
119 void setPaused(
bool paused) { setSuspended(paused); }
121 QT_DEPRECATED_VERSION_X_6_0(
"Use toggleSuspended() instead.")
122 void togglePaused() { toggleSuspended(); }
124 bool isSuspending()
const;
125 bool isSuspended()
const;
126 bool isThrottled()
const;
127 bool isResultReadyAt(
int index)
const;
128 bool isValid()
const;
129 int loadState()
const;
132 void cancelAndFinish() { cancel(CancelMode::CancelAndFinish); }
134 void setAddResultsIfCanceledEnabled(
bool enable);
135 bool isAddResultsIfCanceledEnabled()
const;
137 void setSuspended(
bool suspend);
138 void toggleSuspended();
139 void reportSuspended()
const;
140 void setThrottled(
bool enable);
142 void waitForFinished();
143 bool waitForNextResult();
144 void waitForResult(
int resultIndex);
145 void waitForResume();
146 void suspendIfRequested();
148 QMutex &mutex()
const;
149 bool hasException()
const;
150 QtPrivate::ExceptionStore &exceptionStore();
151 QtPrivate::ResultStoreBase &resultStoreBase();
152 const QtPrivate::ResultStoreBase &resultStoreBase()
const;
154 inline bool operator==(
const QFutureInterfaceBase &other)
const {
return d == other.d; }
155 inline bool operator!=(
const QFutureInterfaceBase &other)
const {
return d != other.d; }
158 void swap(QFutureInterfaceBase &other)
noexcept;
161 static QFutureInterfaceBase get(
const QFuture<T> &future);
163 bool isChainCanceled()
const;
167 bool refT()
const noexcept;
168 bool derefT()
const noexcept;
170 void rethrowPossibleException();
176 friend class QFutureInterfaceBasePrivate;
177 QFutureInterfaceBasePrivate *d;
180 friend class QFutureWatcherBase;
181 friend class QFutureWatcherBasePrivate;
183 template<
typename Function,
typename ResultType,
typename ParentResultType>
184 friend class QtPrivate::CompactContinuation;
186 template<
class Function,
class ResultType>
187 friend class QtPrivate::CanceledHandler;
189#ifndef QT_NO_EXCEPTIONS
190 template<
class Function,
class ResultType>
191 friend class QtPrivate::FailureHandler;
194 friend struct QtPrivate::UnwrapHandler;
196#if QT_CORE_REMOVED_SINCE(6
, 10
)
197 friend Q_CORE_EXPORT
void QtPrivate::watchContinuationImpl(
198 const QObject *context, QtPrivate::QSlotObjectBase *slotObj, QFutureInterfaceBase &fi);
202 friend class QPromise;
205 enum class ContinuationType : quint8
213#if QT_CORE_REMOVED_SINCE(6
, 10
)
214 void setContinuation(std::function<
void(
const QFutureInterfaceBase &)> func);
215 void setContinuation(std::function<
void(
const QFutureInterfaceBase &)> func,
216 QFutureInterfaceBasePrivate *continuationFutureData);
218 void setContinuation(std::function<
void(
const QFutureInterfaceBase &)> func,
219 void *continuationFutureData, ContinuationType type);
220 void setContinuation(
const QObject *context, std::function<
void()> func,
221 const QVariant &continuationFuture, ContinuationType type);
222 void cleanContinuation();
223 void runContinuation()
const;
225 void setLaunchAsync(
bool value);
226 bool launchAsync()
const;
228 bool isRunningOrPending()
const;
230 enum class CancelMode { CancelOnly, CancelAndFinish };
231 void cancel(CancelMode mode);
232 void cancelChain(CancelMode mode);