Debian Codegraph @

tests/ts/my-game/example/struct-of-structs.js

raw
1 // automatically generated by the FlatBuffers compiler, do not modify
2 import { Ability } from '../../my-game/example/ability.js';
3 import { Test } from '../../my-game/example/test.js';
4 export class StructOfStructs {
5 constructor() {
6 this.bb = null;
7 this.bb_pos = 0;
8 }
9 __init(i, bb) {
10 this.bb_pos = i;
11 this.bb = bb;
12 return this;
13 }
14 a(obj) {
15 return (obj || new Ability()).__init(this.bb_pos, this.bb);
16 }
17 b(obj) {
18 return (obj || new Test()).__init(this.bb_pos + 8, this.bb);
19 }
20 c(obj) {
21 return (obj || new Ability()).__init(this.bb_pos + 12, this.bb);
22 }
23 static getFullyQualifiedName() {
24 return 'MyGame.Example.StructOfStructs';
25 }
26 static sizeOf() {
27 return 20;
28 }
29 static createStructOfStructs(builder, a_id, a_distance, b_a, b_b, c_id, c_distance) {
30 builder.prep(4, 20);
31 builder.prep(4, 8);
32 builder.writeInt32(c_distance);
33 builder.writeInt32(c_id);
34 builder.prep(2, 4);
35 builder.pad(1);
36 builder.writeInt8(b_b);
37 builder.writeInt16(b_a);
38 builder.prep(4, 8);
39 builder.writeInt32(a_distance);
40 builder.writeInt32(a_id);
41 return builder.offset();
42 }
43 unpack() {
44 return new StructOfStructsT((this.a() !== null ? this.a().unpack() : null), (this.b() !== null ? this.b().unpack() : null), (this.c() !== null ? this.c().unpack() : null));
45 }
46 unpackTo(_o) {
47 _o.a = (this.a() !== null ? this.a().unpack() : null);
48 _o.b = (this.b() !== null ? this.b().unpack() : null);
49 _o.c = (this.c() !== null ? this.c().unpack() : null);
50 }
51 }
52 export class StructOfStructsT {
53 constructor(a = null, b = null, c = null) {
54 this.a = a;
55 this.b = b;
56 this.c = c;
57 }
58 pack(builder) {
59 return StructOfStructs.createStructOfStructs(builder, (this.a?.id ?? 0), (this.a?.distance ?? 0), (this.b?.a ?? 0), (this.b?.b ?? 0), (this.c?.id ?? 0), (this.c?.distance ?? 0));
60 }
61 }