• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// automatically generated by the FlatBuffers compiler, do not modify
2import * as flatbuffers from 'flatbuffers';
3export class Foo {
4    constructor() {
5        this.bb = null;
6        this.bb_pos = 0;
7    }
8    __init(i, bb) {
9        this.bb_pos = i;
10        this.bb = bb;
11        return this;
12    }
13    static getRootAsFoo(bb, obj) {
14        return (obj || new Foo()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
15    }
16    static getSizePrefixedRootAsFoo(bb, obj) {
17        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
18        return (obj || new Foo()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
19    }
20    strA(optionalEncoding) {
21        const offset = this.bb.__offset(this.bb_pos, 4);
22        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
23    }
24    strB(optionalEncoding) {
25        const offset = this.bb.__offset(this.bb_pos, 6);
26        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
27    }
28    static startFoo(builder) {
29        builder.startObject(2);
30    }
31    static addStrA(builder, strAOffset) {
32        builder.addFieldOffset(0, strAOffset, 0);
33    }
34    static addStrB(builder, strBOffset) {
35        builder.addFieldOffset(1, strBOffset, 0);
36    }
37    static endFoo(builder) {
38        const offset = builder.endObject();
39        builder.requiredField(offset, 4); // str_a
40        builder.requiredField(offset, 6); // str_b
41        return offset;
42    }
43    static createFoo(builder, strAOffset, strBOffset) {
44        Foo.startFoo(builder);
45        Foo.addStrA(builder, strAOffset);
46        Foo.addStrB(builder, strBOffset);
47        return Foo.endFoo(builder);
48    }
49}
50