mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-24 20:26:11 +00:00
TS: Add missing generate files (#8075)
Co-authored-by: Michael Le <michael.le647@gmail.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// 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 */
|
||||
import * as flatbuffers from 'flatbuffers';
|
||||
import { KeyValue } from '../reflection/key-value.js';
|
||||
import { Type } from '../reflection/type.js';
|
||||
@@ -154,11 +155,26 @@ export class Field {
|
||||
this.bb.writeUint16(this.bb_pos + offset, value);
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* If the field uses 64-bit offsets.
|
||||
*/
|
||||
offset64() {
|
||||
const offset = this.bb.__offset(this.bb_pos, 30);
|
||||
return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
|
||||
}
|
||||
mutate_offset64(value) {
|
||||
const offset = this.bb.__offset(this.bb_pos, 30);
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
this.bb.writeInt8(this.bb_pos + offset, +value);
|
||||
return true;
|
||||
}
|
||||
static getFullyQualifiedName() {
|
||||
return 'reflection.Field';
|
||||
}
|
||||
static startField(builder) {
|
||||
builder.startObject(13);
|
||||
builder.startObject(14);
|
||||
}
|
||||
static addName(builder, nameOffset) {
|
||||
builder.addFieldOffset(0, nameOffset, 0);
|
||||
@@ -219,6 +235,9 @@ export class Field {
|
||||
static addPadding(builder, padding) {
|
||||
builder.addFieldInt16(12, padding, 0);
|
||||
}
|
||||
static addOffset64(builder, offset64) {
|
||||
builder.addFieldInt8(13, +offset64, +false);
|
||||
}
|
||||
static endField(builder) {
|
||||
const offset = builder.endObject();
|
||||
builder.requiredField(offset, 4); // name
|
||||
@@ -226,7 +245,7 @@ export class Field {
|
||||
return offset;
|
||||
}
|
||||
unpack() {
|
||||
return new FieldT(this.name(), (this.type() !== null ? this.type().unpack() : null), this.id(), this.offset(), this.defaultInteger(), this.defaultReal(), this.deprecated(), this.required(), this.key(), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.optional(), this.padding());
|
||||
return new FieldT(this.name(), (this.type() !== null ? this.type().unpack() : null), this.id(), this.offset(), this.defaultInteger(), this.defaultReal(), this.deprecated(), this.required(), this.key(), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.optional(), this.padding(), this.offset64());
|
||||
}
|
||||
unpackTo(_o) {
|
||||
_o.name = this.name();
|
||||
@@ -242,10 +261,11 @@ export class Field {
|
||||
_o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
|
||||
_o.optional = this.optional();
|
||||
_o.padding = this.padding();
|
||||
_o.offset64 = this.offset64();
|
||||
}
|
||||
}
|
||||
export class FieldT {
|
||||
constructor(name = null, type = null, id = 0, offset = 0, defaultInteger = BigInt('0'), defaultReal = 0.0, deprecated = false, required = false, key = false, attributes = [], documentation = [], optional = false, padding = 0) {
|
||||
constructor(name = null, type = null, id = 0, offset = 0, defaultInteger = BigInt('0'), defaultReal = 0.0, deprecated = false, required = false, key = false, attributes = [], documentation = [], optional = false, padding = 0, offset64 = false) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.id = id;
|
||||
@@ -259,6 +279,7 @@ export class FieldT {
|
||||
this.documentation = documentation;
|
||||
this.optional = optional;
|
||||
this.padding = padding;
|
||||
this.offset64 = offset64;
|
||||
}
|
||||
pack(builder) {
|
||||
const name = (this.name !== null ? builder.createString(this.name) : 0);
|
||||
@@ -279,6 +300,7 @@ export class FieldT {
|
||||
Field.addDocumentation(builder, documentation);
|
||||
Field.addOptional(builder, this.optional);
|
||||
Field.addPadding(builder, this.padding);
|
||||
Field.addOffset64(builder, this.offset64);
|
||||
return Field.endField(builder);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user