Lines Matching refs:struct_def
56 auto &struct_def = **it; in GenerateStructs() local
58 GenStruct(struct_def, &declcode); in GenerateStructs()
59 if (!SaveType(struct_def, declcode, true)) return false; in GenerateStructs()
100 static void BeginClass(const StructDef &struct_def, std::string *code_ptr) { in BeginClass() argument
102 if (struct_def.fixed) { in BeginClass()
103 code += "class " + struct_def.name + " extends Struct\n"; in BeginClass()
105 code += "class " + struct_def.name + " extends Table\n"; in BeginClass()
138 static void NewRootTypeFromBuffer(const StructDef &struct_def, in NewRootTypeFromBuffer() argument
144 code += Indent + " * @return " + struct_def.name + "\n"; in NewRootTypeFromBuffer()
147 code += struct_def.name; in NewRootTypeFromBuffer()
151 code += Indent + Indent + "$obj = new " + struct_def.name + "();\n"; in NewRootTypeFromBuffer()
159 static void InitializeExisting(const StructDef &struct_def, in InitializeExisting() argument
166 code += Indent + " * @return " + struct_def.name + "\n"; in InitializeExisting()
286 if (field.value.type.struct_def->fixed) { in GetStructFieldOfTable()
328 void GetMemberOfVectorOfStruct(const StructDef &struct_def, in GetMemberOfVectorOfStruct() argument
347 if (struct_def.fixed) { in GetMemberOfVectorOfStruct()
353 code += field.value.type.struct_def->fixed in GetMemberOfVectorOfStruct()
366 if (vectortype.struct_def->fixed) { in GetMemberOfVectorOfStruct()
443 static void StructBuilderArgs(const StructDef &struct_def, in StructBuilderArgs() argument
445 for (auto it = struct_def.fields.vec.begin(); in StructBuilderArgs()
446 it != struct_def.fields.vec.end(); ++it) { in StructBuilderArgs()
453 StructBuilderArgs(*field.value.type.struct_def, in StructBuilderArgs()
465 static void StructBuilderBody(const StructDef &struct_def, in StructBuilderBody() argument
469 code += NumToString(struct_def.minalign) + ", "; in StructBuilderBody()
470 code += NumToString(struct_def.bytesize) + ");\n"; in StructBuilderBody()
471 for (auto it = struct_def.fields.vec.rbegin(); in StructBuilderBody()
472 it != struct_def.fields.vec.rend(); ++it) { in StructBuilderBody()
479 StructBuilderBody(*field.value.type.struct_def, in StructBuilderBody()
489 static void GetStartOfTable(const StructDef &struct_def, in GetStartOfTable() argument
497 code += Indent + "public static function start" + struct_def.name; in GetStartOfTable()
501 code += NumToString(struct_def.fields.vec.size()); in GetStartOfTable()
507 code += Indent + " * @return " + struct_def.name + "\n"; in GetStartOfTable()
509 code += Indent + "public static function create" + struct_def.name; in GetStartOfTable()
512 for (auto it = struct_def.fields.vec.begin(); in GetStartOfTable()
513 it != struct_def.fields.vec.end(); ++it) { in GetStartOfTable()
518 if (!(it == (--struct_def.fields.vec.end()))) { code += ", "; } in GetStartOfTable()
523 code += NumToString(struct_def.fields.vec.size()); in GetStartOfTable()
525 for (auto it = struct_def.fields.vec.begin(); in GetStartOfTable()
526 it != struct_def.fields.vec.end(); ++it) { in GetStartOfTable()
536 for (auto it = struct_def.fields.vec.begin(); in GetStartOfTable()
537 it != struct_def.fields.vec.end(); ++it) { in GetStartOfTable()
633 void GetEndOffsetOnTable(const StructDef &struct_def, std::string *code_ptr) { in GetEndOffsetOnTable() argument
640 code += Indent + "public static function end" + struct_def.name; in GetEndOffsetOnTable()
645 for (auto it = struct_def.fields.vec.begin(); in GetEndOffsetOnTable()
646 it != struct_def.fields.vec.end(); ++it) { in GetEndOffsetOnTable()
657 if (parser_.root_struct_def_ == &struct_def) { in GetEndOffsetOnTable()
660 code += struct_def.name; in GetEndOffsetOnTable()
673 void GenStructAccessor(const StructDef &struct_def, const FieldDef &field, in GenStructAccessor() argument
678 if (struct_def.fixed) { in GenStructAccessor()
686 if (struct_def.fixed) { in GenStructAccessor()
698 GetMemberOfVectorOfStruct(struct_def, field, code_ptr); in GenStructAccessor()
717 void GenTableBuilders(const StructDef &struct_def, std::string *code_ptr) { in GenTableBuilders() argument
718 GetStartOfTable(struct_def, code_ptr); in GenTableBuilders()
720 for (auto it = struct_def.fields.vec.begin(); in GenTableBuilders()
721 it != struct_def.fields.vec.end(); ++it) { in GenTableBuilders()
725 auto offset = it - struct_def.fields.vec.begin(); in GenTableBuilders()
741 GetEndOffsetOnTable(struct_def, code_ptr); in GenTableBuilders()
745 void GenStruct(const StructDef &struct_def, std::string *code_ptr) { in GenStruct() argument
746 if (struct_def.generated) return; in GenStruct()
748 GenComment(struct_def.doc_comment, code_ptr, nullptr); in GenStruct()
749 BeginClass(struct_def, code_ptr); in GenStruct()
751 if (!struct_def.fixed) { in GenStruct()
754 NewRootTypeFromBuffer(struct_def, code_ptr); in GenStruct()
758 if (!struct_def.fixed) { in GenStruct()
761 code += Indent + "public static function " + struct_def.name; in GenStruct()
769 code += Indent + "public static function " + struct_def.name; in GenStruct()
774 code += struct_def.name + "Identifier());\n"; in GenStruct()
780 code += Indent + "public static function " + struct_def.name; in GenStruct()
791 InitializeExisting(struct_def, code_ptr); in GenStruct()
792 for (auto it = struct_def.fields.vec.begin(); in GenStruct()
793 it != struct_def.fields.vec.end(); ++it) { in GenStruct()
797 GenStructAccessor(struct_def, field, code_ptr); in GenStruct()
800 if (struct_def.fixed) { in GenStruct()
802 GenStructBuilder(struct_def, code_ptr); in GenStruct()
805 GenTableBuilders(struct_def, code_ptr); in GenStruct()
901 case BASE_TYPE_STRUCT: return type.struct_def->name; in GenTypePointer()
913 static void GenStructBuilder(const StructDef &struct_def, in GenStructBuilder() argument
920 code += Indent + "public static function create" + struct_def.name; in GenStructBuilder()
922 StructBuilderArgs(struct_def, "", code_ptr); in GenStructBuilder()
926 StructBuilderBody(struct_def, "", code_ptr); in GenStructBuilder()