This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-Qt/doric/async/async_result.h
2021-05-20 18:27:45 +08:00

36 lines
543 B
C++

#ifndef ASYNCRESULT_H
#define ASYNCRESULT_H
#include <QJSValue>
#include "callback.h"
#include "settable_future.h"
static QJSValue EMPTY(QJSValue::NullValue);
class AsyncResult
{
private:
QJSValue result = EMPTY;
Callback *callback;
public:
AsyncResult();
AsyncResult(QJSValue result);
void setResult(QJSValue result);
void setError(QJSValue exception);
bool hasResult();
QJSValue getResult();
void setCallback(Callback *callback);
SettableFuture *synchronous();
};
#endif // ASYNCRESULT_H