diff options
author | saturneric <[email protected]> | 2024-01-12 06:02:37 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-01-12 06:02:37 +0000 |
commit | bf538056b24a68b8fd235b1c50991ee8eb46a776 (patch) | |
tree | e1bab54095b80df62b321fb5bd69453f9f951b05 /src/core/module/ModuleManager.h | |
parent | feat: improve api and ui of keys import and export (diff) | |
download | GpgFrontend-bf538056b24a68b8fd235b1c50991ee8eb46a776.tar.gz GpgFrontend-bf538056b24a68b8fd235b1c50991ee8eb46a776.zip |
refactor: use QString instead of std::string and improve threading system
Diffstat (limited to 'src/core/module/ModuleManager.h')
-rw-r--r-- | src/core/module/ModuleManager.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/core/module/ModuleManager.h b/src/core/module/ModuleManager.h index bf00c87c..93b89e95 100644 --- a/src/core/module/ModuleManager.h +++ b/src/core/module/ModuleManager.h @@ -50,12 +50,12 @@ class GlobalModuleContext; class ModuleManager; using EventRefrernce = std::shared_ptr<Event>; -using ModuleIdentifier = std::string; +using ModuleIdentifier = QString; using ModulePtr = std::shared_ptr<Module>; using ModuleMangerPtr = std::shared_ptr<ModuleManager>; using GMCPtr = std::shared_ptr<GlobalModuleContext>; -using Namespace = std::string; -using Key = std::string; +using Namespace = QString; +using Key = QString; using LPCallback = std::function<void(Namespace, Key, int, std::any)>; class GPGFRONTEND_CORE_EXPORT ModuleManager @@ -83,8 +83,7 @@ class GPGFRONTEND_CORE_EXPORT ModuleManager auto ListenRTPublish(QObject*, Namespace, Key, LPCallback) -> bool; - auto ListRTChildKeys(const std::string&, const std::string&) - -> std::vector<Key>; + auto ListRTChildKeys(const QString&, const QString&) -> std::vector<Key>; private: class Impl; @@ -130,8 +129,8 @@ auto GPGFRONTEND_CORE_EXPORT IsModuleAcivate(ModuleIdentifier) -> bool; * @return true * @return false */ -auto GPGFRONTEND_CORE_EXPORT UpsertRTValue(const std::string& namespace_, - const std::string& key, +auto GPGFRONTEND_CORE_EXPORT UpsertRTValue(const QString& namespace_, + const QString& key, const std::any& value) -> bool; /** @@ -150,12 +149,12 @@ auto GPGFRONTEND_CORE_EXPORT ListenRTPublishEvent(QObject*, Namespace, Key, * @param key * @return std::vector<Key> */ -auto GPGFRONTEND_CORE_EXPORT ListRTChildKeys(const std::string& namespace_, - const std::string& key) +auto GPGFRONTEND_CORE_EXPORT ListRTChildKeys(const QString& namespace_, + const QString& key) -> std::vector<Key>; template <typename T> -auto RetrieveRTValueTyped(const std::string& namespace_, const std::string& key) +auto RetrieveRTValueTyped(const QString& namespace_, const QString& key) -> std::optional<T> { auto any_value = ModuleManager::GetInstance().RetrieveRTValue(namespace_, key); @@ -166,9 +165,9 @@ auto RetrieveRTValueTyped(const std::string& namespace_, const std::string& key) } template <typename T> -auto RetrieveRTValueTypedOrDefault(const std::string& namespace_, - const std::string& key, - const T& defaultValue) -> T { +auto RetrieveRTValueTypedOrDefault(const QString& namespace_, + const QString& key, const T& defaultValue) + -> T { auto any_value = ModuleManager::GetInstance().RetrieveRTValue(namespace_, key); if (any_value && any_value->type() == typeid(T)) { |