This commit is contained in:
ouczbs 2024-10-30 15:14:40 +08:00
parent 9b22a5980a
commit efb590c2cd
2 changed files with 3 additions and 27 deletions

View File

@ -8,16 +8,8 @@ namespace refl{
using Impl = gen::MetaImpl<T, string_hash("Meta")>; using Impl = gen::MetaImpl<T, string_hash("Meta")>;
{%- endif %} {%- endif %}
{%- if IsMultyMeta %} {%- if IsMultyMeta %}
{%- for Meta in MetaList %} consteval static auto MetaList() {
static const UClass* get_{{Meta}}(); return std::array{ {% for Meta in MetaList %}string_hash("{{Meta}}"){% unless forloop.last %}, {% endunless %}{% endfor %} };
{%- endfor %}
static const UClass* GetMeta(Name name) {
{%- for Meta in MetaList %}
if (name == string_hash("{{Meta}}")) {
return get_{{Meta}}();
}
{%- endfor %}
return nullptr;
} }
{%- endif %} {%- endif %}
}; };

View File

@ -22,20 +22,4 @@ namespace gen{
}; };
}; };
}; };
} }
{%- if MetaType == 1 %}
namespace refl{
const UClass* Meta<{{FullName}}>::get_{{ MetaName }}()
{
static const UClass_Meta<T, gen::MetaImpl<T, string_hash("{{ MetaName }}")>> s_cls{};
return &s_cls;
};
}
{%- elsif MetaType == 2 %}
namespace refl{
inline const UClass* Meta<{{FullName}}>::get_{{ MetaName }}()
{
return &TypeInfo<T>::StaticClass;
};
}
{%- endif %}