| 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 { Color } from '../../my-game/example/color.js'; |
| 8 |
|
| 9 |
|
| 10 |
export class TestSimpleTableWithEnum implements flatbuffers.IUnpackableObject<TestSimpleTableWithEnumT> { |
| 11 |
bb: flatbuffers.ByteBuffer|null = null; |
| 12 |
bb_pos = 0; |
| 13 |
__init(i:number, bb:flatbuffers.ByteBuffer):TestSimpleTableWithEnum { |
| 14 |
this.bb_pos = i; |
| 15 |
this.bb = bb; |
| 16 |
return this; |
| 17 |
} |
| 18 |
|
| 19 |
static getRootAsTestSimpleTableWithEnum(bb:flatbuffers.ByteBuffer, obj?:TestSimpleTableWithEnum):TestSimpleTableWithEnum { |
| 20 |
return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 21 |
} |
| 22 |
|
| 23 |
static getSizePrefixedRootAsTestSimpleTableWithEnum(bb:flatbuffers.ByteBuffer, obj?:TestSimpleTableWithEnum):TestSimpleTableWithEnum { |
| 24 |
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); |
| 25 |
return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb); |
| 26 |
} |
| 27 |
|
| 28 |
color():Color { |
| 29 |
const offset = this.bb!.__offset(this.bb_pos, 4); |
| 30 |
return offset ? this.bb!.readUint8(this.bb_pos + offset) : Color.Green; |
| 31 |
} |
| 32 |
|
| 33 |
mutate_color(value:Color):boolean { |
| 34 |
const offset = this.bb!.__offset(this.bb_pos, 4); |
| 35 |
|
| 36 |
if (offset === 0) { |
| 37 |
return false; |
| 38 |
} |
| 39 |
|
| 40 |
this.bb!.writeUint8(this.bb_pos + offset, value); |
| 41 |
return true; |
| 42 |
} |
| 43 |
|
| 44 |
static getFullyQualifiedName():string { |
| 45 |
return 'MyGame.Example.TestSimpleTableWithEnum'; |
| 46 |
} |
| 47 |
|
| 48 |
static startTestSimpleTableWithEnum(builder:flatbuffers.Builder) { |
| 49 |
builder.startObject(1); |
| 50 |
} |
| 51 |
|
| 52 |
static addColor(builder:flatbuffers.Builder, color:Color) { |
| 53 |
builder.addFieldInt8(0, color, Color.Green); |
| 54 |
} |
| 55 |
|
| 56 |
static endTestSimpleTableWithEnum(builder:flatbuffers.Builder):flatbuffers.Offset { |
| 57 |
const offset = builder.endObject(); |
| 58 |
return offset; |
| 59 |
} |
| 60 |
|
| 61 |
static createTestSimpleTableWithEnum(builder:flatbuffers.Builder, color:Color):flatbuffers.Offset { |
| 62 |
TestSimpleTableWithEnum.startTestSimpleTableWithEnum(builder); |
| 63 |
TestSimpleTableWithEnum.addColor(builder, color); |
| 64 |
return TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder); |
| 65 |
} |
| 66 |
|
| 67 |
serialize():Uint8Array { |
| 68 |
return this.bb!.bytes(); |
| 69 |
} |
| 70 |
|
| 71 |
static deserialize(buffer: Uint8Array):TestSimpleTableWithEnum { |
| 72 |
return TestSimpleTableWithEnum.getRootAsTestSimpleTableWithEnum(new flatbuffers.ByteBuffer(buffer)) |
| 73 |
} |
| 74 |
|
| 75 |
unpack(): TestSimpleTableWithEnumT { |
| 76 |
return new TestSimpleTableWithEnumT( |
| 77 |
this.color() |
| 78 |
); |
| 79 |
} |
| 80 |
|
| 81 |
|
| 82 |
unpackTo(_o: TestSimpleTableWithEnumT): void { |
| 83 |
_o.color = this.color(); |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
export class TestSimpleTableWithEnumT implements flatbuffers.IGeneratedObject { |
| 88 |
constructor( |
| 89 |
public color: Color = Color.Green |
| 90 |
){} |
| 91 |
|
| 92 |
|
| 93 |
pack(builder:flatbuffers.Builder): flatbuffers.Offset { |
| 94 |
return TestSimpleTableWithEnum.createTestSimpleTableWithEnum(builder, |
| 95 |
this.color |
| 96 |
); |
| 97 |
} |
| 98 |
} |