mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-12 07:50:59 +00:00
[TS/JS] Entry point per namespace and reworked 1.x compatible single file build (#7510)
* [TS/JS] Entry point per namespace * Fix handling of outputpath and array_test * Attempt to fix generate_code * Fix cwd for ts in generate_code * Attempt to fixup bazel and some docs * Add --ts-flat-files to bazel build to get bundle * Move to DEFAULT_FLATC_TS_ARGS * Attempt to add esbuild * Attempt to use npm instead * Remove futile attempt to add esbuild * Attempt to as bazel esbuild * Shuffle * Upgrade bazel deps * Revert failed attempts to get bazel working * Ignore flatc tests for now * Add esbuild dependency * `package.json` Include esbuild * `WORKSPACE` Add fetching esbuild binary * Update WORKSPACE * Unfreeze Lockfile * Update WORKSPACE * Update BUILD.bazel * Rework to suggest instead of running external bundler * Add esbuild generation to test script * Prelim bundle test * Run test JavaScriptTest from flatbuffers 1.x * Deps upgrade * Clang format fix * Revert bazel changes * Fix newline * Generate with type declarations * Handle "empty" root namespace * Adjust tests for typescript_keywords.ts * Separate test procedure for old node resolution module output * Fix rel path for root level re-exports * Bazel support for esbuild-based flatc Unfortunately, we lose typing information because the new esbuild method of generating single files does not generate type information. The method used here is a bit hack-ish because it relies on parsing the console output of flatc to figure out what to do. * Try to fix bazel build for when node isn't present on host * Auto formatting fixes * Fix missing generated code Co-authored-by: Derek Bailey <derekbailey@google.com> Co-authored-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
This commit is contained in:
451
tests/ts/arrays_test_complex/arrays_test_complex_generated.cjs
Normal file
451
tests/ts/arrays_test_complex/arrays_test_complex_generated.cjs
Normal file
@@ -0,0 +1,451 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// arrays_test_complex/my-game/example.ts
|
||||
var example_exports = {};
|
||||
__export(example_exports, {
|
||||
ArrayStruct: () => ArrayStruct,
|
||||
ArrayTable: () => ArrayTable,
|
||||
InnerStruct: () => InnerStruct,
|
||||
NestedStruct: () => NestedStruct,
|
||||
OuterStruct: () => OuterStruct,
|
||||
TestEnum: () => TestEnum
|
||||
});
|
||||
module.exports = __toCommonJS(example_exports);
|
||||
|
||||
// arrays_test_complex/my-game/example/inner-struct.js
|
||||
var InnerStruct = class {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a() {
|
||||
return this.bb.readFloat64(this.bb_pos);
|
||||
}
|
||||
b(index) {
|
||||
return this.bb.readUint8(this.bb_pos + 8 + index);
|
||||
}
|
||||
c() {
|
||||
return this.bb.readInt8(this.bb_pos + 21);
|
||||
}
|
||||
dUnderscore() {
|
||||
return this.bb.readInt64(this.bb_pos + 24);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return "MyGame.Example.InnerStruct";
|
||||
}
|
||||
static sizeOf() {
|
||||
return 32;
|
||||
}
|
||||
static createInnerStruct(builder, a, b, c, d_underscore) {
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8(b?.[i] ?? 0);
|
||||
}
|
||||
builder.writeFloat64(a);
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new InnerStructT(this.a(), this.bb.createScalarList(this.b.bind(this), 13), this.c(), this.dUnderscore());
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.b = this.bb.createScalarList(this.b.bind(this), 13);
|
||||
_o.c = this.c();
|
||||
_o.dUnderscore = this.dUnderscore();
|
||||
}
|
||||
};
|
||||
var InnerStructT = class {
|
||||
constructor(a = 0, b = [], c = 0, dUnderscore = BigInt("0")) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
this.dUnderscore = dUnderscore;
|
||||
}
|
||||
pack(builder) {
|
||||
return InnerStruct.createInnerStruct(builder, this.a, this.b, this.c, this.dUnderscore);
|
||||
}
|
||||
};
|
||||
|
||||
// arrays_test_complex/my-game/example/outer-struct.js
|
||||
var OuterStruct = class {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a() {
|
||||
return !!this.bb.readInt8(this.bb_pos);
|
||||
}
|
||||
b() {
|
||||
return this.bb.readFloat64(this.bb_pos + 8);
|
||||
}
|
||||
cUnderscore(obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb);
|
||||
}
|
||||
d(index, obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 48 + index * 32, this.bb);
|
||||
}
|
||||
e(obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb);
|
||||
}
|
||||
f(index) {
|
||||
return this.bb.readFloat64(this.bb_pos + 176 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return "MyGame.Example.OuterStruct";
|
||||
}
|
||||
static sizeOf() {
|
||||
return 208;
|
||||
}
|
||||
static createOuterStruct(builder, a, b, c_underscore_a, c_underscore_b, c_underscore_c, c_underscore_d_underscore, d, e_a, e_b, e_c, e_d_underscore, f) {
|
||||
builder.prep(8, 208);
|
||||
for (let i = 3; i >= 0; --i) {
|
||||
builder.writeFloat64(f?.[i] ?? 0);
|
||||
}
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(e_d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(e_c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8(e_b?.[i] ?? 0);
|
||||
}
|
||||
builder.writeFloat64(e_a);
|
||||
for (let i = 2; i >= 0; --i) {
|
||||
const item = d?.[i];
|
||||
if (item instanceof InnerStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
InnerStruct.createInnerStruct(builder, item?.a, item?.b, item?.c, item?.dUnderscore);
|
||||
}
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(c_underscore_d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c_underscore_c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8(c_underscore_b?.[i] ?? 0);
|
||||
}
|
||||
builder.writeFloat64(c_underscore_a);
|
||||
builder.writeFloat64(b);
|
||||
builder.pad(7);
|
||||
builder.writeInt8(Number(Boolean(a)));
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new OuterStructT(this.a(), this.b(), this.cUnderscore() !== null ? this.cUnderscore().unpack() : null, this.bb.createObjList(this.d.bind(this), 3), this.e() !== null ? this.e().unpack() : null, this.bb.createScalarList(this.f.bind(this), 4));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = this.cUnderscore() !== null ? this.cUnderscore().unpack() : null;
|
||||
_o.d = this.bb.createObjList(this.d.bind(this), 3);
|
||||
_o.e = this.e() !== null ? this.e().unpack() : null;
|
||||
_o.f = this.bb.createScalarList(this.f.bind(this), 4);
|
||||
}
|
||||
};
|
||||
var OuterStructT = class {
|
||||
constructor(a = false, b = 0, cUnderscore = null, d = [], e = null, f = []) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.cUnderscore = cUnderscore;
|
||||
this.d = d;
|
||||
this.e = e;
|
||||
this.f = f;
|
||||
}
|
||||
pack(builder) {
|
||||
return OuterStruct.createOuterStruct(builder, this.a, this.b, this.cUnderscore?.a ?? 0, this.cUnderscore?.b ?? [], this.cUnderscore?.c ?? 0, this.cUnderscore?.dUnderscore ?? BigInt(0), this.d, this.e?.a ?? 0, this.e?.b ?? [], this.e?.c ?? 0, this.e?.dUnderscore ?? BigInt(0), this.f);
|
||||
}
|
||||
};
|
||||
|
||||
// arrays_test_complex/my-game/example/test-enum.js
|
||||
var TestEnum;
|
||||
(function(TestEnum2) {
|
||||
TestEnum2[TestEnum2["A"] = 0] = "A";
|
||||
TestEnum2[TestEnum2["B"] = 1] = "B";
|
||||
TestEnum2[TestEnum2["C"] = 2] = "C";
|
||||
})(TestEnum = TestEnum || (TestEnum = {}));
|
||||
|
||||
// arrays_test_complex/my-game/example/nested-struct.js
|
||||
var NestedStruct = class {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a(index) {
|
||||
return this.bb.readInt32(this.bb_pos + 0 + index * 4);
|
||||
}
|
||||
b() {
|
||||
return this.bb.readInt8(this.bb_pos + 8);
|
||||
}
|
||||
cUnderscore(index) {
|
||||
return this.bb.readInt8(this.bb_pos + 9 + index);
|
||||
}
|
||||
dOuter(index, obj) {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 16 + index * 208, this.bb);
|
||||
}
|
||||
e(index) {
|
||||
return this.bb.readInt64(this.bb_pos + 1056 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return "MyGame.Example.NestedStruct";
|
||||
}
|
||||
static sizeOf() {
|
||||
return 1072;
|
||||
}
|
||||
static createNestedStruct(builder, a, b, c_underscore, d_outer, e) {
|
||||
builder.prep(8, 1072);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(e?.[i] ?? 0));
|
||||
}
|
||||
for (let i = 4; i >= 0; --i) {
|
||||
const item = d_outer?.[i];
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
OuterStruct.createOuterStruct(builder, item?.a, item?.b, item?.cUnderscore?.a ?? 0, item?.cUnderscore?.b ?? [], item?.cUnderscore?.c ?? 0, item?.cUnderscore?.dUnderscore ?? BigInt(0), item?.d, item?.e?.a ?? 0, item?.e?.b ?? [], item?.e?.c ?? 0, item?.e?.dUnderscore ?? BigInt(0), item?.f);
|
||||
}
|
||||
builder.pad(5);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt8(c_underscore?.[i] ?? 0);
|
||||
}
|
||||
builder.writeInt8(b);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt32(a?.[i] ?? 0);
|
||||
}
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new NestedStructT(this.bb.createScalarList(this.a.bind(this), 2), this.b(), this.bb.createScalarList(this.cUnderscore.bind(this), 2), this.bb.createObjList(this.dOuter.bind(this), 5), this.bb.createScalarList(this.e.bind(this), 2));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.bb.createScalarList(this.a.bind(this), 2);
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = this.bb.createScalarList(this.cUnderscore.bind(this), 2);
|
||||
_o.dOuter = this.bb.createObjList(this.dOuter.bind(this), 5);
|
||||
_o.e = this.bb.createScalarList(this.e.bind(this), 2);
|
||||
}
|
||||
};
|
||||
var NestedStructT = class {
|
||||
constructor(a = [], b = TestEnum.A, cUnderscore = [TestEnum.A, TestEnum.A], dOuter = [], e = []) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.cUnderscore = cUnderscore;
|
||||
this.dOuter = dOuter;
|
||||
this.e = e;
|
||||
}
|
||||
pack(builder) {
|
||||
return NestedStruct.createNestedStruct(builder, this.a, this.b, this.cUnderscore, this.dOuter, this.e);
|
||||
}
|
||||
};
|
||||
|
||||
// arrays_test_complex/my-game/example/array-struct.js
|
||||
var ArrayStruct = class {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
aUnderscore() {
|
||||
return this.bb.readFloat32(this.bb_pos);
|
||||
}
|
||||
bUnderscore(index) {
|
||||
return this.bb.readInt32(this.bb_pos + 4 + index * 4);
|
||||
}
|
||||
c() {
|
||||
return this.bb.readInt8(this.bb_pos + 64);
|
||||
}
|
||||
d(index, obj) {
|
||||
return (obj || new NestedStruct()).__init(this.bb_pos + 72 + index * 1072, this.bb);
|
||||
}
|
||||
e() {
|
||||
return this.bb.readInt32(this.bb_pos + 2216);
|
||||
}
|
||||
f(index, obj) {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 2224 + index * 208, this.bb);
|
||||
}
|
||||
g(index) {
|
||||
return this.bb.readInt64(this.bb_pos + 2640 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return "MyGame.Example.ArrayStruct";
|
||||
}
|
||||
static sizeOf() {
|
||||
return 2656;
|
||||
}
|
||||
static createArrayStruct(builder, a_underscore, b_underscore, c, d, e, f, g) {
|
||||
builder.prep(8, 2656);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(g?.[i] ?? 0));
|
||||
}
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = f?.[i];
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
OuterStruct.createOuterStruct(builder, item?.a, item?.b, item?.cUnderscore?.a ?? 0, item?.cUnderscore?.b ?? [], item?.cUnderscore?.c ?? 0, item?.cUnderscore?.dUnderscore ?? BigInt(0), item?.d, item?.e?.a ?? 0, item?.e?.b ?? [], item?.e?.c ?? 0, item?.e?.dUnderscore ?? BigInt(0), item?.f);
|
||||
}
|
||||
builder.pad(4);
|
||||
builder.writeInt32(e);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = d?.[i];
|
||||
if (item instanceof NestedStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
NestedStruct.createNestedStruct(builder, item?.a, item?.b, item?.cUnderscore, item?.dOuter, item?.e);
|
||||
}
|
||||
builder.pad(7);
|
||||
builder.writeInt8(c);
|
||||
for (let i = 14; i >= 0; --i) {
|
||||
builder.writeInt32(b_underscore?.[i] ?? 0);
|
||||
}
|
||||
builder.writeFloat32(a_underscore);
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new ArrayStructT(this.aUnderscore(), this.bb.createScalarList(this.bUnderscore.bind(this), 15), this.c(), this.bb.createObjList(this.d.bind(this), 2), this.e(), this.bb.createObjList(this.f.bind(this), 2), this.bb.createScalarList(this.g.bind(this), 2));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.aUnderscore = this.aUnderscore();
|
||||
_o.bUnderscore = this.bb.createScalarList(this.bUnderscore.bind(this), 15);
|
||||
_o.c = this.c();
|
||||
_o.d = this.bb.createObjList(this.d.bind(this), 2);
|
||||
_o.e = this.e();
|
||||
_o.f = this.bb.createObjList(this.f.bind(this), 2);
|
||||
_o.g = this.bb.createScalarList(this.g.bind(this), 2);
|
||||
}
|
||||
};
|
||||
var ArrayStructT = class {
|
||||
constructor(aUnderscore = 0, bUnderscore = [], c = 0, d = [], e = 0, f = [], g = []) {
|
||||
this.aUnderscore = aUnderscore;
|
||||
this.bUnderscore = bUnderscore;
|
||||
this.c = c;
|
||||
this.d = d;
|
||||
this.e = e;
|
||||
this.f = f;
|
||||
this.g = g;
|
||||
}
|
||||
pack(builder) {
|
||||
return ArrayStruct.createArrayStruct(builder, this.aUnderscore, this.bUnderscore, this.c, this.d, this.e, this.f, this.g);
|
||||
}
|
||||
};
|
||||
|
||||
// arrays_test_complex/my-game/example/array-table.js
|
||||
var flatbuffers = __toESM(require("flatbuffers"), 1);
|
||||
var ArrayTable = class {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
static getRootAsArrayTable(bb, obj) {
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static getSizePrefixedRootAsArrayTable(bb, obj) {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static bufferHasIdentifier(bb) {
|
||||
return bb.__has_identifier("RHUB");
|
||||
}
|
||||
a(optionalEncoding) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
cUnderscore(obj) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 6);
|
||||
return offset ? (obj || new ArrayStruct()).__init(this.bb_pos + offset, this.bb) : null;
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return "MyGame.Example.ArrayTable";
|
||||
}
|
||||
static startArrayTable(builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
static addA(builder, aOffset) {
|
||||
builder.addFieldOffset(0, aOffset, 0);
|
||||
}
|
||||
static addCUnderscore(builder, cUnderscoreOffset) {
|
||||
builder.addFieldStruct(1, cUnderscoreOffset, 0);
|
||||
}
|
||||
static endArrayTable(builder) {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
static finishArrayTableBuffer(builder, offset) {
|
||||
builder.finish(offset, "RHUB");
|
||||
}
|
||||
static finishSizePrefixedArrayTableBuffer(builder, offset) {
|
||||
builder.finish(offset, "RHUB", true);
|
||||
}
|
||||
unpack() {
|
||||
return new ArrayTableT(this.a(), this.cUnderscore() !== null ? this.cUnderscore().unpack() : null);
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.cUnderscore = this.cUnderscore() !== null ? this.cUnderscore().unpack() : null;
|
||||
}
|
||||
};
|
||||
var ArrayTableT = class {
|
||||
constructor(a = null, cUnderscore = null) {
|
||||
this.a = a;
|
||||
this.cUnderscore = cUnderscore;
|
||||
}
|
||||
pack(builder) {
|
||||
const a = this.a !== null ? builder.createString(this.a) : 0;
|
||||
ArrayTable.startArrayTable(builder);
|
||||
ArrayTable.addA(builder, a);
|
||||
ArrayTable.addCUnderscore(builder, this.cUnderscore !== null ? this.cUnderscore.pack(builder) : 0);
|
||||
return ArrayTable.endArrayTable(builder);
|
||||
}
|
||||
};
|
||||
@@ -1,409 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
export var TestEnum;
|
||||
(function (TestEnum) {
|
||||
TestEnum[TestEnum["A"] = 0] = "A";
|
||||
TestEnum[TestEnum["B"] = 1] = "B";
|
||||
TestEnum[TestEnum["C"] = 2] = "C";
|
||||
})(TestEnum || (TestEnum = {}));
|
||||
export class InnerStruct {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a() {
|
||||
return this.bb.readFloat64(this.bb_pos);
|
||||
}
|
||||
b(index) {
|
||||
return this.bb.readUint8(this.bb_pos + 8 + index);
|
||||
}
|
||||
c() {
|
||||
return this.bb.readInt8(this.bb_pos + 21);
|
||||
}
|
||||
dUnderscore() {
|
||||
return this.bb.readInt64(this.bb_pos + 24);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.InnerStruct';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 32;
|
||||
}
|
||||
static createInnerStruct(builder, a, b, c, d_underscore) {
|
||||
var _a;
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(d_underscore !== null && d_underscore !== void 0 ? d_underscore : 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8(((_a = b === null || b === void 0 ? void 0 : b[i]) !== null && _a !== void 0 ? _a : 0));
|
||||
}
|
||||
builder.writeFloat64(a);
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new InnerStructT(this.a(), this.bb.createScalarList(this.b.bind(this), 13), this.c(), this.dUnderscore());
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.b = this.bb.createScalarList(this.b.bind(this), 13);
|
||||
_o.c = this.c();
|
||||
_o.dUnderscore = this.dUnderscore();
|
||||
}
|
||||
}
|
||||
export class InnerStructT {
|
||||
constructor(a = 0.0, b = [], c = 0, dUnderscore = BigInt('0')) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
this.dUnderscore = dUnderscore;
|
||||
}
|
||||
pack(builder) {
|
||||
return InnerStruct.createInnerStruct(builder, this.a, this.b, this.c, this.dUnderscore);
|
||||
}
|
||||
}
|
||||
export class OuterStruct {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a() {
|
||||
return !!this.bb.readInt8(this.bb_pos);
|
||||
}
|
||||
b() {
|
||||
return this.bb.readFloat64(this.bb_pos + 8);
|
||||
}
|
||||
cUnderscore(obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb);
|
||||
}
|
||||
d(index, obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 48 + index * 32, this.bb);
|
||||
}
|
||||
e(obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb);
|
||||
}
|
||||
f(index) {
|
||||
return this.bb.readFloat64(this.bb_pos + 176 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.OuterStruct';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 208;
|
||||
}
|
||||
static createOuterStruct(builder, a, b, c_underscore_a, c_underscore_b, c_underscore_c, c_underscore_d_underscore, d, e_a, e_b, e_c, e_d_underscore, f) {
|
||||
var _a, _b, _c;
|
||||
builder.prep(8, 208);
|
||||
for (let i = 3; i >= 0; --i) {
|
||||
builder.writeFloat64(((_a = f === null || f === void 0 ? void 0 : f[i]) !== null && _a !== void 0 ? _a : 0));
|
||||
}
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(e_d_underscore !== null && e_d_underscore !== void 0 ? e_d_underscore : 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(e_c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8(((_b = e_b === null || e_b === void 0 ? void 0 : e_b[i]) !== null && _b !== void 0 ? _b : 0));
|
||||
}
|
||||
builder.writeFloat64(e_a);
|
||||
for (let i = 2; i >= 0; --i) {
|
||||
const item = d === null || d === void 0 ? void 0 : d[i];
|
||||
if (item instanceof InnerStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
InnerStruct.createInnerStruct(builder, item === null || item === void 0 ? void 0 : item.a, item === null || item === void 0 ? void 0 : item.b, item === null || item === void 0 ? void 0 : item.c, item === null || item === void 0 ? void 0 : item.dUnderscore);
|
||||
}
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(c_underscore_d_underscore !== null && c_underscore_d_underscore !== void 0 ? c_underscore_d_underscore : 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c_underscore_c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8(((_c = c_underscore_b === null || c_underscore_b === void 0 ? void 0 : c_underscore_b[i]) !== null && _c !== void 0 ? _c : 0));
|
||||
}
|
||||
builder.writeFloat64(c_underscore_a);
|
||||
builder.writeFloat64(b);
|
||||
builder.pad(7);
|
||||
builder.writeInt8(Number(Boolean(a)));
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new OuterStructT(this.a(), this.b(), (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null), this.bb.createObjList(this.d.bind(this), 3), (this.e() !== null ? this.e().unpack() : null), this.bb.createScalarList(this.f.bind(this), 4));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null);
|
||||
_o.d = this.bb.createObjList(this.d.bind(this), 3);
|
||||
_o.e = (this.e() !== null ? this.e().unpack() : null);
|
||||
_o.f = this.bb.createScalarList(this.f.bind(this), 4);
|
||||
}
|
||||
}
|
||||
export class OuterStructT {
|
||||
constructor(a = false, b = 0.0, cUnderscore = null, d = [], e = null, f = []) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.cUnderscore = cUnderscore;
|
||||
this.d = d;
|
||||
this.e = e;
|
||||
this.f = f;
|
||||
}
|
||||
pack(builder) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _p, _q, _r, _s;
|
||||
return OuterStruct.createOuterStruct(builder, this.a, this.b, ((_b = (_a = this.cUnderscore) === null || _a === void 0 ? void 0 : _a.a) !== null && _b !== void 0 ? _b : 0), ((_d = (_c = this.cUnderscore) === null || _c === void 0 ? void 0 : _c.b) !== null && _d !== void 0 ? _d : []), ((_f = (_e = this.cUnderscore) === null || _e === void 0 ? void 0 : _e.c) !== null && _f !== void 0 ? _f : 0), ((_h = (_g = this.cUnderscore) === null || _g === void 0 ? void 0 : _g.dUnderscore) !== null && _h !== void 0 ? _h : BigInt(0)), this.d, ((_k = (_j = this.e) === null || _j === void 0 ? void 0 : _j.a) !== null && _k !== void 0 ? _k : 0), ((_m = (_l = this.e) === null || _l === void 0 ? void 0 : _l.b) !== null && _m !== void 0 ? _m : []), ((_q = (_p = this.e) === null || _p === void 0 ? void 0 : _p.c) !== null && _q !== void 0 ? _q : 0), ((_s = (_r = this.e) === null || _r === void 0 ? void 0 : _r.dUnderscore) !== null && _s !== void 0 ? _s : BigInt(0)), this.f);
|
||||
}
|
||||
}
|
||||
export class NestedStruct {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a(index) {
|
||||
return this.bb.readInt32(this.bb_pos + 0 + index * 4);
|
||||
}
|
||||
b() {
|
||||
return this.bb.readInt8(this.bb_pos + 8);
|
||||
}
|
||||
cUnderscore(index) {
|
||||
return this.bb.readInt8(this.bb_pos + 9 + index);
|
||||
}
|
||||
dOuter(index, obj) {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 16 + index * 208, this.bb);
|
||||
}
|
||||
e(index) {
|
||||
return this.bb.readInt64(this.bb_pos + 1056 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.NestedStruct';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 1072;
|
||||
}
|
||||
static createNestedStruct(builder, a, b, c_underscore, d_outer, e) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _p, _q, _r, _s, _t, _u, _v;
|
||||
builder.prep(8, 1072);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt((_a = e === null || e === void 0 ? void 0 : e[i]) !== null && _a !== void 0 ? _a : 0));
|
||||
}
|
||||
for (let i = 4; i >= 0; --i) {
|
||||
const item = d_outer === null || d_outer === void 0 ? void 0 : d_outer[i];
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
OuterStruct.createOuterStruct(builder, item === null || item === void 0 ? void 0 : item.a, item === null || item === void 0 ? void 0 : item.b, ((_c = (_b = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _b === void 0 ? void 0 : _b.a) !== null && _c !== void 0 ? _c : 0), ((_e = (_d = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _d === void 0 ? void 0 : _d.b) !== null && _e !== void 0 ? _e : []), ((_g = (_f = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _f === void 0 ? void 0 : _f.c) !== null && _g !== void 0 ? _g : 0), ((_j = (_h = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _h === void 0 ? void 0 : _h.dUnderscore) !== null && _j !== void 0 ? _j : BigInt(0)), item === null || item === void 0 ? void 0 : item.d, ((_l = (_k = item === null || item === void 0 ? void 0 : item.e) === null || _k === void 0 ? void 0 : _k.a) !== null && _l !== void 0 ? _l : 0), ((_p = (_m = item === null || item === void 0 ? void 0 : item.e) === null || _m === void 0 ? void 0 : _m.b) !== null && _p !== void 0 ? _p : []), ((_r = (_q = item === null || item === void 0 ? void 0 : item.e) === null || _q === void 0 ? void 0 : _q.c) !== null && _r !== void 0 ? _r : 0), ((_t = (_s = item === null || item === void 0 ? void 0 : item.e) === null || _s === void 0 ? void 0 : _s.dUnderscore) !== null && _t !== void 0 ? _t : BigInt(0)), item === null || item === void 0 ? void 0 : item.f);
|
||||
}
|
||||
builder.pad(5);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt8(((_u = c_underscore === null || c_underscore === void 0 ? void 0 : c_underscore[i]) !== null && _u !== void 0 ? _u : 0));
|
||||
}
|
||||
builder.writeInt8(b);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt32(((_v = a === null || a === void 0 ? void 0 : a[i]) !== null && _v !== void 0 ? _v : 0));
|
||||
}
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new NestedStructT(this.bb.createScalarList(this.a.bind(this), 2), this.b(), this.bb.createScalarList(this.cUnderscore.bind(this), 2), this.bb.createObjList(this.dOuter.bind(this), 5), this.bb.createScalarList(this.e.bind(this), 2));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.bb.createScalarList(this.a.bind(this), 2);
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = this.bb.createScalarList(this.cUnderscore.bind(this), 2);
|
||||
_o.dOuter = this.bb.createObjList(this.dOuter.bind(this), 5);
|
||||
_o.e = this.bb.createScalarList(this.e.bind(this), 2);
|
||||
}
|
||||
}
|
||||
export class NestedStructT {
|
||||
constructor(a = [], b = TestEnum.A, cUnderscore = [TestEnum.A, TestEnum.A], dOuter = [], e = []) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.cUnderscore = cUnderscore;
|
||||
this.dOuter = dOuter;
|
||||
this.e = e;
|
||||
}
|
||||
pack(builder) {
|
||||
return NestedStruct.createNestedStruct(builder, this.a, this.b, this.cUnderscore, this.dOuter, this.e);
|
||||
}
|
||||
}
|
||||
export class ArrayStruct {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
aUnderscore() {
|
||||
return this.bb.readFloat32(this.bb_pos);
|
||||
}
|
||||
bUnderscore(index) {
|
||||
return this.bb.readInt32(this.bb_pos + 4 + index * 4);
|
||||
}
|
||||
c() {
|
||||
return this.bb.readInt8(this.bb_pos + 64);
|
||||
}
|
||||
d(index, obj) {
|
||||
return (obj || new NestedStruct()).__init(this.bb_pos + 72 + index * 1072, this.bb);
|
||||
}
|
||||
e() {
|
||||
return this.bb.readInt32(this.bb_pos + 2216);
|
||||
}
|
||||
f(index, obj) {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 2224 + index * 208, this.bb);
|
||||
}
|
||||
g(index) {
|
||||
return this.bb.readInt64(this.bb_pos + 2640 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.ArrayStruct';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 2656;
|
||||
}
|
||||
static createArrayStruct(builder, a_underscore, b_underscore, c, d, e, f, g) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _p, _q, _r, _s, _t, _u;
|
||||
builder.prep(8, 2656);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt((_a = g === null || g === void 0 ? void 0 : g[i]) !== null && _a !== void 0 ? _a : 0));
|
||||
}
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = f === null || f === void 0 ? void 0 : f[i];
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
OuterStruct.createOuterStruct(builder, item === null || item === void 0 ? void 0 : item.a, item === null || item === void 0 ? void 0 : item.b, ((_c = (_b = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _b === void 0 ? void 0 : _b.a) !== null && _c !== void 0 ? _c : 0), ((_e = (_d = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _d === void 0 ? void 0 : _d.b) !== null && _e !== void 0 ? _e : []), ((_g = (_f = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _f === void 0 ? void 0 : _f.c) !== null && _g !== void 0 ? _g : 0), ((_j = (_h = item === null || item === void 0 ? void 0 : item.cUnderscore) === null || _h === void 0 ? void 0 : _h.dUnderscore) !== null && _j !== void 0 ? _j : BigInt(0)), item === null || item === void 0 ? void 0 : item.d, ((_l = (_k = item === null || item === void 0 ? void 0 : item.e) === null || _k === void 0 ? void 0 : _k.a) !== null && _l !== void 0 ? _l : 0), ((_p = (_m = item === null || item === void 0 ? void 0 : item.e) === null || _m === void 0 ? void 0 : _m.b) !== null && _p !== void 0 ? _p : []), ((_r = (_q = item === null || item === void 0 ? void 0 : item.e) === null || _q === void 0 ? void 0 : _q.c) !== null && _r !== void 0 ? _r : 0), ((_t = (_s = item === null || item === void 0 ? void 0 : item.e) === null || _s === void 0 ? void 0 : _s.dUnderscore) !== null && _t !== void 0 ? _t : BigInt(0)), item === null || item === void 0 ? void 0 : item.f);
|
||||
}
|
||||
builder.pad(4);
|
||||
builder.writeInt32(e);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = d === null || d === void 0 ? void 0 : d[i];
|
||||
if (item instanceof NestedStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
NestedStruct.createNestedStruct(builder, item === null || item === void 0 ? void 0 : item.a, item === null || item === void 0 ? void 0 : item.b, item === null || item === void 0 ? void 0 : item.cUnderscore, item === null || item === void 0 ? void 0 : item.dOuter, item === null || item === void 0 ? void 0 : item.e);
|
||||
}
|
||||
builder.pad(7);
|
||||
builder.writeInt8(c);
|
||||
for (let i = 14; i >= 0; --i) {
|
||||
builder.writeInt32(((_u = b_underscore === null || b_underscore === void 0 ? void 0 : b_underscore[i]) !== null && _u !== void 0 ? _u : 0));
|
||||
}
|
||||
builder.writeFloat32(a_underscore);
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new ArrayStructT(this.aUnderscore(), this.bb.createScalarList(this.bUnderscore.bind(this), 15), this.c(), this.bb.createObjList(this.d.bind(this), 2), this.e(), this.bb.createObjList(this.f.bind(this), 2), this.bb.createScalarList(this.g.bind(this), 2));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.aUnderscore = this.aUnderscore();
|
||||
_o.bUnderscore = this.bb.createScalarList(this.bUnderscore.bind(this), 15);
|
||||
_o.c = this.c();
|
||||
_o.d = this.bb.createObjList(this.d.bind(this), 2);
|
||||
_o.e = this.e();
|
||||
_o.f = this.bb.createObjList(this.f.bind(this), 2);
|
||||
_o.g = this.bb.createScalarList(this.g.bind(this), 2);
|
||||
}
|
||||
}
|
||||
export class ArrayStructT {
|
||||
constructor(aUnderscore = 0.0, bUnderscore = [], c = 0, d = [], e = 0, f = [], g = []) {
|
||||
this.aUnderscore = aUnderscore;
|
||||
this.bUnderscore = bUnderscore;
|
||||
this.c = c;
|
||||
this.d = d;
|
||||
this.e = e;
|
||||
this.f = f;
|
||||
this.g = g;
|
||||
}
|
||||
pack(builder) {
|
||||
return ArrayStruct.createArrayStruct(builder, this.aUnderscore, this.bUnderscore, this.c, this.d, this.e, this.f, this.g);
|
||||
}
|
||||
}
|
||||
export class ArrayTable {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
static getRootAsArrayTable(bb, obj) {
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static getSizePrefixedRootAsArrayTable(bb, obj) {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static bufferHasIdentifier(bb) {
|
||||
return bb.__has_identifier('RHUB');
|
||||
}
|
||||
a(optionalEncoding) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
cUnderscore(obj) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 6);
|
||||
return offset ? (obj || new ArrayStruct()).__init(this.bb_pos + offset, this.bb) : null;
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.ArrayTable';
|
||||
}
|
||||
static startArrayTable(builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
static addA(builder, aOffset) {
|
||||
builder.addFieldOffset(0, aOffset, 0);
|
||||
}
|
||||
static addCUnderscore(builder, cUnderscoreOffset) {
|
||||
builder.addFieldStruct(1, cUnderscoreOffset, 0);
|
||||
}
|
||||
static endArrayTable(builder) {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
static finishArrayTableBuffer(builder, offset) {
|
||||
builder.finish(offset, 'RHUB');
|
||||
}
|
||||
static finishSizePrefixedArrayTableBuffer(builder, offset) {
|
||||
builder.finish(offset, 'RHUB', true);
|
||||
}
|
||||
unpack() {
|
||||
return new ArrayTableT(this.a(), (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null);
|
||||
}
|
||||
}
|
||||
export class ArrayTableT {
|
||||
constructor(a = null, cUnderscore = null) {
|
||||
this.a = a;
|
||||
this.cUnderscore = cUnderscore;
|
||||
}
|
||||
pack(builder) {
|
||||
const a = (this.a !== null ? builder.createString(this.a) : 0);
|
||||
ArrayTable.startArrayTable(builder);
|
||||
ArrayTable.addA(builder, a);
|
||||
ArrayTable.addCUnderscore(builder, (this.cUnderscore !== null ? this.cUnderscore.pack(builder) : 0));
|
||||
return ArrayTable.endArrayTable(builder);
|
||||
}
|
||||
}
|
||||
@@ -1,626 +0,0 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
|
||||
export enum TestEnum {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2
|
||||
}
|
||||
|
||||
export class InnerStruct implements flatbuffers.IUnpackableObject<InnerStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):InnerStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
a():number {
|
||||
return this.bb!.readFloat64(this.bb_pos);
|
||||
}
|
||||
|
||||
b(index: number):number|null {
|
||||
return this.bb!.readUint8(this.bb_pos + 8 + index);
|
||||
}
|
||||
|
||||
c():number {
|
||||
return this.bb!.readInt8(this.bb_pos + 21);
|
||||
}
|
||||
|
||||
dUnderscore():bigint {
|
||||
return this.bb!.readInt64(this.bb_pos + 24);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.InnerStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 32;
|
||||
}
|
||||
|
||||
static createInnerStruct(builder:flatbuffers.Builder, a: number, b: number[]|null, c: number, d_underscore: bigint):flatbuffers.Offset {
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c);
|
||||
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((b?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeFloat64(a);
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): InnerStructT {
|
||||
return new InnerStructT(
|
||||
this.a(),
|
||||
this.bb!.createScalarList<number>(this.b.bind(this), 13),
|
||||
this.c(),
|
||||
this.dUnderscore()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: InnerStructT): void {
|
||||
_o.a = this.a();
|
||||
_o.b = this.bb!.createScalarList<number>(this.b.bind(this), 13);
|
||||
_o.c = this.c();
|
||||
_o.dUnderscore = this.dUnderscore();
|
||||
}
|
||||
}
|
||||
|
||||
export class InnerStructT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: number = 0.0,
|
||||
public b: (number)[] = [],
|
||||
public c: number = 0,
|
||||
public dUnderscore: bigint = BigInt('0')
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return InnerStruct.createInnerStruct(builder,
|
||||
this.a,
|
||||
this.b,
|
||||
this.c,
|
||||
this.dUnderscore
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class OuterStruct implements flatbuffers.IUnpackableObject<OuterStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):OuterStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
a():boolean {
|
||||
return !!this.bb!.readInt8(this.bb_pos);
|
||||
}
|
||||
|
||||
b():number {
|
||||
return this.bb!.readFloat64(this.bb_pos + 8);
|
||||
}
|
||||
|
||||
cUnderscore(obj?:InnerStruct):InnerStruct|null {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb!);
|
||||
}
|
||||
|
||||
d(index: number, obj?:InnerStruct):InnerStruct|null {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 48 + index * 32, this.bb!);
|
||||
}
|
||||
|
||||
e(obj?:InnerStruct):InnerStruct|null {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb!);
|
||||
}
|
||||
|
||||
f(index: number):number|null {
|
||||
return this.bb!.readFloat64(this.bb_pos + 176 + index * 8);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.OuterStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 208;
|
||||
}
|
||||
|
||||
static createOuterStruct(builder:flatbuffers.Builder, a: boolean, b: number, c_underscore_a: number, c_underscore_b: number[]|null, c_underscore_c: number, c_underscore_d_underscore: bigint, d: (any|InnerStructT)[]|null, e_a: number, e_b: number[]|null, e_c: number, e_d_underscore: bigint, f: number[]|null):flatbuffers.Offset {
|
||||
builder.prep(8, 208);
|
||||
|
||||
for (let i = 3; i >= 0; --i) {
|
||||
builder.writeFloat64((f?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(e_d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(e_c);
|
||||
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((e_b?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeFloat64(e_a);
|
||||
|
||||
for (let i = 2; i >= 0; --i) {
|
||||
const item = d?.[i];
|
||||
|
||||
if (item instanceof InnerStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
InnerStruct.createInnerStruct(builder,
|
||||
item?.a,
|
||||
item?.b,
|
||||
item?.c,
|
||||
item?.dUnderscore
|
||||
);
|
||||
}
|
||||
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(c_underscore_d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c_underscore_c);
|
||||
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((c_underscore_b?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeFloat64(c_underscore_a);
|
||||
builder.writeFloat64(b);
|
||||
builder.pad(7);
|
||||
builder.writeInt8(Number(Boolean(a)));
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): OuterStructT {
|
||||
return new OuterStructT(
|
||||
this.a(),
|
||||
this.b(),
|
||||
(this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null),
|
||||
this.bb!.createObjList<InnerStruct, InnerStructT>(this.d.bind(this), 3),
|
||||
(this.e() !== null ? this.e()!.unpack() : null),
|
||||
this.bb!.createScalarList<number>(this.f.bind(this), 4)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: OuterStructT): void {
|
||||
_o.a = this.a();
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null);
|
||||
_o.d = this.bb!.createObjList<InnerStruct, InnerStructT>(this.d.bind(this), 3);
|
||||
_o.e = (this.e() !== null ? this.e()!.unpack() : null);
|
||||
_o.f = this.bb!.createScalarList<number>(this.f.bind(this), 4);
|
||||
}
|
||||
}
|
||||
|
||||
export class OuterStructT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: boolean = false,
|
||||
public b: number = 0.0,
|
||||
public cUnderscore: InnerStructT|null = null,
|
||||
public d: (InnerStructT)[] = [],
|
||||
public e: InnerStructT|null = null,
|
||||
public f: (number)[] = []
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return OuterStruct.createOuterStruct(builder,
|
||||
this.a,
|
||||
this.b,
|
||||
(this.cUnderscore?.a ?? 0),
|
||||
(this.cUnderscore?.b ?? []),
|
||||
(this.cUnderscore?.c ?? 0),
|
||||
(this.cUnderscore?.dUnderscore ?? BigInt(0)),
|
||||
this.d,
|
||||
(this.e?.a ?? 0),
|
||||
(this.e?.b ?? []),
|
||||
(this.e?.c ?? 0),
|
||||
(this.e?.dUnderscore ?? BigInt(0)),
|
||||
this.f
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class NestedStruct implements flatbuffers.IUnpackableObject<NestedStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):NestedStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
a(index: number):number|null {
|
||||
return this.bb!.readInt32(this.bb_pos + 0 + index * 4);
|
||||
}
|
||||
|
||||
b():TestEnum {
|
||||
return this.bb!.readInt8(this.bb_pos + 8);
|
||||
}
|
||||
|
||||
cUnderscore(index: number):TestEnum|null {
|
||||
return this.bb!.readInt8(this.bb_pos + 9 + index);
|
||||
}
|
||||
|
||||
dOuter(index: number, obj?:OuterStruct):OuterStruct|null {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 16 + index * 208, this.bb!);
|
||||
}
|
||||
|
||||
e(index: number):bigint|null {
|
||||
return this.bb!.readInt64(this.bb_pos + 1056 + index * 8);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.NestedStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 1072;
|
||||
}
|
||||
|
||||
static createNestedStruct(builder:flatbuffers.Builder, a: number[]|null, b: TestEnum, c_underscore: number[]|null, d_outer: (any|OuterStructT)[]|null, e: bigint[]|null):flatbuffers.Offset {
|
||||
builder.prep(8, 1072);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(e?.[i] ?? 0));
|
||||
}
|
||||
|
||||
|
||||
for (let i = 4; i >= 0; --i) {
|
||||
const item = d_outer?.[i];
|
||||
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
OuterStruct.createOuterStruct(builder,
|
||||
item?.a,
|
||||
item?.b,
|
||||
(item?.cUnderscore?.a ?? 0),
|
||||
(item?.cUnderscore?.b ?? []),
|
||||
(item?.cUnderscore?.c ?? 0),
|
||||
(item?.cUnderscore?.dUnderscore ?? BigInt(0)),
|
||||
item?.d,
|
||||
(item?.e?.a ?? 0),
|
||||
(item?.e?.b ?? []),
|
||||
(item?.e?.c ?? 0),
|
||||
(item?.e?.dUnderscore ?? BigInt(0)),
|
||||
item?.f
|
||||
);
|
||||
}
|
||||
|
||||
builder.pad(5);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt8((c_underscore?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeInt8(b);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt32((a?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): NestedStructT {
|
||||
return new NestedStructT(
|
||||
this.bb!.createScalarList<number>(this.a.bind(this), 2),
|
||||
this.b(),
|
||||
this.bb!.createScalarList<TestEnum>(this.cUnderscore.bind(this), 2),
|
||||
this.bb!.createObjList<OuterStruct, OuterStructT>(this.dOuter.bind(this), 5),
|
||||
this.bb!.createScalarList<bigint>(this.e.bind(this), 2)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: NestedStructT): void {
|
||||
_o.a = this.bb!.createScalarList<number>(this.a.bind(this), 2);
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = this.bb!.createScalarList<TestEnum>(this.cUnderscore.bind(this), 2);
|
||||
_o.dOuter = this.bb!.createObjList<OuterStruct, OuterStructT>(this.dOuter.bind(this), 5);
|
||||
_o.e = this.bb!.createScalarList<bigint>(this.e.bind(this), 2);
|
||||
}
|
||||
}
|
||||
|
||||
export class NestedStructT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: (number)[] = [],
|
||||
public b: TestEnum = TestEnum.A,
|
||||
public cUnderscore: (TestEnum)[] = [TestEnum.A, TestEnum.A],
|
||||
public dOuter: (OuterStructT)[] = [],
|
||||
public e: (bigint)[] = []
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return NestedStruct.createNestedStruct(builder,
|
||||
this.a,
|
||||
this.b,
|
||||
this.cUnderscore,
|
||||
this.dOuter,
|
||||
this.e
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class ArrayStruct implements flatbuffers.IUnpackableObject<ArrayStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):ArrayStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
aUnderscore():number {
|
||||
return this.bb!.readFloat32(this.bb_pos);
|
||||
}
|
||||
|
||||
bUnderscore(index: number):number|null {
|
||||
return this.bb!.readInt32(this.bb_pos + 4 + index * 4);
|
||||
}
|
||||
|
||||
c():number {
|
||||
return this.bb!.readInt8(this.bb_pos + 64);
|
||||
}
|
||||
|
||||
d(index: number, obj?:NestedStruct):NestedStruct|null {
|
||||
return (obj || new NestedStruct()).__init(this.bb_pos + 72 + index * 1072, this.bb!);
|
||||
}
|
||||
|
||||
e():number {
|
||||
return this.bb!.readInt32(this.bb_pos + 2216);
|
||||
}
|
||||
|
||||
f(index: number, obj?:OuterStruct):OuterStruct|null {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 2224 + index * 208, this.bb!);
|
||||
}
|
||||
|
||||
g(index: number):bigint|null {
|
||||
return this.bb!.readInt64(this.bb_pos + 2640 + index * 8);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.ArrayStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 2656;
|
||||
}
|
||||
|
||||
static createArrayStruct(builder:flatbuffers.Builder, a_underscore: number, b_underscore: number[]|null, c: number, d: (any|NestedStructT)[]|null, e: number, f: (any|OuterStructT)[]|null, g: bigint[]|null):flatbuffers.Offset {
|
||||
builder.prep(8, 2656);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(g?.[i] ?? 0));
|
||||
}
|
||||
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = f?.[i];
|
||||
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
OuterStruct.createOuterStruct(builder,
|
||||
item?.a,
|
||||
item?.b,
|
||||
(item?.cUnderscore?.a ?? 0),
|
||||
(item?.cUnderscore?.b ?? []),
|
||||
(item?.cUnderscore?.c ?? 0),
|
||||
(item?.cUnderscore?.dUnderscore ?? BigInt(0)),
|
||||
item?.d,
|
||||
(item?.e?.a ?? 0),
|
||||
(item?.e?.b ?? []),
|
||||
(item?.e?.c ?? 0),
|
||||
(item?.e?.dUnderscore ?? BigInt(0)),
|
||||
item?.f
|
||||
);
|
||||
}
|
||||
|
||||
builder.pad(4);
|
||||
builder.writeInt32(e);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = d?.[i];
|
||||
|
||||
if (item instanceof NestedStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
NestedStruct.createNestedStruct(builder,
|
||||
item?.a,
|
||||
item?.b,
|
||||
item?.cUnderscore,
|
||||
item?.dOuter,
|
||||
item?.e
|
||||
);
|
||||
}
|
||||
|
||||
builder.pad(7);
|
||||
builder.writeInt8(c);
|
||||
|
||||
for (let i = 14; i >= 0; --i) {
|
||||
builder.writeInt32((b_underscore?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeFloat32(a_underscore);
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): ArrayStructT {
|
||||
return new ArrayStructT(
|
||||
this.aUnderscore(),
|
||||
this.bb!.createScalarList<number>(this.bUnderscore.bind(this), 15),
|
||||
this.c(),
|
||||
this.bb!.createObjList<NestedStruct, NestedStructT>(this.d.bind(this), 2),
|
||||
this.e(),
|
||||
this.bb!.createObjList<OuterStruct, OuterStructT>(this.f.bind(this), 2),
|
||||
this.bb!.createScalarList<bigint>(this.g.bind(this), 2)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: ArrayStructT): void {
|
||||
_o.aUnderscore = this.aUnderscore();
|
||||
_o.bUnderscore = this.bb!.createScalarList<number>(this.bUnderscore.bind(this), 15);
|
||||
_o.c = this.c();
|
||||
_o.d = this.bb!.createObjList<NestedStruct, NestedStructT>(this.d.bind(this), 2);
|
||||
_o.e = this.e();
|
||||
_o.f = this.bb!.createObjList<OuterStruct, OuterStructT>(this.f.bind(this), 2);
|
||||
_o.g = this.bb!.createScalarList<bigint>(this.g.bind(this), 2);
|
||||
}
|
||||
}
|
||||
|
||||
export class ArrayStructT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public aUnderscore: number = 0.0,
|
||||
public bUnderscore: (number)[] = [],
|
||||
public c: number = 0,
|
||||
public d: (NestedStructT)[] = [],
|
||||
public e: number = 0,
|
||||
public f: (OuterStructT)[] = [],
|
||||
public g: (bigint)[] = []
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return ArrayStruct.createArrayStruct(builder,
|
||||
this.aUnderscore,
|
||||
this.bUnderscore,
|
||||
this.c,
|
||||
this.d,
|
||||
this.e,
|
||||
this.f,
|
||||
this.g
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class ArrayTable implements flatbuffers.IUnpackableObject<ArrayTableT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):ArrayTable {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsArrayTable(bb:flatbuffers.ByteBuffer, obj?:ArrayTable):ArrayTable {
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsArrayTable(bb:flatbuffers.ByteBuffer, obj?:ArrayTable):ArrayTable {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
|
||||
return bb.__has_identifier('RHUB');
|
||||
}
|
||||
|
||||
a():string|null
|
||||
a(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
a(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
cUnderscore(obj?:ArrayStruct):ArrayStruct|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? (obj || new ArrayStruct()).__init(this.bb_pos + offset, this.bb!) : null;
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.ArrayTable';
|
||||
}
|
||||
|
||||
static startArrayTable(builder:flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addA(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, aOffset, 0);
|
||||
}
|
||||
|
||||
static addCUnderscore(builder:flatbuffers.Builder, cUnderscoreOffset:flatbuffers.Offset) {
|
||||
builder.addFieldStruct(1, cUnderscoreOffset, 0);
|
||||
}
|
||||
|
||||
static endArrayTable(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static finishArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
|
||||
builder.finish(offset, 'RHUB');
|
||||
}
|
||||
|
||||
static finishSizePrefixedArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
|
||||
builder.finish(offset, 'RHUB', true);
|
||||
}
|
||||
|
||||
|
||||
unpack(): ArrayTableT {
|
||||
return new ArrayTableT(
|
||||
this.a(),
|
||||
(this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: ArrayTableT): void {
|
||||
_o.a = this.a();
|
||||
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null);
|
||||
}
|
||||
}
|
||||
|
||||
export class ArrayTableT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: string|Uint8Array|null = null,
|
||||
public cUnderscore: ArrayStructT|null = null
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const a = (this.a !== null ? builder.createString(this.a!) : 0);
|
||||
|
||||
ArrayTable.startArrayTable(builder);
|
||||
ArrayTable.addA(builder, a);
|
||||
ArrayTable.addCUnderscore(builder, (this.cUnderscore !== null ? this.cUnderscore!.pack(builder) : 0));
|
||||
|
||||
return ArrayTable.endArrayTable(builder);
|
||||
}
|
||||
}
|
||||
|
||||
6
tests/ts/arrays_test_complex/my-game/example.d.ts
vendored
Normal file
6
tests/ts/arrays_test_complex/my-game/example.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export { ArrayStruct } from './example/array-struct.js';
|
||||
export { ArrayTable } from './example/array-table.js';
|
||||
export { InnerStruct } from './example/inner-struct.js';
|
||||
export { NestedStruct } from './example/nested-struct.js';
|
||||
export { OuterStruct } from './example/outer-struct.js';
|
||||
export { TestEnum } from './example/test-enum.js';
|
||||
7
tests/ts/arrays_test_complex/my-game/example.js
Normal file
7
tests/ts/arrays_test_complex/my-game/example.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
export { ArrayStruct } from './example/array-struct.js';
|
||||
export { ArrayTable } from './example/array-table.js';
|
||||
export { InnerStruct } from './example/inner-struct.js';
|
||||
export { NestedStruct } from './example/nested-struct.js';
|
||||
export { OuterStruct } from './example/outer-struct.js';
|
||||
export { TestEnum } from './example/test-enum.js';
|
||||
8
tests/ts/arrays_test_complex/my-game/example.ts
Normal file
8
tests/ts/arrays_test_complex/my-game/example.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export { ArrayStruct } from './example/array-struct.js';
|
||||
export { ArrayTable } from './example/array-table.js';
|
||||
export { InnerStruct } from './example/inner-struct.js';
|
||||
export { NestedStruct } from './example/nested-struct.js';
|
||||
export { OuterStruct } from './example/outer-struct.js';
|
||||
export { TestEnum } from './example/test-enum.js';
|
||||
31
tests/ts/arrays_test_complex/my-game/example/array-struct.d.ts
vendored
Normal file
31
tests/ts/arrays_test_complex/my-game/example/array-struct.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { NestedStruct, NestedStructT } from '../../my-game/example/nested-struct.js';
|
||||
import { OuterStruct, OuterStructT } from '../../my-game/example/outer-struct.js';
|
||||
export declare class ArrayStruct implements flatbuffers.IUnpackableObject<ArrayStructT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): ArrayStruct;
|
||||
aUnderscore(): number;
|
||||
bUnderscore(index: number): number | null;
|
||||
c(): number;
|
||||
d(index: number, obj?: NestedStruct): NestedStruct | null;
|
||||
e(): number;
|
||||
f(index: number, obj?: OuterStruct): OuterStruct | null;
|
||||
g(index: number): bigint | null;
|
||||
static getFullyQualifiedName(): string;
|
||||
static sizeOf(): number;
|
||||
static createArrayStruct(builder: flatbuffers.Builder, a_underscore: number, b_underscore: number[] | null, c: number, d: (any | NestedStructT)[] | null, e: number, f: (any | OuterStructT)[] | null, g: bigint[] | null): flatbuffers.Offset;
|
||||
unpack(): ArrayStructT;
|
||||
unpackTo(_o: ArrayStructT): void;
|
||||
}
|
||||
export declare class ArrayStructT implements flatbuffers.IGeneratedObject {
|
||||
aUnderscore: number;
|
||||
bUnderscore: (number)[];
|
||||
c: number;
|
||||
d: (NestedStructT)[];
|
||||
e: number;
|
||||
f: (OuterStructT)[];
|
||||
g: (bigint)[];
|
||||
constructor(aUnderscore?: number, bUnderscore?: (number)[], c?: number, d?: (NestedStructT)[], e?: number, f?: (OuterStructT)[], g?: (bigint)[]);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
98
tests/ts/arrays_test_complex/my-game/example/array-struct.js
Normal file
98
tests/ts/arrays_test_complex/my-game/example/array-struct.js
Normal file
@@ -0,0 +1,98 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import { NestedStruct, NestedStructT } from '../../my-game/example/nested-struct.js';
|
||||
import { OuterStruct, OuterStructT } from '../../my-game/example/outer-struct.js';
|
||||
export class ArrayStruct {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
aUnderscore() {
|
||||
return this.bb.readFloat32(this.bb_pos);
|
||||
}
|
||||
bUnderscore(index) {
|
||||
return this.bb.readInt32(this.bb_pos + 4 + index * 4);
|
||||
}
|
||||
c() {
|
||||
return this.bb.readInt8(this.bb_pos + 64);
|
||||
}
|
||||
d(index, obj) {
|
||||
return (obj || new NestedStruct()).__init(this.bb_pos + 72 + index * 1072, this.bb);
|
||||
}
|
||||
e() {
|
||||
return this.bb.readInt32(this.bb_pos + 2216);
|
||||
}
|
||||
f(index, obj) {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 2224 + index * 208, this.bb);
|
||||
}
|
||||
g(index) {
|
||||
return this.bb.readInt64(this.bb_pos + 2640 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.ArrayStruct';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 2656;
|
||||
}
|
||||
static createArrayStruct(builder, a_underscore, b_underscore, c, d, e, f, g) {
|
||||
builder.prep(8, 2656);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(g?.[i] ?? 0));
|
||||
}
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = f?.[i];
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
OuterStruct.createOuterStruct(builder, item?.a, item?.b, (item?.cUnderscore?.a ?? 0), (item?.cUnderscore?.b ?? []), (item?.cUnderscore?.c ?? 0), (item?.cUnderscore?.dUnderscore ?? BigInt(0)), item?.d, (item?.e?.a ?? 0), (item?.e?.b ?? []), (item?.e?.c ?? 0), (item?.e?.dUnderscore ?? BigInt(0)), item?.f);
|
||||
}
|
||||
builder.pad(4);
|
||||
builder.writeInt32(e);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = d?.[i];
|
||||
if (item instanceof NestedStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
NestedStruct.createNestedStruct(builder, item?.a, item?.b, item?.cUnderscore, item?.dOuter, item?.e);
|
||||
}
|
||||
builder.pad(7);
|
||||
builder.writeInt8(c);
|
||||
for (let i = 14; i >= 0; --i) {
|
||||
builder.writeInt32((b_underscore?.[i] ?? 0));
|
||||
}
|
||||
builder.writeFloat32(a_underscore);
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new ArrayStructT(this.aUnderscore(), this.bb.createScalarList(this.bUnderscore.bind(this), 15), this.c(), this.bb.createObjList(this.d.bind(this), 2), this.e(), this.bb.createObjList(this.f.bind(this), 2), this.bb.createScalarList(this.g.bind(this), 2));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.aUnderscore = this.aUnderscore();
|
||||
_o.bUnderscore = this.bb.createScalarList(this.bUnderscore.bind(this), 15);
|
||||
_o.c = this.c();
|
||||
_o.d = this.bb.createObjList(this.d.bind(this), 2);
|
||||
_o.e = this.e();
|
||||
_o.f = this.bb.createObjList(this.f.bind(this), 2);
|
||||
_o.g = this.bb.createScalarList(this.g.bind(this), 2);
|
||||
}
|
||||
}
|
||||
export class ArrayStructT {
|
||||
constructor(aUnderscore = 0.0, bUnderscore = [], c = 0, d = [], e = 0, f = [], g = []) {
|
||||
this.aUnderscore = aUnderscore;
|
||||
this.bUnderscore = bUnderscore;
|
||||
this.c = c;
|
||||
this.d = d;
|
||||
this.e = e;
|
||||
this.f = f;
|
||||
this.g = g;
|
||||
}
|
||||
pack(builder) {
|
||||
return ArrayStruct.createArrayStruct(builder, this.aUnderscore, this.bUnderscore, this.c, this.d, this.e, this.f, this.g);
|
||||
}
|
||||
}
|
||||
166
tests/ts/arrays_test_complex/my-game/example/array-struct.ts
Normal file
166
tests/ts/arrays_test_complex/my-game/example/array-struct.ts
Normal file
@@ -0,0 +1,166 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { NestedStruct, NestedStructT } from '../../my-game/example/nested-struct.js';
|
||||
import { OuterStruct, OuterStructT } from '../../my-game/example/outer-struct.js';
|
||||
|
||||
|
||||
export class ArrayStruct implements flatbuffers.IUnpackableObject<ArrayStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):ArrayStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
aUnderscore():number {
|
||||
return this.bb!.readFloat32(this.bb_pos);
|
||||
}
|
||||
|
||||
bUnderscore(index: number):number|null {
|
||||
return this.bb!.readInt32(this.bb_pos + 4 + index * 4);
|
||||
}
|
||||
|
||||
c():number {
|
||||
return this.bb!.readInt8(this.bb_pos + 64);
|
||||
}
|
||||
|
||||
d(index: number, obj?:NestedStruct):NestedStruct|null {
|
||||
return (obj || new NestedStruct()).__init(this.bb_pos + 72 + index * 1072, this.bb!);
|
||||
}
|
||||
|
||||
e():number {
|
||||
return this.bb!.readInt32(this.bb_pos + 2216);
|
||||
}
|
||||
|
||||
f(index: number, obj?:OuterStruct):OuterStruct|null {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 2224 + index * 208, this.bb!);
|
||||
}
|
||||
|
||||
g(index: number):bigint|null {
|
||||
return this.bb!.readInt64(this.bb_pos + 2640 + index * 8);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.ArrayStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 2656;
|
||||
}
|
||||
|
||||
static createArrayStruct(builder:flatbuffers.Builder, a_underscore: number, b_underscore: number[]|null, c: number, d: (any|NestedStructT)[]|null, e: number, f: (any|OuterStructT)[]|null, g: bigint[]|null):flatbuffers.Offset {
|
||||
builder.prep(8, 2656);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(g?.[i] ?? 0));
|
||||
}
|
||||
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = f?.[i];
|
||||
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
OuterStruct.createOuterStruct(builder,
|
||||
item?.a,
|
||||
item?.b,
|
||||
(item?.cUnderscore?.a ?? 0),
|
||||
(item?.cUnderscore?.b ?? []),
|
||||
(item?.cUnderscore?.c ?? 0),
|
||||
(item?.cUnderscore?.dUnderscore ?? BigInt(0)),
|
||||
item?.d,
|
||||
(item?.e?.a ?? 0),
|
||||
(item?.e?.b ?? []),
|
||||
(item?.e?.c ?? 0),
|
||||
(item?.e?.dUnderscore ?? BigInt(0)),
|
||||
item?.f
|
||||
);
|
||||
}
|
||||
|
||||
builder.pad(4);
|
||||
builder.writeInt32(e);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = d?.[i];
|
||||
|
||||
if (item instanceof NestedStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
NestedStruct.createNestedStruct(builder,
|
||||
item?.a,
|
||||
item?.b,
|
||||
item?.cUnderscore,
|
||||
item?.dOuter,
|
||||
item?.e
|
||||
);
|
||||
}
|
||||
|
||||
builder.pad(7);
|
||||
builder.writeInt8(c);
|
||||
|
||||
for (let i = 14; i >= 0; --i) {
|
||||
builder.writeInt32((b_underscore?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeFloat32(a_underscore);
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): ArrayStructT {
|
||||
return new ArrayStructT(
|
||||
this.aUnderscore(),
|
||||
this.bb!.createScalarList<number>(this.bUnderscore.bind(this), 15),
|
||||
this.c(),
|
||||
this.bb!.createObjList<NestedStruct, NestedStructT>(this.d.bind(this), 2),
|
||||
this.e(),
|
||||
this.bb!.createObjList<OuterStruct, OuterStructT>(this.f.bind(this), 2),
|
||||
this.bb!.createScalarList<bigint>(this.g.bind(this), 2)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: ArrayStructT): void {
|
||||
_o.aUnderscore = this.aUnderscore();
|
||||
_o.bUnderscore = this.bb!.createScalarList<number>(this.bUnderscore.bind(this), 15);
|
||||
_o.c = this.c();
|
||||
_o.d = this.bb!.createObjList<NestedStruct, NestedStructT>(this.d.bind(this), 2);
|
||||
_o.e = this.e();
|
||||
_o.f = this.bb!.createObjList<OuterStruct, OuterStructT>(this.f.bind(this), 2);
|
||||
_o.g = this.bb!.createScalarList<bigint>(this.g.bind(this), 2);
|
||||
}
|
||||
}
|
||||
|
||||
export class ArrayStructT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public aUnderscore: number = 0.0,
|
||||
public bUnderscore: (number)[] = [],
|
||||
public c: number = 0,
|
||||
public d: (NestedStructT)[] = [],
|
||||
public e: number = 0,
|
||||
public f: (OuterStructT)[] = [],
|
||||
public g: (bigint)[] = []
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return ArrayStruct.createArrayStruct(builder,
|
||||
this.aUnderscore,
|
||||
this.bUnderscore,
|
||||
this.c,
|
||||
this.d,
|
||||
this.e,
|
||||
this.f,
|
||||
this.g
|
||||
);
|
||||
}
|
||||
}
|
||||
28
tests/ts/arrays_test_complex/my-game/example/array-table.d.ts
vendored
Normal file
28
tests/ts/arrays_test_complex/my-game/example/array-table.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { ArrayStruct, ArrayStructT } from '../../my-game/example/array-struct.js';
|
||||
export declare class ArrayTable implements flatbuffers.IUnpackableObject<ArrayTableT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): ArrayTable;
|
||||
static getRootAsArrayTable(bb: flatbuffers.ByteBuffer, obj?: ArrayTable): ArrayTable;
|
||||
static getSizePrefixedRootAsArrayTable(bb: flatbuffers.ByteBuffer, obj?: ArrayTable): ArrayTable;
|
||||
static bufferHasIdentifier(bb: flatbuffers.ByteBuffer): boolean;
|
||||
a(): string | null;
|
||||
a(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
||||
cUnderscore(obj?: ArrayStruct): ArrayStruct | null;
|
||||
static getFullyQualifiedName(): string;
|
||||
static startArrayTable(builder: flatbuffers.Builder): void;
|
||||
static addA(builder: flatbuffers.Builder, aOffset: flatbuffers.Offset): void;
|
||||
static addCUnderscore(builder: flatbuffers.Builder, cUnderscoreOffset: flatbuffers.Offset): void;
|
||||
static endArrayTable(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
static finishArrayTableBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
|
||||
static finishSizePrefixedArrayTableBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
|
||||
unpack(): ArrayTableT;
|
||||
unpackTo(_o: ArrayTableT): void;
|
||||
}
|
||||
export declare class ArrayTableT implements flatbuffers.IGeneratedObject {
|
||||
a: string | Uint8Array | null;
|
||||
cUnderscore: ArrayStructT | null;
|
||||
constructor(a?: string | Uint8Array | null, cUnderscore?: ArrayStructT | null);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
74
tests/ts/arrays_test_complex/my-game/example/array-table.js
Normal file
74
tests/ts/arrays_test_complex/my-game/example/array-table.js
Normal file
@@ -0,0 +1,74 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { ArrayStruct } from '../../my-game/example/array-struct.js';
|
||||
export class ArrayTable {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
static getRootAsArrayTable(bb, obj) {
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static getSizePrefixedRootAsArrayTable(bb, obj) {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
static bufferHasIdentifier(bb) {
|
||||
return bb.__has_identifier('RHUB');
|
||||
}
|
||||
a(optionalEncoding) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
cUnderscore(obj) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 6);
|
||||
return offset ? (obj || new ArrayStruct()).__init(this.bb_pos + offset, this.bb) : null;
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.ArrayTable';
|
||||
}
|
||||
static startArrayTable(builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
static addA(builder, aOffset) {
|
||||
builder.addFieldOffset(0, aOffset, 0);
|
||||
}
|
||||
static addCUnderscore(builder, cUnderscoreOffset) {
|
||||
builder.addFieldStruct(1, cUnderscoreOffset, 0);
|
||||
}
|
||||
static endArrayTable(builder) {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
static finishArrayTableBuffer(builder, offset) {
|
||||
builder.finish(offset, 'RHUB');
|
||||
}
|
||||
static finishSizePrefixedArrayTableBuffer(builder, offset) {
|
||||
builder.finish(offset, 'RHUB', true);
|
||||
}
|
||||
unpack() {
|
||||
return new ArrayTableT(this.a(), (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null);
|
||||
}
|
||||
}
|
||||
export class ArrayTableT {
|
||||
constructor(a = null, cUnderscore = null) {
|
||||
this.a = a;
|
||||
this.cUnderscore = cUnderscore;
|
||||
}
|
||||
pack(builder) {
|
||||
const a = (this.a !== null ? builder.createString(this.a) : 0);
|
||||
ArrayTable.startArrayTable(builder);
|
||||
ArrayTable.addA(builder, a);
|
||||
ArrayTable.addCUnderscore(builder, (this.cUnderscore !== null ? this.cUnderscore.pack(builder) : 0));
|
||||
return ArrayTable.endArrayTable(builder);
|
||||
}
|
||||
}
|
||||
102
tests/ts/arrays_test_complex/my-game/example/array-table.ts
Normal file
102
tests/ts/arrays_test_complex/my-game/example/array-table.ts
Normal file
@@ -0,0 +1,102 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { ArrayStruct, ArrayStructT } from '../../my-game/example/array-struct.js';
|
||||
|
||||
|
||||
export class ArrayTable implements flatbuffers.IUnpackableObject<ArrayTableT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):ArrayTable {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
static getRootAsArrayTable(bb:flatbuffers.ByteBuffer, obj?:ArrayTable):ArrayTable {
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static getSizePrefixedRootAsArrayTable(bb:flatbuffers.ByteBuffer, obj?:ArrayTable):ArrayTable {
|
||||
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
|
||||
return (obj || new ArrayTable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
}
|
||||
|
||||
static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
|
||||
return bb.__has_identifier('RHUB');
|
||||
}
|
||||
|
||||
a():string|null
|
||||
a(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
|
||||
a(optionalEncoding?:any):string|Uint8Array|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
cUnderscore(obj?:ArrayStruct):ArrayStruct|null {
|
||||
const offset = this.bb!.__offset(this.bb_pos, 6);
|
||||
return offset ? (obj || new ArrayStruct()).__init(this.bb_pos + offset, this.bb!) : null;
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.ArrayTable';
|
||||
}
|
||||
|
||||
static startArrayTable(builder:flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addA(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, aOffset, 0);
|
||||
}
|
||||
|
||||
static addCUnderscore(builder:flatbuffers.Builder, cUnderscoreOffset:flatbuffers.Offset) {
|
||||
builder.addFieldStruct(1, cUnderscoreOffset, 0);
|
||||
}
|
||||
|
||||
static endArrayTable(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
|
||||
static finishArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
|
||||
builder.finish(offset, 'RHUB');
|
||||
}
|
||||
|
||||
static finishSizePrefixedArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
|
||||
builder.finish(offset, 'RHUB', true);
|
||||
}
|
||||
|
||||
|
||||
unpack(): ArrayTableT {
|
||||
return new ArrayTableT(
|
||||
this.a(),
|
||||
(this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: ArrayTableT): void {
|
||||
_o.a = this.a();
|
||||
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null);
|
||||
}
|
||||
}
|
||||
|
||||
export class ArrayTableT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: string|Uint8Array|null = null,
|
||||
public cUnderscore: ArrayStructT|null = null
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const a = (this.a !== null ? builder.createString(this.a!) : 0);
|
||||
|
||||
ArrayTable.startArrayTable(builder);
|
||||
ArrayTable.addA(builder, a);
|
||||
ArrayTable.addCUnderscore(builder, (this.cUnderscore !== null ? this.cUnderscore!.pack(builder) : 0));
|
||||
|
||||
return ArrayTable.endArrayTable(builder);
|
||||
}
|
||||
}
|
||||
23
tests/ts/arrays_test_complex/my-game/example/inner-struct.d.ts
vendored
Normal file
23
tests/ts/arrays_test_complex/my-game/example/inner-struct.d.ts
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
export declare class InnerStruct implements flatbuffers.IUnpackableObject<InnerStructT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): InnerStruct;
|
||||
a(): number;
|
||||
b(index: number): number | null;
|
||||
c(): number;
|
||||
dUnderscore(): bigint;
|
||||
static getFullyQualifiedName(): string;
|
||||
static sizeOf(): number;
|
||||
static createInnerStruct(builder: flatbuffers.Builder, a: number, b: number[] | null, c: number, d_underscore: bigint): flatbuffers.Offset;
|
||||
unpack(): InnerStructT;
|
||||
unpackTo(_o: InnerStructT): void;
|
||||
}
|
||||
export declare class InnerStructT implements flatbuffers.IGeneratedObject {
|
||||
a: number;
|
||||
b: (number)[];
|
||||
c: number;
|
||||
dUnderscore: bigint;
|
||||
constructor(a?: number, b?: (number)[], c?: number, dUnderscore?: bigint);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
61
tests/ts/arrays_test_complex/my-game/example/inner-struct.js
Normal file
61
tests/ts/arrays_test_complex/my-game/example/inner-struct.js
Normal file
@@ -0,0 +1,61 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
export class InnerStruct {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a() {
|
||||
return this.bb.readFloat64(this.bb_pos);
|
||||
}
|
||||
b(index) {
|
||||
return this.bb.readUint8(this.bb_pos + 8 + index);
|
||||
}
|
||||
c() {
|
||||
return this.bb.readInt8(this.bb_pos + 21);
|
||||
}
|
||||
dUnderscore() {
|
||||
return this.bb.readInt64(this.bb_pos + 24);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.InnerStruct';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 32;
|
||||
}
|
||||
static createInnerStruct(builder, a, b, c, d_underscore) {
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((b?.[i] ?? 0));
|
||||
}
|
||||
builder.writeFloat64(a);
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new InnerStructT(this.a(), this.bb.createScalarList(this.b.bind(this), 13), this.c(), this.dUnderscore());
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.b = this.bb.createScalarList(this.b.bind(this), 13);
|
||||
_o.c = this.c();
|
||||
_o.dUnderscore = this.dUnderscore();
|
||||
}
|
||||
}
|
||||
export class InnerStructT {
|
||||
constructor(a = 0.0, b = [], c = 0, dUnderscore = BigInt('0')) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
this.dUnderscore = dUnderscore;
|
||||
}
|
||||
pack(builder) {
|
||||
return InnerStruct.createInnerStruct(builder, this.a, this.b, this.c, this.dUnderscore);
|
||||
}
|
||||
}
|
||||
91
tests/ts/arrays_test_complex/my-game/example/inner-struct.ts
Normal file
91
tests/ts/arrays_test_complex/my-game/example/inner-struct.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
|
||||
|
||||
export class InnerStruct implements flatbuffers.IUnpackableObject<InnerStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):InnerStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
a():number {
|
||||
return this.bb!.readFloat64(this.bb_pos);
|
||||
}
|
||||
|
||||
b(index: number):number|null {
|
||||
return this.bb!.readUint8(this.bb_pos + 8 + index);
|
||||
}
|
||||
|
||||
c():number {
|
||||
return this.bb!.readInt8(this.bb_pos + 21);
|
||||
}
|
||||
|
||||
dUnderscore():bigint {
|
||||
return this.bb!.readInt64(this.bb_pos + 24);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.InnerStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 32;
|
||||
}
|
||||
|
||||
static createInnerStruct(builder:flatbuffers.Builder, a: number, b: number[]|null, c: number, d_underscore: bigint):flatbuffers.Offset {
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c);
|
||||
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((b?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeFloat64(a);
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): InnerStructT {
|
||||
return new InnerStructT(
|
||||
this.a(),
|
||||
this.bb!.createScalarList<number>(this.b.bind(this), 13),
|
||||
this.c(),
|
||||
this.dUnderscore()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: InnerStructT): void {
|
||||
_o.a = this.a();
|
||||
_o.b = this.bb!.createScalarList<number>(this.b.bind(this), 13);
|
||||
_o.c = this.c();
|
||||
_o.dUnderscore = this.dUnderscore();
|
||||
}
|
||||
}
|
||||
|
||||
export class InnerStructT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: number = 0.0,
|
||||
public b: (number)[] = [],
|
||||
public c: number = 0,
|
||||
public dUnderscore: bigint = BigInt('0')
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return InnerStruct.createInnerStruct(builder,
|
||||
this.a,
|
||||
this.b,
|
||||
this.c,
|
||||
this.dUnderscore
|
||||
);
|
||||
}
|
||||
}
|
||||
27
tests/ts/arrays_test_complex/my-game/example/nested-struct.d.ts
vendored
Normal file
27
tests/ts/arrays_test_complex/my-game/example/nested-struct.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { OuterStruct, OuterStructT } from '../../my-game/example/outer-struct.js';
|
||||
import { TestEnum } from '../../my-game/example/test-enum.js';
|
||||
export declare class NestedStruct implements flatbuffers.IUnpackableObject<NestedStructT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): NestedStruct;
|
||||
a(index: number): number | null;
|
||||
b(): TestEnum;
|
||||
cUnderscore(index: number): TestEnum | null;
|
||||
dOuter(index: number, obj?: OuterStruct): OuterStruct | null;
|
||||
e(index: number): bigint | null;
|
||||
static getFullyQualifiedName(): string;
|
||||
static sizeOf(): number;
|
||||
static createNestedStruct(builder: flatbuffers.Builder, a: number[] | null, b: TestEnum, c_underscore: number[] | null, d_outer: (any | OuterStructT)[] | null, e: bigint[] | null): flatbuffers.Offset;
|
||||
unpack(): NestedStructT;
|
||||
unpackTo(_o: NestedStructT): void;
|
||||
}
|
||||
export declare class NestedStructT implements flatbuffers.IGeneratedObject {
|
||||
a: (number)[];
|
||||
b: TestEnum;
|
||||
cUnderscore: (TestEnum)[];
|
||||
dOuter: (OuterStructT)[];
|
||||
e: (bigint)[];
|
||||
constructor(a?: (number)[], b?: TestEnum, cUnderscore?: (TestEnum)[], dOuter?: (OuterStructT)[], e?: (bigint)[]);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import { OuterStruct, OuterStructT } from '../../my-game/example/outer-struct.js';
|
||||
import { TestEnum } from '../../my-game/example/test-enum.js';
|
||||
export class NestedStruct {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a(index) {
|
||||
return this.bb.readInt32(this.bb_pos + 0 + index * 4);
|
||||
}
|
||||
b() {
|
||||
return this.bb.readInt8(this.bb_pos + 8);
|
||||
}
|
||||
cUnderscore(index) {
|
||||
return this.bb.readInt8(this.bb_pos + 9 + index);
|
||||
}
|
||||
dOuter(index, obj) {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 16 + index * 208, this.bb);
|
||||
}
|
||||
e(index) {
|
||||
return this.bb.readInt64(this.bb_pos + 1056 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.NestedStruct';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 1072;
|
||||
}
|
||||
static createNestedStruct(builder, a, b, c_underscore, d_outer, e) {
|
||||
builder.prep(8, 1072);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(e?.[i] ?? 0));
|
||||
}
|
||||
for (let i = 4; i >= 0; --i) {
|
||||
const item = d_outer?.[i];
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
OuterStruct.createOuterStruct(builder, item?.a, item?.b, (item?.cUnderscore?.a ?? 0), (item?.cUnderscore?.b ?? []), (item?.cUnderscore?.c ?? 0), (item?.cUnderscore?.dUnderscore ?? BigInt(0)), item?.d, (item?.e?.a ?? 0), (item?.e?.b ?? []), (item?.e?.c ?? 0), (item?.e?.dUnderscore ?? BigInt(0)), item?.f);
|
||||
}
|
||||
builder.pad(5);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt8((c_underscore?.[i] ?? 0));
|
||||
}
|
||||
builder.writeInt8(b);
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt32((a?.[i] ?? 0));
|
||||
}
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new NestedStructT(this.bb.createScalarList(this.a.bind(this), 2), this.b(), this.bb.createScalarList(this.cUnderscore.bind(this), 2), this.bb.createObjList(this.dOuter.bind(this), 5), this.bb.createScalarList(this.e.bind(this), 2));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.bb.createScalarList(this.a.bind(this), 2);
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = this.bb.createScalarList(this.cUnderscore.bind(this), 2);
|
||||
_o.dOuter = this.bb.createObjList(this.dOuter.bind(this), 5);
|
||||
_o.e = this.bb.createScalarList(this.e.bind(this), 2);
|
||||
}
|
||||
}
|
||||
export class NestedStructT {
|
||||
constructor(a = [], b = TestEnum.A, cUnderscore = [TestEnum.A, TestEnum.A], dOuter = [], e = []) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.cUnderscore = cUnderscore;
|
||||
this.dOuter = dOuter;
|
||||
this.e = e;
|
||||
}
|
||||
pack(builder) {
|
||||
return NestedStruct.createNestedStruct(builder, this.a, this.b, this.cUnderscore, this.dOuter, this.e);
|
||||
}
|
||||
}
|
||||
135
tests/ts/arrays_test_complex/my-game/example/nested-struct.ts
Normal file
135
tests/ts/arrays_test_complex/my-game/example/nested-struct.ts
Normal file
@@ -0,0 +1,135 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { OuterStruct, OuterStructT } from '../../my-game/example/outer-struct.js';
|
||||
import { TestEnum } from '../../my-game/example/test-enum.js';
|
||||
|
||||
|
||||
export class NestedStruct implements flatbuffers.IUnpackableObject<NestedStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):NestedStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
a(index: number):number|null {
|
||||
return this.bb!.readInt32(this.bb_pos + 0 + index * 4);
|
||||
}
|
||||
|
||||
b():TestEnum {
|
||||
return this.bb!.readInt8(this.bb_pos + 8);
|
||||
}
|
||||
|
||||
cUnderscore(index: number):TestEnum|null {
|
||||
return this.bb!.readInt8(this.bb_pos + 9 + index);
|
||||
}
|
||||
|
||||
dOuter(index: number, obj?:OuterStruct):OuterStruct|null {
|
||||
return (obj || new OuterStruct()).__init(this.bb_pos + 16 + index * 208, this.bb!);
|
||||
}
|
||||
|
||||
e(index: number):bigint|null {
|
||||
return this.bb!.readInt64(this.bb_pos + 1056 + index * 8);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.NestedStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 1072;
|
||||
}
|
||||
|
||||
static createNestedStruct(builder:flatbuffers.Builder, a: number[]|null, b: TestEnum, c_underscore: number[]|null, d_outer: (any|OuterStructT)[]|null, e: bigint[]|null):flatbuffers.Offset {
|
||||
builder.prep(8, 1072);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(e?.[i] ?? 0));
|
||||
}
|
||||
|
||||
|
||||
for (let i = 4; i >= 0; --i) {
|
||||
const item = d_outer?.[i];
|
||||
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
OuterStruct.createOuterStruct(builder,
|
||||
item?.a,
|
||||
item?.b,
|
||||
(item?.cUnderscore?.a ?? 0),
|
||||
(item?.cUnderscore?.b ?? []),
|
||||
(item?.cUnderscore?.c ?? 0),
|
||||
(item?.cUnderscore?.dUnderscore ?? BigInt(0)),
|
||||
item?.d,
|
||||
(item?.e?.a ?? 0),
|
||||
(item?.e?.b ?? []),
|
||||
(item?.e?.c ?? 0),
|
||||
(item?.e?.dUnderscore ?? BigInt(0)),
|
||||
item?.f
|
||||
);
|
||||
}
|
||||
|
||||
builder.pad(5);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt8((c_underscore?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeInt8(b);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt32((a?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): NestedStructT {
|
||||
return new NestedStructT(
|
||||
this.bb!.createScalarList<number>(this.a.bind(this), 2),
|
||||
this.b(),
|
||||
this.bb!.createScalarList<TestEnum>(this.cUnderscore.bind(this), 2),
|
||||
this.bb!.createObjList<OuterStruct, OuterStructT>(this.dOuter.bind(this), 5),
|
||||
this.bb!.createScalarList<bigint>(this.e.bind(this), 2)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: NestedStructT): void {
|
||||
_o.a = this.bb!.createScalarList<number>(this.a.bind(this), 2);
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = this.bb!.createScalarList<TestEnum>(this.cUnderscore.bind(this), 2);
|
||||
_o.dOuter = this.bb!.createObjList<OuterStruct, OuterStructT>(this.dOuter.bind(this), 5);
|
||||
_o.e = this.bb!.createScalarList<bigint>(this.e.bind(this), 2);
|
||||
}
|
||||
}
|
||||
|
||||
export class NestedStructT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: (number)[] = [],
|
||||
public b: TestEnum = TestEnum.A,
|
||||
public cUnderscore: (TestEnum)[] = [TestEnum.A, TestEnum.A],
|
||||
public dOuter: (OuterStructT)[] = [],
|
||||
public e: (bigint)[] = []
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return NestedStruct.createNestedStruct(builder,
|
||||
this.a,
|
||||
this.b,
|
||||
this.cUnderscore,
|
||||
this.dOuter,
|
||||
this.e
|
||||
);
|
||||
}
|
||||
}
|
||||
28
tests/ts/arrays_test_complex/my-game/example/outer-struct.d.ts
vendored
Normal file
28
tests/ts/arrays_test_complex/my-game/example/outer-struct.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { InnerStruct, InnerStructT } from '../../my-game/example/inner-struct.js';
|
||||
export declare class OuterStruct implements flatbuffers.IUnpackableObject<OuterStructT> {
|
||||
bb: flatbuffers.ByteBuffer | null;
|
||||
bb_pos: number;
|
||||
__init(i: number, bb: flatbuffers.ByteBuffer): OuterStruct;
|
||||
a(): boolean;
|
||||
b(): number;
|
||||
cUnderscore(obj?: InnerStruct): InnerStruct | null;
|
||||
d(index: number, obj?: InnerStruct): InnerStruct | null;
|
||||
e(obj?: InnerStruct): InnerStruct | null;
|
||||
f(index: number): number | null;
|
||||
static getFullyQualifiedName(): string;
|
||||
static sizeOf(): number;
|
||||
static createOuterStruct(builder: flatbuffers.Builder, a: boolean, b: number, c_underscore_a: number, c_underscore_b: number[] | null, c_underscore_c: number, c_underscore_d_underscore: bigint, d: (any | InnerStructT)[] | null, e_a: number, e_b: number[] | null, e_c: number, e_d_underscore: bigint, f: number[] | null): flatbuffers.Offset;
|
||||
unpack(): OuterStructT;
|
||||
unpackTo(_o: OuterStructT): void;
|
||||
}
|
||||
export declare class OuterStructT implements flatbuffers.IGeneratedObject {
|
||||
a: boolean;
|
||||
b: number;
|
||||
cUnderscore: InnerStructT | null;
|
||||
d: (InnerStructT)[];
|
||||
e: InnerStructT | null;
|
||||
f: (number)[];
|
||||
constructor(a?: boolean, b?: number, cUnderscore?: InnerStructT | null, d?: (InnerStructT)[], e?: InnerStructT | null, f?: (number)[]);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
95
tests/ts/arrays_test_complex/my-game/example/outer-struct.js
Normal file
95
tests/ts/arrays_test_complex/my-game/example/outer-struct.js
Normal file
@@ -0,0 +1,95 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
import { InnerStruct, InnerStructT } from '../../my-game/example/inner-struct.js';
|
||||
export class OuterStruct {
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
a() {
|
||||
return !!this.bb.readInt8(this.bb_pos);
|
||||
}
|
||||
b() {
|
||||
return this.bb.readFloat64(this.bb_pos + 8);
|
||||
}
|
||||
cUnderscore(obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb);
|
||||
}
|
||||
d(index, obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 48 + index * 32, this.bb);
|
||||
}
|
||||
e(obj) {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb);
|
||||
}
|
||||
f(index) {
|
||||
return this.bb.readFloat64(this.bb_pos + 176 + index * 8);
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'MyGame.Example.OuterStruct';
|
||||
}
|
||||
static sizeOf() {
|
||||
return 208;
|
||||
}
|
||||
static createOuterStruct(builder, a, b, c_underscore_a, c_underscore_b, c_underscore_c, c_underscore_d_underscore, d, e_a, e_b, e_c, e_d_underscore, f) {
|
||||
builder.prep(8, 208);
|
||||
for (let i = 3; i >= 0; --i) {
|
||||
builder.writeFloat64((f?.[i] ?? 0));
|
||||
}
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(e_d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(e_c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((e_b?.[i] ?? 0));
|
||||
}
|
||||
builder.writeFloat64(e_a);
|
||||
for (let i = 2; i >= 0; --i) {
|
||||
const item = d?.[i];
|
||||
if (item instanceof InnerStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
InnerStruct.createInnerStruct(builder, item?.a, item?.b, item?.c, item?.dUnderscore);
|
||||
}
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(c_underscore_d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c_underscore_c);
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((c_underscore_b?.[i] ?? 0));
|
||||
}
|
||||
builder.writeFloat64(c_underscore_a);
|
||||
builder.writeFloat64(b);
|
||||
builder.pad(7);
|
||||
builder.writeInt8(Number(Boolean(a)));
|
||||
return builder.offset();
|
||||
}
|
||||
unpack() {
|
||||
return new OuterStructT(this.a(), this.b(), (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null), this.bb.createObjList(this.d.bind(this), 3), (this.e() !== null ? this.e().unpack() : null), this.bb.createScalarList(this.f.bind(this), 4));
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.a = this.a();
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore().unpack() : null);
|
||||
_o.d = this.bb.createObjList(this.d.bind(this), 3);
|
||||
_o.e = (this.e() !== null ? this.e().unpack() : null);
|
||||
_o.f = this.bb.createScalarList(this.f.bind(this), 4);
|
||||
}
|
||||
}
|
||||
export class OuterStructT {
|
||||
constructor(a = false, b = 0.0, cUnderscore = null, d = [], e = null, f = []) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.cUnderscore = cUnderscore;
|
||||
this.d = d;
|
||||
this.e = e;
|
||||
this.f = f;
|
||||
}
|
||||
pack(builder) {
|
||||
return OuterStruct.createOuterStruct(builder, this.a, this.b, (this.cUnderscore?.a ?? 0), (this.cUnderscore?.b ?? []), (this.cUnderscore?.c ?? 0), (this.cUnderscore?.dUnderscore ?? BigInt(0)), this.d, (this.e?.a ?? 0), (this.e?.b ?? []), (this.e?.c ?? 0), (this.e?.dUnderscore ?? BigInt(0)), this.f);
|
||||
}
|
||||
}
|
||||
152
tests/ts/arrays_test_complex/my-game/example/outer-struct.ts
Normal file
152
tests/ts/arrays_test_complex/my-game/example/outer-struct.ts
Normal file
@@ -0,0 +1,152 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import { InnerStruct, InnerStructT } from '../../my-game/example/inner-struct.js';
|
||||
|
||||
|
||||
export class OuterStruct implements flatbuffers.IUnpackableObject<OuterStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):OuterStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
a():boolean {
|
||||
return !!this.bb!.readInt8(this.bb_pos);
|
||||
}
|
||||
|
||||
b():number {
|
||||
return this.bb!.readFloat64(this.bb_pos + 8);
|
||||
}
|
||||
|
||||
cUnderscore(obj?:InnerStruct):InnerStruct|null {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb!);
|
||||
}
|
||||
|
||||
d(index: number, obj?:InnerStruct):InnerStruct|null {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 48 + index * 32, this.bb!);
|
||||
}
|
||||
|
||||
e(obj?:InnerStruct):InnerStruct|null {
|
||||
return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb!);
|
||||
}
|
||||
|
||||
f(index: number):number|null {
|
||||
return this.bb!.readFloat64(this.bb_pos + 176 + index * 8);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName():string {
|
||||
return 'MyGame.Example.OuterStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 208;
|
||||
}
|
||||
|
||||
static createOuterStruct(builder:flatbuffers.Builder, a: boolean, b: number, c_underscore_a: number, c_underscore_b: number[]|null, c_underscore_c: number, c_underscore_d_underscore: bigint, d: (any|InnerStructT)[]|null, e_a: number, e_b: number[]|null, e_c: number, e_d_underscore: bigint, f: number[]|null):flatbuffers.Offset {
|
||||
builder.prep(8, 208);
|
||||
|
||||
for (let i = 3; i >= 0; --i) {
|
||||
builder.writeFloat64((f?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(e_d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(e_c);
|
||||
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((e_b?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeFloat64(e_a);
|
||||
|
||||
for (let i = 2; i >= 0; --i) {
|
||||
const item = d?.[i];
|
||||
|
||||
if (item instanceof InnerStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
InnerStruct.createInnerStruct(builder,
|
||||
item?.a,
|
||||
item?.b,
|
||||
item?.c,
|
||||
item?.dUnderscore
|
||||
);
|
||||
}
|
||||
|
||||
builder.prep(8, 32);
|
||||
builder.writeInt64(BigInt(c_underscore_d_underscore ?? 0));
|
||||
builder.pad(2);
|
||||
builder.writeInt8(c_underscore_c);
|
||||
|
||||
for (let i = 12; i >= 0; --i) {
|
||||
builder.writeInt8((c_underscore_b?.[i] ?? 0));
|
||||
|
||||
}
|
||||
|
||||
builder.writeFloat64(c_underscore_a);
|
||||
builder.writeFloat64(b);
|
||||
builder.pad(7);
|
||||
builder.writeInt8(Number(Boolean(a)));
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
|
||||
unpack(): OuterStructT {
|
||||
return new OuterStructT(
|
||||
this.a(),
|
||||
this.b(),
|
||||
(this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null),
|
||||
this.bb!.createObjList<InnerStruct, InnerStructT>(this.d.bind(this), 3),
|
||||
(this.e() !== null ? this.e()!.unpack() : null),
|
||||
this.bb!.createScalarList<number>(this.f.bind(this), 4)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unpackTo(_o: OuterStructT): void {
|
||||
_o.a = this.a();
|
||||
_o.b = this.b();
|
||||
_o.cUnderscore = (this.cUnderscore() !== null ? this.cUnderscore()!.unpack() : null);
|
||||
_o.d = this.bb!.createObjList<InnerStruct, InnerStructT>(this.d.bind(this), 3);
|
||||
_o.e = (this.e() !== null ? this.e()!.unpack() : null);
|
||||
_o.f = this.bb!.createScalarList<number>(this.f.bind(this), 4);
|
||||
}
|
||||
}
|
||||
|
||||
export class OuterStructT implements flatbuffers.IGeneratedObject {
|
||||
constructor(
|
||||
public a: boolean = false,
|
||||
public b: number = 0.0,
|
||||
public cUnderscore: InnerStructT|null = null,
|
||||
public d: (InnerStructT)[] = [],
|
||||
public e: InnerStructT|null = null,
|
||||
public f: (number)[] = []
|
||||
){}
|
||||
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return OuterStruct.createOuterStruct(builder,
|
||||
this.a,
|
||||
this.b,
|
||||
(this.cUnderscore?.a ?? 0),
|
||||
(this.cUnderscore?.b ?? []),
|
||||
(this.cUnderscore?.c ?? 0),
|
||||
(this.cUnderscore?.dUnderscore ?? BigInt(0)),
|
||||
this.d,
|
||||
(this.e?.a ?? 0),
|
||||
(this.e?.b ?? []),
|
||||
(this.e?.c ?? 0),
|
||||
(this.e?.dUnderscore ?? BigInt(0)),
|
||||
this.f
|
||||
);
|
||||
}
|
||||
}
|
||||
5
tests/ts/arrays_test_complex/my-game/example/test-enum.d.ts
vendored
Normal file
5
tests/ts/arrays_test_complex/my-game/example/test-enum.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export declare enum TestEnum {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
export var TestEnum;
|
||||
(function (TestEnum) {
|
||||
TestEnum[TestEnum["A"] = 0] = "A";
|
||||
TestEnum[TestEnum["B"] = 1] = "B";
|
||||
TestEnum[TestEnum["C"] = 2] = "C";
|
||||
})(TestEnum = TestEnum || (TestEnum = {}));
|
||||
@@ -0,0 +1,7 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
export enum TestEnum {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2
|
||||
}
|
||||
Reference in New Issue
Block a user