• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// automatically generated by the FlatBuffers compiler, do not modify
2
3import * as flatbuffers from 'flatbuffers';
4
5import { EnumInNestedNS } from '../namespace-a/namespace-b/enum-in-nested-n-s';
6import { StructInNestedNS, StructInNestedNST } from '../namespace-a/namespace-b/struct-in-nested-n-s';
7import { TableInNestedNS, TableInNestedNST } from '../namespace-a/namespace-b/table-in-nested-n-s';
8import { UnionInNestedNS, unionToUnionInNestedNS, unionListToUnionInNestedNS } from '../namespace-a/namespace-b/union-in-nested-n-s';
9
10
11export class TableInFirstNS {
12  bb: flatbuffers.ByteBuffer|null = null;
13  bb_pos = 0;
14__init(i:number, bb:flatbuffers.ByteBuffer):TableInFirstNS {
15  this.bb_pos = i;
16  this.bb = bb;
17  return this;
18}
19
20static getRootAsTableInFirstNS(bb:flatbuffers.ByteBuffer, obj?:TableInFirstNS):TableInFirstNS {
21  return (obj || new TableInFirstNS()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
22}
23
24static getSizePrefixedRootAsTableInFirstNS(bb:flatbuffers.ByteBuffer, obj?:TableInFirstNS):TableInFirstNS {
25  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
26  return (obj || new TableInFirstNS()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
27}
28
29fooTable(obj?:TableInNestedNS):TableInNestedNS|null {
30  const offset = this.bb!.__offset(this.bb_pos, 4);
31  return offset ? (obj || new TableInNestedNS()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
32}
33
34fooEnum():EnumInNestedNS {
35  const offset = this.bb!.__offset(this.bb_pos, 6);
36  return offset ? this.bb!.readInt8(this.bb_pos + offset) : EnumInNestedNS.A;
37}
38
39mutate_foo_enum(value:EnumInNestedNS):boolean {
40  const offset = this.bb!.__offset(this.bb_pos, 6);
41
42  if (offset === 0) {
43    return false;
44  }
45
46  this.bb!.writeInt8(this.bb_pos + offset, value);
47  return true;
48}
49
50fooUnionType():UnionInNestedNS {
51  const offset = this.bb!.__offset(this.bb_pos, 8);
52  return offset ? this.bb!.readUint8(this.bb_pos + offset) : UnionInNestedNS.NONE;
53}
54
55fooUnion<T extends flatbuffers.Table>(obj:any):any|null {
56  const offset = this.bb!.__offset(this.bb_pos, 10);
57  return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;
58}
59
60fooStruct(obj?:StructInNestedNS):StructInNestedNS|null {
61  const offset = this.bb!.__offset(this.bb_pos, 12);
62  return offset ? (obj || new StructInNestedNS()).__init(this.bb_pos + offset, this.bb!) : null;
63}
64
65static getFullyQualifiedName():string {
66  return 'NamespaceA.TableInFirstNS';
67}
68
69static startTableInFirstNS(builder:flatbuffers.Builder) {
70  builder.startObject(5);
71}
72
73static addFooTable(builder:flatbuffers.Builder, fooTableOffset:flatbuffers.Offset) {
74  builder.addFieldOffset(0, fooTableOffset, 0);
75}
76
77static addFooEnum(builder:flatbuffers.Builder, fooEnum:EnumInNestedNS) {
78  builder.addFieldInt8(1, fooEnum, EnumInNestedNS.A);
79}
80
81static addFooUnionType(builder:flatbuffers.Builder, fooUnionType:UnionInNestedNS) {
82  builder.addFieldInt8(2, fooUnionType, UnionInNestedNS.NONE);
83}
84
85static addFooUnion(builder:flatbuffers.Builder, fooUnionOffset:flatbuffers.Offset) {
86  builder.addFieldOffset(3, fooUnionOffset, 0);
87}
88
89static addFooStruct(builder:flatbuffers.Builder, fooStructOffset:flatbuffers.Offset) {
90  builder.addFieldStruct(4, fooStructOffset, 0);
91}
92
93static endTableInFirstNS(builder:flatbuffers.Builder):flatbuffers.Offset {
94  const offset = builder.endObject();
95  return offset;
96}
97
98
99unpack(): TableInFirstNST {
100  return new TableInFirstNST(
101    (this.fooTable() !== null ? this.fooTable()!.unpack() : null),
102    this.fooEnum(),
103    this.fooUnionType(),
104    (() => {
105      let temp = unionToUnionInNestedNS(this.fooUnionType(), this.fooUnion.bind(this));
106      if(temp === null) { return null; }
107      return temp.unpack()
108  })(),
109    (this.fooStruct() !== null ? this.fooStruct()!.unpack() : null)
110  );
111}
112
113
114unpackTo(_o: TableInFirstNST): void {
115  _o.fooTable = (this.fooTable() !== null ? this.fooTable()!.unpack() : null);
116  _o.fooEnum = this.fooEnum();
117  _o.fooUnionType = this.fooUnionType();
118  _o.fooUnion = (() => {
119      let temp = unionToUnionInNestedNS(this.fooUnionType(), this.fooUnion.bind(this));
120      if(temp === null) { return null; }
121      return temp.unpack()
122  })();
123  _o.fooStruct = (this.fooStruct() !== null ? this.fooStruct()!.unpack() : null);
124}
125}
126
127export class TableInFirstNST {
128constructor(
129  public fooTable: TableInNestedNST|null = null,
130  public fooEnum: EnumInNestedNS = EnumInNestedNS.A,
131  public fooUnionType: UnionInNestedNS = UnionInNestedNS.NONE,
132  public fooUnion: TableInNestedNST|null = null,
133  public fooStruct: StructInNestedNST|null = null
134){}
135
136
137pack(builder:flatbuffers.Builder): flatbuffers.Offset {
138  const fooTable = (this.fooTable !== null ? this.fooTable!.pack(builder) : 0);
139  const fooUnion = builder.createObjectOffset(this.fooUnion);
140
141  TableInFirstNS.startTableInFirstNS(builder);
142  TableInFirstNS.addFooTable(builder, fooTable);
143  TableInFirstNS.addFooEnum(builder, this.fooEnum);
144  TableInFirstNS.addFooUnionType(builder, this.fooUnionType);
145  TableInFirstNS.addFooUnion(builder, fooUnion);
146  TableInFirstNS.addFooStruct(builder, (this.fooStruct !== null ? this.fooStruct!.pack(builder) : 0));
147
148  return TableInFirstNS.endTableInFirstNS(builder);
149}
150}
151