File: foo.js

package info (click to toggle)
golang-github-google-flatbuffers 24.12.23-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 17,704 kB
  • sloc: cpp: 53,217; python: 6,900; cs: 5,566; java: 4,370; php: 1,460; javascript: 1,061; xml: 1,016; sh: 886; makefile: 13
file content (49 lines) | stat: -rw-r--r-- 1,696 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
export class Foo {
    constructor() {
        this.bb = null;
        this.bb_pos = 0;
    }
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsFoo(bb, obj) {
        return (obj || new Foo()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsFoo(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new Foo()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    strA(optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
    }
    strB(optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 6);
        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
    }
    static startFoo(builder) {
        builder.startObject(2);
    }
    static addStrA(builder, strAOffset) {
        builder.addFieldOffset(0, strAOffset, 0);
    }
    static addStrB(builder, strBOffset) {
        builder.addFieldOffset(1, strBOffset, 0);
    }
    static endFoo(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // str_a
        builder.requiredField(offset, 6); // str_b
        return offset;
    }
    static createFoo(builder, strAOffset, strBOffset) {
        Foo.startFoo(builder);
        Foo.addStrA(builder, strAOffset);
        Foo.addStrB(builder, strBOffset);
        return Foo.endFoo(builder);
    }
}