refactor: adapt magic_enum to Qt (#5258)

This commit is contained in:
nerix
2024-03-23 12:22:42 +01:00
committed by GitHub
parent 044d457d20
commit ed20e71db4
25 changed files with 603 additions and 80 deletions
+7 -7
View File
@@ -107,14 +107,14 @@ public:
return {};
}
// this uses magic enum to help automatic tooling find usages
auto typeName =
magic_enum::enum_name(lua::api::EventType::CompletionRequested);
std::string cbName;
cbName.reserve(5 + typeName.size());
cbName += "c2cb-";
cbName += typeName;
auto typ =
lua_getfield(this->state_, LUA_REGISTRYINDEX,
QString("c2cb-%1")
.arg(magic_enum::enum_name<lua::api::EventType>(
lua::api::EventType::CompletionRequested)
.data())
.toStdString()
.c_str());
lua_getfield(this->state_, LUA_REGISTRYINDEX, cbName.c_str());
if (typ != LUA_TFUNCTION)
{
lua_pop(this->state_, 1);