diff options
Diffstat (limited to 'tests/namespace_test/namespace-c/table-in-c.ts')
-rw-r--r-- | tests/namespace_test/namespace-c/table-in-c.ts | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/tests/namespace_test/namespace-c/table-in-c.ts b/tests/namespace_test/namespace-c/table-in-c.ts new file mode 100644 index 00000000..7fd559bd --- /dev/null +++ b/tests/namespace_test/namespace-c/table-in-c.ts @@ -0,0 +1,87 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +import * as flatbuffers from 'flatbuffers'; + +import { SecondTableInA, SecondTableInAT } from '../namespace-a/second-table-in-a'; +import { TableInFirstNS, TableInFirstNST } from '../namespace-a/table-in-first-n-s'; + + +export class TableInC { + bb: flatbuffers.ByteBuffer|null = null; + bb_pos = 0; +__init(i:number, bb:flatbuffers.ByteBuffer):TableInC { + this.bb_pos = i; + this.bb = bb; + return this; +} + +static getRootAsTableInC(bb:flatbuffers.ByteBuffer, obj?:TableInC):TableInC { + return (obj || new TableInC()).__init(bb.readInt32(bb.position()) + bb.position(), bb); +} + +static getSizePrefixedRootAsTableInC(bb:flatbuffers.ByteBuffer, obj?:TableInC):TableInC { + bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); + return (obj || new TableInC()).__init(bb.readInt32(bb.position()) + bb.position(), bb); +} + +referToA1(obj?:TableInFirstNS):TableInFirstNS|null { + const offset = this.bb!.__offset(this.bb_pos, 4); + return offset ? (obj || new TableInFirstNS()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; +} + +referToA2(obj?:SecondTableInA):SecondTableInA|null { + const offset = this.bb!.__offset(this.bb_pos, 6); + return offset ? (obj || new SecondTableInA()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null; +} + +static getFullyQualifiedName():string { + return 'NamespaceC.TableInC'; +} + +static startTableInC(builder:flatbuffers.Builder) { + builder.startObject(2); +} + +static addReferToA1(builder:flatbuffers.Builder, referToA1Offset:flatbuffers.Offset) { + builder.addFieldOffset(0, referToA1Offset, 0); +} + +static addReferToA2(builder:flatbuffers.Builder, referToA2Offset:flatbuffers.Offset) { + builder.addFieldOffset(1, referToA2Offset, 0); +} + +static endTableInC(builder:flatbuffers.Builder):flatbuffers.Offset { + const offset = builder.endObject(); + return offset; +} + + +unpack(): TableInCT { + return new TableInCT( + (this.referToA1() !== null ? this.referToA1()!.unpack() : null), + (this.referToA2() !== null ? this.referToA2()!.unpack() : null) + ); +} + + +unpackTo(_o: TableInCT): void { + _o.referToA1 = (this.referToA1() !== null ? this.referToA1()!.unpack() : null); + _o.referToA2 = (this.referToA2() !== null ? this.referToA2()!.unpack() : null); +} +} + +export class TableInCT { +constructor( + public referToA1: TableInFirstNST|null = null, + public referToA2: SecondTableInAT|null = null +){} + + +pack(builder:flatbuffers.Builder): flatbuffers.Offset { + TableInC.startTableInC(builder); + TableInC.addReferToA1(builder, (this.referToA1 !== null ? this.referToA1!.pack(builder) : 0)); + TableInC.addReferToA2(builder, (this.referToA2 !== null ? this.referToA2!.pack(builder) : 0)); + + return TableInC.endTableInC(builder); +} +} |