- 优化cs ToString函数实现,正确打印窗口类型数据
parent
2f46d40ca3
commit
7e03fe7192
|
|
@ -26,9 +26,9 @@ namespace Luban.Job.Common.Defs
|
||||||
return type.Apply(CsDefineTypeName.Ins);
|
return type.Apply(CsDefineTypeName.Ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string CsToString(string filedName, TType type)
|
public static string CsToString(string fieldName, TType type)
|
||||||
{
|
{
|
||||||
return $"{filedName}";
|
return type.Apply(CsToStringVisitor.Ins, fieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string CsConstValue(TType type, string value)
|
public static string CsConstValue(TType type, string value)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
using Luban.Job.Common.Types;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Luban.Job.Common.TypeVisitors
|
||||||
|
{
|
||||||
|
public class CsToStringVisitor : DecoratorFuncVisitor<string, string>
|
||||||
|
{
|
||||||
|
public static CsToStringVisitor Ins { get; } = new CsToStringVisitor();
|
||||||
|
|
||||||
|
public override string DoAccept(TType type, string fieldName)
|
||||||
|
{
|
||||||
|
return fieldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Accept(TArray type, string fieldName)
|
||||||
|
{
|
||||||
|
return $"Bright.Common.StringUtil.CollectionToString({fieldName})";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Accept(TList type, string fieldName)
|
||||||
|
{
|
||||||
|
return $"Bright.Common.StringUtil.CollectionToString({fieldName})";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Accept(TSet type, string fieldName)
|
||||||
|
{
|
||||||
|
return $"Bright.Common.StringUtil.CollectionToString({fieldName})";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Accept(TMap type, string fieldName)
|
||||||
|
{
|
||||||
|
return $"Bright.Common.StringUtil.CollectionToString({fieldName})";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue