diff options
author | saturneric <[email protected]> | 2024-02-29 10:15:57 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-02-29 10:15:57 +0000 |
commit | c1f5b3336836e15d193582e9b8f3e044f7d8bc1b (patch) | |
tree | 35e9edb2e8f0c80dbafb76cc05ad6fe92c2c11d0 /src/module/sdk/Module.cpp | |
parent | feat: upgrade module system (diff) | |
download | GpgFrontend-c1f5b3336836e15d193582e9b8f3e044f7d8bc1b.tar.gz GpgFrontend-c1f5b3336836e15d193582e9b8f3e044f7d8bc1b.zip |
feat: add module controller and continue to work on module system
1. speed up building by reducing build info sheader including
2. add module controller
3. continue to work on module system
Diffstat (limited to '')
-rw-r--r-- | src/module/sdk/Module.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/module/sdk/Module.cpp b/src/module/sdk/Module.cpp index 36fe7b91..c69f6e5c 100644 --- a/src/module/sdk/Module.cpp +++ b/src/module/sdk/Module.cpp @@ -29,9 +29,9 @@ #include "Module.h" #include <core/module/ModuleManager.h> +#include <core/utils/CommonUtils.h> #include "Basic.h" -#include "core/utils/CommonUtils.h" void ListenEvent(const char *module_id, const char *event_id) { return GpgFrontend::Module::ModuleManager::GetInstance().ListenEvent( @@ -40,13 +40,16 @@ void ListenEvent(const char *module_id, const char *event_id) { auto RetrieveRTValueOrDefault(const char *namespace_, const char *key, const char *default_value) -> const char * { - return GpgFrontend::Module::RetrieveRTValueTypedOrDefault( - namespace_, key, QString::fromUtf8(default_value)) - .toUtf8(); + return GpgFrontend::GFStrDup( + GpgFrontend::Module::RetrieveRTValueTypedOrDefault( + QString::fromUtf8(namespace_), QString::fromUtf8(key), + QString::fromUtf8(default_value))); } void UpsertRTValue(const char *namespace_, const char *key, const char *vaule) { - GpgFrontend::Module::UpsertRTValue(namespace_, key, vaule); + GpgFrontend::Module::UpsertRTValue(QString::fromUtf8(namespace_), + QString::fromUtf8(key), + QString::fromUtf8(vaule)); } auto ListRTChildKeys(const char *namespace_, const char *key, @@ -57,15 +60,10 @@ auto ListRTChildKeys(const char *namespace_, const char *key, if (keys.empty()) return 0; *child_keys = - static_cast<char **>(AllocateMemory(sizeof(const char **) * keys.size())); + static_cast<char **>(AllocateMemory(sizeof(char **) * keys.size())); for (int i = 0; i < keys.size(); i++) { - *child_keys[i] = - static_cast<char *>(AllocateMemory(sizeof(char) * keys[i].size() + 1)); - - auto key = keys[i].toUtf8(); - memcpy(reinterpret_cast<void *>(*child_keys[i]), key, key.size()); - (*child_keys[i])[key.size()] = '\0'; + (*child_keys)[i] = GpgFrontend::GFStrDup(keys[i]); } return static_cast<int32_t>(keys.size()); |