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/DoricAsyncResult.h

35 lines
562 B
C
Raw Normal View History

2021-02-04 16:59:58 +08:00
#ifndef ASYNCRESULT_H
#define ASYNCRESULT_H
#include <QJSValue>
#include "DoricCallback.h"
#include "DoricSettableFuture.h"
static QJSValue EMPTY(QJSValue::NullValue);
class DoricAsyncResult {
private:
QJSValue result = EMPTY;
DoricCallback *callback;
public:
DoricAsyncResult();
DoricAsyncResult(QJSValue result);
void setResult(QJSValue result);
void setError(QJSValue exception);
bool hasResult();
QJSValue getResult();
void setCallback(DoricCallback *callback);
DoricSettableFuture *synchronous();
};
#endif // ASYNCRESULT_H