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

44 lines
1.2 KiB
C
Raw Permalink Normal View History

2021-02-04 16:59:58 +08:00
#ifndef NATIVEDRIVER_H
#define NATIVEDRIVER_H
#include <QDebug>
2021-05-18 16:15:28 +08:00
#include "DoricExport.h"
2021-02-04 16:59:58 +08:00
#include "DoricInterfaceDriver.h"
#include "engine/DoricJSEngine.h"
2021-05-18 16:15:28 +08:00
class DORIC_EXPORT DoricNativeDriver : public DoricInterfaceDriver {
2021-02-04 16:59:58 +08:00
private:
static DoricNativeDriver *local_instance;
DoricNativeDriver() { qDebug() << "DoricNativeDriver constructor"; }
2021-02-04 16:59:58 +08:00
~DoricNativeDriver() { qDebug() << "DoricNativeDriver destructor"; }
2021-02-04 16:59:58 +08:00
DoricJSEngine jsEngine;
public:
static DoricNativeDriver *getInstance() {
static DoricNativeDriver instance;
return &instance;
}
2021-05-12 11:08:40 +08:00
std::shared_ptr<DoricAsyncResult>
invokeContextEntityMethod(QString contextId, QString method,
QVariantList args) override;
2021-02-04 16:59:58 +08:00
2021-05-12 11:08:40 +08:00
std::shared_ptr<DoricAsyncResult>
invokeDoricMethod(QString method, QVariantList args) override;
2021-02-04 16:59:58 +08:00
2021-05-12 11:08:40 +08:00
std::shared_ptr<DoricAsyncResult> asyncCall(std::function<void()> lambda,
DoricThreadMode mode) override;
2021-02-07 11:21:53 +08:00
2021-05-12 11:08:40 +08:00
std::shared_ptr<DoricAsyncResult>
createContext(QString contextId, QString script, QString source) override;
2021-02-04 16:59:58 +08:00
2021-05-12 11:08:40 +08:00
std::shared_ptr<DoricAsyncResult> destroyContext(QString contextId) override;
2021-02-04 16:59:58 +08:00
DoricRegistry *getRegistry() override;
};
#endif // NATIVEDRIVER_H