|
| 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 | + |
| 8 | + |
| 9 | +export class Person { |
| 10 | + bb: flatbuffers.ByteBuffer|null = null; |
| 11 | + bb_pos = 0; |
| 12 | + __init(i:number, bb:flatbuffers.ByteBuffer):Person { |
| 13 | + this.bb_pos = i; |
| 14 | + this.bb = bb; |
| 15 | + return this; |
| 16 | +} |
| 17 | + |
| 18 | +static getRootAsPerson(bb:flatbuffers.ByteBuffer, obj?:Person):Person { |
| 19 | + return (obj || new Person()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 20 | +} |
| 21 | + |
| 22 | +static getSizePrefixedRootAsPerson(bb:flatbuffers.ByteBuffer, obj?:Person):Person { |
| 23 | + bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); |
| 24 | + return (obj || new Person()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 25 | +} |
| 26 | + |
| 27 | +name():string|null |
| 28 | +name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null |
| 29 | +name(optionalEncoding?:any):string|Uint8Array|null { |
| 30 | + const offset = this.bb!.__offset(this.bb_pos, 4); |
| 31 | + return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; |
| 32 | +} |
| 33 | + |
| 34 | +age():number { |
| 35 | + const offset = this.bb!.__offset(this.bb_pos, 6); |
| 36 | + return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0; |
| 37 | +} |
| 38 | + |
| 39 | +static startPerson(builder:flatbuffers.Builder) { |
| 40 | + builder.startObject(2); |
| 41 | +} |
| 42 | + |
| 43 | +static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) { |
| 44 | + builder.addFieldOffset(0, nameOffset, 0); |
| 45 | +} |
| 46 | + |
| 47 | +static addAge(builder:flatbuffers.Builder, age:number) { |
| 48 | + builder.addFieldInt16(1, age, 0); |
| 49 | +} |
| 50 | + |
| 51 | +static endPerson(builder:flatbuffers.Builder):flatbuffers.Offset { |
| 52 | + const offset = builder.endObject(); |
| 53 | + return offset; |
| 54 | +} |
| 55 | + |
| 56 | +static finishPersonBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) { |
| 57 | + builder.finish(offset); |
| 58 | +} |
| 59 | + |
| 60 | +static finishSizePrefixedPersonBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) { |
| 61 | + builder.finish(offset, undefined, true); |
| 62 | +} |
| 63 | + |
| 64 | +static createPerson(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, age:number):flatbuffers.Offset { |
| 65 | + Person.startPerson(builder); |
| 66 | + Person.addName(builder, nameOffset); |
| 67 | + Person.addAge(builder, age); |
| 68 | + return Person.endPerson(builder); |
| 69 | +} |
| 70 | +} |
0 commit comments