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/example/doric/async/DoricAsyncResult.h
2021-07-21 19:03:29 +08:00

35 lines
566 B
C++

#ifndef ASYNCRESULT_H
#define ASYNCRESULT_H
#include <QJSValue>
#include "DoricExport.h"
#include "DoricSettableFuture.h"
static QString EMPTY("");
class DORIC_EXPORT DoricAsyncResult {
private:
QString result = EMPTY;
public:
std::function<void()> resultCallback;
std::function<void()> exceptionCallback;
std::function<void()> finishCallback;
DoricAsyncResult();
void setResult(QString result);
void setError(QString exception);
bool hasResult();
QJSValue getResult();
DoricSettableFuture *synchronous();
};
#endif // ASYNCRESULT_H