Debian Codegraph @

tests/ts/foobar/tab.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 { Abc } from '../foobar/abc.js';
8 import { class_ } from '../foobar/class.js';
9
10
11 export class Tab implements flatbuffers.IUnpackableObject<TabT> {
12 bb: flatbuffers.ByteBuffer|null = null;
13 bb_pos = 0;
14 __init(i:number, bb:flatbuffers.ByteBuffer):Tab {
15 this.bb_pos = i;
16 this.bb = bb;
17 return this;
18 }
19
20 static getRootAsTab(bb:flatbuffers.ByteBuffer, obj?:Tab):Tab {
21 return (obj || new Tab()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
22 }
23
24 static getSizePrefixedRootAsTab(bb:flatbuffers.ByteBuffer, obj?:Tab):Tab {
25 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
26 return (obj || new Tab()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
27 }
28
29 abc():Abc {
30 const offset = this.bb!.__offset(this.bb_pos, 4);
31 return offset ? this.bb!.readInt32(this.bb_pos + offset) : Abc.a;
32 }
33
34 mutate_abc(value:Abc):boolean {
35 const offset = this.bb!.__offset(this.bb_pos, 4);
36
37 if (offset === 0) {
38 return false;
39 }
40
41 this.bb!.writeInt32(this.bb_pos + offset, value);
42 return true;
43 }
44
45 arg():class_ {
46 const offset = this.bb!.__offset(this.bb_pos, 6);
47 return offset ? this.bb!.readInt32(this.bb_pos + offset) : class_.arguments_;
48 }
49
50 mutate_arg(value:class_):boolean {
51 const offset = this.bb!.__offset(this.bb_pos, 6);
52
53 if (offset === 0) {
54 return false;
55 }
56
57 this.bb!.writeInt32(this.bb_pos + offset, value);
58 return true;
59 }
60
61 name():string|null
62 name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
63 name(optionalEncoding?:any):string|Uint8Array|null {
64 const offset = this.bb!.__offset(this.bb_pos, 8);
65 return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
66 }
67
68 static getFullyQualifiedName():string {
69 return 'foobar.Tab';
70 }
71
72 static startTab(builder:flatbuffers.Builder) {
73 builder.startObject(3);
74 }
75
76 static addAbc(builder:flatbuffers.Builder, abc:Abc) {
77 builder.addFieldInt32(0, abc, Abc.a);
78 }
79
80 static addArg(builder:flatbuffers.Builder, arg:class_) {
81 builder.addFieldInt32(1, arg, class_.arguments_);
82 }
83
84 static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
85 builder.addFieldOffset(2, nameOffset, 0);
86 }
87
88 static endTab(builder:flatbuffers.Builder):flatbuffers.Offset {
89 const offset = builder.endObject();
90 return offset;
91 }
92
93 static createTab(builder:flatbuffers.Builder, abc:Abc, arg:class_, nameOffset:flatbuffers.Offset):flatbuffers.Offset {
94 Tab.startTab(builder);
95 Tab.addAbc(builder, abc);
96 Tab.addArg(builder, arg);
97 Tab.addName(builder, nameOffset);
98 return Tab.endTab(builder);
99 }
100
101 unpack(): TabT {
102 return new TabT(
103 this.abc(),
104 this.arg(),
105 this.name()
106 );
107 }
108
109
110 unpackTo(_o: TabT): void {
111 _o.abc = this.abc();
112 _o.arg = this.arg();
113 _o.name = this.name();
114 }
115 }
116
117 export class TabT implements flatbuffers.IGeneratedObject {
118 constructor(
119 public abc: Abc = Abc.a,
120 public arg: class_ = class_.arguments_,
121 public name: string|Uint8Array|null = null
122 ){}
123
124
125 pack(builder:flatbuffers.Builder): flatbuffers.Offset {
126 const name = (this.name !== null ? builder.createString(this.name!) : 0);
127
128 return Tab.createTab(builder,
129 this.abc,
130 this.arg,
131 name
132 );
133 }
134 }