| 1 |
|
| 2 |
|
| 3 |
import * as flatbuffers from 'flatbuffers'; |
| 4 |
import { ArrayStruct } from '../../my-game/example/array-struct.js'; |
| 5 |
export class ArrayTable { |
| 6 |
constructor() { |
| 7 |
this.bb = null; |
| 8 |
this.bb_pos = 0; |
| 9 |
} |
| 10 |
__init(i, bb) { |
| 11 |
this.bb_pos = i; |
| 12 |
this.bb = bb; |
| 13 |
return this; |
| 14 |
} |
| 15 |
static getRootAsArrayTable(bb, obj) { |
| 16 |
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 17 |
} |
| 18 |
static getSizePrefixedRootAsArrayTable(bb, obj) { |
| 19 |
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); |
| 20 |
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 21 |
} |
| 22 |
static bufferHasIdentifier(bb) { |
| 23 |
return bb.__has_identifier('RHUB'); |
| 24 |
} |
| 25 |
a(optionalEncoding) { |
| 26 |
const offset = this.bb.__offset(this.bb_pos, 4); |
| 27 |
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null; |
| 28 |
} |
| 29 |
cUnderscore(obj) { |
| 30 |
const offset = this.bb.__offset(this.bb_pos, 6); |
| 31 |
return offset ? (obj || new ArrayStruct()).__init(this.bb_pos + offset, this.bb) : null; |
| 32 |
} |
| 33 |
static getFullyQualifiedName() { |
| 34 |
return 'MyGame.Example.ArrayTable'; |
| 35 |
} |
| 36 |
static startArrayTable(builder) { |
| 37 |
builder.startObject(2); |
| 38 |
} |
| 39 |
static addA(builder, aOffset) { |
| 40 |
builder.addFieldOffset(0, aOffset, 0); |
| 41 |
} |
| 42 |
static addCUnderscore(builder, cUnderscoreOffset) { |
| 43 |
builder.addFieldStruct(1, cUnderscoreOffset, 0); |
| 44 |
} |
| 45 |
static endArrayTable(builder) { |
| 46 |
const offset = builder.endObject(); |
| 47 |
return offset; |
| 48 |
} |
| 49 |
static finishArrayTableBuffer(builder, offset) { |
| 50 |
builder.finish(offset, 'RHUB'); |
| 51 |
} |
| 52 |
static finishSizePrefixedArrayTableBuffer(builder, offset) { |
| 53 |
builder.finish(offset, 'RHUB', true); |
| 54 |
} |
| 55 |
unpack() { |
| 56 |
return new ArrayTableT(this.a(), (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null)); |
| 57 |
} |
| 58 |
unpackTo(_o) { |
| 59 |
_o.a = this.a(); |
| 60 |
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null); |
| 61 |
} |
| 62 |
} |
| 63 |
export class ArrayTableT { |
| 64 |
constructor(a = null, cUnderscore = null) { |
| 65 |
this.a = a; |
| 66 |
this.cUnderscore = cUnderscore; |
| 67 |
} |
| 68 |
pack(builder) { |
| 69 |
const a = (this.a !== null ? builder.createString(this.a) : 0); |
| 70 |
ArrayTable.startArrayTable(builder); |
| 71 |
ArrayTable.addA(builder, a); |
| 72 |
ArrayTable.addCUnderscore(builder, (this.cUnderscore !== null ? this.cUnderscore.pack(builder) : 0)); |
| 73 |
return ArrayTable.endArrayTable(builder); |
| 74 |
} |
| 75 |
} |