67 QFutureInterfaceBase(State initialState = NoState);
68 QFutureInterfaceBase(
const QFutureInterfaceBase &other);
69 QFutureInterfaceBase(QFutureInterfaceBase &&other)
noexcept
70 : d(std::exchange(other.d,
nullptr)) {}
71 QFutureInterfaceBase &operator=(
const QFutureInterfaceBase &other);
72 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QFutureInterfaceBase)
73 virtual ~QFutureInterfaceBase();
77 void reportFinished();
78 void reportCanceled();
79#ifndef QT_NO_EXCEPTIONS
80 void reportException(
const QException &e);
81#if QT_VERSION < QT_VERSION_CHECK(7
, 0
, 0
)
82 void reportException(std::exception_ptr e);
84 void reportException(
const std::exception_ptr &e);
87 void reportResultsReady(
int beginIndex,
int endIndex);
89 void setRunnable(QRunnable *runnable);
90 void setThreadPool(QThreadPool *pool);
91 QThreadPool *threadPool()
const;
92 void setFilterMode(
bool enable);
93 void setProgressRange(
int minimum,
int maximum);
94 int progressMinimum()
const;
95 int progressMaximum()
const;
96 bool isProgressUpdateNeeded()
const;
97 void setProgressValue(
int progressValue);
98 int progressValue()
const;
99 void setProgressValueAndText(
int progressValue,
const QString &progressText);
100 QString progressText()
const;
102 void setExpectedResultCount(
int resultCount);
103 int expectedResultCount();
104 int resultCount()
const;
106 bool queryState(State state)
const;
107 bool isRunning()
const;
108 bool isStarted()
const;
109 bool isCanceled()
const;
110 bool isFinished()
const;
111#if QT_DEPRECATED_SINCE(6
, 0
)
112 QT_DEPRECATED_VERSION_X_6_0(
"Use isSuspending() or isSuspended() instead.")
113 bool isPaused()
const;
115 QT_DEPRECATED_VERSION_X_6_0(
"Use setSuspended() instead.")
116 void setPaused(
bool paused) { setSuspended(paused); }
118 QT_DEPRECATED_VERSION_X_6_0(
"Use toggleSuspended() instead.")
119 void togglePaused() { toggleSuspended(); }
121 bool isSuspending()
const;
122 bool isSuspended()
const;
123 bool isThrottled()
const;
124 bool isResultReadyAt(
int index)
const;
125 bool isValid()
const;
126 int loadState()
const;
129 void cancelAndFinish() { cancel(CancelMode::CancelAndFinish); }
132 void setSuspended(
bool suspend);
133 void toggleSuspended();
134 void reportSuspended()
const;
135 void setThrottled(
bool enable);
137 void waitForFinished();
138 bool waitForNextResult();
139 void waitForResult(
int resultIndex);
140 void waitForResume();
141 void suspendIfRequested();
143 QMutex &mutex()
const;
144 bool hasException()
const;
145 QtPrivate::ExceptionStore &exceptionStore();
146 QtPrivate::ResultStoreBase &resultStoreBase();
147 const QtPrivate::ResultStoreBase &resultStoreBase()
const;
149 inline bool operator==(
const QFutureInterfaceBase &other)
const {
return d == other.d; }
150 inline bool operator!=(
const QFutureInterfaceBase &other)
const {
return d != other.d; }
153 void swap(QFutureInterfaceBase &other)
noexcept;
156 static QFutureInterfaceBase get(
const QFuture<T> &future);
158 bool isChainCanceled()
const;
162 bool refT()
const noexcept;
163 bool derefT()
const noexcept;
165 void rethrowPossibleException();
171 friend class QFutureInterfaceBasePrivate;
172 QFutureInterfaceBasePrivate *d;
175 friend class QFutureWatcherBase;
176 friend class QFutureWatcherBasePrivate;
178 template<
typename Function,
typename ResultType,
typename ParentResultType>
179 friend class QtPrivate::CompactContinuation;
181 template<
class Function,
class ResultType>
182 friend class QtPrivate::CanceledHandler;
184#ifndef QT_NO_EXCEPTIONS
185 template<
class Function,
class ResultType>
186 friend class QtPrivate::FailureHandler;
189#if QT_CORE_REMOVED_SINCE(6
, 10
)
190 friend Q_CORE_EXPORT
void QtPrivate::watchContinuationImpl(
191 const QObject *context, QtPrivate::QSlotObjectBase *slotObj, QFutureInterfaceBase &fi);
195 friend class QPromise;
198 enum class ContinuationType : quint8
206#if QT_CORE_REMOVED_SINCE(6
, 10
)
207 void setContinuation(std::function<
void(
const QFutureInterfaceBase &)> func);
208 void setContinuation(std::function<
void(
const QFutureInterfaceBase &)> func,
209 QFutureInterfaceBasePrivate *continuationFutureData);
211 void setContinuation(std::function<
void(
const QFutureInterfaceBase &)> func,
212 void *continuationFutureData, ContinuationType type);
213 void setContinuation(
const QObject *context, std::function<
void()> func,
214 const QVariant &continuationFuture, ContinuationType type);
215 void cleanContinuation();
216 void runContinuation()
const;
218 void setLaunchAsync(
bool value);
219 bool launchAsync()
const;
221 bool isRunningOrPending()
const;
223 enum class CancelMode { CancelOnly, CancelAndFinish };
224 void cancel(CancelMode mode);
225 void cancelChain(CancelMode mode);