fix: problems in infrastructure in some cases
This commit is contained in:
parent
b6f4647719
commit
55d29163da
@ -43,7 +43,7 @@
|
|||||||
#define UDUP(v) UnStrDup(v)
|
#define UDUP(v) UnStrDup(v)
|
||||||
#define QDUP(v) QStrDup(v)
|
#define QDUP(v) QStrDup(v)
|
||||||
|
|
||||||
#define LISTEN(event) GFModuleListenEvent(GFGetModuleID(), DUP(event));
|
#define LISTEN(event) GFModuleListenEvent(GFGetModuleID(), DUP(event))
|
||||||
|
|
||||||
#define EXECUTE_MODULE() \
|
#define EXECUTE_MODULE() \
|
||||||
auto GFExecuteModule(GFModuleEvent* p_event) -> int { \
|
auto GFExecuteModule(GFModuleEvent* p_event) -> int { \
|
||||||
@ -52,13 +52,17 @@
|
|||||||
#define END_EXECUTE_MODULE() }
|
#define END_EXECUTE_MODULE() }
|
||||||
|
|
||||||
#define CB_SUCC(event) \
|
#define CB_SUCC(event) \
|
||||||
|
{ \
|
||||||
CB(event, GFGetModuleID(), {{"ret", "0"}}); \
|
CB(event, GFGetModuleID(), {{"ret", "0"}}); \
|
||||||
return 0;
|
return 0; \
|
||||||
|
}
|
||||||
|
|
||||||
#define CB_ERR(event, ret, err) \
|
#define CB_ERR(event, ret, err) \
|
||||||
|
{ \
|
||||||
CB(event, GFGetModuleID(), \
|
CB(event, GFGetModuleID(), \
|
||||||
{{"ret", QString::number(ret)}, {"reason", QString(err)}}); \
|
{{"ret", QString::number(ret)}, {"err", QString(err)}}); \
|
||||||
return ret;
|
return ret; \
|
||||||
|
}
|
||||||
|
|
||||||
inline void MLogDebug(const QString& s) { GFModuleLogDebug(s.toUtf8()); }
|
inline void MLogDebug(const QString& s) { GFModuleLogDebug(s.toUtf8()); }
|
||||||
inline void MLogInfo(const QString& s) { GFModuleLogInfo(s.toUtf8()); }
|
inline void MLogInfo(const QString& s) { GFModuleLogInfo(s.toUtf8()); }
|
||||||
@ -292,11 +296,6 @@ inline auto CharArrayToQStringList(char** pl_components,
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
|
||||||
auto FormatString(const QString& format, Args... args) -> QString {
|
|
||||||
return FormatStringHelper(format, args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
auto FormatStringHelper(const QString& format, T arg) -> QString {
|
auto FormatStringHelper(const QString& format, T arg) -> QString {
|
||||||
return format.arg(arg);
|
return format.arg(arg);
|
||||||
@ -306,3 +305,12 @@ template <typename T, typename... Args>
|
|||||||
auto FormatStringHelper(const QString& format, T arg, Args... args) -> QString {
|
auto FormatStringHelper(const QString& format, T arg, Args... args) -> QString {
|
||||||
return FormatStringHelper(format.arg(arg), args...);
|
return FormatStringHelper(format.arg(arg), args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline auto FormatStringHelper(const QString& format) -> QString {
|
||||||
|
return format;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename... Args>
|
||||||
|
auto FormatString(const QString& format, Args... args) -> QString {
|
||||||
|
return FormatStringHelper(format, args...);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user