diff options
author | saturneric <[email protected]> | 2024-02-28 16:32:43 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-02-28 16:32:43 +0000 |
commit | 12d70e1792a5b1ff08d4b58fb49fb9e58d6551a8 (patch) | |
tree | 1b747d6a3a034814104df6f531077de9c03ecd53 /src/core/module/Module.h | |
parent | feat: add user agent header when doing http request (diff) | |
download | GpgFrontend-12d70e1792a5b1ff08d4b58fb49fb9e58d6551a8.tar.gz GpgFrontend-12d70e1792a5b1ff08d4b58fb49fb9e58d6551a8.zip |
feat: upgrade module system
1. load module and resolve symbols at runtime
2. restrict sdk functions and structures to c style
3. add some core api to support it
Diffstat (limited to 'src/core/module/Module.h')
-rw-r--r-- | src/core/module/Module.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/core/module/Module.h b/src/core/module/Module.h index 2a5b54e7..5eb214cc 100644 --- a/src/core/module/Module.h +++ b/src/core/module/Module.h @@ -30,6 +30,7 @@ #include "core/module/Event.h" #include "core/thread/TaskRunner.h" +#include "module/sdk/Module.h" namespace GpgFrontend::Module { @@ -47,21 +48,27 @@ using TaskRunnerPtr = std::shared_ptr<Thread::TaskRunner>; class GPGFRONTEND_CORE_EXPORT Module : public QObject { Q_OBJECT public: - Module(ModuleIdentifier, ModuleVersion, const ModuleMetaData&); + Module(ModuleIdentifier, ModuleVersion, const ModuleMetaData &); + + explicit Module(QLibrary &module_library); ~Module(); - virtual auto Register() -> bool = 0; + auto IsGood() -> bool; + + virtual auto Register() -> int; + + virtual auto Active() -> int; - virtual auto Active() -> bool = 0; + virtual auto Exec(EventRefrernce) -> int; - virtual auto Exec(EventRefrernce) -> int = 0; + virtual auto Deactive() -> int; - virtual auto Deactive() -> bool = 0; + virtual auto UnRegister() -> int; [[nodiscard]] auto GetModuleIdentifier() const -> ModuleIdentifier; - void SetGPC(GlobalModuleContext*); + void SetGPC(GlobalModuleContext *); protected: auto getChannel() -> int; |