aboutsummaryrefslogtreecommitdiffstats
path: root/include/GFModuleDefine.h
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-11-25 21:42:13 +0000
committersaturneric <[email protected]>2024-11-25 21:42:13 +0000
commit664d3cff16ceeb2d7136583d5331e9146de40643 (patch)
treee36ab18d77f5158edc3754e415a118d2e02b23cd /include/GFModuleDefine.h
parentfix: make cache variable docstring clear (diff)
downloadModules-664d3cff16ceeb2d7136583d5331e9146de40643.tar.gz
Modules-664d3cff16ceeb2d7136583d5331e9146de40643.zip
feat: prettify model event handling logic
Diffstat (limited to '')
-rw-r--r--include/GFModuleDefine.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/GFModuleDefine.h b/include/GFModuleDefine.h
index 9585140..c36f139 100644
--- a/include/GFModuleDefine.h
+++ b/include/GFModuleDefine.h
@@ -44,3 +44,23 @@
return QMapToGFModuleMetaDataList( \
{{"Name", (name)}, {"Description", (desc)}, {"Author", (author)}}); \
}
+
+#define GF_MODULE_API_DEFINE_V2(id, name, ver, desc, author) \
+ auto GFGetModuleGFSDKVersion() -> const char* { \
+ return DUP(GF_SDK_VERSION_STR); \
+ } \
+ auto GFGetModuleQtEnvVersion() -> const char* { \
+ return DUP(QT_VERSION_STR); \
+ } \
+ auto GFGetModuleID() -> const char* { return DUP((id)); } \
+ auto GFGetModuleVersion() -> const char* { return DUP((ver)); } \
+ auto GFGetModuleMetaData() -> GFModuleMetaData* { \
+ return QMapToGFModuleMetaDataList( \
+ {{"Name", (name)}, {"Description", (desc)}, {"Author", (author)}}); \
+ } \
+ using MEvent = QMap<QString, QString>; \
+ using EventHandler = std::function<int(const MEvent&)>; \
+ static QMap<QString, EventHandler> Module##nameEventHandlers; \
+ static QMap<QString, EventHandler>& _gr_module_event_handlers = \
+ Module##nameEventHandlers; \
+ DEFINE_EXECUTE_API_USING_STANDARD_EVEN_HANDLE_MODEL \ No newline at end of file