68 QFutureInterfaceBase(State initialState = NoState);
69 QFutureInterfaceBase(
const QFutureInterfaceBase &other);
70 QFutureInterfaceBase(QFutureInterfaceBase &&other)
noexcept
71 : d(std::exchange(other.d,
nullptr)) {}
72 QFutureInterfaceBase &operator=(
const QFutureInterfaceBase &other);
73 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QFutureInterfaceBase)
74 virtual ~QFutureInterfaceBase();
78 void reportFinished();
79 void reportCanceled();
80#ifndef QT_NO_EXCEPTIONS
81 void reportException(
const QException &e);
82#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
83 void reportException(std::exception_ptr e);
85 void reportException(
const std::exception_ptr &e);
88 void reportResultsReady(
int beginIndex,
int endIndex);
90 void setRunnable(QRunnable *runnable);
91 void setThreadPool(QThreadPool *pool);
92 QThreadPool *threadPool()
const;
93 void setFilterMode(
bool enable);
94 void setProgressRange(
int minimum,
int maximum);
95 int progressMinimum()
const;
96 int progressMaximum()
const;
97 bool isProgressUpdateNeeded()
const;
98 void setProgressValue(
int progressValue);
99 int progressValue()
const;
100 void setProgressValueAndText(
int progressValue,
const QString &progressText);
101 QString progressText()
const;
103 void setExpectedResultCount(
int resultCount);
104 int expectedResultCount();
105 int resultCount()
const;
107 bool queryState(State state)
const;
108 bool isRunning()
const;
109 bool isStarted()
const;
110 bool isCanceled()
const;
111 bool isFinished()
const;
112#if QT_DEPRECATED_SINCE(6
, 0
)
113 QT_DEPRECATED_VERSION_X_6_0(
"Use isSuspending() or isSuspended() instead.")
114 bool isPaused()
const;
116 QT_DEPRECATED_VERSION_X_6_0(
"Use setSuspended() instead.")
117 void setPaused(
bool paused) { setSuspended(paused); }
119 QT_DEPRECATED_VERSION_X_6_0(
"Use toggleSuspended() instead.")
120 void togglePaused() { toggleSuspended(); }
122 bool isSuspending()
const;
123 bool isSuspended()
const;
124 bool isThrottled()
const;
125 bool isResultReadyAt(
int index)
const;
126 bool isValid()
const;
127 int loadState()
const;
130 void cancelAndFinish() { cancel(CancelMode::CancelAndFinish); }
133 void setSuspended(
bool suspend);
134 void toggleSuspended();
135 void reportSuspended()
const;
136 void setThrottled(
bool enable);
138 void waitForFinished();
139 bool waitForNextResult();
140 void waitForResult(
int resultIndex);
141 void waitForResume();
142 void suspendIfRequested();
144 QMutex &mutex()
const;
145 bool hasException()
const;
146 QtPrivate::ExceptionStore &exceptionStore();
147 QtPrivate::ResultStoreBase &resultStoreBase();
148 const QtPrivate::ResultStoreBase &resultStoreBase()
const;
150 inline bool operator==(
const QFutureInterfaceBase &other)
const {
return d == other.d; }
151 inline bool operator!=(
const QFutureInterfaceBase &other)
const {
return d != other.d; }
154 void swap(QFutureInterfaceBase &other)
noexcept;
157 static QFutureInterfaceBase get(
const QFuture<T> &future);
159 bool isChainCanceled()
const;
163 bool refT()
const noexcept;
164 bool derefT()
const noexcept;
166 void rethrowPossibleException();
172 friend class QFutureInterfaceBasePrivate;
173 QFutureInterfaceBasePrivate *d;
176 friend class QFutureWatcherBase;
177 friend class QFutureWatcherBasePrivate;
179 template<
typename Function,
typename ResultType,
typename ParentResultType>
180 friend class QtPrivate::CompactContinuation;
182 template<
class Function,
class ResultType>
183 friend class QtPrivate::CanceledHandler;
185#ifndef QT_NO_EXCEPTIONS
186 template<
class Function,
class ResultType>
187 friend class QtPrivate::FailureHandler;
190#if QT_CORE_REMOVED_SINCE(6
, 10
)
191 friend Q_CORE_EXPORT
void QtPrivate::watchContinuationImpl(
192 const QObject *context, QtPrivate::QSlotObjectBase *slotObj, QFutureInterfaceBase &fi);
196 friend class QPromise;
199 enum class ContinuationType : quint8
207#if QT_CORE_REMOVED_SINCE(6
, 10
)
208 void setContinuation(std::function<
void(
const QFutureInterfaceBase &)> func);
209 void setContinuation(std::function<
void(
const QFutureInterfaceBase &)> func,
210 QFutureInterfaceBasePrivate *continuationFutureData);
212 void setContinuation(std::function<
void(
const QFutureInterfaceBase &)> func,
213 void *continuationFutureData, ContinuationType type);
214 void setContinuation(
const QObject *context, std::function<
void()> func,
215 const QVariant &continuationFuture, ContinuationType type);
216 void cleanContinuation();
217 void runContinuation()
const;
219 void setLaunchAsync(
bool value);
220 bool launchAsync()
const;
222 bool isRunningOrPending()
const;
224 enum class CancelMode { CancelOnly, CancelAndFinish };
225 void cancel(CancelMode mode);
226 void cancelChain(CancelMode mode);