...

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

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

     1// automatically generated by the FlatBuffers compiler, do not modify
     2
     3import * as flatbuffers from 'flatbuffers';
     4
     5import { StructOfStructs, StructOfStructsT } from '../../my-game/example/struct-of-structs.js';
     6
     7
     8export class StructOfStructsOfStructs implements flatbuffers.IUnpackableObject<StructOfStructsOfStructsT> {
     9  bb: flatbuffers.ByteBuffer|null = null;
    10  bb_pos = 0;
    11  __init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructsOfStructs {
    12  this.bb_pos = i;
    13  this.bb = bb;
    14  return this;
    15}
    16
    17a(obj?:StructOfStructs):StructOfStructs|null {
    18  return (obj || new StructOfStructs()).__init(this.bb_pos, this.bb!);
    19}
    20
    21static getFullyQualifiedName():string {
    22  return 'MyGame.Example.StructOfStructsOfStructs';
    23}
    24
    25static sizeOf():number {
    26  return 20;
    27}
    28
    29static createStructOfStructsOfStructs(builder:flatbuffers.Builder, a_a_id: number, a_a_distance: number, a_b_a: number, a_b_b: number, a_c_id: number, a_c_distance: number):flatbuffers.Offset {
    30  builder.prep(4, 20);
    31  builder.prep(4, 20);
    32  builder.prep(4, 8);
    33  builder.writeInt32(a_c_distance);
    34  builder.writeInt32(a_c_id);
    35  builder.prep(2, 4);
    36  builder.pad(1);
    37  builder.writeInt8(a_b_b);
    38  builder.writeInt16(a_b_a);
    39  builder.prep(4, 8);
    40  builder.writeInt32(a_a_distance);
    41  builder.writeInt32(a_a_id);
    42  return builder.offset();
    43}
    44
    45
    46unpack(): StructOfStructsOfStructsT {
    47  return new StructOfStructsOfStructsT(
    48    (this.a() !== null ? this.a()!.unpack() : null)
    49  );
    50}
    51
    52
    53unpackTo(_o: StructOfStructsOfStructsT): void {
    54  _o.a = (this.a() !== null ? this.a()!.unpack() : null);
    55}
    56}
    57
    58export class StructOfStructsOfStructsT implements flatbuffers.IGeneratedObject {
    59constructor(
    60  public a: StructOfStructsT|null = null
    61){}
    62
    63
    64pack(builder:flatbuffers.Builder): flatbuffers.Offset {
    65  return StructOfStructsOfStructs.createStructOfStructsOfStructs(builder,
    66    (this.a?.a?.id ?? 0),
    67    (this.a?.a?.distance ?? 0),
    68    (this.a?.b?.a ?? 0),
    69    (this.a?.b?.b ?? 0),
    70    (this.a?.c?.id ?? 0),
    71    (this.a?.c?.distance ?? 0)
    72  );
    73}
    74}

View as plain text