• Home
  • Raw
  • Download

Lines Matching refs:string

42     LuaGenerator(const Parser &parser, const std::string &path,  in LuaGenerator()
43 const std::string &file_name) in LuaGenerator()
75 std::string OffsetPrefix(const FieldDef &field) { in OffsetPrefix()
76 return std::string(Indent) + in OffsetPrefix()
82 void BeginClass(const StructDef &struct_def, std::string *code_ptr) { in BeginClass()
83 std::string &code = *code_ptr; in BeginClass()
90 void BeginEnum(const std::string class_name, std::string *code_ptr) { in BeginEnum()
91 std::string &code = *code_ptr; in BeginEnum()
95 std::string EscapeKeyword(const std::string &name) const { in EscapeKeyword()
99 std::string NormalizedName(const Definition &definition) const { in NormalizedName()
103 std::string NormalizedName(const EnumVal &ev) const { in NormalizedName()
107 std::string NormalizedMetaName(const Definition &definition) const { in NormalizedMetaName()
112 void EnumMember(const EnumVal ev, std::string *code_ptr) { in EnumMember()
113 std::string &code = *code_ptr; in EnumMember()
114 code += std::string(Indent) + NormalizedName(ev) + " = " + NumToString(ev.value) + ",\n"; in EnumMember()
118 void EndEnum(std::string *code_ptr) { in EndEnum()
119 std::string &code = *code_ptr; in EndEnum()
124 std::string *code_ptr) { in GenerateNewObjectPrototype()
125 std::string &code = *code_ptr; in GenerateNewObjectPrototype()
128 code += std::string(Indent) + "local o = {}\n"; in GenerateNewObjectPrototype()
129 …code += std::string(Indent) + "setmetatable(o, {__index = " + NormalizedMetaName(struct_def) + "})… in GenerateNewObjectPrototype()
130 code += std::string(Indent) + "return o\n"; in GenerateNewObjectPrototype()
136 std::string *code_ptr) { in NewRootTypeFromBuffer()
137 std::string &code = *code_ptr; in NewRootTypeFromBuffer()
140 code += std::string(Indent) + "local n = flatbuffers.N.UOffsetT:Unpack(buf, offset)\n"; in NewRootTypeFromBuffer()
141 code += std::string(Indent) + "local o = " + NormalizedName(struct_def) + ".New()\n"; in NewRootTypeFromBuffer()
142 code += std::string(Indent) + "o:Init(buf, n + offset)\n"; in NewRootTypeFromBuffer()
143 code += std::string(Indent) + "return o\n"; in NewRootTypeFromBuffer()
149 std::string *code_ptr) { in InitializeExisting()
150 std::string &code = *code_ptr; in InitializeExisting()
154 code += std::string(Indent) + SelfData + " = flatbuffers.view.New(buf, pos)\n"; in InitializeExisting()
160 std::string *code_ptr) { in GetVectorLen()
161 std::string &code = *code_ptr; in GetVectorLen()
166 code += std::string(Indent) + Indent + "return " + SelfData + ":VectorLen(o)\n"; in GetVectorLen()
167 code += std::string(Indent) + End; in GetVectorLen()
168 code += std::string(Indent) + "return 0\n"; in GetVectorLen()
175 std::string *code_ptr) { in GetScalarFieldOfStruct()
176 std::string &code = *code_ptr; in GetScalarFieldOfStruct()
177 std::string getter = GenGetter(field.value.type); in GetScalarFieldOfStruct()
181 code += std::string(Indent) + "return " + getter; in GetScalarFieldOfStruct()
182 code += std::string(SelfDataPos) + " + " + NumToString(field.value.offset) + ")\n"; in GetScalarFieldOfStruct()
189 std::string *code_ptr) { in GetScalarFieldOfTable()
190 std::string &code = *code_ptr; in GetScalarFieldOfTable()
191 std::string getter = GenGetter(field.value.type); in GetScalarFieldOfTable()
196 getter += std::string("o + ") + SelfDataPos + ")"; in GetScalarFieldOfTable()
201 code += std::string(Indent) + Indent + "return " + getter + "\n"; in GetScalarFieldOfTable()
202 code += std::string(Indent) + End; in GetScalarFieldOfTable()
203 std::string default_value; in GetScalarFieldOfTable()
210 code += std::string(Indent) + "return " + default_value + "\n"; in GetScalarFieldOfTable()
218 std::string *code_ptr) { in GetStructFieldOfStruct()
219 std::string &code = *code_ptr; in GetStructFieldOfStruct()
223 code += std::string(Indent) + "obj:Init(" + SelfDataBytes + ", " + SelfDataPos + " + "; in GetStructFieldOfStruct()
225 code += std::string(Indent) + "return obj\n"; in GetStructFieldOfStruct()
233 std::string *code_ptr) { in GetStructFieldOfTable()
234 std::string &code = *code_ptr; in GetStructFieldOfTable()
240 code += std::string(Indent) + Indent + "local x = o + " + SelfDataPos + "\n"; in GetStructFieldOfTable()
243 …code += std::string(Indent) + Indent + "local x = " + SelfData + ":Indirect(o + " + SelfDataPos + … in GetStructFieldOfTable()
245 …code += std::string(Indent) + Indent + "local obj = require('" + TypeNameWithNamespace(field) + "'… in GetStructFieldOfTable()
246 code += std::string(Indent) + Indent + "obj:Init(" + SelfDataBytes + ", x)\n"; in GetStructFieldOfTable()
247 code += std::string(Indent) + Indent + "return obj\n"; in GetStructFieldOfTable()
248 code += std::string(Indent) + End; in GetStructFieldOfTable()
254 std::string *code_ptr) { in GetStringField()
255 std::string &code = *code_ptr; in GetStringField()
260 code += std::string(Indent) + Indent + "return " + GenGetter(field.value.type); in GetStringField()
261 code += std::string("o + ") + SelfDataPos + ")\n"; in GetStringField()
262 code += std::string(Indent) + End; in GetStringField()
268 std::string *code_ptr) { in GetUnionField()
269 std::string &code = *code_ptr; in GetUnionField()
282 …code += std::string(Indent) + Indent + "local obj = flatbuffers.view.New(require('flatbuffers.bina… in GetUnionField()
283 code += std::string(Indent) + Indent + GenGetter(field.value.type) + "obj, o)\n"; in GetUnionField()
284 code += std::string(Indent) + Indent + "return obj\n"; in GetUnionField()
285 code += std::string(Indent) + End; in GetUnionField()
292 std::string *code_ptr) { in GetMemberOfVectorOfStruct()
293 std::string &code = *code_ptr; in GetMemberOfVectorOfStruct()
300 code += std::string(Indent) + Indent + "local x = " + SelfData + ":Vector(o)\n"; in GetMemberOfVectorOfStruct()
301 code += std::string(Indent) + Indent + "x = x + ((j-1) * "; in GetMemberOfVectorOfStruct()
304 code += std::string(Indent) + Indent + "x = " + SelfData + ":Indirect(x)\n"; in GetMemberOfVectorOfStruct()
306 …code += std::string(Indent) + Indent + "local obj = require('" + TypeNameWithNamespace(field) + "'… in GetMemberOfVectorOfStruct()
307 code += std::string(Indent) + Indent + "obj:Init(" + SelfDataBytes + ", x)\n"; in GetMemberOfVectorOfStruct()
308 code += std::string(Indent) + Indent + "return obj\n"; in GetMemberOfVectorOfStruct()
309 code += std::string(Indent) + End; in GetMemberOfVectorOfStruct()
317 std::string *code_ptr) { in GetMemberOfVectorOfNonStruct()
318 std::string &code = *code_ptr; in GetMemberOfVectorOfNonStruct()
325 code += std::string(Indent) + Indent + "local a = " + SelfData + ":Vector(o)\n"; in GetMemberOfVectorOfNonStruct()
326 code += std::string(Indent) + Indent; in GetMemberOfVectorOfNonStruct()
330 code += std::string(Indent) + End; in GetMemberOfVectorOfNonStruct()
332 code += std::string(Indent) + "return ''\n"; in GetMemberOfVectorOfNonStruct()
335 code += std::string(Indent) + "return 0\n"; in GetMemberOfVectorOfNonStruct()
342 std::string *code_ptr) { in BeginBuilderArgs()
343 std::string &code = *code_ptr; in BeginBuilderArgs()
352 const char *nameprefix, std::string *code_ptr) { in StructBuilderArgs()
364 std::string &code = *code_ptr; in StructBuilderArgs()
365 code += std::string(", ") + nameprefix; in StructBuilderArgs()
372 void EndBuilderArgs(std::string *code_ptr) { in EndBuilderArgs()
373 std::string &code = *code_ptr; in EndBuilderArgs()
380 const char *nameprefix, std::string *code_ptr) { in StructBuilderBody()
381 std::string &code = *code_ptr; in StructBuilderBody()
382 code += std::string(Indent) + "builder:Prep(" + NumToString(struct_def.minalign) + ", "; in StructBuilderBody()
388 code += std::string(Indent) + "builder:Pad(" + NumToString(field.padding) + ")\n"; in StructBuilderBody()
394 code += std::string(Indent) + "builder:Prepend" + GenMethod(field) + "("; in StructBuilderBody()
400 void EndBuilderBody(std::string *code_ptr) { in EndBuilderBody()
401 std::string &code = *code_ptr; in EndBuilderBody()
402 code += std::string(Indent) + "return builder:Offset()\n"; in EndBuilderBody()
408 std::string *code_ptr) { in GetStartOfTable()
409 std::string &code = *code_ptr; in GetStartOfTable()
420 std::string *code_ptr) { in BuildFieldOfTable()
421 std::string &code = *code_ptr; in BuildFieldOfTable()
443 const FieldDef &field, std::string *code_ptr) { in BuildVectorOfTable()
444 std::string &code = *code_ptr; in BuildVectorOfTable()
458 std::string *code_ptr) { in GetEndOffsetOnTable()
459 std::string &code = *code_ptr; in GetEndOffsetOnTable()
466 void GenReceiver(const StructDef &struct_def, std::string *code_ptr) { in GenReceiver()
467 std::string &code = *code_ptr; in GenReceiver()
473 const FieldDef &field, std::string *code_ptr) { in GenStructAccessor()
515 std::string *code_ptr) { in GenTableBuilders()
534 void GenStruct(const StructDef &struct_def, std::string *code_ptr) { in GenStruct()
570 void GenEnum(const EnumDef &enum_def, std::string *code_ptr) { in GenEnum()
585 std::string GenGetter(const Type &type) { in GenGetter()
587 case BASE_TYPE_STRING: return std::string(SelfData) + ":String("; in GenGetter()
588 case BASE_TYPE_UNION: return std::string(SelfData) + ":Union("; in GenGetter()
591 return std::string(SelfData) + ":Get(flatbuffers.N." + in GenGetter()
597 std::string GenMethod(const FieldDef &field) { in GenMethod()
603 std::string GenTypeBasic(const Type &type) { in GenTypeBasic()
616 std::string GenTypePointer(const Type &type) { in GenTypePointer()
627 std::string GenTypeGet(const Type &type) { in GenTypeGet()
631 std::string GetNamespace(const Type &type) { in GetNamespace()
635 std::string TypeName(const FieldDef &field) { in TypeName()
639 std::string TypeNameWithNamespace(const FieldDef &field) { in TypeNameWithNamespace()
645 std::string *code_ptr) { in GenStructBuilder()
665 std::string enumcode; in generateEnums()
676 std::string declcode; in generateStructs()
684 void BeginFile(const std::string name_space_name, const bool needs_imports, in BeginFile()
685 std::string *code_ptr) { in BeginFile()
686 std::string &code = *code_ptr; in BeginFile()
687 code += std::string(Comment) + FlatBuffersGeneratedWarning() + "\n\n"; in BeginFile()
688 code += std::string(Comment) + "namespace: " + name_space_name + "\n\n"; in BeginFile()
695 bool SaveType(const Definition &def, const std::string &classcode, in SaveType()
699 std::string namespace_dir = path_; in SaveType()
708 std::string code = ""; in SaveType()
713 std::string filename = in SaveType()
718 std::unordered_set<std::string> keywords_;
723 bool GenerateLua(const Parser &parser, const std::string &path, in GenerateLua()
724 const std::string &file_name) { in GenerateLua()