【调整】解决生成的cfg c++代码中依然有一部分直接使用了std::shared_ptr的问题

main
walon 2021-08-12 10:52:50 +08:00
parent 901441e9c2
commit 114ebb2573
2 changed files with 11 additions and 2 deletions

View File

@ -47,7 +47,7 @@ class {{name}} : public {{if parent_def_type}} {{parent_def_type.cpp_full_name}}
{
public:
static bool deserialize{{name}}(ByteBuf& _buf, std::shared_ptr<{{name}}>& _out);
static bool deserialize{{name}}(ByteBuf& _buf, ::bright::SharedPtr<{{name}}>& _out);
{{name}}()
{
@ -273,7 +273,7 @@ namespace {{x.top_module}}
return true;
}
bool {{type.cpp_full_name}}::deserialize{{type.name}}(ByteBuf& _buf, std::shared_ptr<{{type.cpp_full_name}}>& _out)
bool {{type.cpp_full_name}}::deserialize{{type.name}}(ByteBuf& _buf, ::bright::SharedPtr<{{type.cpp_full_name}}>& _out)
{
{{~if type.is_abstract_type~}}
int id;

View File

@ -147,15 +147,24 @@ namespace Luban.Job.Common.Defs
switch (type)
{
case "bool": return nullable ? TBool.NullableIns : TBool.Ins;
case "uint8":
case "byte": return nullable ? TByte.NullableIns : TByte.Ins;
case "int16":
case "short": return nullable ? TShort.NullableIns : TShort.Ins;
case "fint16":
case "fshort": return nullable ? TFshort.NullableIns : TFshort.Ins;
case "int32":
case "int": return nullable ? TInt.NullableIns : TInt.Ins;
case "fint32":
case "fint": return nullable ? TFint.NullableIns : TFint.Ins;
case "int64":
case "long": return nullable ? TLong.NullableIns : TLong.Ins;
case "bigint": return nullable ? TLong.NullableBigIns : TLong.BigIns;
case "fint64":
case "flong": return nullable ? TFlong.NullableIns : TFlong.Ins;
case "float32":
case "float": return nullable ? TFloat.NullableIns : TFloat.Ins;
case "float64":
case "double": return nullable ? TDouble.NullableIns : TDouble.Ins;
case "bytes": return TBytes.Ins;
case "string": return nullable ? TString.NullableIns : TString.Ins;