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

31 lines
494 B
C
Raw Normal View History

2021-02-04 16:59:58 +08:00
#ifndef ASYNCRESULT_H
#define ASYNCRESULT_H
2021-05-31 16:00:06 +08:00
#include <QString>
2021-02-04 16:59:58 +08:00
2021-05-18 16:15:28 +08:00
#include "DoricExport.h"
class DORIC_EXPORT DoricAsyncResult {
2021-02-04 16:59:58 +08:00
private:
2021-05-31 16:00:06 +08:00
QString result;
2021-02-04 16:59:58 +08:00
public:
2021-06-10 11:05:31 +08:00
std::function<void()> resultCallback = [] {};
2021-05-25 10:45:45 +08:00
std::function<void()> exceptionCallback;
std::function<void()> finishCallback;
2021-02-04 16:59:58 +08:00
2021-05-25 10:45:45 +08:00
DoricAsyncResult();
2021-02-04 16:59:58 +08:00
2021-05-25 10:45:45 +08:00
void setResult(QString result);
2021-02-04 16:59:58 +08:00
2021-05-25 10:45:45 +08:00
void setError(QString exception);
2021-02-04 16:59:58 +08:00
bool hasResult();
2021-05-31 16:00:06 +08:00
QString getResult();
2021-02-04 16:59:58 +08:00
2021-05-31 16:00:06 +08:00
QString waitUntilResult();
2021-02-04 16:59:58 +08:00
};
#endif // ASYNCRESULT_H