...

Text file src/github.com/google/flatbuffers/tests/ts/arrays_test_complex/my-game/example/inner-struct.ts

Documentation: github.com/google/flatbuffers/tests/ts/arrays_test_complex/my-game/example

     1// automatically generated by the FlatBuffers compiler, do not modify
     2
     3import * as flatbuffers from 'flatbuffers';
     4
     5
     6
     7export class InnerStruct implements flatbuffers.IUnpackableObject<InnerStructT> {
     8  bb: flatbuffers.ByteBuffer|null = null;
     9  bb_pos = 0;
    10  __init(i:number, bb:flatbuffers.ByteBuffer):InnerStruct {
    11  this.bb_pos = i;
    12  this.bb = bb;
    13  return this;
    14}
    15
    16a():number {
    17  return this.bb!.readFloat64(this.bb_pos);
    18}
    19
    20b(index: number):number|null {
    21    return this.bb!.readUint8(this.bb_pos + 8 + index);
    22}
    23
    24c():number {
    25  return this.bb!.readInt8(this.bb_pos + 21);
    26}
    27
    28dUnderscore():bigint {
    29  return this.bb!.readInt64(this.bb_pos + 24);
    30}
    31
    32static getFullyQualifiedName():string {
    33  return 'MyGame.Example.InnerStruct';
    34}
    35
    36static sizeOf():number {
    37  return 32;
    38}
    39
    40static createInnerStruct(builder:flatbuffers.Builder, a: number, b: number[]|null, c: number, d_underscore: bigint):flatbuffers.Offset {
    41  builder.prep(8, 32);
    42  builder.writeInt64(BigInt(d_underscore ?? 0));
    43  builder.pad(2);
    44  builder.writeInt8(c);
    45
    46  for (let i = 12; i >= 0; --i) {
    47    builder.writeInt8((b?.[i] ?? 0));
    48
    49  }
    50
    51  builder.writeFloat64(a);
    52  return builder.offset();
    53}
    54
    55
    56unpack(): InnerStructT {
    57  return new InnerStructT(
    58    this.a(),
    59    this.bb!.createScalarList<number>(this.b.bind(this), 13),
    60    this.c(),
    61    this.dUnderscore()
    62  );
    63}
    64
    65
    66unpackTo(_o: InnerStructT): void {
    67  _o.a = this.a();
    68  _o.b = this.bb!.createScalarList<number>(this.b.bind(this), 13);
    69  _o.c = this.c();
    70  _o.dUnderscore = this.dUnderscore();
    71}
    72}
    73
    74export class InnerStructT implements flatbuffers.IGeneratedObject {
    75constructor(
    76  public a: number = 0.0,
    77  public b: (number)[] = [],
    78  public c: number = 0,
    79  public dUnderscore: bigint = BigInt('0')
    80){}
    81
    82
    83pack(builder:flatbuffers.Builder): flatbuffers.Offset {
    84  return InnerStruct.createInnerStruct(builder,
    85    this.a,
    86    this.b,
    87    this.c,
    88    this.dUnderscore
    89  );
    90}
    91}

View as plain text