GpgFrontend Project A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.

GpgCommandExecutor.h
1
29 #ifndef GPGFRONTEND_ZH_CN_TS_GPGCOMMANDEXECUTOR_H
30 #define GPGFRONTEND_ZH_CN_TS_GPGCOMMANDEXECUTOR_H
31
32 #ifndef WINDOWS
33 #include <boost/process.hpp>
34 #endif
35
36 #include "core/GpgContext.h"
37 #include "core/GpgFunctionObject.h"
38 #include "core/thread/Task.h"
39
40 namespace GpgFrontend {
41
46 class GPGFRONTEND_CORE_EXPORT GpgCommandExecutor
47 : public SingletonFunctionObject<GpgCommandExecutor> {
48 public:
54 explicit GpgCommandExecutor(
55 int channel = SingletonFunctionObject::GetDefaultChannel());
56
63 void Execute(
64 std::string cmd, std::vector<std::string> arguments,
65 std::function<void(int, std::string, std::string)> callback =
66 [](int, std::string, std::string) {},
67 std::function<void(QProcess *)> interact_func = [](QProcess *) {});
68
69 void ExecuteConcurrently(
70 std::string cmd, std::vector<std::string> arguments,
71 std::function<void(int, std::string, std::string)> callback,
72 std::function<void(QProcess *)> interact_func = [](QProcess *) {});
73
74 private:
75 GpgContext &ctx_ = GpgContext::GetInstance(
76 SingletonFunctionObject::GetChannel());
77 };
78
79 } // namespace GpgFrontend
80
81 #endif // GPGFRONTEND_ZH_CN_TS_GPGCOMMANDEXECUTOR_H
GpgFrontend::GpgCommandExecutor
Extra commands related to GPG.
Definition: GpgCommandExecutor.h:47
GpgFrontend::GpgContext
Definition: GpgContext.h:71
GpgFrontend::SingletonFunctionObject
Definition: GpgFunctionObject.h:150
GpgFrontend::SingletonFunctionObject::GetDefaultChannel
static int GetDefaultChannel()
Get the Default Channel object.
Definition: GpgFunctionObject.h:251
GpgFrontend::SingletonFunctionObject< GpgContext >::GetInstance
static GpgContext & GetInstance(int channel=GpgFrontend::GPGFRONTEND_DEFAULT_CHANNEL)
Get the Instance object.
Definition: GpgFunctionObject.h:172
GpgFrontend::SingletonFunctionObject::GetChannel
int GetChannel() const
Get the Channel object.
Definition: GpgFunctionObject.h:258
GpgFrontend
Definition: CoreCommonUtil.cpp:31