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 = std::map<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  ~Module();
53 
54  virtual auto Register() -> bool = 0;
55 
56  virtual auto Active() -> bool = 0;
57 
58  virtual auto Exec(EventRefrernce) -> int = 0;
59 
60  virtual auto Deactive() -> bool = 0;
61 
62  [[nodiscard]] auto GetModuleIdentifier() const -> ModuleIdentifier;
63 
64  void SetGPC(GlobalModuleContext*);
65 
66  protected:
67  auto getChannel() -> int;
68 
69  auto getDefaultChannel() -> int;
70 
71  auto getTaskRunner() -> TaskRunnerPtr;
72 
73  auto listenEvent(EventIdentifier) -> bool;
74 
75  private:
76  class Impl;
77  SecureUniquePtr<Impl> p_;
78 };
79 
80 } // namespace GpgFrontend::Module
Definition: GlobalModuleContext.h:54
Definition: Module.cpp:35
Definition: Module.h:47
Definition: Event.cpp:31