rebuild with refl_impl

This commit is contained in:
ouczbs 2024-06-20 22:32:20 +08:00
parent e3f111ec3c
commit e4bba053cc
11 changed files with 329 additions and 208 deletions

View File

@ -98,7 +98,7 @@ namespace refl
{
cls_meta.Fields.Add(key, new FieldMeta());
}
List<string> nameList = new List<string>{ cppClass.Name };
List<string> nameList = new List<string>{ "T" };
foreach (var parm in func.Parameters)
{
nameList.Add(parm.Type.FullName);
@ -137,7 +137,10 @@ namespace refl
foreach (var spaces in cpp.Namespaces)
{
var child = ParseCppNamespaces(spaces);
module.ChildList.Add(child);
if(child.ClassList.Count > 0 || child.ChildList.Count > 0)
{
module.ChildList.Add(child);
}
}
return module;
}
@ -147,7 +150,10 @@ namespace refl
foreach (var cppClass in cpp.Classes)
{
var cls_meta = ParseCppClass(cppClass);
module.ClassList.Add(cls_meta);
if(cls_meta.Fields.Count > 0)
{
module.ClassList.Add(cls_meta);
}
}
foreach(var spaces in cpp.Namespaces)
{

View File

@ -1,4 +1,6 @@
using Fluid;
using Microsoft.Extensions.Primitives;
using System.IO;
using System.Text;
using System.Xml.Linq;
@ -7,18 +9,29 @@ namespace refl
internal class Gen
{
public static Dictionary<string, StringBuilder> FileList = new Dictionary<string, StringBuilder>();
public static StringBuilder Meta = new StringBuilder();
public static StringBuilder Output = new StringBuilder();
private ClassMetaData data = new ClassMetaData();
private GenMeta meta = new GenMeta();
private GenMetaImpl metaImpl = new GenMetaImpl();
private GenMultyMeta multyMeta = new GenMultyMeta();
private Stack<string> nameSpaces = new Stack<string>();
public Gen() { }
public static string PreprocessTemplate(string template, string indent, string newline)
{
// 替换占位符
return template.Replace("{{ Indent }}", indent);
}
public static bool InitTemplate(string dir)
{
string meta_file = Path.Combine(dir, "meta.liquid");
string meta_impl_file = Path.Combine(dir, "meta_impl.liquid");
string multy_meta_file = Path.Combine(dir, "multy_meta.liquid");
var parser = new FluidParser();
return GenMeta.InitTemplate(meta_file, parser) && GenMultyMeta.InitTemplate(multy_meta_file, parser);
return GenMeta.InitTemplate(meta_file, parser)
&& GenMetaImpl.InitTemplate(meta_impl_file, parser)
&& GenMultyMeta.InitTemplate(multy_meta_file, parser);
}
public void CheckDir(string? dir)
{
@ -29,17 +42,14 @@ namespace refl
}
public void InitFile(string file_name)
{
Output.AppendLine("#pragma once");
Meta.AppendLine("#pragma once");
Meta.AppendLine("namespace refl_impl{");
foreach (var name in ModuleMeta.NameSet)
{
var build = new StringBuilder();
build.AppendLine("#pragma once");
build.AppendLine("namespace refl_impl{");
FileList.Add(name, build);
if (name == "Meta")
{
string path = $"Meta_{file_name}".ToLower();
Output.AppendLine($"#include \"{path}\"");
}
}
}
public void GenCppMeta(ModuleMeta module, string target)
@ -53,6 +63,8 @@ namespace refl
}
public void OutFile(string file_name, string? dir,string target)
{
Meta.AppendLine("\r\n");
Output.AppendLine("}\r\n");
foreach (var pair in FileList)
{
string path = $"{pair.Key}_{file_name}".ToLower();
@ -60,9 +72,20 @@ namespace refl
{
path = Path.Combine(dir, path);
}
pair.Value.AppendLine("}\r\n");
File.WriteAllText(path, pair.Value.ToString());
if (pair.Key == "Meta")
{
path = $"Meta_{file_name}".ToLower();
Output.AppendLine($"#include \"{path}\"");
}
}
File.WriteAllText(target, Output.ToString());
using (StreamWriter writer = new StreamWriter(target, false, Encoding.UTF8))
{
writer.Write(Meta.ToString());
writer.Write(Output.ToString());
}
}
public void GenModuleMeta(ModuleMeta module, string? prefix)
{
@ -70,10 +93,9 @@ namespace refl
{
return;
}
var data = new ClassMetaData(prefix + "", module.NameSpace);
if (prefix != null)
{
GenNamespaceBegin(data.Indent, data.NameSpace);
nameSpaces.Push(module.NameSpace);
}
foreach (var cls in module.ClassList)
{
@ -86,38 +108,30 @@ namespace refl
}
if (prefix != null)
{
GenNamespaceEnd(data.Indent);
nameSpaces.Pop();
}
}
public string GenPrefix()
{
if (nameSpaces.Count > 0)
{
return string.Join("::", nameSpaces) + "::";
}
return "";
}
public void GenClassMeta(ClassMeta cls, ClassMetaData data)
{
if (meta.GenClassMeta(cls, data))
string fullName = GenPrefix() + cls.Name;
data.FullName = fullName;
bool isMulty = meta.GenClassMeta(cls, data);
Meta.Append(metaImpl.GenClassMeta(cls, fullName, isMulty));
Meta.AppendLine("");
if (isMulty)
{
var res = multyMeta.GenClassMeta(cls, data.Indent2);
var res = multyMeta.GenClassMeta(cls, fullName);
Output.Append(res);
Output.AppendLine("");
}
}
public static void GenNamespaceBegin(string indent, string name_space)
{
string line = $"{indent}namespace {name_space} {{";
foreach (var name in ModuleMeta.NameSet)
{
FileList[name].AppendLine(line);
}
Output.AppendLine(line);
}
public static void GenNamespaceEnd(string indent)
{
string line = $"{indent}}}";
foreach (var name in ModuleMeta.NameSet)
{
FileList[name].AppendLine(line);
}
Output.AppendLine(line);
}
public static void Append(string name, string res)
{
FileList[name].Append(res);
}
}
}

View File

@ -1,5 +1,6 @@
using System.IO;
using System.Text;
using System.Xml.Linq;
using Fluid;
namespace refl
@ -20,30 +21,14 @@ namespace refl
internal class ClassMetaData
{
public string Name { get; set; } = "";
public string NameSpace { get; set; } = "";
public string ParentName { get; set; } = "";
public string Indent { get; set; } = "";
public string Indent2 { get; set; } = "";
public string FullName { get; set; } = "";
public string MetaName { get; set; } = "";
public bool IsMultyMeta { get; set; } = false;
public int MemberCount { get; set; } = 0;
public int CtorCount { get; set; } = 0;
public List<FieldMetaData> FieldList = new List<FieldMetaData>();
public ClassMetaData(string indent, string nameSpace)
{
Indent = indent;
NameSpace = nameSpace;
if (string.IsNullOrEmpty(nameSpace))
{
Indent2 = indent;
}
else
{
Indent2 = indent + "\t";
}
}
}
internal class GenMeta
@ -53,6 +38,7 @@ namespace refl
public static bool InitTemplate(string path, FluidParser parser)
{
var meta_string = File.ReadAllText(path);
meta_string = Gen.PreprocessTemplate(meta_string, "\t", "\r\n");
parser.TryParse(meta_string, out template, out var error);
options.MemberAccessStrategy.Register<FieldMetaData>();
if (!string.IsNullOrEmpty(error))
@ -89,7 +75,8 @@ namespace refl
isMulty = isMulty || data.IsMultyMeta;
var context = new TemplateContext(data, options);
var res = template.Render(context);
Gen.Append(pair.Key, res);
Gen.FileList[pair.Key].Append(res);
Gen.FileList[pair.Key].AppendLine("");
}
return isMulty;
}

44
src/refl/GenMetaImpl.cs Normal file
View File

@ -0,0 +1,44 @@
using Fluid;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace refl
{
internal class MetaImplClassData
{
public string Name { get; set; } = "";
public string FullName { get; set; } = "";
public bool IsMultyMeta { get; set; } = false;
}
internal class GenMetaImpl
{
private static IFluidTemplate? template;
private static TemplateOptions options = new TemplateOptions();
private MetaImplClassData impl = new MetaImplClassData();
public static bool InitTemplate(string path, FluidParser parser)
{
var meta_string = File.ReadAllText(path);
meta_string = Gen.PreprocessTemplate(meta_string, "\t", "\r\n");
parser.TryParse(meta_string, out template, out var error);
if (!string.IsNullOrEmpty(error))
{
Console.WriteLine(error);
return false;
}
return true;
}
public string GenClassMeta(ClassMeta cls,string fullName, bool isMulty)
{
impl.Name = cls.Name;
impl.FullName = fullName;
impl.IsMultyMeta = isMulty;
var context = new TemplateContext(impl, options);
return template.Render(context);
}
}
}

View File

@ -10,7 +10,7 @@ namespace refl
internal class MultyMetaClassData
{
public string Name { get; set; } = "";
public string Indent2 { get; set; } = "";
public string FullName { get; set; } = "";
public bool HasMeta { get; set; } = false;
public List<string> MetaList = new List<string>();
@ -22,6 +22,7 @@ namespace refl
public static bool InitTemplate(string path, FluidParser parser)
{
var meta_string = File.ReadAllText(path);
meta_string = Gen.PreprocessTemplate(meta_string, "\t", "\r\n");
parser.TryParse(meta_string, out template, out var error);
if (!string.IsNullOrEmpty(error))
{
@ -30,11 +31,11 @@ namespace refl
}
return true;
}
public string GenClassMeta(ClassMeta cls, string indent)
public string GenClassMeta(ClassMeta cls, string fullName)
{
MultyMetaClassData data = new MultyMetaClassData();
data.Name = cls.Name;
data.Indent2 = indent;
data.FullName = fullName;
foreach (var pair in cls.Fields)
{
if (pair.Key.Equals("Meta"))

View File

@ -1,10 +1,12 @@
#pragma once
#if !defined(__cppast)
#define __cppast(...)
#endif
#define __Meta(...) __cppast(Meta,__VA_ARGS__)
#define UPROPERTY(...) __Meta(__VA_ARGS__)
#define UFUNCTION(...) __Meta(__VA_ARGS__)
#define __vkMeta(...) __cppast(vkMeta,__VA_ARGS__)
#define UPROPERTY_vk(...) __vkMeta(__VA_ARGS__)
#define UFUNCTION_vk(...) __vkMeta(__VA_ARGS__)
@ -12,3 +14,20 @@
#define __dxMeta(...) __cppast(dxMeta,__VA_ARGS__)
#define UPROPERTY_dx(...) __dxMeta(__VA_ARGS__)
#define UFUNCTION_dx(...) __dxMeta(__VA_ARGS__)
// 辅助宏,用于实际拼接
#define CONCATENATE(arg1, arg2) CONCATENATE_IMPL(arg1, arg2)
#define CONCATENATE_IMPL(arg1, arg2) arg1##arg2
#define UNIQUE_NAME(base) CONCATENATE(base, __LINE__)
#define OVERLOAD_CTOR_IMPL(Class, ...) using UNIQUE_NAME(__Ctor) = Class(*)(__VA_ARGS__);
#define OVERLOAD_FUNC_IMPL(Func, R, ...) using UNIQUE_NAME(__Func) = R(*)(__VA_ARGS__);
#define OVERLOAD_CTOR(Class, ...) OVERLOAD_CTOR_IMPL(Class, __VA_ARGS__);Class(__VA_ARGS__)
#define OVERLOAD_FUNC(Func, R, ...) OVERLOAD_FUNC_IMPL(Func, R, __VA_ARGS__);R Func(__VA_ARGS__)
namespace refl_impl {
struct Meta {};
struct vkMeta {};
struct dxMeta {};
}

View File

@ -1,75 +1,114 @@
#include <iostream>
#include "refl/refl.h"
using namespace std;
using namespace refl;
struct vec3_parent {
virtual int norm(int x1, int& x2) {
x2 = x1 * x2;
return x2;
//cout << x2 << "vec3_parent::norm" << endl;
#include <objbase.h>
using std::string_view;
namespace engineapi {
namespace test {
struct vec1 {
UPROPERTY({})
int x;
UPROPERTY({})
int y;
};
}
};
struct vec3 : public vec3_parent {
using MyMeta = class vec3_Meta;
UPROPERTY_vk({ 1.f })
float x = 1;
UPROPERTY_dx({ 2.f })
float y = 2;
UPROPERTY({ 5.f })
float z = 3;
UPROPERTY({ "hello meta" })
string name = "???";
UPROPERTY_vk({ 1.f })
UFUNCTION({})
vec3() {
struct Guid
{
UPROPERTY_vk({})
UPROPERTY({})
unsigned int Data1;
UPROPERTY_vk({})
UPROPERTY({})
unsigned short Data2;
UPROPERTY({})
unsigned short Data3;
UPROPERTY({})
unsigned char Data4[8];
constexpr Guid() noexcept
: Data1{ 0 }, Data2{ 0 }, Data3{ 0 }, Data4{ 0,0,0,0,0,0,0,0 }
{}
UFUNCTION({})
Guid(const string_view& str) noexcept
: Guid{}
{
sscanf_s(str.data(),
"%8x-%4hx-%4hx-%2hhx%2hhx-%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",
&Data1, &Data2, &Data3,
&Data4[0], &Data4[1], &Data4[2], &Data4[3],
&Data4[4], &Data4[5], &Data4[6], &Data4[7]);
}
constexpr Guid(unsigned int a, unsigned short b, unsigned short c, unsigned long long d)
: Data1{ a }
, Data2{ b }
, Data3{ c }
, Data4{
(unsigned char)(d >> 56 & 0xFF)
, (unsigned char)(d >> 48 & 0xFF)
, (unsigned char)(d >> 40 & 0xFF)
, (unsigned char)(d >> 32 & 0xFF)
, (unsigned char)(d >> 24 & 0xFF)
, (unsigned char)(d >> 16 & 0xFF)
, (unsigned char)(d >> 8 & 0xFF)
, (unsigned char)(d >> 0 & 0xFF)
}
{};
auto operator<=>(const Guid&) const noexcept = default;
operator bool() const noexcept
{
return *reinterpret_cast<const GUID*>(this) != GUID_NULL;
}
operator string() const
{
return ToString();
}
UFUNCTION({})
string ToString() const
{
char guid_cstr[39];
snprintf(guid_cstr, sizeof(guid_cstr),
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
Data1, Data2, Data3,
Data4[0], Data4[1], Data4[2], Data4[3],
Data4[4], Data4[5], Data4[6], Data4[7]);
return string{ guid_cstr };
}
UFUNCTION({})
static Guid Make()
{
Guid guid;
const auto res = CoCreateGuid((GUID*)&guid);
return guid;
}
};
}
namespace work {
#include <iostream>
#include <string_view>
struct Guid2 {
};
struct Guid {
using __Ctor_1 = Guid (*)(const std::string_view, Guid2);
Guid(const std::string_view& str, Guid2) {
// Construct Guid from string_view (implementation to be added)
std::cout << "Guid constructed with: " << str << std::endl;
}
};
}
namespace meta {
template<typename T, typename... Args>
static T Ctor(Args... args) {
T obj(args...); // Construct object of type T (in this case, Guid)
return obj
}
UPROPERTY_vk({ 1.f })
UFUNCTION({})
vec3(float x1) {
x = x1;
template<typename T, typename... Args>
static T(*)(Args...) CtorField() {
return &Ctor<T, Args...>;
}
UPROPERTY_dx({ 2.f })
UFUNCTION({})
vec3(float x1, float y1) {
x = x1;
y = y1;
void create_guid() {
using work::Guid;
Guid::__Ctor_1* c1 = CtorField<Guid::__Ctor_1>();
//...其他逻辑
}
UFUNCTION({})
vec3(float x1, float y1, float z1) {
x = x1;
y = y1;
z = z1;
}
UFUNCTION({})
vec3(float x1, float y1, float z1, float w1) {
x = x1;
y = y1;
z = z1;
}
UFUNCTION({ {3,4} })
int norm(int x1, int& x2)override {
int tmp = x1 * 2 + 1;
x1 = x2;
x2 = tmp;
return x2;
//cout << x2 << "vec3::norm" << endl;
}
UFUNCTION({})
virtual float norm1(int& x1) {
x1 = x1 * x * y * z;
x = x1;
y = x1 - 1;
//z = x1 - 10;
//cout << x1 << "::norm1" << endl;
return x1;
}
UFUNCTION({})
static void norm2(int x1 = 10) {
cout << x1 << "::norm2" << endl;
}
UFUNCTION({})
static void norm3(int x1 = 10) {
x1 = x1 * 10;
cout << x1 << "::norm3" << endl;
}
};
}

View File

@ -20,4 +20,8 @@
<ProjectReference Include="..\CppAst\CppAst.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="cpp\gen\" />
</ItemGroup>
</Project>

View File

@ -1,56 +1,57 @@
{%- assign NewLine = newline_to_br -%}
{{ Indent2 }}struct {{ Name }}_Static_{{MetaName}} {
{{ Indent2 }} consteval static auto __MakeStaticFields() {
{{ Indent2 }} return std::array{
{{ NewLine }} {%- for field in FieldList -%}
{{ NewLine }} {%- if field.Type == 1 -%}
{{ Indent2 }} refl::StaticMemberField(&{{Name}}::{{field.Name}}, FName("{{field.Name}}"), {{field.Meta}}),
{{ NewLine }} {%- elsif field.Type == 2 -%}
{{ Indent2 }} refl::StaticCtorField<{{field.Name}}>({{field.Meta}}),
{{ NewLine }} {%- else -%}
{{ Indent2 }} refl::StaticMethodField(&{{Name}}::{{field.Name}}, FName("{{field.Name}}"), {{field.Meta}}),
{{ NewLine }} {%- endif -%}
{{ NewLine }} {%- endfor -%}
{{ Indent2 }} };
{{ Indent2 }} };
{{ NewLine }}
{{ Indent2 }} consteval static int Size() {
{{ Indent2 }} return refl::fetch_meta_size<{{ Name }}_Static_{{MetaName}}>();
{{ Indent2 }} };
{{ Indent2 }} consteval static int MemberCount() {
{{ Indent2 }} return {{MemberCount}};
{{ Indent2 }} };
{{ Indent2 }} consteval static int CtorCount() {
{{ Indent2 }} return {{CtorCount}};
{{ Indent2 }} };
{{ Indent2 }}};
{{ NewLine }}
{{ Indent2 }}struct {{ Name }}_{{MetaName}} : public refl::Meta {
{{ Indent2 }} using MyUClass = refl::UClass_Meta<{{ Name }}, {{ ParentName }}>;
{{ Indent2 }} using MyStatic = {{ Name }}_Static_{{MetaName}};
{{ NewLine }} {%-if IsMultyMeta -%}
{{ Indent2 }} using MyMetas = class {{Name}}_MulytMeta;
{{ NewLine }} {%- endif -%}
{{ Indent2 }} inline static char s_data[MyStatic::Size()]{};
{{ Indent2 }} static auto __MakeFields() {
{{ Indent2 }} char* memory = &s_data[0];
{{ Indent2 }} return std::array{
{{ NewLine }} {%- for field in FieldList -%}
{{ NewLine }} {%- if field.Type == 1 -%}
{{ Indent2 }} MemberField(&{{Name}}::{{field.Name}}, FName("{{field.Name}}"), memory, {{field.Meta}}),
{{ NewLine }} {%- elsif field.Type == 2 -%}
{{ Indent2 }} CtorField<{{field.Name}}>(memory, {{field.Meta}}),
{{ NewLine }} {%- else -%}
{{ Indent2 }} MethodField(&{{Name}}::{{field.Name}}, FName("{{field.Name}}"), memory, {{field.Meta}}),
{{ NewLine }} {%- endif -%}
{{ NewLine }} {%- endfor -%}
{{ Indent2 }} };
{{ Indent2 }} };
{{ Indent2 }}};
{{ NewLine }}{%- if IsMultyMeta -%}
{{ Indent2 }}const refl::UClass* {{Name}}_MulytMeta::{{ MetaName }}()
{{ Indent2 }}{
{{ Indent2 }} static const auto s_cls = {{ Name }}_{{MetaName}}::MyUClass();
{{ Indent2 }} return &s_cls;
{{ Indent2 }}};
{{ NewLine }}{%- endif -%}
{{ Indent }}template<> struct _Static<{{FullName}},{{MetaName}}> {
{{ Indent }} using T = class {{FullName}};
{{ Indent }} consteval static auto __MakeStaticFields() {
{{ Indent }} return std::array{
{{ Indent }} {%- for field in FieldList %}
{{ Indent }} {%- if field.Type == 1 %}
{{ Indent }} refl::StaticMemberField(&T::{{field.Name}}, FName("{{field.Name}}"), {{field.Meta}}),
{{ Indent }} {%- elsif field.Type == 2 %}
{{ Indent }} refl::StaticCtorField<{{field.Name}}>({{field.Meta}}),
{{ Indent }} {%- else %}
{{ Indent }} refl::StaticMethodField(&T::{{field.Name}}, FName("{{field.Name}}"), {{field.Meta}}),
{{ Indent }} {%- endif %}
{{ Indent }} {%- endfor %}
{{ Indent }} };
{{ Indent }} };
{{ Indent }}
{{ Indent }} consteval static int Size() {
{{ Indent }} return refl::fetch_meta_size<_Static<T,{{MetaName}}>>();
{{ Indent }} };
{{ Indent }} consteval static int MemberCount() {
{{ Indent }} return {{MemberCount}};
{{ Indent }} };
{{ Indent }} consteval static int CtorCount() {
{{ Indent }} return {{CtorCount}};
{{ Indent }} };
{{ Indent }}};
{{ Indent }}
{{ Indent }}template<> struct _Meta<{{FullName}},{{MetaName}}> : public refl::MetaHelp {
{{ Indent }} using T = class {{FullName}};
{{ Indent }} using MyParent = {{ ParentName }};
{{ Indent }} using MyStatic = _Static<T,{{MetaName}}>;
{{ Indent }} {%-if IsMultyMeta %}
{{ Indent }} using MyMetas = class _Multy<T>;
{{ Indent }} {%- endif %}
{{ Indent }} inline static char s_data[MyStatic::Size()]{};
{{ Indent }} static auto __MakeFields() {
{{ Indent }} char* memory = &s_data[0];
{{ Indent }} return std::array{
{{ Indent }} {%- for field in FieldList %}
{{ Indent }} {%- if field.Type == 1 %}
{{ Indent }} MemberField(&T::{{field.Name}}, FName("{{field.Name}}"), memory, {{field.Meta}}),
{{ Indent }} {%- elsif field.Type == 2 %}
{{ Indent }} CtorField<{{field.Name}}>(memory, {{field.Meta}}),
{{ Indent }} {%- else %}
{{ Indent }} MethodField(&T::{{field.Name}}, FName("{{field.Name}}"), memory, {{field.Meta}}),
{{ Indent }} {%- endif %}
{{ Indent }} {%- endfor %}
{{ Indent }} };
{{ Indent }} };
{{ Indent }}};
{{ Indent }}{%- if IsMultyMeta %}
{{ Indent }}template<> const refl::UClass* _Multy<{{FullName}}>::{{ MetaName }}()
{{ Indent }}{
{{ Indent }} static const auto s_cls = refl::UClass_Meta<T, _Meta<T,{{ MetaName }}>>::BuildClass();
{{ Indent }} return &s_cls;
{{ Indent }}};
{{ Indent }}{%- endif %}

View File

@ -0,0 +1,7 @@
{{ Indent }}template<> struct MetaImpl<{{FullName}}>{
{{ Indent }} using T = class {{FullName}};
{{ Indent }} using MyMeta = _Meta<T, Meta>;
{{ Indent }}{%- if IsMultyMeta %}
{{ Indent }} using MyMetas = _Multy<T>;
{{ Indent }}{%- endif %}
{{ Indent }}};

View File

@ -1,20 +1,19 @@
{%- assign NewLine = newline_to_br -%}
{{ Indent2 }}struct {{Name}}_MulytMeta {
{{ NewLine }}{%- for Meta in MetaList -%}
{{ Indent2 }} static const refl::UClass* {{Meta}}();
{{ NewLine }}{%- endfor -%}
{{ Indent2 }} static const refl::UClass* GetMeta(const Name& name) {
{{ NewLine }}{%- for Meta in MetaList -%}
{{ Indent2 }} if (name == FName("{{Meta}}")) {
{{ Indent2 }} return {{Meta}}();
{{ Indent2 }} }
{{ NewLine }}{%- endfor -%}
{{ NewLine }}{%- if HasMeta -%}
{{ Indent2 }} if (name == FName("Meta")) {
{{ Indent2 }} return &refl::TypeInfo<{{Name}}>::StaticClass;
{{ Indent2 }} }
{{ NewLine }}{%- endif -%}
{{ Indent2 }} return nullptr;
{{ Indent2 }} }
{{ Indent2 }}};
{{ NewLine }}
{{ Indent }}template<> struct _Multy<{{FullName}}>{
{{ Indent }} using T = class {{FullName}};
{{ Indent }}{%- for Meta in MetaList %}
{{ Indent }} static const refl::UClass* {{Meta}}();
{{ Indent }}{%- endfor %}
{{ Indent }} static const refl::UClass* GetMeta(const Name& name) {
{{ Indent }}{%- for Meta in MetaList %}
{{ Indent }} if (name == FName("{{Meta}}")) {
{{ Indent }} return {{Meta}}();
{{ Indent }} }
{{ Indent }}{%- endfor %}
{{ Indent }}{%- if HasMeta %}
{{ Indent }} if (name == FName("Meta")) {
{{ Indent }} return &refl::TypeInfo<T>::StaticClass;
{{ Indent }} }
{{ Indent }}{%- endif %}
{{ Indent }} return nullptr;
{{ Indent }} }
{{ Indent }}};