From 9edb7041991e19e083a8ed22534b453e2370b116 Mon Sep 17 00:00:00 2001 From: walon Date: Wed, 11 Aug 2021 15:09:22 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=A4=8D=E3=80=91=E4=B8=BAue?= =?UTF-8?q?4=E7=94=9F=E6=88=90cfg=20c++=E4=BB=A3=E7=A0=81=E5=B9=B6?= =?UTF-8?q?=E4=B8=94=E4=BD=BF=E7=94=A8FString=E4=BD=9C=E4=B8=BAstring?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=97=B6=EF=BC=8C=E7=94=B1=E4=BA=8EFString?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E4=BD=9C=E4=B8=BAunordered=5Fmap=E7=9A=84key?= =?UTF-8?q?=EF=BC=8C=E4=BA=A7=E7=94=9F=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=8C=E7=B4=A2=E6=80=A7=E6=94=BE=E5=BC=83=E5=AF=B9FString?= =?UTF-8?q?=E6=94=AF=E6=8C=81=EF=BC=8C=20=E7=BB=9F=E4=B8=80=E4=B8=BAstd::s?= =?UTF-8?q?tring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/Generate/CppCodeBinRender.cs | 12 ++++++------ .../TypeVisitors/CppUnderingDeserializeVisitor.cs | 2 +- .../Source/TypeVisitors/CppUnderingDefineTypeName.cs | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Luban.Job.Cfg/Source/Generate/CppCodeBinRender.cs b/src/Luban.Job.Cfg/Source/Generate/CppCodeBinRender.cs index 20157f9..4b18f53 100644 --- a/src/Luban.Job.Cfg/Source/Generate/CppCodeBinRender.cs +++ b/src/Luban.Job.Cfg/Source/Generate/CppCodeBinRender.cs @@ -89,7 +89,7 @@ class {{name}} : public {{if parent_def_type}} {{parent_def_type.cpp_full_name}} int getTypeId() const { return ID; } {{~end~}} - virtual void resolve(std::unordered_map& _tables); + virtual void resolve(std::unordered_map& _tables); }; {{x.cpp_namespace_end}} @@ -149,7 +149,7 @@ class {{name}} return it != _dataMap.end() ? it->second : nullptr; } - void resolve(std::unordered_map& _tables) + void resolve(std::unordered_map& _tables) { for(auto v : _dataList) { @@ -173,7 +173,7 @@ class {{name}} return true; } - void resolve(std::unordered_map& _tables) + void resolve(std::unordered_map& _tables) { _data->resolve(_tables); } @@ -208,9 +208,9 @@ class {{name}} {{table.cpp_full_name}} {{table.name}}; {{~end~}} - bool load(std::function loader) + bool load(std::function loader) { - std::unordered_map __tables__; + std::unordered_map __tables__; ByteBuf buf; {{~for table in tables~}} @@ -294,7 +294,7 @@ namespace {{x.top_module}} {{~end~}} } - void {{type.cpp_full_name}}::resolve(std::unordered_map& _tables) + void {{type.cpp_full_name}}::resolve(std::unordered_map& _tables) { {{~if type.parent_def_type~}} {{type.parent_def_type.name}}::resolve(_tables); diff --git a/src/Luban.Job.Cfg/Source/TypeVisitors/CppUnderingDeserializeVisitor.cs b/src/Luban.Job.Cfg/Source/TypeVisitors/CppUnderingDeserializeVisitor.cs index ed4d841..25ba442 100644 --- a/src/Luban.Job.Cfg/Source/TypeVisitors/CppUnderingDeserializeVisitor.cs +++ b/src/Luban.Job.Cfg/Source/TypeVisitors/CppUnderingDeserializeVisitor.cs @@ -64,7 +64,7 @@ namespace Luban.Job.Cfg.TypeVisitors public string Accept(TString type, string bufName, string fieldName) { - return $"if(!BYTEBUF_READ_STRING({bufName}, {fieldName})) return false;"; + return $"if(!{bufName}.readString({fieldName})) return false;"; } public string Accept(TBytes type, string bufName, string fieldName) diff --git a/src/Luban.Job.Common/Source/TypeVisitors/CppUnderingDefineTypeName.cs b/src/Luban.Job.Common/Source/TypeVisitors/CppUnderingDefineTypeName.cs index 4899bac..358474a 100644 --- a/src/Luban.Job.Common/Source/TypeVisitors/CppUnderingDefineTypeName.cs +++ b/src/Luban.Job.Common/Source/TypeVisitors/CppUnderingDefineTypeName.cs @@ -63,7 +63,7 @@ namespace Luban.Job.Common.TypeVisitors public string Accept(TString type) { - return "bright::String"; + return "std::string"; } public string Accept(TBytes type) @@ -73,7 +73,7 @@ namespace Luban.Job.Common.TypeVisitors public string Accept(TText type) { - return "bright::String"; + return "std::string"; } public string Accept(TBean type)