Lines Matching refs:struct_def
64 void BeginClass(const StructDef &struct_def, std::string *code_ptr) { in BeginClass() argument
66 code += "class " + NormalizedName(struct_def) + "(object):\n"; in BeginClass()
123 void NewRootTypeFromBuffer(const StructDef &struct_def, in NewRootTypeFromBuffer() argument
134 code += Indent + Indent + "x = " + NormalizedName(struct_def) + "()\n"; in NewRootTypeFromBuffer()
142 code += NormalizedName(struct_def); in NewRootTypeFromBuffer()
149 void InitializeExisting(const StructDef &struct_def, std::string *code_ptr) { in InitializeExisting() argument
152 GenReceiver(struct_def, code_ptr); in InitializeExisting()
159 void GetVectorLen(const StructDef &struct_def, const FieldDef &field, in GetVectorLen() argument
163 GenReceiver(struct_def, code_ptr); in GetVectorLen()
171 void GetVectorIsNone(const StructDef &struct_def, const FieldDef &field, in GetVectorIsNone() argument
175 GenReceiver(struct_def, code_ptr); in GetVectorIsNone()
186 void GetScalarFieldOfStruct(const StructDef &struct_def, in GetScalarFieldOfStruct() argument
190 GenReceiver(struct_def, code_ptr); in GetScalarFieldOfStruct()
198 void GetScalarFieldOfTable(const StructDef &struct_def, const FieldDef &field, in GetScalarFieldOfTable() argument
202 GenReceiver(struct_def, code_ptr); in GetScalarFieldOfTable()
223 void GetStructFieldOfStruct(const StructDef &struct_def, in GetStructFieldOfStruct() argument
226 GenReceiver(struct_def, code_ptr); in GetStructFieldOfStruct()
235 void GetArrayOfStruct(const StructDef &struct_def, const FieldDef &field, in GetArrayOfStruct() argument
239 GenReceiver(struct_def, code_ptr); in GetArrayOfStruct()
260 void GetStructFieldOfTable(const StructDef &struct_def, const FieldDef &field, in GetStructFieldOfTable() argument
263 GenReceiver(struct_def, code_ptr); in GetStructFieldOfTable()
267 if (field.value.type.struct_def->fixed) { in GetStructFieldOfTable()
285 void GetStringField(const StructDef &struct_def, const FieldDef &field, in GetStringField() argument
288 GenReceiver(struct_def, code_ptr); in GetStringField()
298 void GetUnionField(const StructDef &struct_def, const FieldDef &field, in GetUnionField() argument
301 GenReceiver(struct_def, code_ptr); in GetUnionField()
325 if (type.struct_def) { in GenPackageReference()
326 namespaces = type.struct_def->defined_namespace; in GenPackageReference()
337 void GetMemberOfVectorOfStruct(const StructDef &struct_def, in GetMemberOfVectorOfStruct() argument
342 GenReceiver(struct_def, code_ptr); in GetMemberOfVectorOfStruct()
349 if (!(vectortype.struct_def->fixed)) { in GetMemberOfVectorOfStruct()
365 void GetMemberOfVectorOfNonStruct(const StructDef &struct_def, in GetMemberOfVectorOfNonStruct() argument
371 GenReceiver(struct_def, code_ptr); in GetMemberOfVectorOfNonStruct()
390 void GetVectorOfNonStructAsNumpy(const StructDef &struct_def, in GetVectorOfNonStructAsNumpy() argument
400 GenReceiver(struct_def, code_ptr); in GetVectorOfNonStructAsNumpy()
419 void GetVectorAsNestedFlatbuffer(const StructDef &struct_def, in GetVectorAsNestedFlatbuffer() argument
437 GenReceiver(struct_def, code_ptr); in GetVectorAsNestedFlatbuffer()
452 void BeginBuilderArgs(const StructDef &struct_def, std::string *code_ptr) { in BeginBuilderArgs() argument
456 code += "def Create" + NormalizedName(struct_def); in BeginBuilderArgs()
462 void StructBuilderArgs(const StructDef &struct_def, in StructBuilderArgs() argument
467 for (auto it = struct_def.fields.vec.begin(); in StructBuilderArgs()
468 it != struct_def.fields.vec.end(); ++it) { in StructBuilderArgs()
481 StructBuilderArgs(*field.value.type.struct_def, subprefix, namesuffix, in StructBuilderArgs()
500 void StructBuilderBody(const StructDef &struct_def, const char *nameprefix, in StructBuilderBody() argument
506 indent + " builder.Prep(" + NumToString(struct_def.minalign) + ", "; in StructBuilderBody()
507 code += NumToString(struct_def.bytesize) + ")\n"; in StructBuilderBody()
508 for (auto it = struct_def.fields.vec.rbegin(); in StructBuilderBody()
509 it != struct_def.fields.vec.rend(); ++it) { in StructBuilderBody()
518 StructBuilderBody(*field_type.struct_def, in StructBuilderBody()
531 *field_type.struct_def, in StructBuilderBody()
554 void GetStartOfTable(const StructDef &struct_def, std::string *code_ptr) { in GetStartOfTable() argument
558 code += NumToString(struct_def.fields.vec.size()); in GetStartOfTable()
562 code += "def " + NormalizedName(struct_def) + "Start(builder):\n"; in GetStartOfTable()
568 void BuildFieldOfTable(const StructDef &struct_def, const FieldDef &field, in BuildFieldOfTable() argument
578 if (!IsScalar(field.value.type.base_type) && (!struct_def.fixed)) { in BuildFieldOfTable()
592 code += "def " + NormalizedName(struct_def) + "Add" + MakeCamel(NormalizedName(field)); in BuildFieldOfTable()
607 void BuildVectorOfTable(const StructDef &struct_def, const FieldDef &field, in BuildVectorOfTable() argument
621 code += "def " + NormalizedName(struct_def) + "Start"; in BuildVectorOfTable()
676 void GetEndOffsetOnTable(const StructDef &struct_def, std::string *code_ptr) { in GetEndOffsetOnTable() argument
681 code += "def " + NormalizedName(struct_def) + "End(builder):\n"; in GetEndOffsetOnTable()
687 void GenReceiver(const StructDef &struct_def, std::string *code_ptr) { in GenReceiver() argument
689 code += Indent + "# " + NormalizedName(struct_def) + "\n"; in GenReceiver()
694 void GenStructAccessor(const StructDef &struct_def, const FieldDef &field, in GenStructAccessor() argument
698 if (struct_def.fixed) { in GenStructAccessor()
699 GetScalarFieldOfStruct(struct_def, field, code_ptr); in GenStructAccessor()
701 GetScalarFieldOfTable(struct_def, field, code_ptr); in GenStructAccessor()
704 GetArrayOfStruct(struct_def, field, code_ptr); in GenStructAccessor()
708 if (struct_def.fixed) { in GenStructAccessor()
709 GetStructFieldOfStruct(struct_def, field, code_ptr); in GenStructAccessor()
711 GetStructFieldOfTable(struct_def, field, code_ptr); in GenStructAccessor()
715 GetStringField(struct_def, field, code_ptr); in GenStructAccessor()
720 GetMemberOfVectorOfStruct(struct_def, field, code_ptr); in GenStructAccessor()
722 GetMemberOfVectorOfNonStruct(struct_def, field, code_ptr); in GenStructAccessor()
723 GetVectorOfNonStructAsNumpy(struct_def, field, code_ptr); in GenStructAccessor()
724 GetVectorAsNestedFlatbuffer(struct_def, field, code_ptr); in GenStructAccessor()
728 case BASE_TYPE_UNION: GetUnionField(struct_def, field, code_ptr); break; in GenStructAccessor()
733 GetVectorLen(struct_def, field, code_ptr); in GenStructAccessor()
734 GetVectorIsNone(struct_def, field, code_ptr); in GenStructAccessor()
739 void GenStructSizeOf(const StructDef &struct_def, std::string *code_ptr) { in GenStructSizeOf() argument
744 Indent + Indent + "return " + NumToString(struct_def.bytesize) + "\n"; in GenStructSizeOf()
749 void GenTableBuilders(const StructDef &struct_def, std::string *code_ptr) { in GenTableBuilders() argument
750 GetStartOfTable(struct_def, code_ptr); in GenTableBuilders()
752 for (auto it = struct_def.fields.vec.begin(); in GenTableBuilders()
753 it != struct_def.fields.vec.end(); ++it) { in GenTableBuilders()
757 auto offset = it - struct_def.fields.vec.begin(); in GenTableBuilders()
758 BuildFieldOfTable(struct_def, field, offset, code_ptr); in GenTableBuilders()
760 BuildVectorOfTable(struct_def, field, code_ptr); in GenTableBuilders()
765 GetEndOffsetOnTable(struct_def, code_ptr); in GenTableBuilders()
769 void GenHasFileIdentifier(const StructDef &struct_def, in GenHasFileIdentifier() argument
782 code += Indent + "def " + NormalizedName(struct_def); in GenHasFileIdentifier()
793 void GenStruct(const StructDef &struct_def, std::string *code_ptr) { in GenStruct() argument
794 if (struct_def.generated) return; in GenStruct()
796 GenComment(struct_def.doc_comment, code_ptr, &def_comment); in GenStruct()
797 BeginClass(struct_def, code_ptr); in GenStruct()
798 if (!struct_def.fixed) { in GenStruct()
801 NewRootTypeFromBuffer(struct_def, code_ptr); in GenStruct()
804 GenHasFileIdentifier(struct_def, code_ptr); in GenStruct()
808 GenStructSizeOf(struct_def, code_ptr); in GenStruct()
812 InitializeExisting(struct_def, code_ptr); in GenStruct()
813 for (auto it = struct_def.fields.vec.begin(); in GenStruct()
814 it != struct_def.fields.vec.end(); ++it) { in GenStruct()
818 GenStructAccessor(struct_def, field, code_ptr); in GenStruct()
821 if (struct_def.fixed) { in GenStruct()
823 GenStructBuilder(struct_def, code_ptr); in GenStruct()
826 GenTableBuilders(struct_def, code_ptr); in GenStruct()
830 void GenReceiverForObjectAPI(const StructDef &struct_def, in GenReceiverForObjectAPI() argument
833 code += GenIndents(1) + "# " + NormalizedName(struct_def) + "T"; in GenReceiverForObjectAPI()
837 void BeginClassForObjectAPI(const StructDef &struct_def, in BeginClassForObjectAPI() argument
841 code += "class " + NormalizedName(struct_def) + "T(object):"; in BeginClassForObjectAPI()
961 void GenInitialize(const StructDef &struct_def, std::string *code_ptr, in GenInitialize() argument
965 for (auto it = struct_def.fields.vec.begin(); in GenInitialize()
966 it != struct_def.fields.vec.end(); ++it) { in GenInitialize()
1002 GenReceiverForObjectAPI(struct_def, code_ptr); in GenInitialize()
1034 struct_def.defined_namespace->GetFullyQualifiedName( in GenInitialize()
1035 MakeUpperCamel(struct_def)); in GenInitialize()
1040 void InitializeFromBuf(const StructDef &struct_def, std::string *code_ptr) { in InitializeFromBuf() argument
1042 auto instance_name = MakeLowerCamel(struct_def); in InitializeFromBuf()
1043 auto struct_name = NormalizedName(struct_def); in InitializeFromBuf()
1053 void InitializeFromObjForObject(const StructDef &struct_def, in InitializeFromObjForObject() argument
1056 auto instance_name = MakeLowerCamel(struct_def); in InitializeFromObjForObject()
1057 auto struct_name = NormalizedName(struct_def); in InitializeFromObjForObject()
1067 void GenUnPackForStruct(const StructDef &struct_def, const FieldDef &field, in GenUnPackForStruct() argument
1070 auto struct_instance_name = MakeLowerCamel(struct_def); in GenUnPackForStruct()
1083 if (struct_def.fixed && field.value.type.base_type == BASE_TYPE_STRUCT) { in GenUnPackForStruct()
1091 if (struct_def.fixed && field.value.type.base_type == BASE_TYPE_STRUCT) { in GenUnPackForStruct()
1097 void GenUnPackForUnion(const StructDef &struct_def, const FieldDef &field, in GenUnPackForUnion() argument
1102 auto struct_instance_name = MakeLowerCamel(struct_def); in GenUnPackForUnion()
1116 void GenUnPackForStructVector(const StructDef &struct_def, in GenUnPackForStructVector() argument
1121 auto struct_instance_name = MakeLowerCamel(struct_def); in GenUnPackForStructVector()
1149 void GenUnpackforScalarVectorHelper(const StructDef &struct_def, in GenUnpackforScalarVectorHelper() argument
1155 auto struct_instance_name = MakeLowerCamel(struct_def); in GenUnpackforScalarVectorHelper()
1165 void GenUnPackForScalarVector(const StructDef &struct_def, in GenUnPackForScalarVector() argument
1170 auto struct_instance_name = MakeLowerCamel(struct_def); in GenUnPackForScalarVector()
1177 GenUnpackforScalarVectorHelper(struct_def, field, code_ptr, 3); in GenUnPackForScalarVector()
1182 GenUnpackforScalarVectorHelper(struct_def, field, code_ptr, 4); in GenUnPackForScalarVector()
1190 void GenUnPackForScalar(const StructDef &struct_def, const FieldDef &field, in GenUnPackForScalar() argument
1195 auto struct_instance_name = MakeLowerCamel(struct_def); in GenUnPackForScalar()
1202 void GenUnPack(const StructDef &struct_def, std::string *code_ptr) { in GenUnPack() argument
1207 for (auto it = struct_def.fields.vec.begin(); in GenUnPack()
1208 it != struct_def.fields.vec.end(); ++it) { in GenUnPack()
1215 GenUnPackForStruct(struct_def, field, &code); in GenUnPack()
1219 GenUnPackForUnion(struct_def, field, &code); in GenUnPack()
1225 GenUnPackForStructVector(struct_def, field, &code); in GenUnPack()
1227 GenUnPackForScalarVector(struct_def, field, &code); in GenUnPack()
1232 GenUnPackForScalarVector(struct_def, field, &code); in GenUnPack()
1235 default: GenUnPackForScalar(struct_def, field, &code); in GenUnPack()
1241 auto struct_instance_name = MakeLowerCamel(struct_def); in GenUnPack()
1242 auto struct_name = MakeUpperCamel(struct_def); in GenUnPack()
1244 GenReceiverForObjectAPI(struct_def, code_ptr); in GenUnPack()
1260 void GenPackForStruct(const StructDef &struct_def, std::string *code_ptr) { in GenPackForStruct() argument
1262 auto struct_name = MakeUpperCamel(struct_def); in GenPackForStruct()
1264 GenReceiverForObjectAPI(struct_def, code_ptr); in GenPackForStruct()
1268 StructBuilderArgs(struct_def, in GenPackForStruct()
1276 void GenPackForStructVectorField(const StructDef &struct_def, in GenPackForStructVectorField() argument
1283 auto struct_name = NormalizedName(struct_def); in GenPackForStructVectorField()
1289 if (field.value.type.struct_def->fixed) { in GenPackForStructVectorField()
1325 void GenPackForScalarVectorFieldHelper(const StructDef &struct_def, in GenPackForScalarVectorFieldHelper() argument
1331 auto struct_name = NormalizedName(struct_def); in GenPackForScalarVectorFieldHelper()
1359 void GenPackForScalarVectorField(const StructDef &struct_def, in GenPackForScalarVectorField() argument
1367 auto struct_name = NormalizedName(struct_def); in GenPackForScalarVectorField()
1388 GenPackForScalarVectorFieldHelper(struct_def, field, code_prefix_ptr, 3); in GenPackForScalarVectorField()
1401 GenPackForScalarVectorFieldHelper(struct_def, field, code_prefix_ptr, 4); in GenPackForScalarVectorField()
1407 void GenPackForStructField(const StructDef &struct_def, const FieldDef &field, in GenPackForStructField() argument
1415 auto struct_name = NormalizedName(struct_def); in GenPackForStructField()
1417 if (field.value.type.struct_def->fixed) { in GenPackForStructField()
1438 void GenPackForUnionField(const StructDef &struct_def, const FieldDef &field, in GenPackForUnionField() argument
1446 auto struct_name = NormalizedName(struct_def); in GenPackForUnionField()
1458 void GenPackForTable(const StructDef &struct_def, std::string *code_ptr) { in GenPackForTable() argument
1461 auto struct_instance_name = MakeLowerCamel(struct_def); in GenPackForTable()
1462 auto struct_name = NormalizedName(struct_def); in GenPackForTable()
1464 GenReceiverForObjectAPI(struct_def, code_ptr); in GenPackForTable()
1467 for (auto it = struct_def.fields.vec.begin(); in GenPackForTable()
1468 it != struct_def.fields.vec.end(); ++it) { in GenPackForTable()
1477 GenPackForStructField(struct_def, field, &code_prefix, &code); in GenPackForTable()
1481 GenPackForUnionField(struct_def, field, &code_prefix, &code); in GenPackForTable()
1487 GenPackForStructVectorField(struct_def, field, &code_prefix, &code); in GenPackForTable()
1489 GenPackForScalarVectorField(struct_def, field, &code_prefix, &code); in GenPackForTable()
1494 GenPackForScalarVectorField(struct_def, field, &code_prefix, &code); in GenPackForTable()
1526 void GenStructForObjectAPI(const StructDef &struct_def, in GenStructForObjectAPI() argument
1528 if (struct_def.generated) return; in GenStructForObjectAPI()
1534 BeginClassForObjectAPI(struct_def, &code); in GenStructForObjectAPI()
1536 GenInitialize(struct_def, &code, &import_list); in GenStructForObjectAPI()
1538 InitializeFromBuf(struct_def, &code); in GenStructForObjectAPI()
1540 InitializeFromObjForObject(struct_def, &code); in GenStructForObjectAPI()
1542 GenUnPack(struct_def, &code); in GenStructForObjectAPI()
1544 if (struct_def.fixed) { in GenStructForObjectAPI()
1545 GenPackForStruct(struct_def, &code); in GenStructForObjectAPI()
1547 GenPackForTable(struct_def, &code); in GenStructForObjectAPI()
1670 case BASE_TYPE_STRUCT: return type.struct_def->name; in GenTypePointer()
1686 void GenStructBuilder(const StructDef &struct_def, std::string *code_ptr) { in GenStructBuilder() argument
1687 BeginBuilderArgs(struct_def, code_ptr); in GenStructBuilder()
1688 StructBuilderArgs(struct_def, in GenStructBuilder()
1695 StructBuilderBody(struct_def, "", code_ptr); in GenStructBuilder()
1723 auto &struct_def = **it; in generateStructs() local
1725 GenStruct(struct_def, &declcode); in generateStructs()
1727 GenStructForObjectAPI(struct_def, &declcode); in generateStructs()
1729 if (!SaveType(struct_def, declcode, true)) return false; in generateStructs()