【修复】为ue4生成cfg c++代码并且使用FString作为string类型时,由于FString无法作为unordered_map的key,产生编译错误,索性放弃对FString支持, 统一为std::string

main
walon 2021-08-11 15:09:22 +08:00
parent 2854ba4a9f
commit 9edb704199
3 changed files with 9 additions and 9 deletions

View File

@ -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<bright::String, void*>& _tables);
virtual void resolve(std::unordered_map<std::string, void*>& _tables);
};
{{x.cpp_namespace_end}}
@ -149,7 +149,7 @@ class {{name}}
return it != _dataMap.end() ? it->second : nullptr;
}
void resolve(std::unordered_map<bright::String, void*>& _tables)
void resolve(std::unordered_map<std::string, void*>& _tables)
{
for(auto v : _dataList)
{
@ -173,7 +173,7 @@ class {{name}}
return true;
}
void resolve(std::unordered_map<bright::String, void*>& _tables)
void resolve(std::unordered_map<std::string, void*>& _tables)
{
_data->resolve(_tables);
}
@ -208,9 +208,9 @@ class {{name}}
{{table.cpp_full_name}} {{table.name}};
{{~end~}}
bool load(std::function<bool(ByteBuf&, const bright::String&)> loader)
bool load(std::function<bool(ByteBuf&, const std::string&)> loader)
{
std::unordered_map<bright::String, void*> __tables__;
std::unordered_map<std::string, void*> __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<bright::String, void*>& _tables)
void {{type.cpp_full_name}}::resolve(std::unordered_map<std::string, void*>& _tables)
{
{{~if type.parent_def_type~}}
{{type.parent_def_type.name}}::resolve(_tables);

View File

@ -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)

View File

@ -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)