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); }
135 void setSuspended(
bool suspend);
136 void toggleSuspended();
137 void reportSuspended()
const;
138 void setThrottled(
bool enable);
140 void waitForFinished();
141 bool waitForNextResult();
142 void waitForResult(
int resultIndex);
143 void waitForResume();
144 void suspendIfRequested();
146 QMutex &mutex()
const;
147 bool hasException()
const;
148 QtPrivate::ExceptionStore &exceptionStore();
149 QtPrivate::ResultStoreBase &resultStoreBase();
150 const QtPrivate::ResultStoreBase &resultStoreBase()
const;
152 inline bool operator==(
const QFutureInterfaceBase &other)
const {
return d == other.d; }
153 inline bool operator!=(
const QFutureInterfaceBase &other)
const {
return d != other.d; }
156 void swap(QFutureInterfaceBase &other)
noexcept;
159 static QFutureInterfaceBase get(
const QFuture<T> &future);
161 bool isChainCanceled()
const;
165 bool refT()
const noexcept;
166 bool derefT()
const noexcept;
168 void rethrowPossibleException();
174 friend class QFutureInterfaceBasePrivate;
175 QFutureInterfaceBasePrivate *d;
178 friend class QFutureWatcherBase;
179 friend class QFutureWatcherBasePrivate;
181 template<
typename Function,
typename ResultType,
typename ParentResultType>
182 friend class QtPrivate::CompactContinuation;
184 template<
class Function,
class ResultType>
185 friend class QtPrivate::CanceledHandler;
187#ifndef QT_NO_EXCEPTIONS
188 template<
class Function,
class ResultType>
189 friend class QtPrivate::FailureHandler;
192 friend struct QtPrivate::UnwrapHandler;
194#if QT_CORE_REMOVED_SINCE(6
, 10
)
195 friend Q_CORE_EXPORT
void QtPrivate::watchContinuationImpl(
196 const QObject *context, QtPrivate::QSlotObjectBase *slotObj, QFutureInterfaceBase &fi);
200 friend class QPromise;
203 enum class ContinuationType : quint8
211#if QT_CORE_REMOVED_SINCE(6
, 10
)
212 void setContinuation(std::function<
void(
const QFutureInterfaceBase &)> func);
213 void setContinuation(std::function<
void(
const QFutureInterfaceBase &)> func,
214 QFutureInterfaceBasePrivate *continuationFutureData);
216 void setContinuation(std::function<
void(
const QFutureInterfaceBase &)> func,
217 void *continuationFutureData, ContinuationType type);
218 void setContinuation(
const QObject *context, std::function<
void()> func,
219 const QVariant &continuationFuture, ContinuationType type);
220 void cleanContinuation();
221 void runContinuation()
const;
223 void setLaunchAsync(
bool value);
224 bool launchAsync()
const;
226 bool isRunningOrPending()
const;
228 enum class CancelMode { CancelOnly, CancelAndFinish };
229 void cancel(CancelMode mode);
230 void cancelChain(CancelMode mode);