| 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 { ArrayStruct, ArrayStructT } from '../../my-game/example/array-struct.js'; |
| 8 | |
| 9 | |
| 10 | export class ArrayTable implements flatbuffers.IUnpackableObject<ArrayTableT> { |
| 11 | bb: flatbuffers.ByteBuffer|null = null; |
| 12 | bb_pos = 0; |
| 13 | __init(i:number, bb:flatbuffers.ByteBuffer):ArrayTable { |
| 14 | this.bb_pos = i; |
| 15 | this.bb = bb; |
| 16 | return this; |
| 17 | } |
| 18 | |
| 19 | static getRootAsArrayTable(bb:flatbuffers.ByteBuffer, obj?:ArrayTable):ArrayTable { |
| 20 | return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 21 | } |
| 22 | |
| 23 | static getSizePrefixedRootAsArrayTable(bb:flatbuffers.ByteBuffer, obj?:ArrayTable):ArrayTable { |
| 24 | bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); |
| 25 | return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 26 | } |
| 27 | |
| 28 | static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean { |
| 29 | return bb.__has_identifier('RHUB'); |
| 30 | } |
| 31 | |
| 32 | a():string|null |
| 33 | a(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null |
| 34 | a(optionalEncoding?:any):string|Uint8Array|null { |
| 35 | const offset = this.bb!.__offset(this.bb_pos, 4); |
| 36 | return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; |
| 37 | } |
| 38 | |
| 39 | cUnderscore(obj?:ArrayStruct):ArrayStruct|null { |
| 40 | const offset = this.bb!.__offset(this.bb_pos, 6); |
| 41 | return offset ? (obj || new ArrayStruct()).__init(this.bb_pos + offset, this.bb!) : null; |
| 42 | } |
| 43 | |
| 44 | static getFullyQualifiedName():string { |
| 45 | return 'MyGame.Example.ArrayTable'; |
| 46 | } |
| 47 | |
| 48 | static startArrayTable(builder:flatbuffers.Builder) { |
| 49 | builder.startObject(2); |
| 50 | } |
| 51 | |
| 52 | static addA(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset) { |
| 53 | builder.addFieldOffset(0, aOffset, 0); |
| 54 | } |
| 55 | |
| 56 | static addCUnderscore(builder:flatbuffers.Builder, cUnderscoreOffset:flatbuffers.Offset) { |
| 57 | builder.addFieldStruct(1, cUnderscoreOffset, 0); |
| 58 | } |
| 59 | |
| 60 | static endArrayTable(builder:flatbuffers.Builder):flatbuffers.Offset { |
| 61 | const offset = builder.endObject(); |
| 62 | return offset; |
| 63 | } |
| 64 | |
| 65 | static finishArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) { |
| 66 | builder.finish(offset, 'RHUB'); |
| 67 | } |
| 68 | |
| 69 | static finishSizePrefixedArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) { |
| 70 | builder.finish(offset, 'RHUB', true); |
| 71 | } |
| 72 | |
| 73 | |
| 74 | unpack(): ArrayTableT { |
| 75 | return new ArrayTableT( |
| 76 | this.a(), |
| 77 | (this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null) |
| 78 | ); |
| 79 | } |
| 80 | |
| 81 | |
| 82 | unpackTo(_o: ArrayTableT): void { |
| 83 | _o.a = this.a(); |
| 84 | _o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | export class ArrayTableT implements flatbuffers.IGeneratedObject { |
| 89 | constructor( |
| 90 | public a: string|Uint8Array|null = null, |
| 91 | public cUnderscore: ArrayStructT|null = null |
| 92 | ){} |
| 93 | |
| 94 | |
| 95 | pack(builder:flatbuffers.Builder): flatbuffers.Offset { |
| 96 | const a = (this.a !== null ? builder.createString(this.a!) : 0); |
| 97 | |
| 98 | ArrayTable.startArrayTable(builder); |
| 99 | ArrayTable.addA(builder, a); |
| 100 | ArrayTable.addCUnderscore(builder, (this.cUnderscore !== null ? this.cUnderscore!.pack(builder) : 0)); |
| 101 | |
| 102 | return ArrayTable.endArrayTable(builder); |
| 103 | } |
| 104 | } |