Improve fullName template

fullName now support multi-pararmeter templates
This commit is contained in:
Mergul 2023-05-24 22:15:05 +02:00
parent 6a600d22c8
commit 1a5452d6cc
3 changed files with 43 additions and 6 deletions

View file

@ -386,6 +386,7 @@ export struct EntityManager
else
assert(pass < passes.length, "Update pass (ID " ~ pass.to!string ~ ") doesn't exist.");
// enum SystemName = __traits(fullyQualifiedName,Sys);
// enum SystemName = fullyQualifiedName!Sys;
enum SystemName = fullName!Sys;
//enum SystemName = Sys.stringof;
@ -427,7 +428,8 @@ export struct EntityManager
{
alias EventParamType = Params[1];
enum EventName = fullName!(Unqual!(EventParamType));
// enum EventName = fullyQualifiedName!(Unqual!(EventParamType));//.stringof;
// enum EventName = __traits(fullyQualifiedName,Unqual!(EventParamType));
// enum EventName = fullyQualifiedName!(Unqual!(EventParamType));
ushort evt = events_map.get(cast(char[]) EventName, ushort.max);
assert(evt != ushort.max,
"Can't register system \"" ~ SystemName
@ -489,8 +491,10 @@ export struct EntityManager
string name;
static if (isArray!MemberType)
{ // Workaround. This code is never called with: not an array type, but compiler prints an error
// name = fullyQualifiedName!(Unqual!(ForeachType!MemberType));//.stringof;
name = fullName!(Unqual!(typeof(MemberType.init[0])));
// name = __traits(fullyQualifiedName,Unqual!(ForeachType!MemberType));
// name = fullyQualifiedName!(Unqual!(ForeachType!MemberType));
// name = fullName!(Unqual!(typeof(MemberType.init[0])));
name = fullName!(Unqual!(Unqual!(ForeachType!MemberType)));
}
bool is_optional;
@ -715,8 +719,9 @@ export struct EntityManager
string name;
static if (isArray!MemberType)
{ // Workaround. This code is never called with: not an array type, but compiler prints an error
// name = __traits(fullyQualifiedName,Unqual!(ForeachType!MemberType));
// name = fullyQualifiedName!(Unqual!(ForeachType!MemberType));
name = fullName!(Unqual!(typeof(MemberType.init[0])));
name = fullName!(Unqual!(ForeachType!MemberType));
//name = Unqual!(ForeachType!MemberType).stringof;
}
@ -1296,6 +1301,7 @@ export struct EntityManager
{
ComponentInfo info;
// enum ComponentName = __traits(fullyQualifiedName,Comp);
// enum ComponentName = fullyQualifiedName!Comp;
enum ComponentName = fullName!Comp;
// enum ComponentName = Comp.stringof;