Debian Codegraph @

tests/ts/my-game/other-name-space/table-b.ts

raw
1 // automatically generated by the FlatBuffers compiler, do not modify
2
3 /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
4
5 import * as flatbuffers from 'flatbuffers';
6
7 import { TableA, TableAT } from '../../table-a.js';
8
9
10 export class TableB implements flatbuffers.IUnpackableObject<TableBT> {
11 bb: flatbuffers.ByteBuffer|null = null;
12 bb_pos = 0;
13 __init(i:number, bb:flatbuffers.ByteBuffer):TableB {
14 this.bb_pos = i;
15 this.bb = bb;
16 return this;
17 }
18
19 static getRootAsTableB(bb:flatbuffers.ByteBuffer, obj?:TableB):TableB {
20 return (obj || new TableB()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
21 }
22
23 static getSizePrefixedRootAsTableB(bb:flatbuffers.ByteBuffer, obj?:TableB):TableB {
24 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
25 return (obj || new TableB()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
26 }
27
28 a(obj?:TableA):TableA|null {
29 const offset = this.bb!.__offset(this.bb_pos, 4);
30 return offset ? (obj || new TableA()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
31 }
32
33 static getFullyQualifiedName():string {
34 return 'MyGame.OtherNameSpace.TableB';
35 }
36
37 static startTableB(builder:flatbuffers.Builder) {
38 builder.startObject(1);
39 }
40
41 static addA(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset) {
42 builder.addFieldOffset(0, aOffset, 0);
43 }
44
45 static endTableB(builder:flatbuffers.Builder):flatbuffers.Offset {
46 const offset = builder.endObject();
47 return offset;
48 }
49
50 static createTableB(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset):flatbuffers.Offset {
51 TableB.startTableB(builder);
52 TableB.addA(builder, aOffset);
53 return TableB.endTableB(builder);
54 }
55
56 serialize():Uint8Array {
57 return this.bb!.bytes();
58 }
59
60 static deserialize(buffer: Uint8Array):TableB {
61 return TableB.getRootAsTableB(new flatbuffers.ByteBuffer(buffer))
62 }
63
64 unpack(): TableBT {
65 return new TableBT(
66 (this.a() !== null ? this.a()!.unpack() : null)
67 );
68 }
69
70
71 unpackTo(_o: TableBT): void {
72 _o.a = (this.a() !== null ? this.a()!.unpack() : null);
73 }
74 }
75
76 export class TableBT implements flatbuffers.IGeneratedObject {
77 constructor(
78 public a: TableAT|null = null
79 ){}
80
81
82 pack(builder:flatbuffers.Builder): flatbuffers.Offset {
83 const a = (this.a !== null ? this.a!.pack(builder) : 0);
84
85 return TableB.createTableB(builder,
86 a
87 );
88 }
89 }