GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
Module.h
1 
29 #pragma once
30 
31 #include "core/module/Event.h"
32 #include "core/thread/TaskRunner.h"
33 
34 namespace GpgFrontend::Module {
35 
36 class Module;
37 class GlobalModuleContext;
38 class ModuleManager;
39 
40 using ModuleIdentifier = QString;
41 using ModuleVersion = QString;
42 using ModuleMetaData = QMap<QString, QString>;
43 using ModulePtr = std::shared_ptr<Module>;
44 
45 using TaskRunnerPtr = std::shared_ptr<Thread::TaskRunner>;
46 
47 class GPGFRONTEND_CORE_EXPORT Module : public QObject {
48  Q_OBJECT
49  public:
50  Module(ModuleIdentifier, ModuleVersion, const ModuleMetaData &);
51 
52  explicit Module(QLibrary &module_library);
53 
54  ~Module();
55 
56  auto IsGood() -> bool;
57 
58  virtual auto Register() -> int;
59 
60  virtual auto Active() -> int;
61 
62  virtual auto Exec(EventReference) -> int;
63 
64  virtual auto Deactive() -> int;
65 
66  virtual auto UnRegister() -> int;
67 
68  [[nodiscard]] auto GetModuleIdentifier() const -> ModuleIdentifier;
69 
70  [[nodiscard]] auto GetModuleVersion() const -> ModuleVersion;
71 
72  [[nodiscard]] auto GetModuleMetaData() const -> ModuleMetaData;
73 
74  [[nodiscard]] auto GetModulePath() const -> QString;
75 
76  [[nodiscard]] auto GetModuleHash() const -> QString;
77 
78  [[nodiscard]] auto GetModuleSDKVersion() const -> QString;
79 
80  [[nodiscard]] auto GetModuleQtEnvVersion() const -> QString;
81 
82  void SetGPC(GlobalModuleContext *);
83 
84  protected:
85  auto getChannel() -> int;
86 
87  auto getDefaultChannel() -> int;
88 
89  auto getTaskRunner() -> TaskRunnerPtr;
90 
91  auto listenEvent(EventIdentifier) -> bool;
92 
93  private:
94  class Impl;
95  SecureUniquePtr<Impl> p_;
96 };
97 
98 } // namespace GpgFrontend::Module
Definition: GlobalModuleContext.h:54
Definition: Module.cpp:39
Definition: Module.h:47
Definition: Event.cpp:33