aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpg/GpgFunctionObject.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpg/GpgFunctionObject.h')
-rw-r--r--src/gpg/GpgFunctionObject.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/gpg/GpgFunctionObject.h b/src/gpg/GpgFunctionObject.h
index a8746edf..6f1d60af 100644
--- a/src/gpg/GpgFunctionObject.h
+++ b/src/gpg/GpgFunctionObject.h
@@ -1,7 +1,7 @@
/**
- * This file is part of GPGFrontend.
+ * This file is part of GpgFrontend.
*
- * GPGFrontend is free software: you can redistribute it and/or modify
+ * GpgFrontend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@@ -25,6 +25,8 @@
#ifndef GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H
#define GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H
+#include <easyloggingpp/easylogging++.h>
+
#include <map>
#include <memory>
#include <mutex>
@@ -32,8 +34,6 @@
#include <stdexcept>
#include <string>
-#include <easyloggingpp/easylogging++.h>
-
namespace GpgFrontend {
template <typename T>
@@ -42,8 +42,7 @@ class SingletonFunctionObject {
static T& GetInstance(int channel = 0) {
if (!channel) {
std::lock_guard<std::mutex> guard(_instance_mutex);
- if (_instance == nullptr)
- _instance = std::make_unique<T>();
+ if (_instance == nullptr) _instance = std::make_unique<T>();
return *_instance;
} else {
// read _instances_map
@@ -60,8 +59,7 @@ class SingletonFunctionObject {
}
static T& CreateInstance(int channel, std::unique_ptr<T> p_obj = nullptr) {
- if (!channel)
- return *_instance;
+ if (!channel) return *_instance;
// read _instances_map
decltype(_instances_map.end()) _it;
@@ -74,8 +72,7 @@ class SingletonFunctionObject {
std::lock_guard<std::mutex> guard(_default_channel_mutex);
int tmp = channel;
std::swap(_default_channel, tmp);
- if (p_obj == nullptr)
- p_obj = std::make_unique<T>();
+ if (p_obj == nullptr) p_obj = std::make_unique<T>();
std::swap(_default_channel, tmp);
}
T* obj = p_obj.get();