From fd46d4667611c0db9cea3f06205727399b6fb5fd Mon Sep 17 00:00:00 2001 From: saturneric Date: Sun, 29 Oct 2023 02:46:15 +0800 Subject: refactor: start to tidy up code using clang-tidy --- src/core/function/gpg/GpgCommandExecutor.h | 33 ++++-------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) (limited to 'src/core/function/gpg/GpgCommandExecutor.h') diff --git a/src/core/function/gpg/GpgCommandExecutor.h b/src/core/function/gpg/GpgCommandExecutor.h index fc9f2a83..f017fdfb 100644 --- a/src/core/function/gpg/GpgCommandExecutor.h +++ b/src/core/function/gpg/GpgCommandExecutor.h @@ -28,17 +28,7 @@ #pragma once -#include - #include "core/module/Module.h" -#include "core/thread/TaskRunner.h" -#ifndef WINDOWS -#include -#endif - -#include "core/GpgContext.h" -#include "core/GpgFunctionObject.h" -#include "core/thread/Task.h" namespace GpgFrontend { @@ -50,8 +40,7 @@ using GpgCommandExecutorInteractor = std::function; * @brief Extra commands related to GPG * */ -class GPGFRONTEND_CORE_EXPORT GpgCommandExecutor - : public SingletonFunctionObject { +class GPGFRONTEND_CORE_EXPORT GpgCommandExecutor { public: struct ExecuteContext { const std::string cmd; @@ -70,31 +59,17 @@ class GPGFRONTEND_CORE_EXPORT GpgCommandExecutor using ExecuteContexts = std::vector; - /** - * @brief Construct a new Gpg Command Executor object - * - * @param channel Corresponding context - */ - explicit GpgCommandExecutor( - int channel = SingletonFunctionObject::GetDefaultChannel()); - /** * @brief Excuting a command * * @param arguments Command parameters * @param interact_func Command answering function */ - void ExecuteSync(ExecuteContext); - - void ExecuteConcurrentlyAsync(ExecuteContexts); - - void ExecuteConcurrentlySync(ExecuteContexts); + static void ExecuteSync(ExecuteContext); - private: - GpgContext &ctx_ = GpgContext::GetInstance( - SingletonFunctionObject::GetChannel()); ///< Corresponding context + static void ExecuteConcurrentlyAsync(ExecuteContexts); - Thread::Task *build_task_from_exec_ctx(const ExecuteContext &); + static void ExecuteConcurrentlySync(ExecuteContexts); }; } // namespace GpgFrontend -- cgit v1.2.3