42 #ifndef QFUTUREINTERFACE_H
43 #define QFUTUREINTERFACE_H
59 template <typename T> class
QFuture;
60 class QFutureInterfaceBasePrivate;
62 class QFutureWatcherBasePrivate;
77 QFutureInterfaceBase(
State initialState = NoState);
78 QFutureInterfaceBase(
const QFutureInterfaceBase &other);
79 virtual ~QFutureInterfaceBase();
83 void reportFinished();
84 void reportCanceled();
85 #ifndef QT_NO_EXCEPTIONS
88 void reportResultsReady(
int beginIndex,
int endIndex);
91 void setFilterMode(
bool enable);
92 void setProgressRange(
int minimum,
int maximum);
95 bool isProgressUpdateNeeded()
const;
101 void setExpectedResultCount(
int resultCount);
102 int expectedResultCount();
103 int resultCount()
const;
105 bool queryState(
State state)
const;
111 bool isThrottled()
const;
112 bool isResultReadyAt(
int index)
const;
117 void setThrottled(
bool enable);
120 bool waitForNextResult();
121 void waitForResult(
int resultIndex);
122 void waitForResume();
129 inline bool operator==(
const QFutureInterfaceBase &other)
const {
return d == other.d; }
130 inline bool operator!=(
const QFutureInterfaceBase &other)
const {
return d != other.d; }
131 QFutureInterfaceBase &operator=(
const QFutureInterfaceBase &other);
134 bool referenceCountIsOne()
const;
140 QFutureInterfaceBasePrivate *d;
143 friend class QFutureWatcherBase;
144 friend class QFutureWatcherBasePrivate;
147 template <
typename T>
160 resultStore().clear();
169 resultStore().clear();
191 template <
typename T>
195 if (this->queryState(Canceled) || this->queryState(Finished)) {
203 const int resultCountBefore = store.
count();
205 this->reportResultsReady(resultCountBefore, resultCountBefore + store.
count());
207 const int insertIndex = store.
addResult(index, result);
208 this->reportResultsReady(insertIndex, insertIndex + 1);
212 template <
typename T>
215 reportResult(&result, index);
218 template <
typename T>
222 if (this->queryState(Canceled) || this->queryState(Finished)) {
229 const int resultCountBefore = store.
count();
230 store.
addResults(beginIndex, &_results, count);
231 this->reportResultsReady(resultCountBefore, store.
count());
233 const int insertIndex = store.
addResults(beginIndex, &_results, count);
234 this->reportResultsReady(insertIndex, insertIndex + _results.
count());
238 template <
typename T>
242 reportResult(result);
246 template <
typename T>
250 return resultStore().resultAt(index).value();
253 template <
typename T>
257 return resultStore().resultAt(index).pointer();
260 template <
typename T>
263 if (this->isCanceled()) {
264 exceptionStore().throwPossibleException();
273 while (it != resultStore().
end()) {
311 #endif // QT_NO_CONCURRENT
313 #endif // QFUTUREINTERFACE_H
void reportResults(const QVector< T > &results, int beginIndex=-1, int count=-1)
QFutureInterface< void > & operator=(const QFutureInterface< void > &other)
State
The state the media producing object is in at the moment.
void setPaused(bool paused)
bool operator==(const QFutureInterfaceBase &other) const
QFutureInterface(const QFutureInterface &other)
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
void waitForResult(int resultIndex)
void reportFinished(void *=0)
static QFutureInterface< void > canceledResult()
int addResult(int index, const T *result)
QFutureInterfaceBase & operator=(const QFutureInterfaceBase &other)
#define QT_BEGIN_NAMESPACE
QtConcurrent::ResultStoreBase & resultStoreBase()
bool operator!=(const QFutureInterfaceBase &other) const
int addResults(int index, const QVector< T > *results)
int progressMaximum() const
const T & resultReference(int index) const
GLuint GLuint GLsizei count
static QFutureInterface canceledResult()
int count(const T &t) const
QFutureInterface(State initialState=NoState)
void reportResult(const void *, int)
QString progressText() const
QFutureInterface & operator=(const QFutureInterface &other)
void reportResults(const QVector< void > &, int)
const T * resultPointer(int index) const
int progressMinimum() const
QFutureInterfaceBase(State initialState=NoState)
int progressValue() const
void reportResult(const T *result, int index=-1)
bool referenceCountIsOne() const