• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
5import * as flatbuffers from 'flatbuffers';
6
7import { Color } from '../../my-game/example/color.js';
8
9
10export 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
19static getRootAsTestSimpleTableWithEnum(bb:flatbuffers.ByteBuffer, obj?:TestSimpleTableWithEnum):TestSimpleTableWithEnum {
20  return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
21}
22
23static 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
28color():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
33mutate_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
44static getFullyQualifiedName():string {
45  return 'MyGame.Example.TestSimpleTableWithEnum';
46}
47
48static startTestSimpleTableWithEnum(builder:flatbuffers.Builder) {
49  builder.startObject(1);
50}
51
52static addColor(builder:flatbuffers.Builder, color:Color) {
53  builder.addFieldInt8(0, color, Color.Green);
54}
55
56static endTestSimpleTableWithEnum(builder:flatbuffers.Builder):flatbuffers.Offset {
57  const offset = builder.endObject();
58  return offset;
59}
60
61static createTestSimpleTableWithEnum(builder:flatbuffers.Builder, color:Color):flatbuffers.Offset {
62  TestSimpleTableWithEnum.startTestSimpleTableWithEnum(builder);
63  TestSimpleTableWithEnum.addColor(builder, color);
64  return TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder);
65}
66
67serialize():Uint8Array {
68  return this.bb!.bytes();
69}
70
71static deserialize(buffer: Uint8Array):TestSimpleTableWithEnum {
72  return TestSimpleTableWithEnum.getRootAsTestSimpleTableWithEnum(new flatbuffers.ByteBuffer(buffer))
73}
74
75unpack(): TestSimpleTableWithEnumT {
76  return new TestSimpleTableWithEnumT(
77    this.color()
78  );
79}
80
81
82unpackTo(_o: TestSimpleTableWithEnumT): void {
83  _o.color = this.color();
84}
85}
86
87export class TestSimpleTableWithEnumT implements flatbuffers.IGeneratedObject {
88constructor(
89  public color: Color = Color.Green
90){}
91
92
93pack(builder:flatbuffers.Builder): flatbuffers.Offset {
94  return TestSimpleTableWithEnum.createTestSimpleTableWithEnum(builder,
95    this.color
96  );
97}
98}
99