防止命名空间歧义

This commit is contained in:
xiongziliang 2022-02-05 01:01:29 +08:00
parent 4505f8ff4f
commit 0402646f7c
2 changed files with 33 additions and 33 deletions

@ -1 +1 @@
Subproject commit b49676057e05bed1b43070c99bc4e541f2302526 Subproject commit 40c09a4865026de94cdc1ad874aeba580bf15fdf

View File

@ -103,45 +103,45 @@ extern const std::string kBroadcastReloadConfig;
#define BroadcastReloadConfigArgs void #define BroadcastReloadConfigArgs void
#define ReloadConfigTag ((void *)(0xFF)) #define ReloadConfigTag ((void *)(0xFF))
#define RELOAD_KEY(arg,key) \ #define RELOAD_KEY(arg,key) \
do { \ do { \
decltype(arg) arg##_tmp = toolkit::mINI::Instance()[key]; \ decltype(arg) arg##_tmp = ::toolkit::mINI::Instance()[key]; \
if (arg == arg##_tmp) { \ if (arg == arg##_tmp) { \
return; \ return; \
} \ } \
arg = arg##_tmp; \ arg = arg##_tmp; \
InfoL << "reload config:" << key << "=" << arg; \ InfoL << "reload config:" << key << "=" << arg; \
} while(0) } while(0)
//监听某个配置发送变更 //监听某个配置发送变更
#define LISTEN_RELOAD_KEY(arg, key, ...) \ #define LISTEN_RELOAD_KEY(arg, key, ...) \
do { \ do { \
static toolkit::onceToken s_token_listen([](){ \ static ::toolkit::onceToken s_token_listen([](){ \
toolkit::NoticeCenter::Instance().addListener(ReloadConfigTag, \ ::toolkit::NoticeCenter::Instance().addListener(ReloadConfigTag, \
Broadcast::kBroadcastReloadConfig,[](BroadcastReloadConfigArgs) { \ Broadcast::kBroadcastReloadConfig,[](BroadcastReloadConfigArgs) { \
__VA_ARGS__; \ __VA_ARGS__; \
}); \ }); \
}); \ }); \
} while(0) } while(0)
#define GET_CONFIG(type, arg, key) \ #define GET_CONFIG(type, arg, key) \
static type arg = toolkit::mINI::Instance()[key]; \ static type arg = ::toolkit::mINI::Instance()[key]; \
LISTEN_RELOAD_KEY(arg, key, { \ LISTEN_RELOAD_KEY(arg, key, { \
RELOAD_KEY(arg, key); \ RELOAD_KEY(arg, key); \
}); });
#define GET_CONFIG_FUNC(type, arg, key, ...) \ #define GET_CONFIG_FUNC(type, arg, key, ...) \
static type arg; \ static type arg; \
do { \ do { \
static toolkit::onceToken s_token_set([](){ \ static ::toolkit::onceToken s_token_set([](){ \
static auto lam = __VA_ARGS__ ; \ static auto lam = __VA_ARGS__ ; \
static auto arg##_str = toolkit::mINI::Instance()[key]; \ static auto arg##_str = ::toolkit::mINI::Instance()[key]; \
arg = lam(arg##_str); \ arg = lam(arg##_str); \
LISTEN_RELOAD_KEY(arg, key, { \ LISTEN_RELOAD_KEY(arg, key, { \
RELOAD_KEY(arg##_str, key); \ RELOAD_KEY(arg##_str, key); \
arg = lam(arg##_str); \ arg = lam(arg##_str); \
}); \ }); \
}); \ }); \
} while(0) } while(0)
} //namespace Broadcast } //namespace Broadcast