2018-07-22 13:04:13 +00:00
|
|
|
|
2020-12-16 10:59:23 +00:00
|
|
|
#ifndef RZTASK_H
|
|
|
|
#define RZTASK_H
|
2018-07-22 13:04:13 +00:00
|
|
|
|
2019-02-22 16:50:45 +00:00
|
|
|
#include "core/Cutter.h"
|
2018-07-22 13:04:13 +00:00
|
|
|
|
2021-01-24 14:50:13 +00:00
|
|
|
class CUTTER_EXPORT RizinTask : public QObject
|
2018-07-22 13:04:13 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2020-12-18 09:47:50 +00:00
|
|
|
protected:
|
2020-10-28 12:28:04 +00:00
|
|
|
RzCoreTask *task;
|
2018-07-22 13:04:13 +00:00
|
|
|
|
2020-12-18 09:47:50 +00:00
|
|
|
RizinTask() {}
|
2018-07-22 13:04:13 +00:00
|
|
|
void taskFinished();
|
|
|
|
|
|
|
|
public:
|
2020-12-16 09:51:53 +00:00
|
|
|
using Ptr = QSharedPointer<RizinTask>;
|
2019-11-20 08:50:07 +00:00
|
|
|
|
2020-12-18 09:47:50 +00:00
|
|
|
virtual ~RizinTask();
|
2018-07-22 13:04:13 +00:00
|
|
|
|
|
|
|
void startTask();
|
|
|
|
void breakTask();
|
|
|
|
void joinTask();
|
|
|
|
|
2020-12-18 09:47:50 +00:00
|
|
|
signals:
|
|
|
|
void finished();
|
|
|
|
};
|
|
|
|
|
2021-01-24 14:50:13 +00:00
|
|
|
class CUTTER_EXPORT RizinCmdTask : public RizinTask
|
2020-12-18 09:47:50 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
static void taskFinishedCallback(const char *, void *user);
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit RizinCmdTask(const QString &cmd, bool transient = true);
|
|
|
|
|
2018-07-22 13:04:13 +00:00
|
|
|
QString getResult();
|
2019-08-28 17:01:12 +00:00
|
|
|
QJsonDocument getResultJson();
|
2018-07-22 13:04:13 +00:00
|
|
|
const char *getResultRaw();
|
2020-12-18 09:47:50 +00:00
|
|
|
};
|
2018-07-22 13:04:13 +00:00
|
|
|
|
2021-01-24 14:50:13 +00:00
|
|
|
class CUTTER_EXPORT RizinFunctionTask : public RizinTask
|
2020-12-18 09:47:50 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::function<void *(RzCore *)> fcn;
|
|
|
|
void *res;
|
|
|
|
|
|
|
|
static void *runner(RzCore *core, void *user);
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit RizinFunctionTask(std::function<void *(RzCore *)> fcn, bool transient = true);
|
|
|
|
|
|
|
|
void *getResult() { return res; }
|
2018-07-22 13:04:13 +00:00
|
|
|
};
|
|
|
|
|
2020-12-16 10:59:23 +00:00
|
|
|
#endif // RZTASK_H
|