Files
flatbuffers/tests/my-game/example/struct-of-structs-of-structs.ts
tira-misu 2ad408697f [TS] Fix generation of struct members in object api (#7148)
* Fix C/C++ Create<Type>Direct with sorted vectors

If a struct has a key the vector has to be sorted. To sort the vector
you can't use "const".

* Changes due to code review

* Improve code readability

* Add generate of JSON schema to string to lib

* option indent_step is supported

* Remove unused variables

* Fix break in test

* Fix style to be consistent with rest of the code

* [TS] Fix reserved words as arguments (#6955)

* [TS] Fix generation of reserved words in object api (#7106)

* [TS] Fix generation of object api

* [TS] Fix MakeCamel -> ConvertCase

* [TS] Add test for struct of struct of struct

* Update generated files

* Add missing files

* [TS] Fix query of null/undefined fields in object api
2022-03-23 21:40:11 -07:00

75 lines
1.8 KiB
TypeScript

// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { StructOfStructs, StructOfStructsT } from '../../my-game/example/struct-of-structs';
export class StructOfStructsOfStructs {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructsOfStructs {
this.bb_pos = i;
this.bb = bb;
return this;
}
a(obj?:StructOfStructs):StructOfStructs|null {
return (obj || new StructOfStructs()).__init(this.bb_pos, this.bb!);
}
static getFullyQualifiedName():string {
return 'MyGame.Example.StructOfStructsOfStructs';
}
static sizeOf():number {
return 20;
}
static createStructOfStructsOfStructs(builder:flatbuffers.Builder, a_a_id: number, a_a_distance: number, a_b_a: number, a_b_b: number, a_c_id: number, a_c_distance: number):flatbuffers.Offset {
builder.prep(4, 20);
builder.prep(4, 20);
builder.prep(4, 8);
builder.writeInt32(a_c_distance);
builder.writeInt32(a_c_id);
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(a_b_b);
builder.writeInt16(a_b_a);
builder.prep(4, 8);
builder.writeInt32(a_a_distance);
builder.writeInt32(a_a_id);
return builder.offset();
}
unpack(): StructOfStructsOfStructsT {
return new StructOfStructsOfStructsT(
(this.a() !== null ? this.a()!.unpack() : null)
);
}
unpackTo(_o: StructOfStructsOfStructsT): void {
_o.a = (this.a() !== null ? this.a()!.unpack() : null);
}
}
export class StructOfStructsOfStructsT {
constructor(
public a: StructOfStructsT|null = null
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
return StructOfStructsOfStructs.createStructOfStructsOfStructs(builder,
(this.a?.a?.id ?? 0),
(this.a?.a?.distance ?? 0),
(this.a?.b?.a ?? 0),
(this.a?.b?.b ?? 0),
(this.a?.c?.id ?? 0),
(this.a?.c?.distance ?? 0)
);
}
}