mirror of
https://github.com/google/flatbuffers.git
synced 2026-08-06 12:13:19 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3206325259 | |||
| 3216b77f90 | |||
| 43e1505f61 | |||
| 496f10525b |
@@ -2,5 +2,5 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
export { HelloReply } from './models/hello-reply.js';
|
||||
export { HelloRequest } from './models/hello-request.js';
|
||||
export {HelloReply} from './models/hello-reply.js';
|
||||
export {HelloRequest} from './models/hello-request.js';
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class HelloReply {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
bb_pos: number = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):HelloReply {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
@@ -31,11 +31,11 @@ message(optionalEncoding?:any):string|Uint8Array|null {
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
static startHelloReply(builder:flatbuffers.Builder) {
|
||||
static startHelloReply(builder:flatbuffers.Builder):void {
|
||||
builder.startObject(1);
|
||||
}
|
||||
|
||||
static addMessage(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset) {
|
||||
static addMessage(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset):void {
|
||||
builder.addFieldOffset(0, messageOffset, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
export class HelloRequest {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos = 0;
|
||||
bb_pos: number = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):HelloRequest {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
@@ -31,11 +31,11 @@ name(optionalEncoding?:any):string|Uint8Array|null {
|
||||
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
|
||||
}
|
||||
|
||||
static startHelloRequest(builder:flatbuffers.Builder) {
|
||||
static startHelloRequest(builder:flatbuffers.Builder):void {
|
||||
builder.startObject(1);
|
||||
}
|
||||
|
||||
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
|
||||
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset):void {
|
||||
builder.addFieldOffset(0, nameOffset, 0);
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -296,11 +296,11 @@ class TsGenerator : public BaseGenerator {
|
||||
auto fully_qualified_type_name =
|
||||
it.second.ns->GetFullyQualifiedName(type_name);
|
||||
auto is_struct = parser_.structs_.Lookup(fully_qualified_type_name);
|
||||
code += "export { " + type_name;
|
||||
code += "export {" + type_name;
|
||||
if (parser_.opts.generate_object_based_api && is_struct) {
|
||||
code += ", " + type_name + parser_.opts.object_suffix;
|
||||
}
|
||||
code += " } from '";
|
||||
code += "} from '";
|
||||
std::string import_extension =
|
||||
parser_.opts.ts_no_import_ext ? "" : ".js";
|
||||
code += base_name_rel + import_extension + "';\n";
|
||||
@@ -818,7 +818,7 @@ class TsGenerator : public BaseGenerator {
|
||||
|
||||
code += "static finish" + (size_prefixed ? sizePrefixed : "") +
|
||||
GetPrefixedName(struct_def) + "Buffer";
|
||||
code += "(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {\n";
|
||||
code += "(builder:flatbuffers.Builder, offset:flatbuffers.Offset):void {\n";
|
||||
code += " builder.finish(offset";
|
||||
if (!parser_.file_identifier_.empty()) {
|
||||
code += ", '" + parser_.file_identifier_ + "'";
|
||||
@@ -1040,7 +1040,7 @@ class TsGenerator : public BaseGenerator {
|
||||
std::string import_extension = parser_.opts.ts_no_import_ext ? "" : ".js";
|
||||
import.import_statement = "import { " + symbols_expression + " } from '" +
|
||||
rel_file_path + import_extension + "';";
|
||||
import.export_statement = "export { " + symbols_expression + " } from '." +
|
||||
import.export_statement = "export {" + symbols_expression + "} from '." +
|
||||
bare_file_path + import_extension + "';";
|
||||
import.dependency = &dependency;
|
||||
import.dependent = &dependent;
|
||||
@@ -1703,7 +1703,7 @@ class TsGenerator : public BaseGenerator {
|
||||
}
|
||||
code += " bb: flatbuffers.ByteBuffer|" + null_keyword_ + " = " +
|
||||
null_keyword_ + ";\n";
|
||||
code += " bb_pos = 0;\n";
|
||||
code += " bb_pos: number = 0;\n";
|
||||
|
||||
// Generate the __init method that sets the field in a pre-existing
|
||||
// accessor object. This is to allow object reuse.
|
||||
@@ -2156,7 +2156,7 @@ class TsGenerator : public BaseGenerator {
|
||||
GenDocComment(code_ptr);
|
||||
|
||||
code += "static start" + GetPrefixedName(struct_def) +
|
||||
"(builder:flatbuffers.Builder) {\n";
|
||||
"(builder:flatbuffers.Builder):void {\n";
|
||||
|
||||
code += " builder.startObject(" +
|
||||
NumToString(struct_def.fields.vec.size()) + ");\n";
|
||||
@@ -2173,7 +2173,7 @@ class TsGenerator : public BaseGenerator {
|
||||
GenDocComment(code_ptr);
|
||||
code += "static " + namer_.Method("add", field);
|
||||
code += "(builder:flatbuffers.Builder, " + argname + ":" +
|
||||
GetArgType(imports, struct_def, field, false) + ") {\n";
|
||||
GetArgType(imports, struct_def, field, false) + "):void {\n";
|
||||
code += " builder.addField" + GenWriteMethod(field.value.type) + "(";
|
||||
code += NumToString(it - struct_def.fields.vec.begin()) + ", ";
|
||||
if (field.value.type.base_type == BASE_TYPE_BOOL) {
|
||||
@@ -2245,7 +2245,7 @@ class TsGenerator : public BaseGenerator {
|
||||
|
||||
code += "static ";
|
||||
code += namer_.Method("start", field, "Vector");
|
||||
code += "(builder:flatbuffers.Builder, numElems:number) {\n";
|
||||
code += "(builder:flatbuffers.Builder, numElems:number):void {\n";
|
||||
code += " builder.startVector(" + NumToString(elem_size);
|
||||
code += ", numElems, " + NumToString(alignment) + ");\n";
|
||||
code += "}\n\n";
|
||||
|
||||
@@ -228,6 +228,11 @@ print(
|
||||
" no_import_ext..."
|
||||
)
|
||||
check_call(["../../node_modules/.bin/tsc", "-p", "./tsconfig.node.json"])
|
||||
print(
|
||||
"Running TypeScript Compiler with isolatedDeclarations and"
|
||||
" isolatedModules..."
|
||||
)
|
||||
check_call(["../../node_modules/.bin/tsc", "-p", "./tsconfig.isolated.json"])
|
||||
|
||||
NODE_CMD = ["node"]
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
export enum ABC {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2
|
||||
}
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
export {ArrayStruct, ArrayStructT} from './example/array-struct.js';
|
||||
export {ArrayTable, ArrayTableT} from './example/array-table.js';
|
||||
export {InnerStruct, InnerStructT} from './example/inner-struct.js';
|
||||
export {NestedStruct, NestedStructT} from './example/nested-struct.js';
|
||||
export {OuterStruct, OuterStructT} from './example/outer-struct.js';
|
||||
export {TestEnum} from './example/test-enum.js';
|
||||
export { ArrayStruct, ArrayStructT } from './example/array-struct.js';
|
||||
export { ArrayTable, ArrayTableT } from './example/array-table.js';
|
||||
export { InnerStruct, InnerStructT } from './example/inner-struct.js';
|
||||
export { NestedStruct, NestedStructT } from './example/nested-struct.js';
|
||||
export { OuterStruct, OuterStructT } from './example/outer-struct.js';
|
||||
export { TestEnum } from './example/test-enum.js';
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
|
||||
* @typescript-eslint/no-non-null-assertion */
|
||||
export {ArrayStruct, ArrayStructT} from './example/array-struct.js';
|
||||
export {ArrayTable, ArrayTableT} from './example/array-table.js';
|
||||
export {InnerStruct, InnerStructT} from './example/inner-struct.js';
|
||||
export {NestedStruct, NestedStructT} from './example/nested-struct.js';
|
||||
export {OuterStruct, OuterStructT} from './example/outer-struct.js';
|
||||
export {TestEnum} from './example/test-enum.js';
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
export { ArrayStruct, ArrayStructT } from './example/array-struct.js';
|
||||
export { ArrayTable, ArrayTableT } from './example/array-table.js';
|
||||
export { InnerStruct, InnerStructT } from './example/inner-struct.js';
|
||||
export { NestedStruct, NestedStructT } from './example/nested-struct.js';
|
||||
export { OuterStruct, OuterStructT } from './example/outer-struct.js';
|
||||
export { TestEnum } from './example/test-enum.js';
|
||||
|
||||
+27
-49
@@ -1,53 +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;
|
||||
import { NestedStruct, NestedStructT } from './nested-struct.js';
|
||||
import { OuterStruct, OuterStructT } from './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(): "MyGame.Example.ArrayStruct";
|
||||
static sizeOf(): number;
|
||||
static createArrayStruct(builder: flatbuffers.Builder, a_underscore: number, b_underscore: number[], c: number, d: (any | NestedStructT)[], e: number, f: (any | OuterStructT)[], g: bigint[]): 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;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1,115 +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';
|
||||
import { NestedStruct, NestedStructT } from './nested-struct.js';
|
||||
import { OuterStruct, OuterStructT } from './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));
|
||||
constructor() {
|
||||
this.bb = null;
|
||||
this.bb_pos = 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);
|
||||
__init(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
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);
|
||||
aUnderscore() {
|
||||
return this.bb.readFloat32(this.bb_pos);
|
||||
}
|
||||
builder.pad(7);
|
||||
builder.writeInt8(c);
|
||||
for (let i = 14; i >= 0; --i) {
|
||||
builder.writeInt32((b_underscore?.[i] ?? 0));
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,191 +4,165 @@
|
||||
|
||||
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';
|
||||
import { NestedStruct, NestedStructT } from './nested-struct.js';
|
||||
import { OuterStruct, OuterStructT } from './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);
|
||||
}
|
||||
export class ArrayStruct implements flatbuffers.IUnpackableObject<ArrayStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos: number = 0;
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):ArrayStruct {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
}
|
||||
|
||||
bUnderscore(index: number): number | null {
|
||||
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);
|
||||
}
|
||||
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!,
|
||||
);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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!,
|
||||
);
|
||||
}
|
||||
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 {
|
||||
g(index: number):bigint|null {
|
||||
return this.bb!.readInt64(this.bb_pos + 2640 + index * 8);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName(): "MyGame.Example.ArrayStruct" {
|
||||
return 'MyGame.Example.ArrayStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 2656;
|
||||
}
|
||||
|
||||
static createArrayStruct(builder:flatbuffers.Builder, a_underscore: number, b_underscore: number[], c: number, d: (any|NestedStructT)[], e: number, f: (any|OuterStructT)[], g: bigint[]):flatbuffers.Offset {
|
||||
builder.prep(8, 2656);
|
||||
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
builder.writeInt64(BigInt(g?.[i] ?? 0));
|
||||
}
|
||||
|
||||
static getFullyQualifiedName(): string {
|
||||
return 'MyGame.Example.ArrayStruct';
|
||||
}
|
||||
|
||||
static sizeOf(): number {
|
||||
return 2656;
|
||||
}
|
||||
for (let i = 1; i >= 0; --i) {
|
||||
const item = f?.[i];
|
||||
|
||||
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));
|
||||
if (item instanceof OuterStructT) {
|
||||
item.pack(builder);
|
||||
continue;
|
||||
}
|
||||
|
||||
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),
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
unpackTo(_o: ArrayStructT): void {
|
||||
_o.aUnderscore = this.aUnderscore();
|
||||
_o.bUnderscore = this.bb!.createScalarList<number>(
|
||||
this.bUnderscore.bind(this),
|
||||
15,
|
||||
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
|
||||
);
|
||||
_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);
|
||||
}
|
||||
|
||||
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[] = [],
|
||||
) {}
|
||||
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,
|
||||
);
|
||||
}
|
||||
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
return ArrayStruct.createArrayStruct(builder,
|
||||
this.aUnderscore,
|
||||
this.bUnderscore,
|
||||
this.c,
|
||||
this.d,
|
||||
this.e,
|
||||
this.f,
|
||||
this.g
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+24
-44
@@ -1,48 +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;
|
||||
import { ArrayStruct, ArrayStructT } from './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(): "MyGame.Example.ArrayTable";
|
||||
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;
|
||||
a: string | Uint8Array | null;
|
||||
cUnderscore: ArrayStructT | null;
|
||||
constructor(a?: string | Uint8Array | null, cUnderscore?: ArrayStructT | null);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
|
||||
@@ -1,88 +1,75 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
|
||||
* @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import {ArrayStruct} from '../../my-game/example/array-struct.js';
|
||||
|
||||
import { ArrayStruct } from './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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,126 +4,101 @@
|
||||
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
|
||||
import {ArrayStruct, ArrayStructT} from '../../my-game/example/array-struct.js';
|
||||
import { ArrayStruct, ArrayStructT } from './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;
|
||||
}
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos: number = 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 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 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');
|
||||
}
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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 getFullyQualifiedName(): "MyGame.Example.ArrayTable" {
|
||||
return 'MyGame.Example.ArrayTable';
|
||||
}
|
||||
|
||||
static startArrayTable(builder: flatbuffers.Builder) {
|
||||
builder.startObject(2);
|
||||
}
|
||||
static startArrayTable(builder:flatbuffers.Builder):void {
|
||||
builder.startObject(2);
|
||||
}
|
||||
|
||||
static addA(builder: flatbuffers.Builder, aOffset: flatbuffers.Offset) {
|
||||
builder.addFieldOffset(0, aOffset, 0);
|
||||
}
|
||||
static addA(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset):void {
|
||||
builder.addFieldOffset(0, aOffset, 0);
|
||||
}
|
||||
|
||||
static addCUnderscore(
|
||||
builder: flatbuffers.Builder,
|
||||
cUnderscoreOffset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.addFieldStruct(1, cUnderscoreOffset, 0);
|
||||
}
|
||||
static addCUnderscore(builder:flatbuffers.Builder, cUnderscoreOffset:flatbuffers.Offset):void {
|
||||
builder.addFieldStruct(1, cUnderscoreOffset, 0);
|
||||
}
|
||||
|
||||
static endArrayTable(builder: flatbuffers.Builder): flatbuffers.Offset {
|
||||
const offset = builder.endObject();
|
||||
return offset;
|
||||
}
|
||||
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 finishArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset):void {
|
||||
builder.finish(offset, 'RHUB');
|
||||
}
|
||||
|
||||
static finishSizePrefixedArrayTableBuffer(
|
||||
builder: flatbuffers.Builder,
|
||||
offset: flatbuffers.Offset,
|
||||
) {
|
||||
builder.finish(offset, 'RHUB', true);
|
||||
}
|
||||
static finishSizePrefixedArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset):void {
|
||||
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;
|
||||
}
|
||||
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,
|
||||
) {}
|
||||
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,
|
||||
);
|
||||
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
|
||||
const a = (this.a !== null ? builder.createString(this.a!) : 0);
|
||||
|
||||
return ArrayTable.endArrayTable(builder);
|
||||
}
|
||||
ArrayTable.startArrayTable(builder);
|
||||
ArrayTable.addA(builder, a);
|
||||
ArrayTable.addCUnderscore(builder, (this.cUnderscore !== null ? this.cUnderscore!.pack(builder) : 0));
|
||||
|
||||
return ArrayTable.endArrayTable(builder);
|
||||
}
|
||||
}
|
||||
|
||||
+19
-27
@@ -1,31 +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 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(): "MyGame.Example.InnerStruct";
|
||||
static sizeOf(): number;
|
||||
static createInnerStruct(builder: flatbuffers.Builder, a: number, b: number[], 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;
|
||||
a: number;
|
||||
b: (number)[];
|
||||
c: number;
|
||||
dUnderscore: bigint;
|
||||
constructor(a?: number, b?: (number)[], c?: number, dUnderscore?: bigint);
|
||||
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
||||
}
|
||||
|
||||
@@ -1,64 +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));
|
||||
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();
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,93 +4,90 @@
|
||||
|
||||
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 {
|
||||
export class InnerStruct implements flatbuffers.IUnpackableObject<InnerStructT> {
|
||||
bb: flatbuffers.ByteBuffer|null = null;
|
||||
bb_pos: number = 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(): "MyGame.Example.InnerStruct" {
|
||||
return 'MyGame.Example.InnerStruct';
|
||||
}
|
||||
|
||||
static sizeOf():number {
|
||||
return 32;
|
||||
}
|
||||
|
||||
static createInnerStruct(builder:flatbuffers.Builder, a: number, b: number[], 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));
|
||||
|
||||
}
|
||||
|
||||
c(): number {
|
||||
return this.bb!.readInt8(this.bb_pos + 21);
|
||||
}
|
||||
builder.writeFloat64(a);
|
||||
return builder.offset();
|
||||
}
|
||||
|
||||
dUnderscore(): bigint {
|
||||
return this.bb!.readInt64(this.bb_pos + 24);
|
||||
}
|
||||
|
||||
static getFullyQualifiedName(): string {
|
||||
return 'MyGame.Example.InnerStruct';
|
||||
}
|
||||
unpack(): InnerStructT {
|
||||
return new InnerStructT(
|
||||
this.a(),
|
||||
this.bb!.createScalarList<number>(this.b.bind(this), 13),
|
||||
this.c(),
|
||||
this.dUnderscor | ||||