Debian Codegraph @

tests/ts/my-game/example/type-aliases.js

raw
1 // automatically generated by the FlatBuffers compiler, do not modify
2 /* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
3 import * as flatbuffers from 'flatbuffers';
4 export class TypeAliases {
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 static getRootAsTypeAliases(bb, obj) {
15 return (obj || new TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
16 }
17 static getSizePrefixedRootAsTypeAliases(bb, obj) {
18 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
19 return (obj || new TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
20 }
21 i8() {
22 const offset = this.bb.__offset(this.bb_pos, 4);
23 return offset ? this.bb.readInt8(this.bb_pos + offset) : 0;
24 }
25 mutate_i8(value) {
26 const offset = this.bb.__offset(this.bb_pos, 4);
27 if (offset === 0) {
28 return false;
29 }
30 this.bb.writeInt8(this.bb_pos + offset, value);
31 return true;
32 }
33 u8() {
34 const offset = this.bb.__offset(this.bb_pos, 6);
35 return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
36 }
37 mutate_u8(value) {
38 const offset = this.bb.__offset(this.bb_pos, 6);
39 if (offset === 0) {
40 return false;
41 }
42 this.bb.writeUint8(this.bb_pos + offset, value);
43 return true;
44 }
45 i16() {
46 const offset = this.bb.__offset(this.bb_pos, 8);
47 return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
48 }
49 mutate_i16(value) {
50 const offset = this.bb.__offset(this.bb_pos, 8);
51 if (offset === 0) {
52 return false;
53 }
54 this.bb.writeInt16(this.bb_pos + offset, value);
55 return true;
56 }
57 u16() {
58 const offset = this.bb.__offset(this.bb_pos, 10);
59 return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
60 }
61 mutate_u16(value) {
62 const offset = this.bb.__offset(this.bb_pos, 10);
63 if (offset === 0) {
64 return false;
65 }
66 this.bb.writeUint16(this.bb_pos + offset, value);
67 return true;
68 }
69 i32() {
70 const offset = this.bb.__offset(this.bb_pos, 12);
71 return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
72 }
73 mutate_i32(value) {
74 const offset = this.bb.__offset(this.bb_pos, 12);
75 if (offset === 0) {
76 return false;
77 }
78 this.bb.writeInt32(this.bb_pos + offset, value);
79 return true;
80 }
81 u32() {
82 const offset = this.bb.__offset(this.bb_pos, 14);
83 return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
84 }
85 mutate_u32(value) {
86 const offset = this.bb.__offset(this.bb_pos, 14);
87 if (offset === 0) {
88 return false;
89 }
90 this.bb.writeUint32(this.bb_pos + offset, value);
91 return true;
92 }
93 i64() {
94 const offset = this.bb.__offset(this.bb_pos, 16);
95 return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
96 }
97 mutate_i64(value) {
98 const offset = this.bb.__offset(this.bb_pos, 16);
99 if (offset === 0) {
100 return false;
101 }
102 this.bb.writeInt64(this.bb_pos + offset, value);
103 return true;
104 }
105 u64() {
106 const offset = this.bb.__offset(this.bb_pos, 18);
107 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
108 }
109 mutate_u64(value) {
110 const offset = this.bb.__offset(this.bb_pos, 18);
111 if (offset === 0) {
112 return false;
113 }
114 this.bb.writeUint64(this.bb_pos + offset, value);
115 return true;
116 }
117 f32() {
118 const offset = this.bb.__offset(this.bb_pos, 20);
119 return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;
120 }
121 mutate_f32(value) {
122 const offset = this.bb.__offset(this.bb_pos, 20);
123 if (offset === 0) {
124 return false;
125 }
126 this.bb.writeFloat32(this.bb_pos + offset, value);
127 return true;
128 }
129 f64() {
130 const offset = this.bb.__offset(this.bb_pos, 22);
131 return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
132 }
133 mutate_f64(value) {
134 const offset = this.bb.__offset(this.bb_pos, 22);
135 if (offset === 0) {
136 return false;
137 }
138 this.bb.writeFloat64(this.bb_pos + offset, value);
139 return true;
140 }
141 v8(index) {
142 const offset = this.bb.__offset(this.bb_pos, 24);
143 return offset ? this.bb.readInt8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
144 }
145 v8Length() {
146 const offset = this.bb.__offset(this.bb_pos, 24);
147 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
148 }
149 v8Array() {
150 const offset = this.bb.__offset(this.bb_pos, 24);
151 return offset ? new Int8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
152 }
153 vf64(index) {
154 const offset = this.bb.__offset(this.bb_pos, 26);
155 return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
156 }
157 vf64Length() {
158 const offset = this.bb.__offset(this.bb_pos, 26);
159 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
160 }
161 vf64Array() {
162 const offset = this.bb.__offset(this.bb_pos, 26);
163 return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
164 }
165 static getFullyQualifiedName() {
166 return 'MyGame.Example.TypeAliases';
167 }
168 static startTypeAliases(builder) {
169 builder.startObject(12);
170 }
171 static addI8(builder, i8) {
172 builder.addFieldInt8(0, i8, 0);
173 }
174 static addU8(builder, u8) {
175 builder.addFieldInt8(1, u8, 0);
176 }
177 static addI16(builder, i16) {
178 builder.addFieldInt16(2, i16, 0);
179 }
180 static addU16(builder, u16) {
181 builder.addFieldInt16(3, u16, 0);
182 }
183 static addI32(builder, i32) {
184 builder.addFieldInt32(4, i32, 0);
185 }
186 static addU32(builder, u32) {
187 builder.addFieldInt32(5, u32, 0);
188 }
189 static addI64(builder, i64) {
190 builder.addFieldInt64(6, i64, BigInt('0'));
191 }
192 static addU64(builder, u64) {
193 builder.addFieldInt64(7, u64, BigInt('0'));
194 }
195 static addF32(builder, f32) {
196 builder.addFieldFloat32(8, f32, 0.0);
197 }
198 static addF64(builder, f64) {
199 builder.addFieldFloat64(9, f64, 0.0);
200 }
201 static addV8(builder, v8Offset) {
202 builder.addFieldOffset(10, v8Offset, 0);
203 }
204 static createV8Vector(builder, data) {
205 builder.startVector(1, data.length, 1);
206 for (let i = data.length - 1; i >= 0; i--) {
207 builder.addInt8(data[i]);
208 }
209 return builder.endVector();
210 }
211 static startV8Vector(builder, numElems) {
212 builder.startVector(1, numElems, 1);
213 }
214 static addVf64(builder, vf64Offset) {
215 builder.addFieldOffset(11, vf64Offset, 0);
216 }
217 static createVf64Vector(builder, data) {
218 builder.startVector(8, data.length, 8);
219 for (let i = data.length - 1; i >= 0; i--) {
220 builder.addFloat64(data[i]);
221 }
222 return builder.endVector();
223 }
224 static startVf64Vector(builder, numElems) {
225 builder.startVector(8, numElems, 8);
226 }
227 static endTypeAliases(builder) {
228 const offset = builder.endObject();
229 return offset;
230 }
231 static createTypeAliases(builder, i8, u8, i16, u16, i32, u32, i64, u64, f32, f64, v8Offset, vf64Offset) {
232 TypeAliases.startTypeAliases(builder);
233 TypeAliases.addI8(builder, i8);
234 TypeAliases.addU8(builder, u8);
235 TypeAliases.addI16(builder, i16);
236 TypeAliases.addU16(builder, u16);
237 TypeAliases.addI32(builder, i32);
238 TypeAliases.addU32(builder, u32);
239 TypeAliases.addI64(builder, i64);
240 TypeAliases.addU64(builder, u64);
241 TypeAliases.addF32(builder, f32);
242 TypeAliases.addF64(builder, f64);
243 TypeAliases.addV8(builder, v8Offset);
244 TypeAliases.addVf64(builder, vf64Offset);
245 return TypeAliases.endTypeAliases(builder);
246 }
247 serialize() {
248 return this.bb.bytes();
249 }
250 static deserialize(buffer) {
251 return TypeAliases.getRootAsTypeAliases(new flatbuffers.ByteBuffer(buffer));
252 }
253 unpack() {
254 return new TypeAliasesT(this.i8(), this.u8(), this.i16(), this.u16(), this.i32(), this.u32(), this.i64(), this.u64(), this.f32(), this.f64(), this.bb.createScalarList(this.v8.bind(this), this.v8Length()), this.bb.createScalarList(this.vf64.bind(this), this.vf64Length()));
255 }
256 unpackTo(_o) {
257 _o.i8 = this.i8();
258 _o.u8 = this.u8();
259 _o.i16 = this.i16();
260 _o.u16 = this.u16();
261 _o.i32 = this.i32();
262 _o.u32 = this.u32();
263 _o.i64 = this.i64();
264 _o.u64 = this.u64();
265 _o.f32 = this.f32();
266 _o.f64 = this.f64();
267 _o.v8 = this.bb.createScalarList(this.v8.bind(this), this.v8Length());
268 _o.vf64 = this.bb.createScalarList(this.vf64.bind(this), this.vf64Length());
269 }
270 }
271 export class TypeAliasesT {
272 constructor(i8 = 0, u8 = 0, i16 = 0, u16 = 0, i32 = 0, u32 = 0, i64 = BigInt('0'), u64 = BigInt('0'), f32 = 0.0, f64 = 0.0, v8 = [], vf64 = []) {
273 this.i8 = i8;
274 this.u8 = u8;
275 this.i16 = i16;
276 this.u16 = u16;
277 this.i32 = i32;
278 this.u32 = u32;
279 this.i64 = i64;
280 this.u64 = u64;
281 this.f32 = f32;
282 this.f64 = f64;
283 this.v8 = v8;
284 this.vf64 = vf64;
285 }
286 pack(builder) {
287 const v8 = TypeAliases.createV8Vector(builder, this.v8);
288 const vf64 = TypeAliases.createVf64Vector(builder, this.vf64);
289 return TypeAliases.createTypeAliases(builder, this.i8, this.u8, this.i16, this.u16, this.i32, this.u32, this.i64, this.u64, this.f32, this.f64, v8, vf64);
290 }
291 }