cppast/src/refl/template/meta_impl.liquid
2024-10-30 15:14:40 +08:00

25 lines
1.3 KiB
Plaintext

namespace gen{
template<> struct MetaImpl<{{FullName}}, string_hash("{{MetaName}}")> : public refl::MetaHelp {
using T = {{FullName}};
consteval static int MemberCount() { return {{MemberCount}}; };
consteval static int CtorCount() { return {{CtorCount}}; };
consteval static auto Fields(){
return std::make_tuple({% for field in FieldList limit:LastAttrIndex%}{%- if field.Type == 1 %}FProperty(&T::{{field.Name}},"{{field.Name}}"){% unless forloop.last %}, {% endunless %}{%- endif %}{% endfor %});
}
static auto MakeFields() {
return std::array{
{%- for field in FieldList %}
{%- if field.Type == 1 %}
MemberField(&T::{{field.Name}}, FName("{{field.Name}}"), {{field.Meta}}),
{%- elsif field.Type == 2 %}
CtorField((T::{{field.Ref}})nullptr, {{field.Meta}}),
{%- elsif field.Type == 3 %}
MethodField(&T::{{field.Name}}, FName("{{field.Name}}"), {{field.Meta}}),
{%- else %}
MethodField((T::{{field.Ref}})&T::{{field.Name}}, FName("{{field.Name}}"), {{field.Meta}}),
{%- endif %}
{%- endfor %}
};
};
};
}