Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
7e68c3625a Bump gradle/actions from 5 to 6
Bumps [gradle/actions](https://github.com/gradle/actions) from 5 to 6.
- [Release notes](https://github.com/gradle/actions/releases)
- [Commits](https://github.com/gradle/actions/compare/v5...v6)

---
updated-dependencies:
- dependency-name: gradle/actions
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-30 15:06:24 +00:00
269 changed files with 15070 additions and 13774 deletions

View File

@@ -319,7 +319,7 @@ jobs:
distribution: temurin
java-version: 17
- name: set up Gradle
uses: gradle/actions/setup-gradle@v5
uses: gradle/actions/setup-gradle@v6
- name: set up flatc
run: |
cmake -DFLATBUFFERS_BUILD_TESTS=OFF -DFLATBUFFERS_BUILD_FLATLIB=OFF -DFLATBUFFERS_BUILD_FLATHASH=OFF -DFLATBUFFERS_STRICT_MODE=ON .
@@ -399,7 +399,7 @@ jobs:
distribution: temurin
java-version: 17
- name: set up Gradle
uses: gradle/actions/setup-gradle@v5
uses: gradle/actions/setup-gradle@v6
- name: Build flatc
run: |
cmake -DFLATBUFFERS_BUILD_TESTS=OFF -DFLATBUFFERS_BUILD_FLATLIB=OFF -DFLATBUFFERS_BUILD_FLATHASH=OFF .
@@ -422,7 +422,7 @@ jobs:
distribution: temurin
java-version: 17
- name: set up Gradle
uses: gradle/actions/setup-gradle@v5
uses: gradle/actions/setup-gradle@v6
- name: Build flatc
run: |
cmake -DFLATBUFFERS_BUILD_TESTS=OFF -DFLATBUFFERS_BUILD_FLATLIB=OFF -DFLATBUFFERS_BUILD_FLATHASH=OFF .

View File

@@ -57,7 +57,7 @@ a `char *` array, which you pass to `GetMonster()`.
```cpp
#include "flatbuffers/flatbuffers.h"
#include "monster_test_generated.h"
#include "monster_test_generate.h"
#include <iostream> // C++ header file for printing
#include <fstream> // C++ header file for file access

View File

@@ -97,61 +97,6 @@ convenient accessors for all fields, e.g. `hp()`, `mana()`, etc:
*Note: That we never stored a `mana` value, so it will return the default.*
## Fallible API and Custom Allocators
Every `FlatBufferBuilder` method that may allocate has a `try_*` counterpart
(e.g. `try_create_string`, `try_push`, `try_finish`) that returns
`Result<T, A::Error>` instead of panicking. This is useful when allocation
failures must be handled gracefully: for example in `no_std` environments or
with fixed-capacity buffers.
The existing panicking methods are unchanged and remain the simplest option
when using the default allocator.
#### Custom allocators
Implement the `Allocator` trait and pass it to `FlatBufferBuilder::new_in()`:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.rs}
use flatbuffers::{Allocator, FlatBufferBuilder};
struct MyAllocator { /* ... */ }
unsafe impl Allocator for MyAllocator {
type Error = MyError;
fn grow_downwards(&mut self) -> Result<(), Self::Error> { /* ... */ }
fn len(&self) -> usize { /* ... */ }
}
let alloc = MyAllocator::new(/* ... */);
let mut builder = FlatBufferBuilder::new_in(alloc);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The built-in `DefaultAllocator` uses `Vec<u8>` and sets `Error = Infallible`,
so the `try_*` methods on a default builder can never fail.
#### Example: building a buffer with error propagation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.rs}
fn build<A: flatbuffers::Allocator>(
builder: &mut FlatBufferBuilder<A>,
) -> Result<(), A::Error> {
let name = builder.try_create_string("Orc")?;
let inventory = builder.try_create_vector(&[0u8, 1, 2, 3, 4])?;
let table_start = builder.start_table();
builder.try_push_slot_always(Monster::VT_NAME, name)?;
builder.try_push_slot_always(Monster::VT_INVENTORY, inventory)?;
builder.try_push_slot(Monster::VT_HP, 80i16, 100)?;
let root = builder.try_end_table(table_start)?;
builder.try_finish(root, None)?;
Ok(())
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
See the `FlatBufferBuilder` rustdoc for the full list of `try_*` methods.
## Direct memory access
As you can see from the above examples, all elements in a buffer are

View File

@@ -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';

View File

@@ -8,7 +8,7 @@ import * as flatbuffers from 'flatbuffers';
export class HelloReply {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos: number = 0;
bb_pos = 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):void {
static startHelloReply(builder:flatbuffers.Builder) {
builder.startObject(1);
}
static addMessage(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset):void {
static addMessage(builder:flatbuffers.Builder, messageOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, messageOffset, 0);
}

View File

@@ -8,7 +8,7 @@ import * as flatbuffers from 'flatbuffers';
export class HelloRequest {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos: number = 0;
bb_pos = 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):void {
static startHelloRequest(builder:flatbuffers.Builder) {
builder.startObject(1);
}
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset):void {
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, nameOffset, 0);
}

View File

@@ -172,7 +172,6 @@ class StubGenerator : public BaseGenerator {
<< " def __init__(self, channel: grpc.Channel) -> None: ...\n";
for (const RPCCall* method : service->calls.vec) {
imports->Import("typing");
std::string request = "bytes";
std::string response = "bytes";
@@ -184,22 +183,14 @@ class StubGenerator : public BaseGenerator {
imports->Import(ModuleFor(method->response), response);
}
ss << " def " << method->name << "(\n";
ss << " self,\n";
ss << " def " << method->name << "(self, ";
if (ClientStreaming(method)) {
ss << " request_iterator: typing.Iterator[" << request << "]\n";
imports->Import("typing");
ss << "request_iterator: typing.Iterator[" << request << "]";
} else {
ss << " request: " << request << ",\n";
ss << "request: " << request;
}
ss << " timeout: float | None = None,\n";
// https://github.com/python/typeshed/blob/ccf9411fb1f5bee2a8e3d278889de17a08f7bbe3/stubs/grpcio/grpc/__init__.pyi#L37
ss << " metadata: typing.Sequence[tuple[str, typing.Union[str, bytes]]] | None = None,\n";
ss << " credentials: grpc.CallCredentials | None = None,\n";
ss << " wait_for_ready: bool | None = None,\n";
ss << " compression: grpc.Compression | None = None\n";
ss << " ) -> ";
ss << ") -> ";
if (ServerStreaming(method)) {
imports->Import("typing");
ss << "typing.Iterator[" << response << "]";

View File

@@ -12,54 +12,33 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from pathlib import Path
import shutil
from setuptools import setup
_THIS_DIR = Path(__file__).resolve().parent
_ROOT_LICENSE = _THIS_DIR.parent / 'LICENSE'
_LOCAL_LICENSE = _THIS_DIR / 'LICENSE'
def _stage_license_file():
if _LOCAL_LICENSE.exists() or not _ROOT_LICENSE.exists():
return False
shutil.copyfile(_ROOT_LICENSE, _LOCAL_LICENSE)
return True
_remove_staged_license = _stage_license_file()
try:
setup(
name='flatbuffers',
version='25.12.19',
license='Apache 2.0',
author='Derek Bailey',
author_email='derekbailey@google.com',
url='https://google.github.io/flatbuffers/',
long_description=(
'Python runtime library for use with the '
'`Flatbuffers <https://google.github.io/flatbuffers/>`_ '
'serialization format.'
),
packages=['flatbuffers'],
include_package_data=True,
requires=[],
description='The FlatBuffers serialization format for Python',
classifiers=[
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Software Development :: Libraries :: Python Modules',
],
project_urls={
'Documentation': 'https://google.github.io/flatbuffers/',
'Source': 'https://github.com/google/flatbuffers',
},
)
finally:
if _remove_staged_license and _LOCAL_LICENSE.exists():
_LOCAL_LICENSE.unlink()
setup(
name='flatbuffers',
version='25.12.19',
license='Apache 2.0',
author='Derek Bailey',
author_email='derekbailey@google.com',
url='https://google.github.io/flatbuffers/',
long_description=(
'Python runtime library for use with the '
'`Flatbuffers <https://google.github.io/flatbuffers/>`_ '
'serialization format.'
),
packages=['flatbuffers'],
include_package_data=True,
requires=[],
description='The FlatBuffers serialization format for Python',
classifiers=[
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Software Development :: Libraries :: Python Modules',
],
project_urls={
'Documentation': 'https://google.github.io/flatbuffers/',
'Source': 'https://github.com/google/flatbuffers',
},
)

View File

@@ -337,43 +337,22 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
self.strings_pool.clear();
}
/// Fallible version of [`push`](Self::push).
#[inline]
pub fn try_push<P: Push>(&mut self, x: P) -> Result<WIPOffset<P::Output>, A::Error> {
let sz = P::size();
self.align(sz, P::alignment())?;
self.make_space(sz)?;
{
let (dst, rest) = self.allocator[self.head.range_to_end()].split_at_mut(sz);
// Safety:
// Called make_space above
unsafe { x.push(dst, rest.len()) };
}
Ok(WIPOffset::new(self.used_space() as UOffsetT))
}
/// Push a Push'able value onto the front of the in-progress data.
///
/// This function uses traits to provide a unified API for writing
/// scalars, tables, vectors, and WIPOffsets.
#[inline]
pub fn push<P: Push>(&mut self, x: P) -> WIPOffset<P::Output> {
self.try_push(x).expect("Flatbuffer allocation failure")
}
/// Fallible version of [`push_slot`](Self::push_slot).
#[inline]
pub fn try_push_slot<X: Push + PartialEq>(
&mut self,
slotoff: VOffsetT,
x: X,
default: X,
) -> Result<(), A::Error> {
self.assert_nested("push_slot");
if x != default || self.force_defaults {
self.try_push_slot_always(slotoff, x)?;
let sz = P::size();
self.align(sz, P::alignment());
self.make_space(sz);
{
let (dst, rest) = self.allocator[self.head.range_to_end()].split_at_mut(sz);
// Safety:
// Called make_space above
unsafe { x.push(dst, rest.len()) };
}
Ok(())
WIPOffset::new(self.used_space() as UOffsetT)
}
/// Push a Push'able value onto the front of the in-progress data, and
@@ -381,29 +360,19 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
/// the default, then this is a no-op.
#[inline]
pub fn push_slot<X: Push + PartialEq>(&mut self, slotoff: VOffsetT, x: X, default: X) {
self.try_push_slot(slotoff, x, default)
.expect("Flatbuffer allocation failure")
}
/// Fallible version of [`push_slot_always`](Self::push_slot_always).
#[inline]
pub fn try_push_slot_always<X: Push>(
&mut self,
slotoff: VOffsetT,
x: X,
) -> Result<(), A::Error> {
self.assert_nested("push_slot_always");
let off = self.try_push(x)?;
self.track_field(slotoff, off.value());
Ok(())
self.assert_nested("push_slot");
if x != default || self.force_defaults {
self.push_slot_always(slotoff, x);
}
}
/// Push a Push'able value onto the front of the in-progress data, and
/// store a reference to it in the in-progress vtable.
#[inline]
pub fn push_slot_always<X: Push>(&mut self, slotoff: VOffsetT, x: X) {
self.try_push_slot_always(slotoff, x)
.expect("Flatbuffer allocation failure")
self.assert_nested("push_slot_always");
let off = self.push(x);
self.track_field(slotoff, off.value());
}
/// Retrieve the number of vtables that have been serialized into the
@@ -428,22 +397,6 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
WIPOffset::new(self.used_space() as UOffsetT)
}
/// Fallible version of [`end_table`](Self::end_table).
#[inline]
pub fn try_end_table(
&mut self,
off: WIPOffset<TableUnfinishedWIPOffset>,
) -> Result<WIPOffset<TableFinishedWIPOffset>, A::Error> {
self.assert_nested("end_table");
let o = self.write_vtable(off)?;
self.nested = false;
self.field_locs.clear();
Ok(WIPOffset::new(o.value()))
}
/// End a Table write.
///
/// Asserts that the builder is in a nested state.
@@ -452,19 +405,14 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
&mut self,
off: WIPOffset<TableUnfinishedWIPOffset>,
) -> WIPOffset<TableFinishedWIPOffset> {
self.try_end_table(off)
.expect("Flatbuffer allocation failure")
}
self.assert_nested("end_table");
/// Fallible version of [`start_vector`](Self::start_vector).
#[inline]
pub fn try_start_vector<T: Push>(&mut self, num_items: usize) -> Result<(), A::Error> {
self.assert_not_nested(
"start_vector can not be called when a table or vector is under construction",
);
self.align(num_items * T::size(), T::alignment().max_of(SIZE_UOFFSET))?;
self.nested = true;
Ok(())
let o = self.write_vtable(off);
self.nested = false;
self.field_locs.clear();
WIPOffset::new(o.value())
}
/// Start a Vector write.
@@ -476,20 +424,11 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
/// function will want to use `push` to add values.
#[inline]
pub fn start_vector<T: Push>(&mut self, num_items: usize) {
self.try_start_vector::<T>(num_items)
.expect("Flatbuffer allocation failure")
}
/// Fallible version of [`end_vector`](Self::end_vector).
#[inline]
pub fn try_end_vector<T: Push>(
&mut self,
num_elems: usize,
) -> Result<WIPOffset<Vector<'fbb, T>>, A::Error> {
self.assert_nested("end_vector");
let o = self.try_push::<UOffsetT>(num_elems as UOffsetT)?;
self.nested = false;
Ok(WIPOffset::new(o.value()))
self.assert_not_nested(
"start_vector can not be called when a table or vector is under construction",
);
self.nested = true;
self.align(num_items * T::size(), T::alignment().max_of(SIZE_UOFFSET));
}
/// End a Vector write.
@@ -500,31 +439,10 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
/// Asserts that the builder is in a nested state.
#[inline]
pub fn end_vector<T: Push>(&mut self, num_elems: usize) -> WIPOffset<Vector<'fbb, T>> {
self.try_end_vector::<T>(num_elems)
.expect("Flatbuffer allocation failure")
}
/// Fallible version of [`create_shared_string`](Self::create_shared_string).
///
/// Uses a HashMap to track previously written strings, providing O(1)
/// amortized lookup and insertion.
#[cfg(feature = "std")]
#[inline]
pub fn try_create_shared_string<'a: 'b, 'b>(
&'a mut self,
s: &'b str,
) -> Result<WIPOffset<&'fbb str>, A::Error> {
self.assert_not_nested(
"create_shared_string can not be called when a table or vector is under construction",
);
if let Some(&offset) = self.strings_pool.get(s) {
return Ok(offset);
}
let address = WIPOffset::new(self.try_create_byte_string(s.as_bytes())?.value());
self.strings_pool.insert(s.to_owned(), address);
Ok(address)
self.assert_nested("end_vector");
self.nested = false;
let o = self.push::<UOffsetT>(num_elems as UOffsetT);
WIPOffset::new(o.value())
}
/// Create a utf8 string, and de-duplicate if already created.
@@ -534,20 +452,26 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
#[cfg(feature = "std")]
#[inline]
pub fn create_shared_string<'a: 'b, 'b>(&'a mut self, s: &'b str) -> WIPOffset<&'fbb str> {
self.try_create_shared_string(s)
.expect("Flatbuffer allocation failure")
self.assert_not_nested(
"create_shared_string can not be called when a table or vector is under construction",
);
if let Some(&offset) = self.strings_pool.get(s) {
return offset;
}
let address = WIPOffset::new(self.create_byte_string(s.as_bytes()).value());
self.strings_pool.insert(s.to_owned(), address);
address
}
/// Fallible version of [`create_shared_string`](Self::create_shared_string).
/// Create a utf8 string, and de-duplicate if already created.
///
/// Uses a sorted Vec with binary search to track previously written
/// strings when in `no_std` mode.
#[cfg(not(feature = "std"))]
#[inline]
pub fn try_create_shared_string<'a: 'b, 'b>(
&'a mut self,
s: &'b str,
) -> Result<WIPOffset<&'fbb str>, A::Error> {
pub fn create_shared_string<'a: 'b, 'b>(&'a mut self, s: &'b str) -> WIPOffset<&'fbb str> {
self.assert_not_nested(
"create_shared_string can not be called when a table or vector is under construction",
);
@@ -570,83 +494,52 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
});
match found {
Ok(index) => Ok(self.strings_pool[index]),
Ok(index) => self.strings_pool[index],
Err(index) => {
let address =
WIPOffset::new(self.try_create_byte_string(s.as_bytes())?.value());
let address = WIPOffset::new(self.create_byte_string(s.as_bytes()).value());
self.strings_pool.insert(index, address);
Ok(address)
address
}
}
}
/// Create a utf8 string, and de-duplicate if already created.
///
/// Uses a sorted Vec with binary search to track previously written
/// strings when in `no_std` mode.
#[cfg(not(feature = "std"))]
#[inline]
pub fn create_shared_string<'a: 'b, 'b>(&'a mut self, s: &'b str) -> WIPOffset<&'fbb str> {
self.try_create_shared_string(s)
.expect("Flatbuffer allocation failure")
}
/// Fallible version of [`create_string`](Self::create_string).
#[inline]
pub fn try_create_string<'a: 'b, 'b>(
&'a mut self,
s: &'b str,
) -> Result<WIPOffset<&'fbb str>, A::Error> {
self.assert_not_nested(
"create_string can not be called when a table or vector is under construction",
);
Ok(WIPOffset::new(
self.try_create_byte_string(s.as_bytes())?.value(),
))
}
/// Create a utf8 string.
///
/// The wire format represents this as a zero-terminated byte vector.
#[inline]
pub fn create_string<'a: 'b, 'b>(&'a mut self, s: &'b str) -> WIPOffset<&'fbb str> {
self.try_create_string(s)
.expect("Flatbuffer allocation failure")
}
/// Fallible version of [`create_byte_string`](Self::create_byte_string).
#[inline]
pub fn try_create_byte_string(
&mut self,
data: &[u8],
) -> Result<WIPOffset<&'fbb [u8]>, A::Error> {
self.assert_not_nested(
"create_byte_string can not be called when a table or vector is under construction",
"create_string can not be called when a table or vector is under construction",
);
self.align(data.len() + 1, PushAlignment::new(SIZE_UOFFSET))?;
self.try_push(0u8)?;
self.push_bytes_unprefixed(data)?;
self.try_push(data.len() as UOffsetT)?;
Ok(WIPOffset::new(self.used_space() as UOffsetT))
WIPOffset::new(self.create_byte_string(s.as_bytes()).value())
}
/// Create a zero-terminated byte vector.
#[inline]
pub fn create_byte_string(&mut self, data: &[u8]) -> WIPOffset<&'fbb [u8]> {
self.try_create_byte_string(data)
.expect("Flatbuffer allocation failure")
self.assert_not_nested(
"create_byte_string can not be called when a table or vector is under construction",
);
self.align(data.len() + 1, PushAlignment::new(SIZE_UOFFSET));
self.push(0u8);
self.push_bytes_unprefixed(data);
self.push(data.len() as UOffsetT);
WIPOffset::new(self.used_space() as UOffsetT)
}
/// Fallible version of [`create_vector`](Self::create_vector).
/// Create a vector of Push-able objects.
///
/// Speed-sensitive users may wish to reduce memory usage by creating the
/// vector manually: use `start_vector`, `push`, and `end_vector`.
#[inline]
pub fn try_create_vector<'a: 'b, 'b, T: Push + 'b>(
pub fn create_vector<'a: 'b, 'b, T: Push + 'b>(
&'a mut self,
items: &'b [T],
) -> Result<WIPOffset<Vector<'fbb, T::Output>>, A::Error> {
) -> WIPOffset<Vector<'fbb, T::Output>> {
let elem_size = T::size();
let slice_size = items.len() * elem_size;
self.align(slice_size, T::alignment().max_of(SIZE_UOFFSET))?;
self.ensure_capacity(slice_size + UOffsetT::size())?;
self.align(slice_size, T::alignment().max_of(SIZE_UOFFSET));
self.ensure_capacity(slice_size + UOffsetT::size());
self.head -= slice_size;
let mut written_len = self.head.distance_to_end();
@@ -660,38 +553,7 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
unsafe { item.push(out, written_len) };
}
Ok(WIPOffset::new(
self.try_push::<UOffsetT>(items.len() as UOffsetT)?.value(),
))
}
/// Create a vector of Push-able objects.
///
/// Speed-sensitive users may wish to reduce memory usage by creating the
/// vector manually: use `start_vector`, `push`, and `end_vector`.
#[inline]
pub fn create_vector<'a: 'b, 'b, T: Push + 'b>(
&'a mut self,
items: &'b [T],
) -> WIPOffset<Vector<'fbb, T::Output>> {
self.try_create_vector(items)
.expect("Flatbuffer allocation failure")
}
/// Fallible version of [`create_vector_from_iter`](Self::create_vector_from_iter).
#[inline]
pub fn try_create_vector_from_iter<T: Push>(
&mut self,
items: impl ExactSizeIterator<Item = T> + DoubleEndedIterator,
) -> Result<WIPOffset<Vector<'fbb, T::Output>>, A::Error> {
let elem_size = T::size();
self.align(items.len() * elem_size, T::alignment().max_of(SIZE_UOFFSET))?;
let mut actual = 0;
for item in items.rev() {
self.try_push(item)?;
actual += 1;
}
Ok(WIPOffset::new(self.try_push::<UOffsetT>(actual)?.value()))
WIPOffset::new(self.push::<UOffsetT>(items.len() as UOffsetT).value())
}
/// Create a vector of Push-able objects.
@@ -703,8 +565,14 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
&mut self,
items: impl ExactSizeIterator<Item = T> + DoubleEndedIterator,
) -> WIPOffset<Vector<'fbb, T::Output>> {
self.try_create_vector_from_iter(items)
.expect("Flatbuffer allocation failure")
let elem_size = T::size();
self.align(items.len() * elem_size, T::alignment().max_of(SIZE_UOFFSET));
let mut actual = 0;
for item in items.rev() {
self.push(item);
actual += 1;
}
WIPOffset::new(self.push::<UOffsetT>(actual).value())
}
/// Set whether default values are stored.
@@ -767,34 +635,13 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
assert!(o != 0, "missing required field {}", assert_msg_name);
}
/// Fallible version of [`finish_size_prefixed`](Self::finish_size_prefixed).
#[inline]
pub fn try_finish_size_prefixed<T>(
&mut self,
root: WIPOffset<T>,
file_identifier: Option<&str>,
) -> Result<(), A::Error> {
self.finish_with_opts(root, file_identifier, true)
}
/// Finalize the FlatBuffer by: aligning it, pushing an optional file
/// identifier on to it, pushing a size prefix on to it, and marking the
/// internal state of the FlatBufferBuilder as `finished`. Afterwards,
/// users can call `finished_data` to get the resulting data.
#[inline]
pub fn finish_size_prefixed<T>(&mut self, root: WIPOffset<T>, file_identifier: Option<&str>) {
self.try_finish_size_prefixed(root, file_identifier)
.expect("Flatbuffer allocation failure")
}
/// Fallible version of [`finish`](Self::finish).
#[inline]
pub fn try_finish<T>(
&mut self,
root: WIPOffset<T>,
file_identifier: Option<&str>,
) -> Result<(), A::Error> {
self.finish_with_opts(root, file_identifier, false)
self.finish_with_opts(root, file_identifier, true);
}
/// Finalize the FlatBuffer by: aligning it, pushing an optional file
@@ -803,14 +650,7 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
/// `finished_data` to get the resulting data.
#[inline]
pub fn finish<T>(&mut self, root: WIPOffset<T>, file_identifier: Option<&str>) {
self.try_finish(root, file_identifier)
.expect("Flatbuffer allocation failure")
}
/// Fallible version of [`finish_minimal`](Self::finish_minimal).
#[inline]
pub fn try_finish_minimal<T>(&mut self, root: WIPOffset<T>) -> Result<(), A::Error> {
self.finish_with_opts(root, None, false)
self.finish_with_opts(root, file_identifier, false);
}
/// Finalize the FlatBuffer by: aligning it and marking the internal state
@@ -818,8 +658,7 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
/// `finished_data` to get the resulting data.
#[inline]
pub fn finish_minimal<T>(&mut self, root: WIPOffset<T>) {
self.try_finish_minimal(root)
.expect("Flatbuffer allocation failure")
self.finish_with_opts(root, None, false);
}
#[inline]
@@ -837,13 +676,13 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
fn write_vtable(
&mut self,
table_tail_revloc: WIPOffset<TableUnfinishedWIPOffset>,
) -> Result<WIPOffset<VTableWIPOffset>, A::Error> {
) -> WIPOffset<VTableWIPOffset> {
self.assert_nested("write_vtable");
// Write the vtable offset, which is the start of any Table.
// We fill its value later.
let object_revloc_to_vtable: WIPOffset<VTableWIPOffset> =
WIPOffset::new(self.try_push::<UOffsetT>(0xF0F0_F0F0)?.value());
WIPOffset::new(self.push::<UOffsetT>(0xF0F0_F0F0).value());
// Layout of the data this function will create when a new vtable is
// needed.
@@ -886,7 +725,7 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
// fill the WIP vtable with zeros:
let vtable_byte_len = get_vtable_byte_len(&self.field_locs);
self.make_space(vtable_byte_len)?;
self.make_space(vtable_byte_len);
// compute the length of the table (not vtable!) in bytes:
let table_object_size = object_revloc_to_vtable.value() - table_tail_revloc.value();
@@ -911,15 +750,13 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
}
}
let new_vt_bytes = &self.allocator[vt_start_pos.range_to(vt_end_pos)];
let found = self
.written_vtable_revpos
.binary_search_by(|old_vtable_revpos: &UOffsetT| {
let old_vtable_pos = self.allocator.len() - *old_vtable_revpos as usize;
// Safety:
// Already written vtables are valid by construction
let old_vtable = unsafe { VTable::init(&self.allocator, old_vtable_pos) };
new_vt_bytes.cmp(old_vtable.as_bytes())
});
let found = self.written_vtable_revpos.binary_search_by(|old_vtable_revpos: &UOffsetT| {
let old_vtable_pos = self.allocator.len() - *old_vtable_revpos as usize;
// Safety:
// Already written vtables are valid by construction
let old_vtable = unsafe { VTable::init(&self.allocator, old_vtable_pos) };
new_vt_bytes.cmp(old_vtable.as_bytes())
});
let final_vtable_revpos = match found {
Ok(i) => {
// The new vtable is a duplicate so clear it.
@@ -957,18 +794,17 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
self.field_locs.clear();
Ok(object_revloc_to_vtable)
object_revloc_to_vtable
}
// Only call this when you know it is safe to double the size of the buffer.
#[inline]
fn grow_allocator(&mut self) -> Result<(), A::Error> {
fn grow_allocator(&mut self) {
let starting_active_size = self.used_space();
self.allocator.grow_downwards()?;
self.allocator.grow_downwards().expect("Flatbuffer allocation failure");
let ending_active_size = self.used_space();
debug_assert_eq!(starting_active_size, ending_active_size);
Ok(())
}
// with or without a size prefix changes how we load the data, so finish*
@@ -978,7 +814,7 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
root: WIPOffset<T>,
file_identifier: Option<&str>,
size_prefixed: bool,
) -> Result<(), A::Error> {
) {
self.assert_not_finished("buffer cannot be finished when it is already finished");
self.assert_not_nested(
"buffer cannot be finished when a table or vector is under construction",
@@ -991,40 +827,34 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
// for the size prefix:
let b = if size_prefixed { SIZE_UOFFSET } else { 0 };
// for the file identifier (a string that is not zero-terminated):
let c = if file_identifier.is_some() {
FILE_IDENTIFIER_LENGTH
} else {
0
};
let c = if file_identifier.is_some() { FILE_IDENTIFIER_LENGTH } else { 0 };
a + b + c
};
{
let ma = PushAlignment::new(self.min_align);
self.align(to_align, ma)?;
self.align(to_align, ma);
}
if let Some(ident) = file_identifier {
debug_assert_eq!(ident.len(), FILE_IDENTIFIER_LENGTH);
self.push_bytes_unprefixed(ident.as_bytes())?;
self.push_bytes_unprefixed(ident.as_bytes());
}
self.try_push(root)?;
self.push(root);
if size_prefixed {
let sz = self.used_space() as UOffsetT;
self.try_push::<UOffsetT>(sz)?;
self.push::<UOffsetT>(sz);
}
self.finished = true;
Ok(())
}
#[inline]
fn align(&mut self, len: usize, alignment: PushAlignment) -> Result<(), A::Error> {
fn align(&mut self, len: usize, alignment: PushAlignment) {
self.track_min_align(alignment.value());
let s = self.used_space() as usize;
self.make_space(padding_bytes(s + len, alignment.value()))?;
Ok(())
self.make_space(padding_bytes(s + len, alignment.value()));
}
#[inline]
@@ -1033,34 +863,31 @@ impl<'fbb, A: Allocator> FlatBufferBuilder<'fbb, A> {
}
#[inline]
fn push_bytes_unprefixed(&mut self, x: &[u8]) -> Result<UOffsetT, A::Error> {
let n = self.make_space(x.len())?;
fn push_bytes_unprefixed(&mut self, x: &[u8]) -> UOffsetT {
let n = self.make_space(x.len());
self.allocator[n.range_to(n + x.len())].copy_from_slice(x);
Ok(n.to_forward_index(&self.allocator) as UOffsetT)
n.to_forward_index(&self.allocator) as UOffsetT
}
#[inline]
fn make_space(&mut self, want: usize) -> Result<ReverseIndex, A::Error> {
self.ensure_capacity(want)?;
fn make_space(&mut self, want: usize) -> ReverseIndex {
self.ensure_capacity(want);
self.head -= want;
Ok(self.head)
self.head
}
#[inline]
fn ensure_capacity(&mut self, want: usize) -> Result<usize, A::Error> {
fn ensure_capacity(&mut self, want: usize) -> usize {
if self.unused_ready_space() >= want {
return Ok(want);
return want;
}
assert!(
want <= FLATBUFFERS_MAX_BUFFER_SIZE,
"cannot grow buffer beyond 2 gigabytes"
);
assert!(want <= FLATBUFFERS_MAX_BUFFER_SIZE, "cannot grow buffer beyond 2 gigabytes");
while self.unused_ready_space() < want {
self.grow_allocator()?;
self.grow_allocator();
}
Ok(want)
want
}
#[inline]
fn unused_ready_space(&self) -> usize {
@@ -1302,111 +1129,4 @@ mod tests {
allocs
);
}
/// A test allocator that fails after a specified number of grow operations.
struct FailingAllocator {
inner: DefaultAllocator,
grows_remaining: usize,
}
#[derive(Debug, Clone, PartialEq, Eq)]
struct AllocationError;
impl core::fmt::Display for AllocationError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "allocation failed")
}
}
impl FailingAllocator {
fn new(initial_size: usize, max_grows: usize) -> Self {
Self {
inner: DefaultAllocator::from_vec(vec![0u8; initial_size]),
grows_remaining: max_grows,
}
}
}
impl Deref for FailingAllocator {
type Target = [u8];
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl DerefMut for FailingAllocator {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
unsafe impl Allocator for FailingAllocator {
type Error = AllocationError;
fn grow_downwards(&mut self) -> Result<(), Self::Error> {
if self.grows_remaining == 0 {
return Err(AllocationError);
}
self.grows_remaining -= 1;
// DefaultAllocator returns Infallible, so unwrap is safe
self.inner.grow_downwards().unwrap();
Ok(())
}
fn len(&self) -> usize {
self.inner.len()
}
}
#[test]
fn try_push_propagates_allocation_error() {
let allocator = FailingAllocator::new(1, 0);
let mut builder = FlatBufferBuilder::new_in(allocator);
let result = builder.try_push::<u64>(0x1234567890ABCDEF);
assert!(result.is_err());
}
#[test]
fn try_create_string_propagates_allocation_error() {
let allocator = FailingAllocator::new(1, 0);
let mut builder = FlatBufferBuilder::new_in(allocator);
let result = builder.try_create_string("hello world");
assert!(result.is_err());
}
#[test]
fn try_create_vector_propagates_allocation_error() {
let allocator = FailingAllocator::new(1, 0);
let mut builder = FlatBufferBuilder::new_in(allocator);
let result = builder.try_create_vector(&[1u32, 2, 3, 4, 5]);
assert!(result.is_err());
}
#[test]
fn try_methods_succeed_with_sufficient_capacity() {
let allocator = FailingAllocator::new(1, 10);
let mut builder = FlatBufferBuilder::new_in(allocator);
let result = builder.try_create_string("hello");
assert!(result.is_ok());
let result = builder.try_create_vector(&[1u32, 2, 3]);
assert!(result.is_ok());
}
#[test]
fn try_finish_propagates_allocation_error() {
let allocator = FailingAllocator::new(1, 3);
let mut builder = FlatBufferBuilder::new_in(allocator);
let start = builder.start_table();
let table = builder
.try_end_table(start)
.expect("end_table should succeed with 3 grows");
let result = builder.try_finish_minimal(table);
assert!(result.is_err(), "finish should fail after grows exhausted");
}
}

View File

@@ -492,8 +492,8 @@ impl<'ver, 'opts, 'buf> TableVerifier<'ver, 'opts, 'buf> {
Ok(self)
}
_ => InvalidFlatbuffer::new_inconsistent_union(
val_field_name.into(),
key_field_name.into(),
val_field_name.into(),
),
}
}

View File

@@ -397,8 +397,8 @@ fn verify_union<'a, 'b, 'c>(
}
} else {
return InvalidFlatbuffer::new_inconsistent_union(
field.name().to_string(),
format!("{}_type", field.name()),
field.name().to_string(),
)?;
}

View File

@@ -2471,7 +2471,7 @@ class PythonGenerator : public BaseGenerator {
} else {
GenPackForScalarVectorFieldHelper(struct_def, field, code_prefix_ptr, 3);
code_prefix += "(self." + field_field + "[i])";
code_prefix += GenIndents(3) + field_field + " = builder.EndVector()";
code_prefix += GenIndents(4) + field_field + " = builder.EndVector()";
}
}

View File

@@ -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):void {\n";
code += "(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {\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: number = 0;\n";
code += " bb_pos = 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):void {\n";
"(builder:flatbuffers.Builder) {\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) + "):void {\n";
GetArgType(imports, struct_def, field, false) + ") {\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):void {\n";
code += "(builder:flatbuffers.Builder, numElems:number) {\n";
code += " builder.startVector(" + NumToString(elem_size);
code += ", numElems, " + NumToString(alignment) + ");\n";
code += "}\n\n";

View File

@@ -4132,15 +4132,7 @@ bool StructDef::Deserialize(Parser& parser, const reflection::Object* object) {
sortbysize = attributes.Lookup("original_order") == nullptr && !fixed;
const auto& of = *(object->fields());
auto indexes = std::vector<uoffset_t>(of.size());
for (uoffset_t i = 0; i < of.size(); i++) {
uint16_t field_id = of.Get(i)->id();
if (field_id >= of.size()) {
parser.error_ = "Field ID " + std::to_string(field_id) +
" exceeds field count " + std::to_string(of.size());
return false;
}
indexes[field_id] = i;
}
for (uoffset_t i = 0; i < of.size(); i++) indexes[of.Get(i)->id()] = i;
size_t tmp_struct_size = 0;
for (size_t i = 0; i < indexes.size(); i++) {
auto field = of.Get(indexes[i]);

View File

@@ -389,7 +389,7 @@ void ForAllFields(const reflection::Object* object, bool reverse,
for (size_t i = 0; i < field_to_id_map.size(); ++i) {
func(object->fields()->Get(
field_to_id_map[reverse ? field_to_id_map.size() - (i + 1) : i]));
field_to_id_map[reverse ? field_to_id_map.size() - i + 1 : i]));
}
}

View File

@@ -248,93 +248,6 @@ void ReflectionTest(const std::string& tests_data_path, uint8_t* flatbuf,
true);
}
// Test that ForAllFields with reverse=true iterates fields in descending
// ID order. This exercises a fix for an operator precedence bug where the
// expression `size() - i + 1` was evaluated as `(size() - i) + 1` instead
// of the correct `size() - (i + 1)`, causing an out-of-bounds read.
void ForAllFieldsReverseTest(const std::string& tests_data_path) {
// Load the binary schema.
std::string bfbsfile;
TEST_EQ(flatbuffers::LoadFile((tests_data_path + "monster_test.bfbs").c_str(),
true, &bfbsfile),
true);
// Verify the schema.
flatbuffers::Verifier verifier(
reinterpret_cast<const uint8_t*>(bfbsfile.c_str()), bfbsfile.length());
TEST_EQ(reflection::VerifySchemaBuffer(verifier), true);
auto& schema = *reflection::GetSchema(bfbsfile.c_str());
// Use the Stat table which has 3 fields with sequential IDs:
// id:string (id: 0)
// val:long (id: 1)
// count:ushort (id: 2)
auto stat_object = schema.objects()->LookupByKey("MyGame.Example.Stat");
TEST_NOTNULL(stat_object);
TEST_EQ(stat_object->fields()->size(), 3u);
// Test forward iteration: fields should come in ascending ID order (0,1,2).
{
std::vector<uint16_t> forward_ids;
flatbuffers::ForAllFields(
stat_object, /*reverse=*/false,
[&forward_ids](const reflection::Field* field) {
forward_ids.push_back(field->id());
});
TEST_EQ(forward_ids.size(), 3u);
TEST_EQ(forward_ids[0], 0); // id
TEST_EQ(forward_ids[1], 1); // val
TEST_EQ(forward_ids[2], 2); // count
}
// Test reverse iteration: fields should come in descending ID order (2,1,0).
// With the old buggy code `size() - i + 1`, at i=0 this would compute
// index 3 - 0 + 1 = 4, which is out of bounds for a size-3 vector.
{
std::vector<uint16_t> reverse_ids;
flatbuffers::ForAllFields(
stat_object, /*reverse=*/true,
[&reverse_ids](const reflection::Field* field) {
reverse_ids.push_back(field->id());
});
TEST_EQ(reverse_ids.size(), 3u);
TEST_EQ(reverse_ids[0], 2); // count (highest ID first)
TEST_EQ(reverse_ids[1], 1); // val
TEST_EQ(reverse_ids[2], 0); // id (lowest ID last)
}
// Also test with the root Monster table which has many fields and
// non-sequential definition order vs. ID order (e.g., pos=id:0, hp=id:2,
// mana=id:1). This ensures the ID-to-index mapping works correctly.
auto root_table = schema.root_table();
TEST_NOTNULL(root_table);
{
std::vector<uint16_t> forward_ids;
flatbuffers::ForAllFields(
root_table, /*reverse=*/false,
[&forward_ids](const reflection::Field* field) {
forward_ids.push_back(field->id());
});
// Verify ascending order.
for (size_t i = 1; i < forward_ids.size(); ++i) {
TEST_ASSERT(forward_ids[i - 1] < forward_ids[i]);
}
}
{
std::vector<uint16_t> reverse_ids;
flatbuffers::ForAllFields(
root_table, /*reverse=*/true,
[&reverse_ids](const reflection::Field* field) {
reverse_ids.push_back(field->id());
});
// Verify descending order.
for (size_t i = 1; i < reverse_ids.size(); ++i) {
TEST_ASSERT(reverse_ids[i - 1] > reverse_ids[i]);
}
}
}
void MiniReflectFlatBuffersTest(uint8_t* flatbuf) {
auto s =
flatbuffers::FlatBufferToString(flatbuf, Monster::MiniReflectTypeTable());

View File

@@ -10,7 +10,6 @@ namespace tests {
void ReflectionTest(const std::string& tests_data_path, uint8_t* flatbuf,
size_t length);
void ForAllFieldsReverseTest(const std::string& tests_data_path);
void MiniReflectFixedLengthArrayTest();
void MiniReflectFlatBuffersTest(uint8_t* flatbuf);

View File

@@ -3448,250 +3448,4 @@ fn test_shared_strings_pool_deduplication() {
}
} // mod flatbuffers_tests
#[cfg(test)]
mod try_api {
extern crate flatbuffers;
use alloc::vec::Vec;
use flatbuffers::Follow;
use super::my_game;
use super::serialized_example_is_accessible_and_correct;
#[test]
fn try_api_full_table_roundtrip() {
// Build a Monster using exclusively try_* API (mirrors library_code example).
let mut builder = flatbuffers::FlatBufferBuilder::new();
let nested_union_mon = {
let name = builder.try_create_string("Fred").unwrap();
let table_start = builder.start_table();
builder
.try_push_slot_always(my_game::example::Monster::VT_NAME, name)
.unwrap();
builder.try_end_table(table_start).unwrap()
};
let pos = my_game::example::Vec3::new(
1.0,
2.0,
3.0,
3.0,
my_game::example::Color::Green,
&my_game::example::Test::new(5i16, 6i8),
);
let inv = builder.try_create_vector(&[0u8, 1, 2, 3, 4]).unwrap();
let test4 = builder
.try_create_vector(
&[
my_game::example::Test::new(10, 20),
my_game::example::Test::new(30, 40),
][..],
)
.unwrap();
let name = builder.try_create_string("MyMonster").unwrap();
let test1 = builder.try_create_string("test1").unwrap();
let test2 = builder.try_create_string("test2").unwrap();
let testarrayofstring = builder.try_create_vector(&[test1, test2]).unwrap();
let table_start = builder.start_table();
builder
.try_push_slot(my_game::example::Monster::VT_HP, 80i16, 100)
.unwrap();
builder
.try_push_slot_always(my_game::example::Monster::VT_NAME, name)
.unwrap();
builder
.try_push_slot_always(my_game::example::Monster::VT_POS, &pos)
.unwrap();
builder
.try_push_slot(
my_game::example::Monster::VT_TEST_TYPE,
my_game::example::Any::Monster,
my_game::example::Any::NONE,
)
.unwrap();
builder
.try_push_slot_always(my_game::example::Monster::VT_TEST, nested_union_mon)
.unwrap();
builder
.try_push_slot_always(my_game::example::Monster::VT_INVENTORY, inv)
.unwrap();
builder
.try_push_slot_always(my_game::example::Monster::VT_TEST4, test4)
.unwrap();
builder
.try_push_slot_always(
my_game::example::Monster::VT_TESTARRAYOFSTRING,
testarrayofstring,
)
.unwrap();
let root = builder.try_end_table(table_start).unwrap();
builder
.try_finish(root, Some(my_game::example::MONSTER_IDENTIFIER))
.unwrap();
let buf = builder.finished_data();
serialized_example_is_accessible_and_correct(buf, true, false).unwrap();
}
#[test]
fn try_shared_string_deduplication() {
let mut builder = flatbuffers::FlatBufferBuilder::new();
let offset1 = builder
.try_create_shared_string("welcome to flatbuffers!!")
.unwrap();
let offset2 = builder.try_create_shared_string("welcome").unwrap();
let offset3 = builder
.try_create_shared_string("welcome to flatbuffers!!")
.unwrap();
assert_ne!(offset2.value(), offset3.value());
assert_eq!(offset1.value(), offset3.value());
builder.reset();
let offset4 = builder.try_create_shared_string("welcome").unwrap();
let offset5 = builder
.try_create_shared_string("welcome to flatbuffers!!")
.unwrap();
assert_ne!(offset2.value(), offset4.value());
assert_ne!(offset5.value(), offset1.value());
builder.reset();
// Shared strings work with an object in between writes
let name = builder.try_create_shared_string("foo").unwrap();
let enemy =
my_game::example::Monster::create(&mut builder, &my_game::example::MonsterArgs {
name: Some(name),
..Default::default()
});
let secondary_name = builder.try_create_shared_string("foo").unwrap();
assert_eq!(name.value(), secondary_name.value());
let args = my_game::example::MonsterArgs {
name: Some(secondary_name),
enemy: Some(enemy),
testarrayofstring: Some(builder.try_create_vector(&[name, secondary_name]).unwrap()),
..Default::default()
};
let main_monster = my_game::example::Monster::create(&mut builder, &args);
builder.try_finish(main_monster, None).unwrap();
let monster =
my_game::example::root_as_monster(builder.finished_data()).unwrap();
assert_eq!(monster.enemy().unwrap().name(), "foo");
let string_vector = monster.testarrayofstring().unwrap();
assert_eq!(string_vector.get(0), "foo");
assert_eq!(string_vector.get(1), "foo");
}
#[test]
fn try_vector_manual_build_roundtrip() {
// Build a vector of scalars manually using try_start_vector / try_push / try_end_vector.
let mut builder = flatbuffers::FlatBufferBuilder::new();
let items: Vec<u32> = vec![10, 20, 30, 40, 50];
builder
.try_start_vector::<u32>(items.len())
.unwrap();
for &v in items.iter().rev() {
builder.try_push::<u32>(v).unwrap();
}
let vecend = builder.try_end_vector::<u32>(items.len()).unwrap();
builder.try_finish_minimal(vecend).unwrap();
let buf = builder.finished_data();
let got = unsafe {
<flatbuffers::ForwardsUOffset<flatbuffers::Vector<u32>>>::follow(&buf[..], 0)
};
let result: Vec<u32> = got.iter().collect();
assert_eq!(result, items);
}
#[test]
fn try_create_vector_roundtrip() {
let mut builder = flatbuffers::FlatBufferBuilder::new();
let items: Vec<i64> = vec![-1, 0, 1, i64::MIN, i64::MAX];
let offset = builder.try_create_vector(&items).unwrap();
builder.try_finish_minimal(offset).unwrap();
let buf = builder.finished_data();
let got = unsafe {
<flatbuffers::ForwardsUOffset<flatbuffers::Vector<i64>>>::follow(&buf[..], 0)
};
let result: Vec<i64> = got.iter().collect();
assert_eq!(result, items);
}
#[test]
fn try_create_vector_from_iter_roundtrip() {
let mut builder = flatbuffers::FlatBufferBuilder::new();
let items: Vec<f64> = vec![1.0, 2.5, -3.14, 0.0];
let offset = builder
.try_create_vector_from_iter(items.iter().copied())
.unwrap();
builder.try_finish_minimal(offset).unwrap();
let buf = builder.finished_data();
let got = unsafe {
<flatbuffers::ForwardsUOffset<flatbuffers::Vector<f64>>>::follow(&buf[..], 0)
};
let result: Vec<f64> = got.iter().collect();
assert_eq!(result, items);
}
#[test]
fn try_create_byte_string_roundtrip() {
let mut builder = flatbuffers::FlatBufferBuilder::new();
let data = b"hello bytes";
let offset = builder.try_create_byte_string(data).unwrap();
builder.try_finish_minimal(offset).unwrap();
let buf = builder.finished_data();
let got = unsafe {
<flatbuffers::ForwardsUOffset<&[u8]>>::follow(&buf[..], 0)
};
assert_eq!(got, data);
}
#[test]
fn try_finish_size_prefixed_roundtrip() {
let mut builder = flatbuffers::FlatBufferBuilder::new();
let args = &my_game::example::MonsterArgs {
mana: 200,
hp: 300,
name: Some(builder.try_create_string("bob").unwrap()),
..Default::default()
};
let mon = my_game::example::Monster::create(&mut builder, &args);
builder.try_finish_size_prefixed(mon, None).unwrap();
let buf = builder.finished_data();
let m = flatbuffers::size_prefixed_root::<my_game::example::Monster>(buf).unwrap();
assert_eq!(m.mana(), 200);
assert_eq!(m.hp(), 300);
assert_eq!(m.name(), "bob");
}
#[test]
fn try_finish_with_file_identifier() {
let mut builder = flatbuffers::FlatBufferBuilder::new();
let name = builder.try_create_string("foo").unwrap();
let args = &my_game::example::MonsterArgs {
name: Some(name),
hp: 42,
..Default::default()
};
let mon = my_game::example::Monster::create(&mut builder, &args);
builder
.try_finish(mon, Some(my_game::example::MONSTER_IDENTIFIER))
.unwrap();
let buf = builder.finished_data();
assert!(my_game::example::monster_buffer_has_identifier(buf));
let m = my_game::example::root_as_monster(buf).unwrap();
assert_eq!(m.name(), "foo");
assert_eq!(m.hp(), 42);
}
}
}

View File

@@ -1774,7 +1774,6 @@ int FlatBufferTests(const std::string& tests_data_path) {
FixedLengthArrayJsonTest(tests_data_path, false);
FixedLengthArrayJsonTest(tests_data_path, true);
ReflectionTest(tests_data_path, flatbuf.data(), flatbuf.size());
ForAllFieldsReverseTest(tests_data_path);
ParseProtoTest(tests_data_path);
EvolutionTest(tests_data_path);
UnionDeprecationTest(tests_data_path);

View File

@@ -228,11 +228,6 @@ 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"]

View File

@@ -1,9 +0,0 @@
// 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
}

View File

@@ -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';

View File

@@ -1,8 +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 { 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';

View File

@@ -1,31 +1,53 @@
import * as flatbuffers from 'flatbuffers';
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;
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;
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;
}

View File

@@ -1,98 +1,115 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { NestedStruct, NestedStructT } from './nested-struct.js';
import { OuterStruct, OuterStructT } from './outer-struct.js';
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;
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));
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
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);
}
aUnderscore() {
return this.bb.readFloat32(this.bb_pos);
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);
}
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.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);
}
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);
}
}

View File

@@ -4,165 +4,191 @@
import * as flatbuffers from 'flatbuffers';
import { NestedStruct, NestedStructT } from './nested-struct.js';
import { OuterStruct, OuterStructT } from './outer-struct.js';
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;
}
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;
}
aUnderscore(): number {
return this.bb!.readFloat32(this.bb_pos);
}
aUnderscore():number {
return this.bb!.readFloat32(this.bb_pos);
}
bUnderscore(index: number):number|null {
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';
}
for (let i = 1; i >= 0; --i) {
const item = f?.[i];
static sizeOf(): number {
return 2656;
}
if (item instanceof OuterStructT) {
item.pack(builder);
continue;
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));
}
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
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),
);
}
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
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);
}
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,
);
}
}

View File

@@ -1,28 +1,48 @@
import * as flatbuffers from 'flatbuffers';
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;
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;
a: string | Uint8Array | null;
cUnderscore: ArrayStructT | null;
constructor(
a?: string | Uint8Array | null,
cUnderscore?: ArrayStructT | null,
);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

@@ -1,75 +1,88 @@
// 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 './array-struct.js';
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);
}
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);
}
}

View File

@@ -4,101 +4,126 @@
import * as flatbuffers from 'flatbuffers';
import { ArrayStruct, ArrayStructT } from './array-struct.js';
import {ArrayStruct, ArrayStructT} from '../../my-game/example/array-struct.js';
export class ArrayTable implements flatbuffers.IUnpackableObject<ArrayTableT> {
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;
}
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 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(): "MyGame.Example.ArrayTable" {
return 'MyGame.Example.ArrayTable';
}
static getFullyQualifiedName(): string {
return 'MyGame.Example.ArrayTable';
}
static startArrayTable(builder:flatbuffers.Builder):void {
builder.startObject(2);
}
static startArrayTable(builder: flatbuffers.Builder) {
builder.startObject(2);
}
static addA(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset):void {
builder.addFieldOffset(0, aOffset, 0);
}
static addA(builder: flatbuffers.Builder, aOffset: flatbuffers.Offset) {
builder.addFieldOffset(0, aOffset, 0);
}
static addCUnderscore(builder:flatbuffers.Builder, cUnderscoreOffset:flatbuffers.Offset):void {
builder.addFieldStruct(1, cUnderscoreOffset, 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 endArrayTable(builder: flatbuffers.Builder): flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static finishArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset):void {
builder.finish(offset, 'RHUB');
}
static finishArrayTableBuffer(
builder: flatbuffers.Builder,
offset: flatbuffers.Offset,
) {
builder.finish(offset, 'RHUB');
}
static finishSizePrefixedArrayTableBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset):void {
builder.finish(offset, 'RHUB', true);
}
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,
);
}
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);
}
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;
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,
);
ArrayTable.startArrayTable(builder);
ArrayTable.addA(builder, a);
ArrayTable.addCUnderscore(builder, (this.cUnderscore !== null ? this.cUnderscore!.pack(builder) : 0));
return ArrayTable.endArrayTable(builder);
}
return ArrayTable.endArrayTable(builder);
}
}

View File

@@ -1,23 +1,31 @@
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(): "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 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;
a: number;
b: number[];
c: number;
dUnderscore: bigint;
constructor(a?: number, b?: number[], c?: number, dUnderscore?: bigint);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

@@ -1,61 +1,64 @@
// 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();
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);
}
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);
}
}

View File

@@ -4,90 +4,93 @@
import * as flatbuffers from 'flatbuffers';
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));
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;
}
builder.writeFloat64(a);
return builder.offset();
}
a(): number {
return this.bb!.readFloat64(this.bb_pos);
}
b(index: number): number | null {
return this.bb!.readUint8(this.bb_pos + 8 + index);
}
unpack(): InnerStructT {
return new InnerStructT(
this.a(),
this.bb!.createScalarList<number>(this.b.bind(this), 13),
this.c(),
this.dUnderscore()
);
}
c(): number {
return this.bb!.readInt8(this.bb_pos + 21);
}
dUnderscore(): bigint {
return this.bb!.readInt64(this.bb_pos + 24);
}
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();
}
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')
){}
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
);
}
pack(builder: flatbuffers.Builder): flatbuffers.Offset {
return InnerStruct.createInnerStruct(
builder,
this.a,
this.b,
this.c,
this.dUnderscore,
);
}
}

View File

@@ -1,27 +1,42 @@
import * as flatbuffers from 'flatbuffers';
import { OuterStruct, OuterStructT } from './outer-struct.js';
import { TestEnum } from './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(): "MyGame.Example.NestedStruct";
static sizeOf(): number;
static createNestedStruct(builder: flatbuffers.Builder, a: number[], b: TestEnum, c_underscore: number[], d_outer: (any | OuterStructT)[], e: bigint[]): flatbuffers.Offset;
unpack(): NestedStructT;
unpackTo(_o: NestedStructT): void;
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;
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;
}

View File

@@ -1,80 +1,93 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { OuterStruct, OuterStructT } from './outer-struct.js';
import { TestEnum } from './test-enum.js';
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;
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));
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
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);
}
a(index) {
return this.bb.readInt32(this.bb_pos + 0 + index * 4);
builder.pad(5);
for (let i = 1; i >= 0; --i) {
builder.writeInt8((c_underscore?.[i] ?? 0));
}
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);
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);
}
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);
}
}

View File

@@ -4,134 +4,150 @@
import * as flatbuffers from 'flatbuffers';
import { OuterStruct, OuterStructT } from './outer-struct.js';
import { TestEnum } from './test-enum.js';
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: number = 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(): "MyGame.Example.NestedStruct" {
return 'MyGame.Example.NestedStruct';
}
static sizeOf():number {
return 1072;
}
static createNestedStruct(builder:flatbuffers.Builder, a: number[], b: TestEnum, c_underscore: number[], d_outer: (any|OuterStructT)[], e: bigint[]):flatbuffers.Offset {
builder.prep(8, 1072);
for (let i = 1; i >= 0; --i) {
builder.writeInt64(BigInt(e?.[i] ?? 0));
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);
}
for (let i = 4; i >= 0; --i) {
const item = d_outer?.[i];
b(): TestEnum {
return this.bb!.readInt8(this.bb_pos + 8);
}
if (item instanceof OuterStructT) {
item.pack(builder);
continue;
}
cUnderscore(index: number): TestEnum | null {
return this.bb!.readInt8(this.bb_pos + 9 + index);
}
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
dOuter(index: number, obj?: OuterStruct): OuterStruct | null {
return (obj || new OuterStruct()).__init(
this.bb_pos + 16 + index * 208,
this.bb!,
);
}
builder.pad(5);
for (let i = 1; i >= 0; --i) {
builder.writeInt8((c_underscore?.[i] ?? 0));
e(index: number): bigint | null {
return this.bb!.readInt64(this.bb_pos + 1056 + index * 8);
}
builder.writeInt8(b);
for (let i = 1; i >= 0; --i) {
builder.writeInt32((a?.[i] ?? 0));
static getFullyQualifiedName(): string {
return 'MyGame.Example.NestedStruct';
}
return builder.offset();
}
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);
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)
);
}
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];
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);
}
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)[] = []
){}
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
);
}
pack(builder: flatbuffers.Builder): flatbuffers.Offset {
return NestedStruct.createNestedStruct(
builder,
this.a,
this.b,
this.cUnderscore,
this.dOuter,
this.e,
);
}
}

View File

@@ -1,28 +1,51 @@
import * as flatbuffers from 'flatbuffers';
import { InnerStruct, InnerStructT } from './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(): "MyGame.Example.OuterStruct";
static sizeOf(): number;
static createOuterStruct(builder: flatbuffers.Builder, a: boolean, b: number, c_underscore_a: number, c_underscore_b: number[], c_underscore_c: number, c_underscore_d_underscore: bigint, d: (any | InnerStructT)[], e_a: number, e_b: number[], e_c: number, e_d_underscore: bigint, f: number[]): flatbuffers.Offset;
unpack(): OuterStructT;
unpackTo(_o: OuterStructT): void;
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;
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;
}

View File

@@ -1,95 +1,111 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { InnerStruct, InnerStructT } from './inner-struct.js';
import {InnerStruct, InnerStructT} from '../../my-game/example/inner-struct.js';
export class OuterStruct {
constructor() {
this.bb = null;
this.bb_pos = 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.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));
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
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));
}
a() {
return !!this.bb.readInt8(this.bb_pos);
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);
}
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);
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);
}
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);
}
}

View File

@@ -4,151 +4,169 @@
import * as flatbuffers from 'flatbuffers';
import { InnerStruct, InnerStructT } from './inner-struct.js';
export class OuterStruct implements flatbuffers.IUnpackableObject<OuterStructT> {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos: number = 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(): "MyGame.Example.OuterStruct" {
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[], c_underscore_c: number, c_underscore_d_underscore: bigint, d: (any|InnerStructT)[], e_a: number, e_b: number[], e_c: number, e_d_underscore: bigint, f: number[]):flatbuffers.Offset {
builder.prep(8, 208);
for (let i = 3; i >= 0; --i) {
builder.writeFloat64((f?.[i] ?? 0));
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;
}
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));
a(): boolean {
return !!this.bb!.readInt8(this.bb_pos);
}
builder.writeFloat64(e_a);
b(): number {
return this.bb!.readFloat64(this.bb_pos + 8);
}
for (let i = 2; i >= 0; --i) {
const item = d?.[i];
cUnderscore(obj?: InnerStruct): InnerStruct | null {
return (obj || new InnerStruct()).__init(this.bb_pos + 16, this.bb!);
}
if (item instanceof InnerStructT) {
item.pack(builder);
continue;
}
InnerStruct.createInnerStruct(builder,
item?.a,
item?.b,
item?.c,
item?.dUnderscore
d(index: number, obj?: InnerStruct): InnerStruct | null {
return (obj || new InnerStruct()).__init(
this.bb_pos + 48 + index * 32,
this.bb!,
);
}
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));
e(obj?: InnerStruct): InnerStruct | null {
return (obj || new InnerStruct()).__init(this.bb_pos + 144, this.bb!);
}
builder.writeFloat64(c_underscore_a);
builder.writeFloat64(b);
builder.pad(7);
builder.writeInt8(Number(Boolean(a)));
return builder.offset();
}
f(index: number): number | null {
return this.bb!.readFloat64(this.bb_pos + 176 + index * 8);
}
static getFullyQualifiedName(): string {
return 'MyGame.Example.OuterStruct';
}
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)
);
}
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);
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);
}
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)[] = []
){}
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
);
}
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,
);
}
}

View File

@@ -1,5 +1,5 @@
export declare enum TestEnum {
A = 0,
B = 1,
C = 2
A = 0,
B = 1,
C = 2,
}

View File

@@ -1,8 +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 */
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export var TestEnum;
(function (TestEnum) {
TestEnum[TestEnum["A"] = 0] = "A";
TestEnum[TestEnum["B"] = 1] = "B";
TestEnum[TestEnum["C"] = 2] = "C";
(function(TestEnum) {
TestEnum[TestEnum['A'] = 0] = 'A';
TestEnum[TestEnum['B'] = 1] = 'B';
TestEnum[TestEnum['C'] = 2] = 'C';
})(TestEnum || (TestEnum = {}));

View File

@@ -5,5 +5,5 @@
export enum TestEnum {
A = 0,
B = 1,
C = 2
C = 2,
}

View File

@@ -4,67 +4,86 @@
import * as flatbuffers from 'flatbuffers';
export class Person {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos: number = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Person {
this.bb_pos = i;
this.bb = bb;
return this;
}
bb: flatbuffers.ByteBuffer | null = null;
bb_pos = 0;
__init(i: number, bb: flatbuffers.ByteBuffer): Person {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsPerson(bb:flatbuffers.ByteBuffer, obj?:Person):Person {
return (obj || new Person()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getRootAsPerson(bb: flatbuffers.ByteBuffer, obj?: Person): Person {
return (obj || new Person()).__init(
bb.readInt32(bb.position()) + bb.position(),
bb,
);
}
static getSizePrefixedRootAsPerson(bb:flatbuffers.ByteBuffer, obj?:Person):Person {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Person()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsPerson(
bb: flatbuffers.ByteBuffer,
obj?: Person,
): Person {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Person()).__init(
bb.readInt32(bb.position()) + bb.position(),
bb,
);
}
name():string|null
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
name(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;
}
name(): string | null;
name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
name(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;
}
age():number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0;
}
age(): number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0;
}
static startPerson(builder:flatbuffers.Builder):void {
builder.startObject(2);
}
static startPerson(builder: flatbuffers.Builder) {
builder.startObject(2);
}
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset):void {
builder.addFieldOffset(0, nameOffset, 0);
}
static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addAge(builder:flatbuffers.Builder, age:number):void {
builder.addFieldInt16(1, age, 0);
}
static addAge(builder: flatbuffers.Builder, age: number) {
builder.addFieldInt16(1, age, 0);
}
static endPerson(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static endPerson(builder: flatbuffers.Builder): flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static finishPersonBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset):void {
builder.finish(offset);
}
static finishPersonBuffer(
builder: flatbuffers.Builder,
offset: flatbuffers.Offset,
) {
builder.finish(offset);
}
static finishSizePrefixedPersonBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset):void {
builder.finish(offset, undefined, true);
}
static finishSizePrefixedPersonBuffer(
builder: flatbuffers.Builder,
offset: flatbuffers.Offset,
) {
builder.finish(offset, undefined, true);
}
static createPerson(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, age:number):flatbuffers.Offset {
Person.startPerson(builder);
Person.addName(builder, nameOffset);
Person.addAge(builder, age);
return Person.endPerson(builder);
}
static createPerson(
builder: flatbuffers.Builder,
nameOffset: flatbuffers.Offset,
age: number,
): flatbuffers.Offset {
Person.startPerson(builder);
Person.addName(builder, nameOffset);
Person.addAge(builder, age);
return Person.endPerson(builder);
}
}

View File

@@ -1,473 +0,0 @@
// 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 { ABC } from './abc.js';
import { EvenMoreStruct, EvenMoreStructT } from './even-more-struct.js';
export class EvenMoreDefaults implements flatbuffers.IUnpackableObject<EvenMoreDefaultsT> {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos: number = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):EvenMoreDefaults {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsEvenMoreDefaults(bb:flatbuffers.ByteBuffer, obj?:EvenMoreDefaults):EvenMoreDefaults {
return (obj || new EvenMoreDefaults()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsEvenMoreDefaults(bb:flatbuffers.ByteBuffer, obj?:EvenMoreDefaults):EvenMoreDefaults {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new EvenMoreDefaults()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
str(obj?:EvenMoreStruct):EvenMoreStruct|null {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? (obj || new EvenMoreStruct()).__init(this.bb_pos + offset, this.bb!) : null;
}
ints(index: number):number|null {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt32(this.bb!.__vector(this.bb_pos + offset) + index * 4) : 0;
}
intsLength():number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
intsArray():Int32Array {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? new Int32Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : new Int32Array();
}
floats(index: number):number|null {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.readFloat32(this.bb!.__vector(this.bb_pos + offset) + index * 4) : 0;
}
floatsLength():number {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
floatsArray():Float32Array {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? new Float32Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : new Float32Array();
}
floatOptional(index: number):number|null {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.readFloat32(this.bb!.__vector(this.bb_pos + offset) + index * 4) : 0;
}
floatOptionalLength():number {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
floatOptionalArray():Float32Array|null {
const offset = this.bb!.__offset(this.bb_pos, 10);
return offset ? new Float32Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
}
bytesOptional(index: number):number|null {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
}
bytesOptionalLength():number {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
bytesOptionalArray():Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 12);
return offset ? new Uint8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
}
floatsRequired(index: number):number|null {
const offset = this.bb!.__offset(this.bb_pos, 14);
return offset ? this.bb!.readFloat32(this.bb!.__vector(this.bb_pos + offset) + index * 4) : 0;
}
floatsRequiredLength():number {
const offset = this.bb!.__offset(this.bb_pos, 14);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
floatsRequiredArray():Float32Array {
const offset = this.bb!.__offset(this.bb_pos, 14);
return new Float32Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset));
}
emptyString():string
emptyString(optionalEncoding:flatbuffers.Encoding):string|Uint8Array
emptyString(optionalEncoding?:any):string|Uint8Array {
const offset = this.bb!.__offset(this.bb_pos, 16);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : "";
}
someString():string
someString(optionalEncoding:flatbuffers.Encoding):string|Uint8Array
someString(optionalEncoding?:any):string|Uint8Array {
const offset = this.bb!.__offset(this.bb_pos, 18);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : "some";
}
zeroString():string|null
zeroString(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
zeroString(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 20);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
aString():string
aString(optionalEncoding:flatbuffers.Encoding):string|Uint8Array
aString(optionalEncoding?:any):string|Uint8Array {
const offset = this.bb!.__offset(this.bb_pos, 22);
return this.bb!.__string(this.bb_pos + offset, optionalEncoding);
}
requiredString():string
requiredString(optionalEncoding:flatbuffers.Encoding):string|Uint8Array
requiredString(optionalEncoding?:any):string|Uint8Array {
const offset = this.bb!.__offset(this.bb_pos, 24);
return this.bb!.__string(this.bb_pos + offset, optionalEncoding);
}
abcs(index: number):ABC|null {
const offset = this.bb!.__offset(this.bb_pos, 26);
return offset ? this.bb!.readInt32(this.bb!.__vector(this.bb_pos + offset) + index * 4) : null;
}
abcsLength():number {
const offset = this.bb!.__offset(this.bb_pos, 26);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
abcsArray():Int32Array {
const offset = this.bb!.__offset(this.bb_pos, 26);
return offset ? new Int32Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : new Int32Array();
}
bools(index: number):boolean|null {
const offset = this.bb!.__offset(this.bb_pos, 28);
return offset ? !!this.bb!.readInt8(this.bb!.__vector(this.bb_pos + offset) + index) : false;
}
boolsLength():number {
const offset = this.bb!.__offset(this.bb_pos, 28);
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
}
boolsArray():Int8Array {
const offset = this.bb!.__offset(this.bb_pos, 28);
return offset ? new Int8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : new Int8Array();
}
oneBool():boolean {
const offset = this.bb!.__offset(this.bb_pos, 30);
return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : true;
}
mutate_one_bool(value:boolean):boolean {
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(): "EvenMoreDefaults" {
return 'EvenMoreDefaults';
}
static startEvenMoreDefaults(builder:flatbuffers.Builder):void {
builder.startObject(14);
}
static addStr(builder:flatbuffers.Builder, strOffset:flatbuffers.Offset):void {
builder.addFieldStruct(0, strOffset, 0);
}
static addInts(builder:flatbuffers.Builder, intsOffset:flatbuffers.Offset):void {
builder.addFieldOffset(1, intsOffset, 0);
}
static createIntsVector(builder:flatbuffers.Builder, data:number[]|Int32Array):flatbuffers.Offset;
/**
* @deprecated This Uint8Array overload will be removed in the future.
*/
static createIntsVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset;
static createIntsVector(builder:flatbuffers.Builder, data:number[]|Int32Array|Uint8Array):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addInt32(data[i]!);
}
return builder.endVector();
}
static startIntsVector(builder:flatbuffers.Builder, numElems:number):void {
builder.startVector(4, numElems, 4);
}
static addFloats(builder:flatbuffers.Builder, floatsOffset:flatbuffers.Offset):void {
builder.addFieldOffset(2, floatsOffset, 0);
}
static createFloatsVector(builder:flatbuffers.Builder, data:number[]|Float32Array):flatbuffers.Offset;
/**
* @deprecated This Uint8Array overload will be removed in the future.
*/
static createFloatsVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset;
static createFloatsVector(builder:flatbuffers.Builder, data:number[]|Float32Array|Uint8Array):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addFloat32(data[i]!);
}
return builder.endVector();
}
static startFloatsVector(builder:flatbuffers.Builder, numElems:number):void {
builder.startVector(4, numElems, 4);
}
static addFloatOptional(builder:flatbuffers.Builder, floatOptionalOffset:flatbuffers.Offset):void {
builder.addFieldOffset(3, floatOptionalOffset, 0);
}
static createFloatOptionalVector(builder:flatbuffers.Builder, data:number[]|Float32Array):flatbuffers.Offset;
/**
* @deprecated This Uint8Array overload will be removed in the future.
*/
static createFloatOptionalVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset;
static createFloatOptionalVector(builder:flatbuffers.Builder, data:number[]|Float32Array|Uint8Array):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addFloat32(data[i]!);
}
return builder.endVector();
}
static startFloatOptionalVector(builder:flatbuffers.Builder, numElems:number):void {
builder.startVector(4, numElems, 4);
}
static addBytesOptional(builder:flatbuffers.Builder, bytesOptionalOffset:flatbuffers.Offset):void {
builder.addFieldOffset(4, bytesOptionalOffset, 0);
}
static createBytesOptionalVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset {
builder.startVector(1, data.length, 1);
for (let i = data.length - 1; i >= 0; i--) {
builder.addInt8(data[i]!);
}
return builder.endVector();
}
static startBytesOptionalVector(builder:flatbuffers.Builder, numElems:number):void {
builder.startVector(1, numElems, 1);
}
static addFloatsRequired(builder:flatbuffers.Builder, floatsRequiredOffset:flatbuffers.Offset):void {
builder.addFieldOffset(5, floatsRequiredOffset, 0);
}
static createFloatsRequiredVector(builder:flatbuffers.Builder, data:number[]|Float32Array):flatbuffers.Offset;
/**
* @deprecated This Uint8Array overload will be removed in the future.
*/
static createFloatsRequiredVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset;
static createFloatsRequiredVector(builder:flatbuffers.Builder, data:number[]|Float32Array|Uint8Array):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addFloat32(data[i]!);
}
return builder.endVector();
}
static startFloatsRequiredVector(builder:flatbuffers.Builder, numElems:number):void {
builder.startVector(4, numElems, 4);
}
static addEmptyString(builder:flatbuffers.Builder, emptyStringOffset:flatbuffers.Offset):void {
builder.addFieldOffset(6, emptyStringOffset, 0);
}
static addSomeString(builder:flatbuffers.Builder, someStringOffset:flatbuffers.Offset):void {
builder.addFieldOffset(7, someStringOffset, 0);
}
static addZeroString(builder:flatbuffers.Builder, zeroStringOffset:flatbuffers.Offset):void {
builder.addFieldOffset(8, zeroStringOffset, 0);
}
static addAString(builder:flatbuffers.Builder, aStringOffset:flatbuffers.Offset):void {
builder.addFieldOffset(9, aStringOffset, 0);
}
static addRequiredString(builder:flatbuffers.Builder, requiredStringOffset:flatbuffers.Offset):void {
builder.addFieldOffset(10, requiredStringOffset, 0);
}
static addAbcs(builder:flatbuffers.Builder, abcsOffset:flatbuffers.Offset):void {
builder.addFieldOffset(11, abcsOffset, 0);
}
static createAbcsVector(builder:flatbuffers.Builder, data:ABC[]):flatbuffers.Offset {
builder.startVector(4, data.length, 4);
for (let i = data.length - 1; i >= 0; i--) {
builder.addInt32(data[i]!);
}
return builder.endVector();
}
static startAbcsVector(builder:flatbuffers.Builder, numElems:number):void {
builder.startVector(4, numElems, 4);
}
static addBools(builder:flatbuffers.Builder, boolsOffset:flatbuffers.Offset):void {
builder.addFieldOffset(12, boolsOffset, 0);
}
static createBoolsVector(builder:flatbuffers.Builder, data:boolean[]):flatbuffers.Offset {
builder.startVector(1, data.length, 1);
for (let i = data.length - 1; i >= 0; i--) {
builder.addInt8(+data[i]!);
}
return builder.endVector();
}
static startBoolsVector(builder:flatbuffers.Builder, numElems:number):void {
builder.startVector(1, numElems, 1);
}
static addOneBool(builder:flatbuffers.Builder, oneBool:boolean):void {
builder.addFieldInt8(13, +oneBool, +true);
}
static endEvenMoreDefaults(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
builder.requiredField(offset, 14) // floats_required
builder.requiredField(offset, 22) // a_string
builder.requiredField(offset, 24) // required_string
return offset;
}
static createEvenMoreDefaults(builder:flatbuffers.Builder, strOffset:flatbuffers.Offset, intsOffset:flatbuffers.Offset, floatsOffset:flatbuffers.Offset, floatOptionalOffset:flatbuffers.Offset, bytesOptionalOffset:flatbuffers.Offset, floatsRequiredOffset:flatbuffers.Offset, emptyStringOffset:flatbuffers.Offset, someStringOffset:flatbuffers.Offset, zeroStringOffset:flatbuffers.Offset, aStringOffset:flatbuffers.Offset, requiredStringOffset:flatbuffers.Offset, abcsOffset:flatbuffers.Offset, boolsOffset:flatbuffers.Offset, oneBool:boolean):flatbuffers.Offset {
EvenMoreDefaults.startEvenMoreDefaults(builder);
EvenMoreDefaults.addStr(builder, strOffset);
EvenMoreDefaults.addInts(builder, intsOffset);
EvenMoreDefaults.addFloats(builder, floatsOffset);
EvenMoreDefaults.addFloatOptional(builder, floatOptionalOffset);
EvenMoreDefaults.addBytesOptional(builder, bytesOptionalOffset);
EvenMoreDefaults.addFloatsRequired(builder, floatsRequiredOffset);
EvenMoreDefaults.addEmptyString(builder, emptyStringOffset);
EvenMoreDefaults.addSomeString(builder, someStringOffset);
EvenMoreDefaults.addZeroString(builder, zeroStringOffset);
EvenMoreDefaults.addAString(builder, aStringOffset);
EvenMoreDefaults.addRequiredString(builder, requiredStringOffset);
EvenMoreDefaults.addAbcs(builder, abcsOffset);
EvenMoreDefaults.addBools(builder, boolsOffset);
EvenMoreDefaults.addOneBool(builder, oneBool);
return EvenMoreDefaults.endEvenMoreDefaults(builder);
}
unpack(): EvenMoreDefaultsT {
return new EvenMoreDefaultsT(
(this.str() !== null ? this.str()!.unpack() : null),
this.bb!.createScalarList<number>(this.ints.bind(this), this.intsLength()),
this.bb!.createScalarList<number>(this.floats.bind(this), this.floatsLength()),
this.bb!.createScalarList<number>(this.floatOptional.bind(this), this.floatOptionalLength()),
this.bb!.createScalarList<number>(this.bytesOptional.bind(this), this.bytesOptionalLength()),
this.bb!.createScalarList<number>(this.floatsRequired.bind(this), this.floatsRequiredLength()),
this.emptyString(),
this.someString(),
this.zeroString(),
this.aString(),
this.requiredString(),
this.bb!.createScalarList<ABC>(this.abcs.bind(this), this.abcsLength()),
this.bb!.createScalarList<boolean>(this.bools.bind(this), this.boolsLength()),
this.oneBool()
);
}
unpackTo(_o: EvenMoreDefaultsT): void {
_o.str = (this.str() !== null ? this.str()!.unpack() : null);
_o.ints = this.bb!.createScalarList<number>(this.ints.bind(this), this.intsLength());
_o.floats = this.bb!.createScalarList<number>(this.floats.bind(this), this.floatsLength());
_o.floatOptional = this.bb!.createScalarList<number>(this.floatOptional.bind(this), this.floatOptionalLength());
_o.bytesOptional = this.bb!.createScalarList<number>(this.bytesOptional.bind(this), this.bytesOptionalLength());
_o.floatsRequired = this.bb!.createScalarList<number>(this.floatsRequired.bind(this), this.floatsRequiredLength());
_o.emptyString = this.emptyString();
_o.someString = this.someString();
_o.zeroString = this.zeroString();
_o.aString = this.aString();
_o.requiredString = this.requiredString();
_o.abcs = this.bb!.createScalarList<ABC>(this.abcs.bind(this), this.abcsLength());
_o.bools = this.bb!.createScalarList<boolean>(this.bools.bind(this), this.boolsLength());
_o.oneBool = this.oneBool();
}
}
export class EvenMoreDefaultsT implements flatbuffers.IGeneratedObject {
constructor(
public str: EvenMoreStructT|null = null,
public ints: (number)[] = [],
public floats: (number)[] = [],
public floatOptional: (number)[] = [],
public bytesOptional: (number)[] = [],
public floatsRequired: (number)[] = [],
public emptyString: string|Uint8Array = "",
public someString: string|Uint8Array = "some",
public zeroString: string|Uint8Array|null = null,
public aString: string|Uint8Array|null = null,
public requiredString: string|Uint8Array|null = null,
public abcs: (ABC)[] = [],
public bools: (boolean)[] = [],
public oneBool: boolean = true
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
const ints = EvenMoreDefaults.createIntsVector(builder, this.ints);
const floats = EvenMoreDefaults.createFloatsVector(builder, this.floats);
const floatOptional = EvenMoreDefaults.createFloatOptionalVector(builder, this.floatOptional);
const bytesOptional = EvenMoreDefaults.createBytesOptionalVector(builder, this.bytesOptional);
const floatsRequired = EvenMoreDefaults.createFloatsRequiredVector(builder, this.floatsRequired);
const emptyString = (this.emptyString !== null ? builder.createString(this.emptyString!) : 0);
const someString = (this.someString !== null ? builder.createString(this.someString!) : 0);
const zeroString = (this.zeroString !== null ? builder.createString(this.zeroString!) : 0);
const aString = (this.aString !== null ? builder.createString(this.aString!) : 0);
const requiredString = (this.requiredString !== null ? builder.createString(this.requiredString!) : 0);
const abcs = EvenMoreDefaults.createAbcsVector(builder, this.abcs);
const bools = EvenMoreDefaults.createBoolsVector(builder, this.bools);
return EvenMoreDefaults.createEvenMoreDefaults(builder,
(this.str !== null ? this.str!.pack(builder) : 0),
ints,
floats,
floatOptional,
bytesOptional,
floatsRequired,
emptyString,
someString,
zeroString,
aString,
requiredString,
abcs,
bools,
this.oneBool
);
}
}

View File

@@ -1,64 +0,0 @@
// 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';
export class EvenMoreStruct implements flatbuffers.IUnpackableObject<EvenMoreStructT> {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos: number = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):EvenMoreStruct {
this.bb_pos = i;
this.bb = bb;
return this;
}
g(index: number):bigint|null {
return this.bb!.readInt64(this.bb_pos + 0 + index * 8);
}
static getFullyQualifiedName(): "EvenMoreStruct" {
return 'EvenMoreStruct';
}
static sizeOf():number {
return 16;
}
static createEvenMoreStruct(builder:flatbuffers.Builder, g: bigint[]):flatbuffers.Offset {
builder.prep(8, 16);
for (let i = 1; i >= 0; --i) {
builder.writeInt64(BigInt(g?.[i] ?? 0));
}
return builder.offset();
}
unpack(): EvenMoreStructT {
return new EvenMoreStructT(
this.bb!.createScalarList<bigint>(this.g.bind(this), 2)
);
}
unpackTo(_o: EvenMoreStructT): void {
_o.g = this.bb!.createScalarList<bigint>(this.g.bind(this), 2);
}
}
export class EvenMoreStructT implements flatbuffers.IGeneratedObject {
constructor(
public g: (bigint)[] = []
){}
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
return EvenMoreStruct.createEvenMoreStruct(builder,
this.g
);
}
}

View File

@@ -1,7 +0,0 @@
// 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 {ABC} from './abc.js';
export {EvenMoreDefaults, EvenMoreDefaultsT} from './even-more-defaults.js';
export {EvenMoreStruct, EvenMoreStructT} from './even-more-struct.js';

View File

@@ -1 +1 @@
export { Abc } from './foobar/abc.js';
export {Abc} from './foobar/abc.js';

View File

@@ -1,3 +1,4 @@
// 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 { Abc } from './foobar/abc.js';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export {Abc} from './foobar/abc.js';

View File

@@ -1,3 +1,3 @@
export declare enum Abc {
a = 0
a = 0,
}

View File

@@ -1,6 +1,7 @@
// 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 */
export var Abc;
(function (Abc) {
Abc[Abc["a"] = 0] = "a";
(function(Abc) {
Abc[Abc['a'] = 0] = 'a';
})(Abc || (Abc = {}));

View File

@@ -3,5 +3,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export enum Abc {
a = 0
a = 0,
}

View File

@@ -1,3 +1,3 @@
export declare enum class_ {
arguments_ = 0
arguments_ = 0,
}

View File

@@ -1,6 +1,7 @@
// 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 */
export var class_;
(function (class_) {
class_[class_["arguments_"] = 0] = "arguments_";
(function(class_) {
class_[class_['arguments_'] = 0] = 'arguments_';
})(class_ || (class_ = {}));

View File

@@ -3,5 +3,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export enum class_ {
arguments_ = 0
arguments_ = 0,
}

View File

@@ -4,131 +4,135 @@
import * as flatbuffers from 'flatbuffers';
import { Abc } from './abc.js';
import { class_ } from './class.js';
import {Abc} from '../foobar/abc.js';
import {class_} from '../foobar/class.js';
export class Tab implements flatbuffers.IUnpackableObject<TabT> {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos: number = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Tab {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsTab(bb:flatbuffers.ByteBuffer, obj?:Tab):Tab {
return (obj || new Tab()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsTab(bb:flatbuffers.ByteBuffer, obj?:Tab):Tab {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Tab()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
abc():Abc {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : Abc.a;
}
mutate_abc(value:Abc):boolean {
const offset = this.bb!.__offset(this.bb_pos, 4);
if (offset === 0) {
return false;
bb: flatbuffers.ByteBuffer | null = null;
bb_pos = 0;
__init(i: number, bb: flatbuffers.ByteBuffer): Tab {
this.bb_pos = i;
this.bb = bb;
return this;
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
arg():class_ {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : class_.arguments_;
}
mutate_arg(value:class_):boolean {
const offset = this.bb!.__offset(this.bb_pos, 6);
if (offset === 0) {
return false;
static getRootAsTab(bb: flatbuffers.ByteBuffer, obj?: Tab): Tab {
return (obj || new Tab()).__init(
bb.readInt32(bb.position()) + bb.position(),
bb,
);
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
static getSizePrefixedRootAsTab(bb: flatbuffers.ByteBuffer, obj?: Tab): Tab {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Tab()).__init(
bb.readInt32(bb.position()) + bb.position(),
bb,
);
}
name():string|null
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
name(optionalEncoding?:any):string|Uint8Array|null {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}
abc(): Abc {
const offset = this.bb!.__offset(this.bb_pos, 4);
return offset ? this.bb!.readInt32(this.bb_pos + offset) : Abc.a;
}
static getFullyQualifiedName(): "foobar.Tab" {
return 'foobar.Tab';
}
mutate_abc(value: Abc): boolean {
const offset = this.bb!.__offset(this.bb_pos, 4);
static startTab(builder:flatbuffers.Builder):void {
builder.startObject(3);
}
if (offset === 0) {
return false;
}
static addAbc(builder:flatbuffers.Builder, abc:Abc):void {
builder.addFieldInt32(0, abc, Abc.a);
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
static addArg(builder:flatbuffers.Builder, arg:class_):void {
builder.addFieldInt32(1, arg, class_.arguments_);
}
arg(): class_ {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset
? this.bb!.readInt32(this.bb_pos + offset)
: class_.arguments_;
}
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset):void {
builder.addFieldOffset(2, nameOffset, 0);
}
mutate_arg(value: class_): boolean {
const offset = this.bb!.__offset(this.bb_pos, 6);
static endTab(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
if (offset === 0) {
return false;
}
static createTab(builder:flatbuffers.Builder, abc:Abc, arg:class_, nameOffset:flatbuffers.Offset):flatbuffers.Offset {
Tab.startTab(builder);
Tab.addAbc(builder, abc);
Tab.addArg(builder, arg);
Tab.addName(builder, nameOffset);
return Tab.endTab(builder);
}
this.bb!.writeInt32(this.bb_pos + offset, value);
return true;
}
unpack(): TabT {
return new TabT(
this.abc(),
this.arg(),
this.name()
);
}
name(): string | null;
name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
name(optionalEncoding?: any): string | Uint8Array | null {
const offset = this.bb!.__offset(this.bb_pos, 8);
return offset
? this.bb!.__string(this.bb_pos + offset, optionalEncoding)
: null;
}
static getFullyQualifiedName(): string {
return 'foobar.Tab';
}
unpackTo(_o: TabT): void {
_o.abc = this.abc();
_o.arg = this.arg();
_o.name = this.name();
}
static startTab(builder: flatbuffers.Builder) {
builder.startObject(3);
}
static addAbc(builder: flatbuffers.Builder, abc: Abc) {
builder.addFieldInt32(0, abc, Abc.a);
}
static addArg(builder: flatbuffers.Builder, arg: class_) {
builder.addFieldInt32(1, arg, class_.arguments_);
}
static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset) {
builder.addFieldOffset(2, nameOffset, 0);
}
static endTab(builder: flatbuffers.Builder): flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static createTab(
builder: flatbuffers.Builder,
abc: Abc,
arg: class_,
nameOffset: flatbuffers.Offset,
): flatbuffers.Offset {
Tab.startTab(builder);
Tab.addAbc(builder, abc);
Tab.addArg(builder, arg);
Tab.addName(builder, nameOffset);
return Tab.endTab(builder);
}
unpack(): TabT {
return new TabT(this.abc(), this.arg(), this.name());
}
unpackTo(_o: TabT): void {
_o.abc = this.abc();
_o.arg = this.arg();
_o.name = this.name();
}
}
export class TabT implements flatbuffers.IGeneratedObject {
constructor(
public abc: Abc = Abc.a,
public arg: class_ = class_.arguments_,
public name: string|Uint8Array|null = null
){}
constructor(
public abc: Abc = Abc.a,
public arg: class_ = class_.arguments_,
public name: string | Uint8Array | null = null,
) {}
pack(builder: flatbuffers.Builder): flatbuffers.Offset {
const name = this.name !== null ? builder.createString(this.name!) : 0;
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
const name = (this.name !== null ? builder.createString(this.name!) : 0);
return Tab.createTab(builder,
this.abc,
this.arg,
name
);
}
return Tab.createTab(builder, this.abc, this.arg, name);
}
}

View File

@@ -1 +1 @@
export { Person } from './c/person.js';
export {Person} from './c/person.js';

View File

@@ -1,3 +1,4 @@
// 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 { Person } from './c/person.js';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export {Person} from './c/person.js';

View File

@@ -1,18 +1,34 @@
import * as flatbuffers from 'flatbuffers';
export declare class Person {
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): Person;
static getRootAsPerson(bb: flatbuffers.ByteBuffer, obj?: Person): Person;
static getSizePrefixedRootAsPerson(bb: flatbuffers.ByteBuffer, obj?: Person): Person;
name(): string | null;
name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
age(): number;
static startPerson(builder: flatbuffers.Builder): void;
static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset): void;
static addAge(builder: flatbuffers.Builder, age: number): void;
static endPerson(builder: flatbuffers.Builder): flatbuffers.Offset;
static finishPersonBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
static finishSizePrefixedPersonBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
static createPerson(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset, age: number): flatbuffers.Offset;
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): Person;
static getRootAsPerson(bb: flatbuffers.ByteBuffer, obj?: Person): Person;
static getSizePrefixedRootAsPerson(
bb: flatbuffers.ByteBuffer,
obj?: Person,
): Person;
name(): string | null;
name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
age(): number;
static startPerson(builder: flatbuffers.Builder): void;
static addName(
builder: flatbuffers.Builder,
nameOffset: flatbuffers.Offset,
): void;
static addAge(builder: flatbuffers.Builder, age: number): void;
static endPerson(builder: flatbuffers.Builder): flatbuffers.Offset;
static finishPersonBuffer(
builder: flatbuffers.Builder,
offset: flatbuffers.Offset,
): void;
static finishSizePrefixedPersonBuffer(
builder: flatbuffers.Builder,
offset: flatbuffers.Offset,
): void;
static createPerson(
builder: flatbuffers.Builder,
nameOffset: flatbuffers.Offset,
age: number,
): flatbuffers.Offset;
}

View File

@@ -1,54 +1,58 @@
// 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';
export class Person {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsPerson(bb, obj) {
return (obj || new Person()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsPerson(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Person()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
age() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
}
static startPerson(builder) {
builder.startObject(2);
}
static addName(builder, nameOffset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addAge(builder, age) {
builder.addFieldInt16(1, age, 0);
}
static endPerson(builder) {
const offset = builder.endObject();
return offset;
}
static finishPersonBuffer(builder, offset) {
builder.finish(offset);
}
static finishSizePrefixedPersonBuffer(builder, offset) {
builder.finish(offset, undefined, true);
}
static createPerson(builder, nameOffset, age) {
Person.startPerson(builder);
Person.addName(builder, nameOffset);
Person.addAge(builder, age);
return Person.endPerson(builder);
}
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsPerson(bb, obj) {
return (obj || new Person())
.__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsPerson(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Person())
.__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
name(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) :
null;
}
age() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
}
static startPerson(builder) {
builder.startObject(2);
}
static addName(builder, nameOffset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addAge(builder, age) {
builder.addFieldInt16(1, age, 0);
}
static endPerson(builder) {
const offset = builder.endObject();
return offset;
}
static finishPersonBuffer(builder, offset) {
builder.finish(offset);
}
static finishSizePrefixedPersonBuffer(builder, offset) {
builder.finish(offset, undefined, true);
}
static createPerson(builder, nameOffset, age) {
Person.startPerson(builder);
Person.addName(builder, nameOffset);
Person.addAge(builder, age);
return Person.endPerson(builder);
}
}

View File

@@ -4,67 +4,86 @@
import * as flatbuffers from 'flatbuffers';
export class Person {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos: number = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Person {
this.bb_pos = i;
this.bb = bb;
return this;
}
bb: flatbuffers.ByteBuffer | null = null;
bb_pos = 0;
__init(i: number, bb: flatbuffers.ByteBuffer): Person {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsPerson(bb:flatbuffers.ByteBuffer, obj?:Person):Person {
return (obj || new Person()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getRootAsPerson(bb: flatbuffers.ByteBuffer, obj?: Person): Person {
return (obj || new Person()).__init(
bb.readInt32(bb.position()) + bb.position(),
bb,
);
}
static getSizePrefixedRootAsPerson(bb:flatbuffers.ByteBuffer, obj?:Person):Person {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Person()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsPerson(
bb: flatbuffers.ByteBuffer,
obj?: Person,
): Person {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Person()).__init(
bb.readInt32(bb.position()) + bb.position(),
bb,
);
}
name():string|null
name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
name(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;
}
name(): string | null;
name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
name(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;
}
age():number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0;
}
age(): number {
const offset = this.bb!.__offset(this.bb_pos, 6);
return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0;
}
static startPerson(builder:flatbuffers.Builder):void {
builder.startObject(2);
}
static startPerson(builder: flatbuffers.Builder) {
builder.startObject(2);
}
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset):void {
builder.addFieldOffset(0, nameOffset, 0);
}
static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset) {
builder.addFieldOffset(0, nameOffset, 0);
}
static addAge(builder:flatbuffers.Builder, age:number):void {
builder.addFieldInt16(1, age, 0);
}
static addAge(builder: flatbuffers.Builder, age: number) {
builder.addFieldInt16(1, age, 0);
}
static endPerson(builder:flatbuffers.Builder):flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static endPerson(builder: flatbuffers.Builder): flatbuffers.Offset {
const offset = builder.endObject();
return offset;
}
static finishPersonBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset):void {
builder.finish(offset);
}
static finishPersonBuffer(
builder: flatbuffers.Builder,
offset: flatbuffers.Offset,
) {
builder.finish(offset);
}
static finishSizePrefixedPersonBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset):void {
builder.finish(offset, undefined, true);
}
static finishSizePrefixedPersonBuffer(
builder: flatbuffers.Builder,
offset: flatbuffers.Offset,
) {
builder.finish(offset, undefined, true);
}
static createPerson(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, age:number):flatbuffers.Offset {
Person.startPerson(builder);
Person.addName(builder, nameOffset);
Person.addAge(builder, age);
return Person.endPerson(builder);
}
static createPerson(
builder: flatbuffers.Builder,
nameOffset: flatbuffers.Offset,
age: number,
): flatbuffers.Offset {
Person.startPerson(builder);
Person.addName(builder, nameOffset);
Person.addAge(builder, age);
return Person.endPerson(builder);
}
}

View File

@@ -1,2 +1,2 @@
export { TableA, TableAT } from './table-a.js';
export * as MyGame from './my-game.js';
export {TableA, TableAT} from './table-a.js';

View File

@@ -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 */
export { TableA, TableAT } from './table-a.js';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export * as MyGame from './my-game.js';
export {TableA, TableAT} from './table-a.js';

View File

@@ -2,5 +2,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export {TableA, TableAT} from './table-a.js';
export { TableA, TableAT } from './table-a.js';
export * as MyGame from './my-game.js';

View File

@@ -882,7 +882,7 @@ var Monster2 = class _Monster {
}
name(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 10);
return this.bb.__string(this.bb_pos + offset, optionalEncoding);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
inventory(index) {
const offset = this.bb.__offset(this.bb_pos, 14);
@@ -1274,7 +1274,7 @@ var Monster2 = class _Monster {
}
vectorOfEnums(index) {
const offset = this.bb.__offset(this.bb_pos, 98);
return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : null;
return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
}
vectorOfEnumsLength() {
const offset = this.bb.__offset(this.bb_pos, 98);

View File

@@ -1,4 +1,7 @@
export { InParentNamespace, InParentNamespaceT } from './my-game/in-parent-namespace.js';
export * as Example from './my-game/example.js';
export * as Example2 from './my-game/example2.js';
export {
InParentNamespace,
InParentNamespaceT,
} from './my-game/in-parent-namespace.js';
export * as OtherNameSpace from './my-game/other-name-space.js';

View File

@@ -1,6 +1,7 @@
// 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 { InParentNamespace, InParentNamespaceT } from './my-game/in-parent-namespace.js';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export * as Example from './my-game/example.js';
export * as Example2 from './my-game/example2.js';
export {InParentNamespace, InParentNamespaceT} from './my-game/in-parent-namespace.js';
export * as OtherNameSpace from './my-game/other-name-space.js';

View File

@@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export {InParentNamespace, InParentNamespaceT} from './my-game/in-parent-namespace.js';
export { InParentNamespace, InParentNamespaceT } from './my-game/in-parent-namespace.js';
export * as Example from './my-game/example.js';
export * as Example2 from './my-game/example2.js';
export * as OtherNameSpace from './my-game/other-name-space.js';

View File

@@ -1,16 +1,25 @@
export { Ability, AbilityT } from './example/ability.js';
export { Any } from './example/any.js';
export { AnyAmbiguousAliases } from './example/any-ambiguous-aliases.js';
export { AnyUniqueAliases } from './example/any-unique-aliases.js';
export { Color } from './example/color.js';
export { LongEnum } from './example/long-enum.js';
export { Monster, MonsterT } from './example/monster.js';
export { Race } from './example/race.js';
export { Referrable, ReferrableT } from './example/referrable.js';
export { Stat, StatT } from './example/stat.js';
export { StructOfStructs, StructOfStructsT } from './example/struct-of-structs.js';
export { StructOfStructsOfStructs, StructOfStructsOfStructsT } from './example/struct-of-structs-of-structs.js';
export { Test, TestT } from './example/test.js';
export { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from './example/test-simple-table-with-enum.js';
export { TypeAliases, TypeAliasesT } from './example/type-aliases.js';
export { Vec3, Vec3T } from './example/vec3.js';
export {Ability, AbilityT} from './example/ability.js';
export {AnyAmbiguousAliases} from './example/any-ambiguous-aliases.js';
export {AnyUniqueAliases} from './example/any-unique-aliases.js';
export {Any} from './example/any.js';
export {Color} from './example/color.js';
export {LongEnum} from './example/long-enum.js';
export {Monster, MonsterT} from './example/monster.js';
export {Race} from './example/race.js';
export {Referrable, ReferrableT} from './example/referrable.js';
export {Stat, StatT} from './example/stat.js';
export {
StructOfStructsOfStructs,
StructOfStructsOfStructsT,
} from './example/struct-of-structs-of-structs.js';
export {
StructOfStructs,
StructOfStructsT,
} from './example/struct-of-structs.js';
export {
TestSimpleTableWithEnum,
TestSimpleTableWithEnumT,
} from './example/test-simple-table-with-enum.js';
export {Test, TestT} from './example/test.js';
export {TypeAliases, TypeAliasesT} from './example/type-aliases.js';
export {Vec3, Vec3T} from './example/vec3.js';

View File

@@ -1,18 +1,19 @@
// 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 { Ability, AbilityT } from './example/ability.js';
export { Any } from './example/any.js';
export { AnyAmbiguousAliases } from './example/any-ambiguous-aliases.js';
export { AnyUniqueAliases } from './example/any-unique-aliases.js';
export { Color } from './example/color.js';
export { LongEnum } from './example/long-enum.js';
export { Monster, MonsterT } from './example/monster.js';
export { Race } from './example/race.js';
export { Referrable, ReferrableT } from './example/referrable.js';
export { Stat, StatT } from './example/stat.js';
export { StructOfStructs, StructOfStructsT } from './example/struct-of-structs.js';
export { StructOfStructsOfStructs, StructOfStructsOfStructsT } from './example/struct-of-structs-of-structs.js';
export { Test, TestT } from './example/test.js';
export { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from './example/test-simple-table-with-enum.js';
export { TypeAliases, TypeAliasesT } from './example/type-aliases.js';
export { Vec3, Vec3T } from './example/vec3.js';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export {Ability, AbilityT} from './example/ability.js';
export {AnyAmbiguousAliases} from './example/any-ambiguous-aliases.js';
export {AnyUniqueAliases} from './example/any-unique-aliases.js';
export {Any} from './example/any.js';
export {Color} from './example/color.js';
export {LongEnum} from './example/long-enum.js';
export {Monster, MonsterT} from './example/monster.js';
export {Race} from './example/race.js';
export {Referrable, ReferrableT} from './example/referrable.js';
export {Stat, StatT} from './example/stat.js';
export {StructOfStructsOfStructs, StructOfStructsOfStructsT} from './example/struct-of-structs-of-structs.js';
export {StructOfStructs, StructOfStructsT} from './example/struct-of-structs.js';
export {TestSimpleTableWithEnum, TestSimpleTableWithEnumT} from './example/test-simple-table-with-enum.js';
export {Test, TestT} from './example/test.js';
export {TypeAliases, TypeAliasesT} from './example/type-aliases.js';
export {Vec3, Vec3T} from './example/vec3.js';

View File

@@ -2,19 +2,19 @@
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
export {Ability, AbilityT} from './example/ability.js';
export {Any} from './example/any.js';
export {AnyAmbiguousAliases} from './example/any-ambiguous-aliases.js';
export {AnyUniqueAliases} from './example/any-unique-aliases.js';
export {Color} from './example/color.js';
export {LongEnum} from './example/long-enum.js';
export {Monster, MonsterT} from './example/monster.js';
export {Race} from './example/race.js';
export {Referrable, ReferrableT} from './example/referrable.js';
export {Stat, StatT} from './example/stat.js';
export {StructOfStructs, StructOfStructsT} from './example/struct-of-structs.js';
export {StructOfStructsOfStructs, StructOfStructsOfStructsT} from './example/struct-of-structs-of-structs.js';
export {Test, TestT} from './example/test.js';
export {TestSimpleTableWithEnum, TestSimpleTableWithEnumT} from './example/test-simple-table-with-enum.js';
export {TypeAliases, TypeAliasesT} from './example/type-aliases.js';
export {Vec3, Vec3T} from './example/vec3.js';
export { Ability, AbilityT } from './example/ability.js';
export { Any } from './example/any.js';
export { AnyAmbiguousAliases } from './example/any-ambiguous-aliases.js';
export { AnyUniqueAliases } from './example/any-unique-aliases.js';
export { Color } from './example/color.js';
export { LongEnum } from './example/long-enum.js';
export { Monster, MonsterT } from './example/monster.js';
export { Race } from './example/race.js';
export { Referrable, ReferrableT } from './example/referrable.js';
export { Stat, StatT } from './example/stat.js';
export { StructOfStructs, StructOfStructsT } from './example/struct-of-structs.js';
export { StructOfStructsOfStructs, StructOfStructsOfStructsT } from './example/struct-of-structs-of-structs.js';
export { Test, TestT } from './example/test.js';
export { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from './example/test-simple-table-with-enum.js';
export { TypeAliases, TypeAliasesT } from './example/type-aliases.js';
export { Vec3, Vec3T } from './example/vec3.js';

View File

@@ -1,21 +1,27 @@
import * as flatbuffers from 'flatbuffers';
export declare class Ability implements flatbuffers.IUnpackableObject<AbilityT> {
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): Ability;
id(): number;
mutate_id(value: number): boolean;
distance(): number;
mutate_distance(value: number): boolean;
static getFullyQualifiedName(): "MyGame.Example.Ability";
static sizeOf(): number;
static createAbility(builder: flatbuffers.Builder, id: number, distance: number): flatbuffers.Offset;
unpack(): AbilityT;
unpackTo(_o: AbilityT): void;
export declare class Ability
implements flatbuffers.IUnpackableObject<AbilityT>
{
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): Ability;
id(): number;
mutate_id(value: number): boolean;
distance(): number;
mutate_distance(value: number): boolean;
static getFullyQualifiedName(): string;
static sizeOf(): number;
static createAbility(
builder: flatbuffers.Builder,
id: number,
distance: number,
): flatbuffers.Offset;
unpack(): AbilityT;
unpackTo(_o: AbilityT): void;
}
export declare class AbilityT implements flatbuffers.IGeneratedObject {
id: number;
distance: number;
constructor(id?: number, distance?: number);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
id: number;
distance: number;
constructor(id?: number, distance?: number);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

@@ -1,54 +1,54 @@
// automatically generated by the FlatBuffers compiler, do not modify
export class Ability {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
id() {
return this.bb.readUint32(this.bb_pos);
}
mutate_id(value) {
this.bb.writeUint32(this.bb_pos + 0, value);
return true;
}
distance() {
return this.bb.readUint32(this.bb_pos + 4);
}
mutate_distance(value) {
this.bb.writeUint32(this.bb_pos + 4, value);
return true;
}
static getFullyQualifiedName() {
return 'MyGame.Example.Ability';
}
static sizeOf() {
return 8;
}
static createAbility(builder, id, distance) {
builder.prep(4, 8);
builder.writeInt32(distance);
builder.writeInt32(id);
return builder.offset();
}
unpack() {
return new AbilityT(this.id(), this.distance());
}
unpackTo(_o) {
_o.id = this.id();
_o.distance = this.distance();
}
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
id() {
return this.bb.readUint32(this.bb_pos);
}
mutate_id(value) {
this.bb.writeUint32(this.bb_pos + 0, value);
return true;
}
distance() {
return this.bb.readUint32(this.bb_pos + 4);
}
mutate_distance(value) {
this.bb.writeUint32(this.bb_pos + 4, value);
return true;
}
static getFullyQualifiedName() {
return 'MyGame.Example.Ability';
}
static sizeOf() {
return 8;
}
static createAbility(builder, id, distance) {
builder.prep(4, 8);
builder.writeInt32(distance);
builder.writeInt32(id);
return builder.offset();
}
unpack() {
return new AbilityT(this.id(), this.distance());
}
unpackTo(_o) {
_o.id = this.id();
_o.distance = this.distance();
}
}
export class AbilityT {
constructor(id = 0, distance = 0) {
this.id = id;
this.distance = distance;
}
pack(builder) {
return Ability.createAbility(builder, this.id, this.distance);
}
constructor(id = 0, distance = 0) {
this.id = id;
this.distance = distance;
}
pack(builder) {
return Ability.createAbility(builder, this.id, this.distance);
}
}

View File

@@ -8,7 +8,7 @@ import * as flatbuffers from 'flatbuffers';
export class Ability implements flatbuffers.IUnpackableObject<AbilityT> {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos: number = 0;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Ability {
this.bb_pos = i;
this.bb = bb;

View File

@@ -1,9 +1,16 @@
import { Monster } from './monster.js';
import {Monster} from '../../my-game/example/monster.js';
export declare enum AnyAmbiguousAliases {
NONE = 0,
M1 = 1,
M2 = 2,
M3 = 3
NONE = 0,
M1 = 1,
M2 = 2,
M3 = 3,
}
export declare function unionToAnyAmbiguousAliases(type: AnyAmbiguousAliases, accessor: (obj: Monster) => Monster | null): Monster | null;
export declare function unionListToAnyAmbiguousAliases(type: AnyAmbiguousAliases, accessor: (index: number, obj: Monster) => Monster | null, index: number): Monster | null;
export declare function unionToAnyAmbiguousAliases(
type: AnyAmbiguousAliases,
accessor: (obj: Monster) => Monster | null,
): Monster | null;
export declare function unionListToAnyAmbiguousAliases(
type: AnyAmbiguousAliases,
accessor: (index: number, obj: Monster) => Monster | null,
index: number,
): Monster | null;

View File

@@ -1,28 +1,39 @@
// 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 { Monster } from './monster.js';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
import {Monster} from '../../my-game/example/monster.js';
export var AnyAmbiguousAliases;
(function (AnyAmbiguousAliases) {
AnyAmbiguousAliases[AnyAmbiguousAliases["NONE"] = 0] = "NONE";
AnyAmbiguousAliases[AnyAmbiguousAliases["M1"] = 1] = "M1";
AnyAmbiguousAliases[AnyAmbiguousAliases["M2"] = 2] = "M2";
AnyAmbiguousAliases[AnyAmbiguousAliases["M3"] = 3] = "M3";
(function(AnyAmbiguousAliases) {
AnyAmbiguousAliases[AnyAmbiguousAliases['NONE'] = 0] = 'NONE';
AnyAmbiguousAliases[AnyAmbiguousAliases['M1'] = 1] = 'M1';
AnyAmbiguousAliases[AnyAmbiguousAliases['M2'] = 2] = 'M2';
AnyAmbiguousAliases[AnyAmbiguousAliases['M3'] = 3] = 'M3';
})(AnyAmbiguousAliases || (AnyAmbiguousAliases = {}));
export function unionToAnyAmbiguousAliases(type, accessor) {
switch (AnyAmbiguousAliases[type]) {
case 'NONE': return null;
case 'M1': return accessor(new Monster());
case 'M2': return accessor(new Monster());
case 'M3': return accessor(new Monster());
default: return null;
}
switch (AnyAmbiguousAliases[type]) {
case 'NONE':
return null;
case 'M1':
return accessor(new Monster());
case 'M2':
return accessor(new Monster());
case 'M3':
return accessor(new Monster());
default:
return null;
}
}
export function unionListToAnyAmbiguousAliases(type, accessor, index) {
switch (AnyAmbiguousAliases[type]) {
case 'NONE': return null;
case 'M1': return accessor(index, new Monster());
case 'M2': return accessor(index, new Monster());
case 'M3': return accessor(index, new Monster());
default: return null;
}
switch (AnyAmbiguousAliases[type]) {
case 'NONE':
return null;
case 'M1':
return accessor(index, new Monster());
case 'M2':
return accessor(index, new Monster());
case 'M3':
return accessor(index, new Monster());
default:
return null;
}
}

View File

@@ -1,11 +1,23 @@
import { Monster as MyGame_Example2_Monster } from '../example2/monster.js';
import { Monster } from './monster.js';
import { TestSimpleTableWithEnum } from './test-simple-table-with-enum.js';
import {Monster} from '../../my-game/example/monster.js';
import {TestSimpleTableWithEnum} from '../../my-game/example/test-simple-table-with-enum.js';
import {Monster as MyGame_Example2_Monster} from '../../my-game/example2/monster.js';
export declare enum AnyUniqueAliases {
NONE = 0,
M = 1,
TS = 2,
M2 = 3
NONE = 0,
M = 1,
TS = 2,
M2 = 3,
}
export declare function unionToAnyUniqueAliases(type: AnyUniqueAliases, accessor: (obj: Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum) => Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null): Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null;
export declare function unionListToAnyUniqueAliases(type: AnyUniqueAliases, accessor: (index: number, obj: Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum) => Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null, index: number): Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null;
export declare function unionToAnyUniqueAliases(
type: AnyUniqueAliases,
accessor: (
obj: Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum,
) => Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null,
): Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null;
export declare function unionListToAnyUniqueAliases(
type: AnyUniqueAliases,
accessor: (
index: number,
obj: Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum,
) => Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null,
index: number,
): Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null;

View File

@@ -1,30 +1,42 @@
// 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 { Monster as MyGame_Example2_Monster } from '../example2/monster.js';
import { Monster } from './monster.js';
import { TestSimpleTableWithEnum } from './test-simple-table-with-enum.js';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
import {Monster} from '../../my-game/example/monster.js';
import {TestSimpleTableWithEnum} from '../../my-game/example/test-simple-table-with-enum.js';
import {Monster as MyGame_Example2_Monster} from '../../my-game/example2/monster.js';
export var AnyUniqueAliases;
(function (AnyUniqueAliases) {
AnyUniqueAliases[AnyUniqueAliases["NONE"] = 0] = "NONE";
AnyUniqueAliases[AnyUniqueAliases["M"] = 1] = "M";
AnyUniqueAliases[AnyUniqueAliases["TS"] = 2] = "TS";
AnyUniqueAliases[AnyUniqueAliases["M2"] = 3] = "M2";
(function(AnyUniqueAliases) {
AnyUniqueAliases[AnyUniqueAliases['NONE'] = 0] = 'NONE';
AnyUniqueAliases[AnyUniqueAliases['M'] = 1] = 'M';
AnyUniqueAliases[AnyUniqueAliases['TS'] = 2] = 'TS';
AnyUniqueAliases[AnyUniqueAliases['M2'] = 3] = 'M2';
})(AnyUniqueAliases || (AnyUniqueAliases = {}));
export function unionToAnyUniqueAliases(type, accessor) {
switch (AnyUniqueAliases[type]) {
case 'NONE': return null;
case 'M': return accessor(new Monster());
case 'TS': return accessor(new TestSimpleTableWithEnum());
case 'M2': return accessor(new MyGame_Example2_Monster());
default: return null;
}
switch (AnyUniqueAliases[type]) {
case 'NONE':
return null;
case 'M':
return accessor(new Monster());
case 'TS':
return accessor(new TestSimpleTableWithEnum());
case 'M2':
return accessor(new MyGame_Example2_Monster());
default:
return null;
}
}
export function unionListToAnyUniqueAliases(type, accessor, index) {
switch (AnyUniqueAliases[type]) {
case 'NONE': return null;
case 'M': return accessor(index, new Monster());
case 'TS': return accessor(index, new TestSimpleTableWithEnum());
case 'M2': return accessor(index, new MyGame_Example2_Monster());
default: return null;
}
switch (AnyUniqueAliases[type]) {
case 'NONE':
return null;
case 'M':
return accessor(index, new Monster());
case 'TS':
return accessor(index, new TestSimpleTableWithEnum());
case 'M2':
return accessor(index, new MyGame_Example2_Monster());
default:
return null;
}
}

View File

@@ -1,11 +1,23 @@
import { Monster as MyGame_Example2_Monster } from '../example2/monster.js';
import { Monster } from './monster.js';
import { TestSimpleTableWithEnum } from './test-simple-table-with-enum.js';
import {Monster} from '../../my-game/example/monster.js';
import {TestSimpleTableWithEnum} from '../../my-game/example/test-simple-table-with-enum.js';
import {Monster as MyGame_Example2_Monster} from '../../my-game/example2/monster.js';
export declare enum Any {
NONE = 0,
Monster = 1,
TestSimpleTableWithEnum = 2,
MyGame_Example2_Monster = 3
NONE = 0,
Monster = 1,
TestSimpleTableWithEnum = 2,
MyGame_Example2_Monster = 3,
}
export declare function unionToAny(type: Any, accessor: (obj: Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum) => Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null): Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null;
export declare function unionListToAny(type: Any, accessor: (index: number, obj: Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum) => Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null, index: number): Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null;
export declare function unionToAny(
type: Any,
accessor: (
obj: Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum,
) => Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null,
): Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null;
export declare function unionListToAny(
type: Any,
accessor: (
index: number,
obj: Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum,
) => Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null,
index: number,
): Monster | MyGame_Example2_Monster | TestSimpleTableWithEnum | null;

View File

@@ -1,30 +1,42 @@
// 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 { Monster as MyGame_Example2_Monster } from '../example2/monster.js';
import { Monster } from './monster.js';
import { TestSimpleTableWithEnum } from './test-simple-table-with-enum.js';
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
import {Monster} from '../../my-game/example/monster.js';
import {TestSimpleTableWithEnum} from '../../my-game/example/test-simple-table-with-enum.js';
import {Monster as MyGame_Example2_Monster} from '../../my-game/example2/monster.js';
export var Any;
(function (Any) {
Any[Any["NONE"] = 0] = "NONE";
Any[Any["Monster"] = 1] = "Monster";
Any[Any["TestSimpleTableWithEnum"] = 2] = "TestSimpleTableWithEnum";
Any[Any["MyGame_Example2_Monster"] = 3] = "MyGame_Example2_Monster";
(function(Any) {
Any[Any['NONE'] = 0] = 'NONE';
Any[Any['Monster'] = 1] = 'Monster';
Any[Any['TestSimpleTableWithEnum'] = 2] = 'TestSimpleTableWithEnum';
Any[Any['MyGame_Example2_Monster'] = 3] = 'MyGame_Example2_Monster';
})(Any || (Any = {}));
export function unionToAny(type, accessor) {
switch (Any[type]) {
case 'NONE': return null;
case 'Monster': return accessor(new Monster());
case 'TestSimpleTableWithEnum': return accessor(new TestSimpleTableWithEnum());
case 'MyGame_Example2_Monster': return accessor(new MyGame_Example2_Monster());
default: return null;
}
switch (Any[type]) {
case 'NONE':
return null;
case 'Monster':
return accessor(new Monster());
case 'TestSimpleTableWithEnum':
return accessor(new TestSimpleTableWithEnum());
case 'MyGame_Example2_Monster':
return accessor(new MyGame_Example2_Monster());
default:
return null;
}
}
export function unionListToAny(type, accessor, index) {
switch (Any[type]) {
case 'NONE': return null;
case 'Monster': return accessor(index, new Monster());
case 'TestSimpleTableWithEnum': return accessor(index, new TestSimpleTableWithEnum());
case 'MyGame_Example2_Monster': return accessor(index, new MyGame_Example2_Monster());
default: return null;
}
switch (Any[type]) {
case 'NONE':
return null;
case 'Monster':
return accessor(index, new Monster());
case 'TestSimpleTableWithEnum':
return accessor(index, new TestSimpleTableWithEnum());
case 'MyGame_Example2_Monster':
return accessor(index, new MyGame_Example2_Monster());
default:
return null;
}
}

View File

@@ -2,14 +2,14 @@
* Composite components of Monster color.
*/
export declare enum Color {
Red = 1,
/**
* \brief color Green
* Green is bit_flag with value (1u << 1)
*/
Green = 2,
/**
* \brief color Blue (1u << 3)
*/
Blue = 8
Red = 1,
/**
* \brief color Green
* Green is bit_flag with value (1u << 1)
*/
Green = 2,
/**
* \brief color Blue (1u << 3)
*/
Blue = 8,
}

View File

@@ -1,18 +1,19 @@
// 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 */
/**
* Composite components of Monster color.
*/
export var Color;
(function (Color) {
Color[Color["Red"] = 1] = "Red";
/**
* \brief color Green
* Green is bit_flag with value (1u << 1)
*/
Color[Color["Green"] = 2] = "Green";
/**
* \brief color Blue (1u << 3)
*/
Color[Color["Blue"] = 8] = "Blue";
(function(Color) {
Color[Color['Red'] = 1] = 'Red';
/**
* \brief color Green
* Green is bit_flag with value (1u << 1)
*/
Color[Color['Green'] = 2] = 'Green';
/**
* \brief color Blue (1u << 3)
*/
Color[Color['Blue'] = 8] = 'Blue';
})(Color || (Color = {}));

View File

@@ -1,5 +1,5 @@
export declare enum LongEnum {
LongOne = "2",
LongTwo = "4",
LongBig = "1099511627776"
LongOne = '2',
LongTwo = '4',
LongBig = '1099511627776',
}

View File

@@ -1,8 +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 */
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any,
* @typescript-eslint/no-non-null-assertion */
export var LongEnum;
(function (LongEnum) {
LongEnum["LongOne"] = "2";
LongEnum["LongTwo"] = "4";
LongEnum["LongBig"] = "1099511627776";
(function(LongEnum) {
LongEnum['LongOne'] = '2';
LongEnum['LongTwo'] = '4';
LongEnum['LongBig'] = '1099511627776';
})(LongEnum || (LongEnum = {}));

View File

@@ -1,325 +1,674 @@
import * as flatbuffers from 'flatbuffers';
import { MonsterT as MyGame_Example2_MonsterT } from '../example2/monster.js';
import { Ability, AbilityT } from './ability.js';
import { Any } from './any.js';
import { AnyAmbiguousAliases } from './any-ambiguous-aliases.js';
import { AnyUniqueAliases } from './any-unique-aliases.js';
import { Color } from './color.js';
import { Race } from './race.js';
import { Referrable, ReferrableT } from './referrable.js';
import { Stat, StatT } from './stat.js';
import { Test, TestT } from './test.js';
import { TestSimpleTableWithEnumT } from './test-simple-table-with-enum.js';
import { Vec3, Vec3T } from './vec3.js';
import { InParentNamespace, InParentNamespaceT } from '../in-parent-namespace.js';
import {Ability, AbilityT} from '../../my-game/example/ability.js';
import {AnyAmbiguousAliases} from '../../my-game/example/any-ambiguous-aliases.js';
import {AnyUniqueAliases} from '../../my-game/example/any-unique-aliases.js';
import {Any} from '../../my-game/example/any.js';
import {Color} from '../../my-game/example/color.js';
import {Race} from '../../my-game/example/race.js';
import {Referrable, ReferrableT} from '../../my-game/example/referrable.js';
import {Stat, StatT} from '../../my-game/example/stat.js';
import {TestSimpleTableWithEnumT} from '../../my-game/example/test-simple-table-with-enum.js';
import {Test, TestT} from '../../my-game/example/test.js';
import {Vec3, Vec3T} from '../../my-game/example/vec3.js';
import {MonsterT as MyGame_Example2_MonsterT} from '../../my-game/example2/monster.js';
import {
InParentNamespace,
InParentNamespaceT,
} from '../../my-game/in-parent-namespace.js';
/**
* an example documentation comment: "monster object"
*/
export declare class Monster implements flatbuffers.IUnpackableObject<MonsterT> {
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): Monster;
static getRootAsMonster(bb: flatbuffers.ByteBuffer, obj?: Monster): Monster;
static getSizePrefixedRootAsMonster(bb: flatbuffers.ByteBuffer, obj?: Monster): Monster;
static bufferHasIdentifier(bb: flatbuffers.ByteBuffer): boolean;
pos(obj?: Vec3): Vec3 | null;
mana(): number;
mutate_mana(value: number): boolean;
hp(): number;
mutate_hp(value: number): boolean;
name(): string;
name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array;
inventory(index: number): number | null;
inventoryLength(): number;
inventoryArray(): Uint8Array | null;
color(): Color;
mutate_color(value: Color): boolean;
testType(): Any;
test<T extends flatbuffers.Table>(obj: any): any | null;
test4(index: number, obj?: Test): Test | null;
test4Length(): number;
testarrayofstring(index: number): string;
testarrayofstring(index: number, optionalEncoding: flatbuffers.Encoding): string | Uint8Array;
testarrayofstringLength(): number;
/**
* an example documentation comment: this will end up in the generated code
* multiline too
*/
testarrayoftables(index: number, obj?: Monster): Monster | null;
testarrayoftablesLength(): number;
enemy(obj?: Monster): Monster | null;
testnestedflatbuffer(index: number): number | null;
testnestedflatbufferLength(): number;
testnestedflatbufferArray(): Uint8Array | null;
testempty(obj?: Stat): Stat | null;
testbool(): boolean;
mutate_testbool(value: boolean): boolean;
testhashs32Fnv1(): number;
mutate_testhashs32_fnv1(value: number): boolean;
testhashu32Fnv1(): number;
mutate_testhashu32_fnv1(value: number): boolean;
testhashs64Fnv1(): bigint;
mutate_testhashs64_fnv1(value: bigint): boolean;
testhashu64Fnv1(): bigint;
mutate_testhashu64_fnv1(value: bigint): boolean;
testhashs32Fnv1a(): number;
mutate_testhashs32_fnv1a(value: number): boolean;
testhashu32Fnv1a(): number;
mutate_testhashu32_fnv1a(value: number): boolean;
testhashs64Fnv1a(): bigint;
mutate_testhashs64_fnv1a(value: bigint): boolean;
testhashu64Fnv1a(): bigint;
mutate_testhashu64_fnv1a(value: bigint): boolean;
testarrayofbools(index: number): boolean | null;
testarrayofboolsLength(): number;
testarrayofboolsArray(): Int8Array | null;
testf(): number;
mutate_testf(value: number): boolean;
testf2(): number;
mutate_testf2(value: number): boolean;
testf3(): number;
mutate_testf3(value: number): boolean;
testarrayofstring2(index: number): string;
testarrayofstring2(index: number, optionalEncoding: flatbuffers.Encoding): string | Uint8Array;
testarrayofstring2Length(): number;
testarrayofsortedstruct(index: number, obj?: Ability): Ability | null;
testarrayofsortedstructLength(): number;
flex(index: number): number | null;
flexLength(): number;
flexArray(): Uint8Array | null;
test5(index: number, obj?: Test): Test | null;
test5Length(): number;
vectorOfLongs(index: number): bigint | null;
vectorOfLongsLength(): number;
vectorOfDoubles(index: number): number | null;
vectorOfDoublesLength(): number;
vectorOfDoublesArray(): Float64Array | null;
parentNamespaceTest(obj?: InParentNamespace): InParentNamespace | null;
vectorOfReferrables(index: number, obj?: Referrable): Referrable | null;
vectorOfReferrablesLength(): number;
singleWeakReference(): bigint;
mutate_single_weak_reference(value: bigint): boolean;
vectorOfWeakReferences(index: number): bigint | null;
vectorOfWeakReferencesLength(): number;
vectorOfStrongReferrables(index: number, obj?: Referrable): Referrable | null;
vectorOfStrongReferrablesLength(): number;
coOwningReference(): bigint;
mutate_co_owning_reference(value: bigint): boolean;
vectorOfCoOwningReferences(index: number): bigint | null;
vectorOfCoOwningReferencesLength(): number;
nonOwningReference(): bigint;
mutate_non_owning_reference(value: bigint): boolean;
vectorOfNonOwningReferences(index: number): bigint | null;
vectorOfNonOwningReferencesLength(): number;
anyUniqueType(): AnyUniqueAliases;
anyUnique<T extends flatbuffers.Table>(obj: any): any | null;
anyAmbiguousType(): AnyAmbiguousAliases;
anyAmbiguous<T extends flatbuffers.Table>(obj: any): any | null;
vectorOfEnums(index: number): Color | null;
vectorOfEnumsLength(): number;
vectorOfEnumsArray(): Uint8Array | null;
signedEnum(): Race;
mutate_signed_enum(value: Race): boolean;
testrequirednestedflatbuffer(index: number): number | null;
testrequirednestedflatbufferLength(): number;
testrequirednestedflatbufferArray(): Uint8Array | null;
scalarKeySortedTables(index: number, obj?: Stat): Stat | null;
scalarKeySortedTablesLength(): number;
nativeInline(obj?: Test): Test | null;
longEnumNonEnumDefault(): bigint;
mutate_long_enum_non_enum_default(value: bigint): boolean;
longEnumNormalDefault(): bigint;
mutate_long_enum_normal_default(value: bigint): boolean;
nanDefault(): number;
mutate_nan_default(value: number): boolean;
infDefault(): number;
mutate_inf_default(value: number): boolean;
positiveInfDefault(): number;
mutate_positive_inf_default(value: number): boolean;
infinityDefault(): number;
mutate_infinity_default(value: number): boolean;
positiveInfinityDefault(): number;
mutate_positive_infinity_default(value: number): boolean;
negativeInfDefault(): number;
mutate_negative_inf_default(value: number): boolean;
negativeInfinityDefault(): number;
mutate_negative_infinity_default(value: number): boolean;
doubleInfDefault(): number;
mutate_double_inf_default(value: number): boolean;
static getFullyQualifiedName(): "MyGame.Example.Monster";
static startMonster(builder: flatbuffers.Builder): void;
static addPos(builder: flatbuffers.Builder, posOffset: flatbuffers.Offset): void;
static addMana(builder: flatbuffers.Builder, mana: number): void;
static addHp(builder: flatbuffers.Builder, hp: number): void;
static addName(builder: flatbuffers.Builder, nameOffset: flatbuffers.Offset): void;
static addInventory(builder: flatbuffers.Builder, inventoryOffset: flatbuffers.Offset): void;
static createInventoryVector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
static startInventoryVector(builder: flatbuffers.Builder, numElems: number): void;
static addColor(builder: flatbuffers.Builder, color: Color): void;
static addTestType(builder: flatbuffers.Builder, testType: Any): void;
static addTest(builder: flatbuffers.Builder, testOffset: flatbuffers.Offset): void;
static addTest4(builder: flatbuffers.Builder, test4Offset: flatbuffers.Offset): void;
static startTest4Vector(builder: flatbuffers.Builder, numElems: number): void;
static addTestarrayofstring(builder: flatbuffers.Builder, testarrayofstringOffset: flatbuffers.Offset): void;
static createTestarrayofstringVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset;
static startTestarrayofstringVector(builder: flatbuffers.Builder, numElems: number): void;
static addTestarrayoftables(builder: flatbuffers.Builder, testarrayoftablesOffset: flatbuffers.Offset): void;
static createTestarrayoftablesVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset;
static startTestarrayoftablesVector(builder: flatbuffers.Builder, numElems: number): void;
static addEnemy(builder: flatbuffers.Builder, enemyOffset: flatbuffers.Offset): void;
static addTestnestedflatbuffer(builder: flatbuffers.Builder, testnestedflatbufferOffset: flatbuffers.Offset): void;
static createTestnestedflatbufferVector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
static startTestnestedflatbufferVector(builder: flatbuffers.Builder, numElems: number): void;
static addTestempty(builder: flatbuffers.Builder, testemptyOffset: flatbuffers.Offset): void;
static addTestbool(builder: flatbuffers.Builder, testbool: boolean): void;
static addTesthashs32Fnv1(builder: flatbuffers.Builder, testhashs32Fnv1: number): void;
static addTesthashu32Fnv1(builder: flatbuffers.Builder, testhashu32Fnv1: number): void;
static addTesthashs64Fnv1(builder: flatbuffers.Builder, testhashs64Fnv1: bigint): void;
static addTesthashu64Fnv1(builder: flatbuffers.Builder, testhashu64Fnv1: bigint): void;
static addTesthashs32Fnv1a(builder: flatbuffers.Builder, testhashs32Fnv1a: number): void;
static addTesthashu32Fnv1a(builder: flatbuffers.Builder, testhashu32Fnv1a: number): void;
static addTesthashs64Fnv1a(builder: flatbuffers.Builder, testhashs64Fnv1a: bigint): void;
static addTesthashu64Fnv1a(builder: flatbuffers.Builder, testhashu64Fnv1a: bigint): void;
static addTestarrayofbools(builder: flatbuffers.Builder, testarrayofboolsOffset: flatbuffers.Offset): void;
static createTestarrayofboolsVector(builder: flatbuffers.Builder, data: boolean[]): flatbuffers.Offset;
static startTestarrayofboolsVector(builder: flatbuffers.Builder, numElems: number): void;
static addTestf(builder: flatbuffers.Builder, testf: number): void;
static addTestf2(builder: flatbuffers.Builder, testf2: number): void;
static addTestf3(builder: flatbuffers.Builder, testf3: number): void;
static addTestarrayofstring2(builder: flatbuffers.Builder, testarrayofstring2Offset: flatbuffers.Offset): void;
static createTestarrayofstring2Vector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset;
static startTestarrayofstring2Vector(builder: flatbuffers.Builder, numElems: number): void;
static addTestarrayofsortedstruct(builder: flatbuffers.Builder, testarrayofsortedstructOffset: flatbuffers.Offset): void;
static startTestarrayofsortedstructVector(builder: flatbuffers.Builder, numElems: number): void;
static addFlex(builder: flatbuffers.Builder, flexOffset: flatbuffers.Offset): void;
static createFlexVector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
static startFlexVector(builder: flatbuffers.Builder, numElems: number): void;
static addTest5(builder: flatbuffers.Builder, test5Offset: flatbuffers.Offset): void;
static startTest5Vector(builder: flatbuffers.Builder, numElems: number): void;
static addVectorOfLongs(builder: flatbuffers.Builder, vectorOfLongsOffset: flatbuffers.Offset): void;
static createVectorOfLongsVector(builder: flatbuffers.Builder, data: bigint[]): flatbuffers.Offset;
static startVectorOfLongsVector(builder: flatbuffers.Builder, numElems: number): void;
static addVectorOfDoubles(builder: flatbuffers.Builder, vectorOfDoublesOffset: flatbuffers.Offset): void;
static createVectorOfDoublesVector(builder: flatbuffers.Builder, data: number[] | Float64Array): flatbuffers.Offset;
/**
* @deprecated This Uint8Array overload will be removed in the future.
*/
static createVectorOfDoublesVector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
static startVectorOfDoublesVector(builder: flatbuffers.Builder, numElems: number): void;
static addParentNamespaceTest(builder: flatbuffers.Builder, parentNamespaceTestOffset: flatbuffers.Offset): void;
static addVectorOfReferrables(builder: flatbuffers.Builder, vectorOfReferrablesOffset: flatbuffers.Offset): void;
static createVectorOfReferrablesVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset;
static startVectorOfReferrablesVector(builder: flatbuffers.Builder, numElems: number): void;
static addSingleWeakReference(builder: flatbuffers.Builder, singleWeakReference: bigint): void;
static addVectorOfWeakReferences(builder: flatbuffers.Builder, vectorOfWeakReferencesOffset: flatbuffers.Offset): void;
static createVectorOfWeakReferencesVector(builder: flatbuffers.Builder, data: bigint[]): flatbuffers.Offset;
static startVectorOfWeakReferencesVector(builder: flatbuffers.Builder, numElems: number): void;
static addVectorOfStrongReferrables(builder: flatbuffers.Builder, vectorOfStrongReferrablesOffset: flatbuffers.Offset): void;
static createVectorOfStrongReferrablesVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset;
static startVectorOfStrongReferrablesVector(builder: flatbuffers.Builder, numElems: number): void;
static addCoOwningReference(builder: flatbuffers.Builder, coOwningReference: bigint): void;
static addVectorOfCoOwningReferences(builder: flatbuffers.Builder, vectorOfCoOwningReferencesOffset: flatbuffers.Offset): void;
static createVectorOfCoOwningReferencesVector(builder: flatbuffers.Builder, data: bigint[]): flatbuffers.Offset;
static startVectorOfCoOwningReferencesVector(builder: flatbuffers.Builder, numElems: number): void;
static addNonOwningReference(builder: flatbuffers.Builder, nonOwningReference: bigint): void;
static addVectorOfNonOwningReferences(builder: flatbuffers.Builder, vectorOfNonOwningReferencesOffset: flatbuffers.Offset): void;
static createVectorOfNonOwningReferencesVector(builder: flatbuffers.Builder, data: bigint[]): flatbuffers.Offset;
static startVectorOfNonOwningReferencesVector(builder: flatbuffers.Builder, numElems: number): void;
static addAnyUniqueType(builder: flatbuffers.Builder, anyUniqueType: AnyUniqueAliases): void;
static addAnyUnique(builder: flatbuffers.Builder, anyUniqueOffset: flatbuffers.Offset): void;
static addAnyAmbiguousType(builder: flatbuffers.Builder, anyAmbiguousType: AnyAmbiguousAliases): void;
static addAnyAmbiguous(builder: flatbuffers.Builder, anyAmbiguousOffset: flatbuffers.Offset): void;
static addVectorOfEnums(builder: flatbuffers.Builder, vectorOfEnumsOffset: flatbuffers.Offset): void;
static createVectorOfEnumsVector(builder: flatbuffers.Builder, data: Color[]): flatbuffers.Offset;
static startVectorOfEnumsVector(builder: flatbuffers.Builder, numElems: number): void;
static addSignedEnum(builder: flatbuffers.Builder, signedEnum: Race): void;
static addTestrequirednestedflatbuffer(builder: flatbuffers.Builder, testrequirednestedflatbufferOffset: flatbuffers.Offset): void;
static createTestrequirednestedflatbufferVector(builder: flatbuffers.Builder, data: number[] | Uint8Array): flatbuffers.Offset;
static startTestrequirednestedflatbufferVector(builder: flatbuffers.Builder, numElems: number): void;
static addScalarKeySortedTables(builder: flatbuffers.Builder, scalarKeySortedTablesOffset: flatbuffers.Offset): void;
static createScalarKeySortedTablesVector(builder: flatbuffers.Builder, data: flatbuffers.Offset[]): flatbuffers.Offset;
static startScalarKeySortedTablesVector(builder: flatbuffers.Builder, numElems: number): void;
static addNativeInline(builder: flatbuffers.Builder, nativeInlineOffset: flatbuffers.Offset): void;
static addLongEnumNonEnumDefault(builder: flatbuffers.Builder, longEnumNonEnumDefault: bigint): void;
static addLongEnumNormalDefault(builder: flatbuffers.Builder, longEnumNormalDefault: bigint): void;
static addNanDefault(builder: flatbuffers.Builder, nanDefault: number): void;
static addInfDefault(builder: flatbuffers.Builder, infDefault: number): void;
static addPositiveInfDefault(builder: flatbuffers.Builder, positiveInfDefault: number): void;
static addInfinityDefault(builder: flatbuffers.Builder, infinityDefault: number): void;
static addPositiveInfinityDefault(builder: flatbuffers.Builder, positiveInfinityDefault: number): void;
static addNegativeInfDefault(builder: flatbuffers.Builder, negativeInfDefault: number): void;
static addNegativeInfinityDefault(builder: flatbuffers.Builder, negativeInfinityDefault: number): void;
static addDoubleInfDefault(builder: flatbuffers.Builder, doubleInfDefault: number): void;
static endMonster(builder: flatbuffers.Builder): flatbuffers.Offset;
static finishMonsterBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
static finishSizePrefixedMonsterBuffer(builder: flatbuffers.Builder, offset: flatbuffers.Offset): void;
serialize(): Uint8Array;
static deserialize(buffer: Uint8Array): Monster;
unpack(): MonsterT;
unpackTo(_o: MonsterT): void;
export declare class Monster
implements flatbuffers.IUnpackableObject<MonsterT>
{
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): Monster;
static getRootAsMonster(bb: flatbuffers.ByteBuffer, obj?: Monster): Monster;
static getSizePrefixedRootAsMonster(
bb: flatbuffers.ByteBuffer,
obj?: Monster,
): Monster;
static bufferHasIdentifier(bb: flatbuffers.ByteBuffer): boolean;
pos(obj?: Vec3): Vec3 | null;
mana(): number;
mutate_mana(value: number): boolean;
hp(): number;
mutate_hp(value: number): boolean;
name(): string | null;
name(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
inventory(index: number): number | null;
inventoryLength(): number;
inventoryArray(): Uint8Array | null;
color(): Color;
mutate_color(value: Color): boolean;
testType(): Any;
test<T extends flatbuffers.Table>(obj: any): any | null;
test4(index: number, obj?: Test): Test | null;
test4Length(): number;
testarrayofstring(index: number): string;
testarrayofstring(
index: number,
optionalEncoding: flatbuffers.Encoding,
): string | Uint8Array;
testarrayofstringLength(): number;
/**
* an example documentation comment: this will end up in the generated code
* multiline too
*/
testarrayoftables(index: number, obj?: Monster): Monster | null;
testarrayoftablesLength(): number;
enemy(obj?: Monster): Monster | null;
testnestedflatbuffer(index: number): number | null;
testnestedflatbufferLength(): number;
testnestedflatbufferArray(): Uint8Array | null;
testempty(obj?: Stat): Stat | null;
testbool(): boolean;
mutate_testbool(value: boolean): boolean;
testhashs32Fnv1(): number;
mutate_testhashs32_fnv1(value: number): boolean;
testhashu32Fnv1(): number;
mutate_testhashu32_fnv1(value: number): boolean;
testhashs64Fnv1(): bigint;
mutate_testhashs64_fnv1(value: bigint): boolean;
testhashu64Fnv1(): bigint;
mutate_testhashu64_fnv1(value: bigint): boolean;
testhashs32Fnv1a(): number;
mutate_testhashs32_fnv1a(value: number): boolean;
testhashu32Fnv1a(): number;
mutate_testhashu32_fnv1a(value: number): boolean;
testhashs64Fnv1a(): bigint;
mutate_testhashs64_fnv1a(value: bigint): boolean;
testhashu64Fnv1a(): bigint;
mutate_testhashu64_fnv1a(value: bigint): boolean;
testarrayofbools(index: number): boolean | null;
testarrayofboolsLength(): number;
testarrayofboolsArray(): Int8Array | null;
testf(): number;
mutate_testf(value: number): boolean;
testf2(): number;
mutate_testf2(value: number): boolean;
testf3(): number;
mutate_testf3(value: number): boolean;
testarrayofstring2(index: number): string;
testarrayofstring2(
index: number,
optionalEncoding: flatbuffers.Encoding,
): string | Uint8Array;
testarrayofstring2Length(): number;
testarrayofsortedstruct(index: number, obj?: Ability): Ability | null;
testarrayofsortedstructLength(): number;
flex(index: number): number | null;
flexLength(): number;
flexArray(): Uint8Array | null;
test5(index: number, obj?: Test): Test | null;
test5Length(): number;
vectorOfLongs(index: number): bigint | null;
vectorOfLongsLength(): number;
vectorOfDoubles(index: number): number | null;
vectorOfDoublesLength(): number;
vectorOfDoublesArray(): Float64Array | null;
parentNamespaceTest(obj?: InParentNamespace): InParentNamespace | null;
vectorOfReferrables(index: number, obj?: Referrable): Referrable | null;
vectorOfReferrablesLength(): number;
singleWeakReference(): bigint;
mutate_single_weak_reference(value: bigint): boolean;
vectorOfWeakReferences(index: number): bigint | null;
vectorOfWeakReferencesLength(): number;
vectorOfStrongReferrables(index: number, obj?: Referrable): Referrable | null;
vectorOfStrongReferrablesLength(): number;
coOwningReference(): bigint;
mutate_co_owning_reference(value: bigint): boolean;
vectorOfCoOwningReferences(index: number): bigint | null;
vectorOfCoOwningReferencesLength(): number;
nonOwningReference(): bigint;
mutate_non_owning_reference(value: bigint): boolean;
vectorOfNonOwningReferences(index: number): bigint | null;
vectorOfNonOwningReferencesLength(): number;
anyUniqueType(): AnyUniqueAliases;
anyUnique<T extends flatbuffers.Table>(obj: any): any | null;
anyAmbiguousType(): AnyAmbiguousAliases;
anyAmbiguous<T extends flatbuffers.Table>(obj: any): any | null;
vectorOfEnums(index: number): Color | null;
vectorOfEnumsLength(): number;
vectorOfEnumsArray(): Uint8Array | null;
signedEnum(): Race;
mutate_signed_enum(value: Race): boolean;
testrequirednestedflatbuffer(index: number): number | null;
testrequirednestedflatbufferLength(): number;
testrequirednestedflatbufferArray(): Uint8Array | null;
scalarKeySortedTables(index: number, obj?: Stat): Stat | null;
scalarKeySortedTablesLength(): number;
nativeInline(obj?: Test): Test | null;
longEnumNonEnumDefault(): bigint;
mutate_long_enum_non_enum_default(value: bigint): boolean;
longEnumNormalDefault(): bigint;
mutate_long_enum_normal_default(value: bigint): boolean;
nanDefault(): number;
mutate_nan_default(value: number): boolean;
infDefault(): number;
mutate_inf_default(value: number): boolean;
positiveInfDefault(): number;
mutate_positive_inf_default(value: number): boolean;
infinityDefault(): number;
mutate_infinity_default(value: number): boolean;
positiveInfinityDefault(): number;
mutate_positive_infinity_default(value: number): boolean;
negativeInfDefault(): number;
mutate_negative_inf_default(value: number): boolean;
negativeInfinityDefault(): number;
mutate_negative_infinity_default(value: number): boolean;
doubleInfDefault(): number;
mutate_double_inf_default(value: number): boolean;
static getFullyQualifiedName(): string;
static startMonster(builder: flatbuffers.Builder): void;
static addPos(
builder: flatbuffers.Builder,
posOffset: flatbuffers.Offset,
): void;
static addMana(builder: flatbuffers.Builder, mana: number): void;
static addHp(builder: flatbuffers.Builder, hp: number): void;
static addName(
builder: flatbuffers.Builder,
nameOffset: flatbuffers.Offset,
): void;
static addInventory(
builder: flatbuffers.Builder,
inventoryOffset: flatbuffers.Offset,
): void;
static createInventoryVector(
builder: flatbuffers.Builder,
data: number[] | Uint8Array,
): flatbuffers.Offset;
static startInventoryVector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addColor(builder: flatbuffers.Builder, color: Color): void;
static addTestType(builder: flatbuffers.Builder, testType: Any): void;
static addTest(
builder: flatbuffers.Builder,
testOffset: flatbuffers.Offset,
): void;
static addTest4(
builder: flatbuffers.Builder,
test4Offset: flatbuffers.Offset,
): void;
static startTest4Vector(builder: flatbuffers.Builder, numElems: number): void;
static addTestarrayofstring(
builder: flatbuffers.Builder,
testarrayofstringOffset: flatbuffers.Offset,
): void;
static createTestarrayofstringVector(
builder: flatbuffers.Builder,
data: flatbuffers.Offset[],
): flatbuffers.Offset;
static startTestarrayofstringVector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addTestarrayoftables(
builder: flatbuffers.Builder,
testarrayoftablesOffset: flatbuffers.Offset,
): void;
static createTestarrayoftablesVector(
builder: flatbuffers.Builder,
data: flatbuffers.Offset[],
): flatbuffers.Offset;
static startTestarrayoftablesVector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addEnemy(
builder: flatbuffers.Builder,
enemyOffset: flatbuffers.Offset,
): void;
static addTestnestedflatbuffer(
builder: flatbuffers.Builder,
testnestedflatbufferOffset: flatbuffers.Offset,
): void;
static createTestnestedflatbufferVector(
builder: flatbuffers.Builder,
data: number[] | Uint8Array,
): flatbuffers.Offset;
static startTestnestedflatbufferVector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addTestempty(
builder: flatbuffers.Builder,
testemptyOffset: flatbuffers.Offset,
): void;
static addTestbool(builder: flatbuffers.Builder, testbool: boolean): void;
static addTesthashs32Fnv1(
builder: flatbuffers.Builder,
testhashs32Fnv1: number,
): void;
static addTesthashu32Fnv1(
builder: flatbuffers.Builder,
testhashu32Fnv1: number,
): void;
static addTesthashs64Fnv1(
builder: flatbuffers.Builder,
testhashs64Fnv1: bigint,
): void;
static addTesthashu64Fnv1(
builder: flatbuffers.Builder,
testhashu64Fnv1: bigint,
): void;
static addTesthashs32Fnv1a(
builder: flatbuffers.Builder,
testhashs32Fnv1a: number,
): void;
static addTesthashu32Fnv1a(
builder: flatbuffers.Builder,
testhashu32Fnv1a: number,
): void;
static addTesthashs64Fnv1a(
builder: flatbuffers.Builder,
testhashs64Fnv1a: bigint,
): void;
static addTesthashu64Fnv1a(
builder: flatbuffers.Builder,
testhashu64Fnv1a: bigint,
): void;
static addTestarrayofbools(
builder: flatbuffers.Builder,
testarrayofboolsOffset: flatbuffers.Offset,
): void;
static createTestarrayofboolsVector(
builder: flatbuffers.Builder,
data: boolean[],
): flatbuffers.Offset;
static startTestarrayofboolsVector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addTestf(builder: flatbuffers.Builder, testf: number): void;
static addTestf2(builder: flatbuffers.Builder, testf2: number): void;
static addTestf3(builder: flatbuffers.Builder, testf3: number): void;
static addTestarrayofstring2(
builder: flatbuffers.Builder,
testarrayofstring2Offset: flatbuffers.Offset,
): void;
static createTestarrayofstring2Vector(
builder: flatbuffers.Builder,
data: flatbuffers.Offset[],
): flatbuffers.Offset;
static startTestarrayofstring2Vector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addTestarrayofsortedstruct(
builder: flatbuffers.Builder,
testarrayofsortedstructOffset: flatbuffers.Offset,
): void;
static startTestarrayofsortedstructVector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addFlex(
builder: flatbuffers.Builder,
flexOffset: flatbuffers.Offset,
): void;
static createFlexVector(
builder: flatbuffers.Builder,
data: number[] | Uint8Array,
): flatbuffers.Offset;
static startFlexVector(builder: flatbuffers.Builder, numElems: number): void;
static addTest5(
builder: flatbuffers.Builder,
test5Offset: flatbuffers.Offset,
): void;
static startTest5Vector(builder: flatbuffers.Builder, numElems: number): void;
static addVectorOfLongs(
builder: flatbuffers.Builder,
vectorOfLongsOffset: flatbuffers.Offset,
): void;
static createVectorOfLongsVector(
builder: flatbuffers.Builder,
data: bigint[],
): flatbuffers.Offset;
static startVectorOfLongsVector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addVectorOfDoubles(
builder: flatbuffers.Builder,
vectorOfDoublesOffset: flatbuffers.Offset,
): void;
static createVectorOfDoublesVector(
builder: flatbuffers.Builder,
data: number[] | Float64Array,
): flatbuffers.Offset;
/**
* @deprecated This Uint8Array overload will be removed in the future.
*/
static createVectorOfDoublesVector(
builder: flatbuffers.Builder,
data: number[] | Uint8Array,
): flatbuffers.Offset;
static startVectorOfDoublesVector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addParentNamespaceTest(
builder: flatbuffers.Builder,
parentNamespaceTestOffset: flatbuffers.Offset,
): void;
static addVectorOfReferrables(
builder: flatbuffers.Builder,
vectorOfReferrablesOffset: flatbuffers.Offset,
): void;
static createVectorOfReferrablesVector(
builder: flatbuffers.Builder,
data: flatbuffers.Offset[],
): flatbuffers.Offset;
static startVectorOfReferrablesVector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addSingleWeakReference(
builder: flatbuffers.Builder,
singleWeakReference: bigint,
): void;
static addVectorOfWeakReferences(
builder: flatbuffers.Builder,
vectorOfWeakReferencesOffset: flatbuffers.Offset,
): void;
static createVectorOfWeakReferencesVector(
builder: flatbuffers.Builder,
data: bigint[],
): flatbuffers.Offset;
static startVectorOfWeakReferencesVector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addVectorOfStrongReferrables(
builder: flatbuffers.Builder,
vectorOfStrongReferrablesOffset: flatbuffers.Offset,
): void;
static createVectorOfStrongReferrablesVector(
builder: flatbuffers.Builder,
data: flatbuffers.Offset[],
): flatbuffers.Offset;
static startVectorOfStrongReferrablesVector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addCoOwningReference(
builder: flatbuffers.Builder,
coOwningReference: bigint,
): void;
static addVectorOfCoOwningReferences(
builder: flatbuffers.Builder,
vectorOfCoOwningReferencesOffset: flatbuffers.Offset,
): void;
static createVectorOfCoOwningReferencesVector(
builder: flatbuffers.Builder,
data: bigint[],
): flatbuffers.Offset;
static startVectorOfCoOwningReferencesVector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addNonOwningReference(
builder: flatbuffers.Builder,
nonOwningReference: bigint,
): void;
static addVectorOfNonOwningReferences(
builder: flatbuffers.Builder,
vectorOfNonOwningReferencesOffset: flatbuffers.Offset,
): void;
static createVectorOfNonOwningReferencesVector(
builder: flatbuffers.Builder,
data: bigint[],
): flatbuffers.Offset;
static startVectorOfNonOwningReferencesVector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addAnyUniqueType(
builder: flatbuffers.Builder,
anyUniqueType: AnyUniqueAliases,
): void;
static addAnyUnique(
builder: flatbuffers.Builder,
anyUniqueOffset: flatbuffers.Offset,
): void;
static addAnyAmbiguousType(
builder: flatbuffers.Builder,
anyAmbiguousType: AnyAmbiguousAliases,
): void;
static addAnyAmbiguous(
builder: flatbuffers.Builder,
anyAmbiguousOffset: flatbuffers.Offset,
): void;
static addVectorOfEnums(
builder: flatbuffers.Builder,
vectorOfEnumsOffset: flatbuffers.Offset,
): void;
static createVectorOfEnumsVector(
builder: flatbuffers.Builder,
data: Color[],
): flatbuffers.Offset;
static startVectorOfEnumsVector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addSignedEnum(builder: flatbuffers.Builder, signedEnum: Race): void;
static addTestrequirednestedflatbuffer(
builder: flatbuffers.Builder,
testrequirednestedflatbufferOffset: flatbuffers.Offset,
): void;
static createTestrequirednestedflatbufferVector(
builder: flatbuffers.Builder,
data: number[] | Uint8Array,
): flatbuffers.Offset;
static startTestrequirednestedflatbufferVector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addScalarKeySortedTables(
builder: flatbuffers.Builder,
scalarKeySortedTablesOffset: flatbuffers.Offset,
): void;
static createScalarKeySortedTablesVector(
builder: flatbuffers.Builder,
data: flatbuffers.Offset[],
): flatbuffers.Offset;
static startScalarKeySortedTablesVector(
builder: flatbuffers.Builder,
numElems: number,
): void;
static addNativeInline(
builder: flatbuffers.Builder,
nativeInlineOffset: flatbuffers.Offset,
): void;
static addLongEnumNonEnumDefault(
builder: flatbuffers.Builder,
longEnumNonEnumDefault: bigint,
): void;
static addLongEnumNormalDefault(
builder: flatbuffers.Builder,
longEnumNormalDefault: bigint,
): void;
static addNanDefault(builder: flatbuffers.Builder, nanDefault: number): void;
static addInfDefault(builder: flatbuffers.Builder, infDefault: number): void;
static addPositiveInfDefault(
builder: flatbuffers.Builder,
positiveInfDefault: number,
): void;
static addInfinityDefault(
builder: flatbuffers.Builder,
infinityDefault: number,
): void;
static addPositiveInfinityDefault(
builder: flatbuffers.Builder,
positiveInfinityDefault: number,
): void;
static addNegativeInfDefault(
builder: flatbuffers.Builder,
negativeInfDefault: number,
): void;
static addNegativeInfinityDefault(
builder: flatbuffers.Builder,
negativeInfinityDefault: number,
): void;
static addDoubleInfDefault(
builder: flatbuffers.Builder,
doubleInfDefault: number,
): void;
static endMonster(builder: flatbuffers.Builder): flatbuffers.Offset;
static finishMonsterBuffer(
builder: flatbuffers.Builder,
offset: flatbuffers.Offset,
): void;
static finishSizePrefixedMonsterBuffer(
builder: flatbuffers.Builder,
offset: flatbuffers.Offset,
): void;
serialize(): Uint8Array;
static deserialize(buffer: Uint8Array): Monster;
unpack(): MonsterT;
unpackTo(_o: MonsterT): void;
}
export declare class MonsterT implements flatbuffers.IGeneratedObject {
pos: Vec3T | null;
mana: number;
hp: number;
name: string | Uint8Array | null;
inventory: (number)[];
color: Color;
testType: Any;
test: MonsterT | MyGame_Example2_MonsterT | TestSimpleTableWithEnumT | null;
test4: (TestT)[];
testarrayofstring: (string)[];
testarrayoftables: (MonsterT)[];
enemy: MonsterT | null;
testnestedflatbuffer: (number)[];
testempty: StatT | null;
testbool: boolean;
testhashs32Fnv1: number;
testhashu32Fnv1: number;
testhashs64Fnv1: bigint;
testhashu64Fnv1: bigint;
testhashs32Fnv1a: number;
testhashu32Fnv1a: number;
testhashs64Fnv1a: bigint;
testhashu64Fnv1a: bigint;
testarrayofbools: (boolean)[];
testf: number;
testf2: number;
testf3: number;
testarrayofstring2: (string)[];
testarrayofsortedstruct: (AbilityT)[];
flex: (number)[];
test5: (TestT)[];
vectorOfLongs: (bigint)[];
vectorOfDoubles: (number)[];
parentNamespaceTest: InParentNamespaceT | null;
vectorOfReferrables: (ReferrableT)[];
singleWeakReference: bigint;
vectorOfWeakReferences: (bigint)[];
vectorOfStrongReferrables: (ReferrableT)[];
coOwningReference: bigint;
vectorOfCoOwningReferences: (bigint)[];
nonOwningReference: bigint;
vectorOfNonOwningReferences: (bigint)[];
anyUniqueType: AnyUniqueAliases;
anyUnique: MonsterT | MyGame_Example2_MonsterT | TestSimpleTableWithEnumT | null;
anyAmbiguousType: AnyAmbiguousAliases;
anyAmbiguous: MonsterT | null;
vectorOfEnums: (Color)[];
signedEnum: Race;
testrequirednestedflatbuffer: (number)[];
scalarKeySortedTables: (StatT)[];
nativeInline: TestT | null;
longEnumNonEnumDefault: bigint;
longEnumNormalDefault: bigint;
nanDefault: number;
infDefault: number;
positiveInfDefault: number;
infinityDefault: number;
positiveInfinityDefault: number;
negativeInfDefault: number;
negativeInfinityDefault: number;
doubleInfDefault: number;
constructor(pos?: Vec3T | null, mana?: number, hp?: number, name?: string | Uint8Array | null, inventory?: (number)[], color?: Color, testType?: Any, test?: MonsterT | MyGame_Example2_MonsterT | TestSimpleTableWithEnumT | null, test4?: (TestT)[], testarrayofstring?: (string)[], testarrayoftables?: (MonsterT)[], enemy?: MonsterT | null, testnestedflatbuffer?: (number)[], testempty?: StatT | null, testbool?: boolean, testhashs32Fnv1?: number, testhashu32Fnv1?: number, testhashs64Fnv1?: bigint, testhashu64Fnv1?: bigint, testhashs32Fnv1a?: number, testhashu32Fnv1a?: number, testhashs64Fnv1a?: bigint, testhashu64Fnv1a?: bigint, testarrayofbools?: (boolean)[], testf?: number, testf2?: number, testf3?: number, testarrayofstring2?: (string)[], testarrayofsortedstruct?: (AbilityT)[], flex?: (number)[], test5?: (TestT)[], vectorOfLongs?: (bigint)[], vectorOfDoubles?: (number)[], parentNamespaceTest?: InParentNamespaceT | null, vectorOfReferrables?: (ReferrableT)[], singleWeakReference?: bigint, vectorOfWeakReferences?: (bigint)[], vectorOfStrongReferrables?: (ReferrableT)[], coOwningReference?: bigint, vectorOfCoOwningReferences?: (bigint)[], nonOwningReference?: bigint, vectorOfNonOwningReferences?: (bigint)[], anyUniqueType?: AnyUniqueAliases, anyUnique?: MonsterT | MyGame_Example2_MonsterT | TestSimpleTableWithEnumT | null, anyAmbiguousType?: AnyAmbiguousAliases, anyAmbiguous?: MonsterT | null, vectorOfEnums?: (Color)[], signedEnum?: Race, testrequirednestedflatbuffer?: (number)[], scalarKeySortedTables?: (StatT)[], nativeInline?: TestT | null, longEnumNonEnumDefault?: bigint, longEnumNormalDefault?: bigint, nanDefault?: number, infDefault?: number, positiveInfDefault?: number, infinityDefault?: number, positiveInfinityDefault?: number, negativeInfDefault?: number, negativeInfinityDefault?: number, doubleInfDefault?: number);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
pos: Vec3T | null;
mana: number;
hp: number;
name: string | Uint8Array | null;
inventory: number[];
color: Color;
testType: Any;
test: MonsterT | MyGame_Example2_MonsterT | TestSimpleTableWithEnumT | null;
test4: TestT[];
testarrayofstring: string[];
testarrayoftables: MonsterT[];
enemy: MonsterT | null;
testnestedflatbuffer: number[];
testempty: StatT | null;
testbool: boolean;
testhashs32Fnv1: number;
testhashu32Fnv1: number;
testhashs64Fnv1: bigint;
testhashu64Fnv1: bigint;
testhashs32Fnv1a: number;
testhashu32Fnv1a: number;
testhashs64Fnv1a: bigint;
testhashu64Fnv1a: bigint;
testarrayofbools: boolean[];
testf: number;
testf2: number;
testf3: number;
testarrayofstring2: string[];
testarrayofsortedstruct: AbilityT[];
flex: number[];
test5: TestT[];
vectorOfLongs: bigint[];
vectorOfDoubles: number[];
parentNamespaceTest: InParentNamespaceT | null;
vectorOfReferrables: ReferrableT[];
singleWeakReference: bigint;
vectorOfWeakReferences: bigint[];
vectorOfStrongReferrables: ReferrableT[];
coOwningReference: bigint;
vectorOfCoOwningReferences: bigint[];
nonOwningReference: bigint;
vectorOfNonOwningReferences: bigint[];
anyUniqueType: AnyUniqueAliases;
anyUnique:
| MonsterT
| MyGame_Example2_MonsterT
| TestSimpleTableWithEnumT
| null;
anyAmbiguousType: AnyAmbiguousAliases;
anyAmbiguous: MonsterT | null;
vectorOfEnums: Color[];
signedEnum: Race;
testrequirednestedflatbuffer: number[];
scalarKeySortedTables: StatT[];
nativeInline: TestT | null;
longEnumNonEnumDefault: bigint;
longEnumNormalDefault: bigint;
nanDefault: number;
infDefault: number;
positiveInfDefault: number;
infinityDefault: number;
positiveInfinityDefault: number;
negativeInfDefault: number;
negativeInfinityDefault: number;
doubleInfDefault: number;
constructor(
pos?: Vec3T | null,
mana?: number,
hp?: number,
name?: string | Uint8Array | null,
inventory?: number[],
color?: Color,
testType?: Any,
test?:
| MonsterT
| MyGame_Example2_MonsterT
| TestSimpleTableWithEnumT
| null,
test4?: TestT[],
testarrayofstring?: string[],
testarrayoftables?: MonsterT[],
enemy?: MonsterT | null,
testnestedflatbuffer?: number[],
testempty?: StatT | null,
testbool?: boolean,
testhashs32Fnv1?: number,
testhashu32Fnv1?: number,
testhashs64Fnv1?: bigint,
testhashu64Fnv1?: bigint,
testhashs32Fnv1a?: number,
testhashu32Fnv1a?: number,
testhashs64Fnv1a?: bigint,
testhashu64Fnv1a?: bigint,
testarrayofbools?: boolean[],
testf?: number,
testf2?: number,
testf3?: number,
testarrayofstring2?: string[],
testarrayofsortedstruct?: AbilityT[],
flex?: number[],
test5?: TestT[],
vectorOfLongs?: bigint[],
vectorOfDoubles?: number[],
parentNamespaceTest?: InParentNamespaceT | null,
vectorOfReferrables?: ReferrableT[],
singleWeakReference?: bigint,
vectorOfWeakReferences?: bigint[],
vectorOfStrongReferrables?: ReferrableT[],
coOwningReference?: bigint,
vectorOfCoOwningReferences?: bigint[],
nonOwningReference?: bigint,
vectorOfNonOwningReferences?: bigint[],
anyUniqueType?: AnyUniqueAliases,
anyUnique?:
| MonsterT
| MyGame_Example2_MonsterT
| TestSimpleTableWithEnumT
| null,
anyAmbiguousType?: AnyAmbiguousAliases,
anyAmbiguous?: MonsterT | null,
vectorOfEnums?: Color[],
signedEnum?: Race,
testrequirednestedflatbuffer?: number[],
scalarKeySortedTables?: StatT[],
nativeInline?: TestT | null,
longEnumNonEnumDefault?: bigint,
longEnumNormalDefault?: bigint,
nanDefault?: number,
infDefault?: number,
positiveInfDefault?: number,
infinityDefault?: number,
positiveInfinityDefault?: number,
negativeInfDefault?: number,
negativeInfinityDefault?: number,
doubleInfDefault?: number,
);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,7 @@ import { InParentNamespace, InParentNamespaceT } from '../in-parent-namespace.js
*/
export class Monster implements flatbuffers.IUnpackableObject<MonsterT> {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos: number = 0;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Monster {
this.bb_pos = i;
this.bb = bb;
@@ -817,27 +817,27 @@ static getFullyQualifiedName(): "MyGame.Example.Monster" {
return 'MyGame.Example.Monster';
}
static startMonster(builder:flatbuffers.Builder):void {
static startMonster(builder:flatbuffers.Builder) {
builder.startObject(62);
}
static addPos(builder:flatbuffers.Builder, posOffset:flatbuffers.Offset):void {
static addPos(builder:flatbuffers.Builder, posOffset:flatbuffers.Offset) {
builder.addFieldStruct(0, posOffset, 0);
}
static addMana(builder:flatbuffers.Builder, mana:number):void {
static addMana(builder:flatbuffers.Builder, mana:number) {
builder.addFieldInt16(1, mana, 150);
}
static addHp(builder:flatbuffers.Builder, hp:number):void {
static addHp(builder:flatbuffers.Builder, hp:number) {
builder.addFieldInt16(2, hp, 100);
}
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset):void {
static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
builder.addFieldOffset(3, nameOffset, 0);
}
static addInventory(builder:flatbuffers.Builder, inventoryOffset:flatbuffers.Offset):void {
static addInventory(builder:flatbuffers.Builder, inventoryOffset:flatbuffers.Offset) {
builder.addFieldOffset(5, inventoryOffset, 0);
}
@@ -849,31 +849,31 @@ static createInventoryVector(builder:flatbuffers.Builder, data:number[]|Uint8Arr
return builder.endVector();
}
static startInventoryVector(builder:flatbuffers.Builder, numElems:number):void {
static startInventoryVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(1, numElems, 1);
}
static addColor(builder:flatbuffers.Builder, color:Color):void {
static addColor(builder:flatbuffers.Builder, color:Color) {
builder.addFieldInt8(6, color, Color.Blue);
}
static addTestType(builder:flatbuffers.Builder, testType:Any):void {
static addTestType(builder:flatbuffers.Builder, testType:Any) {
builder.addFieldInt8(7, testType, Any.NONE);
}
static addTest(builder:flatbuffers.Builder, testOffset:flatbuffers.Offset):void {
static addTest(builder:flatbuffers.Builder, testOffset:flatbuffers.Offset) {
builder.addFieldOffset(8, testOffset, 0);
}
static addTest4(builder:flatbuffers.Builder, test4Offset:flatbuffers.Offset):void {
static addTest4(builder:flatbuffers.Builder, test4Offset:flatbuffers.Offset) {
builder.addFieldOffset(9, test4Offset, 0);
}
static startTest4Vector(builder:flatbuffers.Builder, numElems:number):void {
static startTest4Vector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 2);
}
static addTestarrayofstring(builder:flatbuffers.Builder, testarrayofstringOffset:flatbuffers.Offset):void {
static addTestarrayofstring(builder:flatbuffers.Builder, testarrayofstringOffset:flatbuffers.Offset) {
builder.addFieldOffset(10, testarrayofstringOffset, 0);
}
@@ -885,11 +885,11 @@ static createTestarrayofstringVector(builder:flatbuffers.Builder, data:flatbuffe
return builder.endVector();
}
static startTestarrayofstringVector(builder:flatbuffers.Builder, numElems:number):void {
static startTestarrayofstringVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addTestarrayoftables(builder:flatbuffers.Builder, testarrayoftablesOffset:flatbuffers.Offset):void {
static addTestarrayoftables(builder:flatbuffers.Builder, testarrayoftablesOffset:flatbuffers.Offset) {
builder.addFieldOffset(11, testarrayoftablesOffset, 0);
}
@@ -901,15 +901,15 @@ static createTestarrayoftablesVector(builder:flatbuffers.Builder, data:flatbuffe
return builder.endVector();
}
static startTestarrayoftablesVector(builder:flatbuffers.Builder, numElems:number):void {
static startTestarrayoftablesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addEnemy(builder:flatbuffers.Builder, enemyOffset:flatbuffers.Offset):void {
static addEnemy(builder:flatbuffers.Builder, enemyOffset:flatbuffers.Offset) {
builder.addFieldOffset(12, enemyOffset, 0);
}
static addTestnestedflatbuffer(builder:flatbuffers.Builder, testnestedflatbufferOffset:flatbuffers.Offset):void {
static addTestnestedflatbuffer(builder:flatbuffers.Builder, testnestedflatbufferOffset:flatbuffers.Offset) {
builder.addFieldOffset(13, testnestedflatbufferOffset, 0);
}
@@ -921,51 +921,51 @@ static createTestnestedflatbufferVector(builder:flatbuffers.Builder, data:number
return builder.endVector();
}
static startTestnestedflatbufferVector(builder:flatbuffers.Builder, numElems:number):void {
static startTestnestedflatbufferVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(1, numElems, 1);
}
static addTestempty(builder:flatbuffers.Builder, testemptyOffset:flatbuffers.Offset):void {
static addTestempty(builder:flatbuffers.Builder, testemptyOffset:flatbuffers.Offset) {
builder.addFieldOffset(14, testemptyOffset, 0);
}
static addTestbool(builder:flatbuffers.Builder, testbool:boolean):void {
static addTestbool(builder:flatbuffers.Builder, testbool:boolean) {
builder.addFieldInt8(15, +testbool, +false);
}
static addTesthashs32Fnv1(builder:flatbuffers.Builder, testhashs32Fnv1:number):void {
static addTesthashs32Fnv1(builder:flatbuffers.Builder, testhashs32Fnv1:number) {
builder.addFieldInt32(16, testhashs32Fnv1, 0);
}
static addTesthashu32Fnv1(builder:flatbuffers.Builder, testhashu32Fnv1:number):void {
static addTesthashu32Fnv1(builder:flatbuffers.Builder, testhashu32Fnv1:number) {
builder.addFieldInt32(17, testhashu32Fnv1, 0);
}
static addTesthashs64Fnv1(builder:flatbuffers.Builder, testhashs64Fnv1:bigint):void {
static addTesthashs64Fnv1(builder:flatbuffers.Builder, testhashs64Fnv1:bigint) {
builder.addFieldInt64(18, testhashs64Fnv1, BigInt('0'));
}
static addTesthashu64Fnv1(builder:flatbuffers.Builder, testhashu64Fnv1:bigint):void {
static addTesthashu64Fnv1(builder:flatbuffers.Builder, testhashu64Fnv1:bigint) {
builder.addFieldInt64(19, testhashu64Fnv1, BigInt('0'));
}
static addTesthashs32Fnv1a(builder:flatbuffers.Builder, testhashs32Fnv1a:number):void {
static addTesthashs32Fnv1a(builder:flatbuffers.Builder, testhashs32Fnv1a:number) {
builder.addFieldInt32(20, testhashs32Fnv1a, 0);
}
static addTesthashu32Fnv1a(builder:flatbuffers.Builder, testhashu32Fnv1a:number):void {
static addTesthashu32Fnv1a(builder:flatbuffers.Builder, testhashu32Fnv1a:number) {
builder.addFieldInt32(21, testhashu32Fnv1a, 0);
}
static addTesthashs64Fnv1a(builder:flatbuffers.Builder, testhashs64Fnv1a:bigint):void {
static addTesthashs64Fnv1a(builder:flatbuffers.Builder, testhashs64Fnv1a:bigint) {
builder.addFieldInt64(22, testhashs64Fnv1a, BigInt('0'));
}
static addTesthashu64Fnv1a(builder:flatbuffers.Builder, testhashu64Fnv1a:bigint):void {
static addTesthashu64Fnv1a(builder:flatbuffers.Builder, testhashu64Fnv1a:bigint) {
builder.addFieldInt64(23, testhashu64Fnv1a, BigInt('0'));
}
static addTestarrayofbools(builder:flatbuffers.Builder, testarrayofboolsOffset:flatbuffers.Offset):void {
static addTestarrayofbools(builder:flatbuffers.Builder, testarrayofboolsOffset:flatbuffers.Offset) {
builder.addFieldOffset(24, testarrayofboolsOffset, 0);
}
@@ -977,23 +977,23 @@ static createTestarrayofboolsVector(builder:flatbuffers.Builder, data:boolean[])
return builder.endVector();
}
static startTestarrayofboolsVector(builder:flatbuffers.Builder, numElems:number):void {
static startTestarrayofboolsVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(1, numElems, 1);
}
static addTestf(builder:flatbuffers.Builder, testf:number):void {
static addTestf(builder:flatbuffers.Builder, testf:number) {
builder.addFieldFloat32(25, testf, 3.14159);
}
static addTestf2(builder:flatbuffers.Builder, testf2:number):void {
static addTestf2(builder:flatbuffers.Builder, testf2:number) {
builder.addFieldFloat32(26, testf2, 3.0);
}
static addTestf3(builder:flatbuffers.Builder, testf3:number):void {
static addTestf3(builder:flatbuffers.Builder, testf3:number) {
builder.addFieldFloat32(27, testf3, 0.0);
}
static addTestarrayofstring2(builder:flatbuffers.Builder, testarrayofstring2Offset:flatbuffers.Offset):void {
static addTestarrayofstring2(builder:flatbuffers.Builder, testarrayofstring2Offset:flatbuffers.Offset) {
builder.addFieldOffset(28, testarrayofstring2Offset, 0);
}
@@ -1005,19 +1005,19 @@ static createTestarrayofstring2Vector(builder:flatbuffers.Builder, data:flatbuff
return builder.endVector();
}
static startTestarrayofstring2Vector(builder:flatbuffers.Builder, numElems:number):void {
static startTestarrayofstring2Vector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addTestarrayofsortedstruct(builder:flatbuffers.Builder, testarrayofsortedstructOffset:flatbuffers.Offset):void {
static addTestarrayofsortedstruct(builder:flatbuffers.Builder, testarrayofsortedstructOffset:flatbuffers.Offset) {
builder.addFieldOffset(29, testarrayofsortedstructOffset, 0);
}
static startTestarrayofsortedstructVector(builder:flatbuffers.Builder, numElems:number):void {
static startTestarrayofsortedstructVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(8, numElems, 4);
}
static addFlex(builder:flatbuffers.Builder, flexOffset:flatbuffers.Offset):void {
static addFlex(builder:flatbuffers.Builder, flexOffset:flatbuffers.Offset) {
builder.addFieldOffset(30, flexOffset, 0);
}
@@ -1029,19 +1029,19 @@ static createFlexVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):f
return builder.endVector();
}
static startFlexVector(builder:flatbuffers.Builder, numElems:number):void {
static startFlexVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(1, numElems, 1);
}
static addTest5(builder:flatbuffers.Builder, test5Offset:flatbuffers.Offset):void {
static addTest5(builder:flatbuffers.Builder, test5Offset:flatbuffers.Offset) {
builder.addFieldOffset(31, test5Offset, 0);
}
static startTest5Vector(builder:flatbuffers.Builder, numElems:number):void {
static startTest5Vector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 2);
}
static addVectorOfLongs(builder:flatbuffers.Builder, vectorOfLongsOffset:flatbuffers.Offset):void {
static addVectorOfLongs(builder:flatbuffers.Builder, vectorOfLongsOffset:flatbuffers.Offset) {
builder.addFieldOffset(32, vectorOfLongsOffset, 0);
}
@@ -1053,11 +1053,11 @@ static createVectorOfLongsVector(builder:flatbuffers.Builder, data:bigint[]):fla
return builder.endVector();
}
static startVectorOfLongsVector(builder:flatbuffers.Builder, numElems:number):void {
static startVectorOfLongsVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(8, numElems, 8);
}
static addVectorOfDoubles(builder:flatbuffers.Builder, vectorOfDoublesOffset:flatbuffers.Offset):void {
static addVectorOfDoubles(builder:flatbuffers.Builder, vectorOfDoublesOffset:flatbuffers.Offset) {
builder.addFieldOffset(33, vectorOfDoublesOffset, 0);
}
@@ -1074,15 +1074,15 @@ static createVectorOfDoublesVector(builder:flatbuffers.Builder, data:number[]|Fl
return builder.endVector();
}
static startVectorOfDoublesVector(builder:flatbuffers.Builder, numElems:number):void {
static startVectorOfDoublesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(8, numElems, 8);
}
static addParentNamespaceTest(builder:flatbuffers.Builder, parentNamespaceTestOffset:flatbuffers.Offset):void {
static addParentNamespaceTest(builder:flatbuffers.Builder, parentNamespaceTestOffset:flatbuffers.Offset) {
builder.addFieldOffset(34, parentNamespaceTestOffset, 0);
}
static addVectorOfReferrables(builder:flatbuffers.Builder, vectorOfReferrablesOffset:flatbuffers.Offset):void {
static addVectorOfReferrables(builder:flatbuffers.Builder, vectorOfReferrablesOffset:flatbuffers.Offset) {
builder.addFieldOffset(35, vectorOfReferrablesOffset, 0);
}
@@ -1094,15 +1094,15 @@ static createVectorOfReferrablesVector(builder:flatbuffers.Builder, data:flatbuf
return builder.endVector();
}
static startVectorOfReferrablesVector(builder:flatbuffers.Builder, numElems:number):void {
static startVectorOfReferrablesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addSingleWeakReference(builder:flatbuffers.Builder, singleWeakReference:bigint):void {
static addSingleWeakReference(builder:flatbuffers.Builder, singleWeakReference:bigint) {
builder.addFieldInt64(36, singleWeakReference, BigInt('0'));
}
static addVectorOfWeakReferences(builder:flatbuffers.Builder, vectorOfWeakReferencesOffset:flatbuffers.Offset):void {
static addVectorOfWeakReferences(builder:flatbuffers.Builder, vectorOfWeakReferencesOffset:flatbuffers.Offset) {
builder.addFieldOffset(37, vectorOfWeakReferencesOffset, 0);
}
@@ -1114,11 +1114,11 @@ static createVectorOfWeakReferencesVector(builder:flatbuffers.Builder, data:bigi
return builder.endVector();
}
static startVectorOfWeakReferencesVector(builder:flatbuffers.Builder, numElems:number):void {
static startVectorOfWeakReferencesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(8, numElems, 8);
}
static addVectorOfStrongReferrables(builder:flatbuffers.Builder, vectorOfStrongReferrablesOffset:flatbuffers.Offset):void {
static addVectorOfStrongReferrables(builder:flatbuffers.Builder, vectorOfStrongReferrablesOffset:flatbuffers.Offset) {
builder.addFieldOffset(38, vectorOfStrongReferrablesOffset, 0);
}
@@ -1130,15 +1130,15 @@ static createVectorOfStrongReferrablesVector(builder:flatbuffers.Builder, data:f
return builder.endVector();
}
static startVectorOfStrongReferrablesVector(builder:flatbuffers.Builder, numElems:number):void {
static startVectorOfStrongReferrablesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addCoOwningReference(builder:flatbuffers.Builder, coOwningReference:bigint):void {
static addCoOwningReference(builder:flatbuffers.Builder, coOwningReference:bigint) {
builder.addFieldInt64(39, coOwningReference, BigInt('0'));
}
static addVectorOfCoOwningReferences(builder:flatbuffers.Builder, vectorOfCoOwningReferencesOffset:flatbuffers.Offset):void {
static addVectorOfCoOwningReferences(builder:flatbuffers.Builder, vectorOfCoOwningReferencesOffset:flatbuffers.Offset) {
builder.addFieldOffset(40, vectorOfCoOwningReferencesOffset, 0);
}
@@ -1150,15 +1150,15 @@ static createVectorOfCoOwningReferencesVector(builder:flatbuffers.Builder, data:
return builder.endVector();
}
static startVectorOfCoOwningReferencesVector(builder:flatbuffers.Builder, numElems:number):void {
static startVectorOfCoOwningReferencesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(8, numElems, 8);
}
static addNonOwningReference(builder:flatbuffers.Builder, nonOwningReference:bigint):void {
static addNonOwningReference(builder:flatbuffers.Builder, nonOwningReference:bigint) {
builder.addFieldInt64(41, nonOwningReference, BigInt('0'));
}
static addVectorOfNonOwningReferences(builder:flatbuffers.Builder, vectorOfNonOwningReferencesOffset:flatbuffers.Offset):void {
static addVectorOfNonOwningReferences(builder:flatbuffers.Builder, vectorOfNonOwningReferencesOffset:flatbuffers.Offset) {
builder.addFieldOffset(42, vectorOfNonOwningReferencesOffset, 0);
}
@@ -1170,27 +1170,27 @@ static createVectorOfNonOwningReferencesVector(builder:flatbuffers.Builder, data
return builder.endVector();
}
static startVectorOfNonOwningReferencesVector(builder:flatbuffers.Builder, numElems:number):void {
static startVectorOfNonOwningReferencesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(8, numElems, 8);
}
static addAnyUniqueType(builder:flatbuffers.Builder, anyUniqueType:AnyUniqueAliases):void {
static addAnyUniqueType(builder:flatbuffers.Builder, anyUniqueType:AnyUniqueAliases) {
builder.addFieldInt8(43, anyUniqueType, AnyUniqueAliases.NONE);
}
static addAnyUnique(builder:flatbuffers.Builder, anyUniqueOffset:flatbuffers.Offset):void {
static addAnyUnique(builder:flatbuffers.Builder, anyUniqueOffset:flatbuffers.Offset) {
builder.addFieldOffset(44, anyUniqueOffset, 0);
}
static addAnyAmbiguousType(builder:flatbuffers.Builder, anyAmbiguousType:AnyAmbiguousAliases):void {
static addAnyAmbiguousType(builder:flatbuffers.Builder, anyAmbiguousType:AnyAmbiguousAliases) {
builder.addFieldInt8(45, anyAmbiguousType, AnyAmbiguousAliases.NONE);
}
static addAnyAmbiguous(builder:flatbuffers.Builder, anyAmbiguousOffset:flatbuffers.Offset):void {
static addAnyAmbiguous(builder:flatbuffers.Builder, anyAmbiguousOffset:flatbuffers.Offset) {
builder.addFieldOffset(46, anyAmbiguousOffset, 0);
}
static addVectorOfEnums(builder:flatbuffers.Builder, vectorOfEnumsOffset:flatbuffers.Offset):void {
static addVectorOfEnums(builder:flatbuffers.Builder, vectorOfEnumsOffset:flatbuffers.Offset) {
builder.addFieldOffset(47, vectorOfEnumsOffset, 0);
}
@@ -1202,15 +1202,15 @@ static createVectorOfEnumsVector(builder:flatbuffers.Builder, data:Color[]):flat
return builder.endVector();
}
static startVectorOfEnumsVector(builder:flatbuffers.Builder, numElems:number):void {
static startVectorOfEnumsVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(1, numElems, 1);
}
static addSignedEnum(builder:flatbuffers.Builder, signedEnum:Race):void {
static addSignedEnum(builder:flatbuffers.Builder, signedEnum:Race) {
builder.addFieldInt8(48, signedEnum, Race.None);
}
static addTestrequirednestedflatbuffer(builder:flatbuffers.Builder, testrequirednestedflatbufferOffset:flatbuffers.Offset):void {
static addTestrequirednestedflatbuffer(builder:flatbuffers.Builder, testrequirednestedflatbufferOffset:flatbuffers.Offset) {
builder.addFieldOffset(49, testrequirednestedflatbufferOffset, 0);
}
@@ -1222,11 +1222,11 @@ static createTestrequirednestedflatbufferVector(builder:flatbuffers.Builder, dat
return builder.endVector();
}
static startTestrequirednestedflatbufferVector(builder:flatbuffers.Builder, numElems:number):void {
static startTestrequirednestedflatbufferVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(1, numElems, 1);
}
static addScalarKeySortedTables(builder:flatbuffers.Builder, scalarKeySortedTablesOffset:flatbuffers.Offset):void {
static addScalarKeySortedTables(builder:flatbuffers.Builder, scalarKeySortedTablesOffset:flatbuffers.Offset) {
builder.addFieldOffset(50, scalarKeySortedTablesOffset, 0);
}
@@ -1238,51 +1238,51 @@ static createScalarKeySortedTablesVector(builder:flatbuffers.Builder, data:flatb
return builder.endVector();
}
static startScalarKeySortedTablesVector(builder:flatbuffers.Builder, numElems:number):void {
static startScalarKeySortedTablesVector(builder:flatbuffers.Builder, numElems:number) {
builder.startVector(4, numElems, 4);
}
static addNativeInline(builder:flatbuffers.Builder, nativeInlineOffset:flatbuffers.Offset):void {
static addNativeInline(builder:flatbuffers.Builder, nativeInlineOffset:flatbuffers.Offset) {
builder.addFieldStruct(51, nativeInlineOffset, 0);
}
static addLongEnumNonEnumDefault(builder:flatbuffers.Builder, longEnumNonEnumDefault:bigint):void {
static addLongEnumNonEnumDefault(builder:flatbuffers.Builder, longEnumNonEnumDefault:bigint) {
builder.addFieldInt64(52, longEnumNonEnumDefault, BigInt('0'));
}
static addLongEnumNormalDefault(builder:flatbuffers.Builder, longEnumNormalDefault:bigint):void {
static addLongEnumNormalDefault(builder:flatbuffers.Builder, longEnumNormalDefault:bigint) {
builder.addFieldInt64(53, longEnumNormalDefault, BigInt('2'));
}
static addNanDefault(builder:flatbuffers.Builder, nanDefault:number):void {
static addNanDefault(builder:flatbuffers.Builder, nanDefault:number) {
builder.addFieldFloat32(54, nanDefault, NaN);
}
static addInfDefault(builder:flatbuffers.Builder, infDefault:number):void {
static addInfDefault(builder:flatbuffers.Builder, infDefault:number) {
builder.addFieldFloat32(55, infDefault, Infinity);
}
static addPositiveInfDefault(builder:flatbuffers.Builder, positiveInfDefault:number):void {
static addPositiveInfDefault(builder:flatbuffers.Builder, positiveInfDefault:number) {
builder.addFieldFloat32(56, positiveInfDefault, Infinity);
}
static addInfinityDefault(builder:flatbuffers.Builder, infinityDefault:number):void {
static addInfinityDefault(builder:flatbuffers.Builder, infinityDefault:number) {
builder.addFieldFloat32(57, infinityDefault, Infinity);
}
static addPositiveInfinityDefault(builder:flatbuffers.Builder, positiveInfinityDefault:number):void {
static addPositiveInfinityDefault(builder:flatbuffers.Builder, positiveInfinityDefault:number) {
builder.addFieldFloat32(58, positiveInfinityDefault, Infinity);
}
static addNegativeInfDefault(builder:flatbuffers.Builder, negativeInfDefault:number):void {
static addNegativeInfDefault(builder:flatbuffers.Builder, negativeInfDefault:number) {
builder.addFieldFloat32(59, negativeInfDefault, -Infinity);
}
static addNegativeInfinityDefault(builder:flatbuffers.Builder, negativeInfinityDefault:number):void {
static addNegativeInfinityDefault(builder:flatbuffers.Builder, negativeInfinityDefault:number) {
builder.addFieldFloat32(60, negativeInfinityDefault, -Infinity);
}
static addDoubleInfDefault(builder:flatbuffers.Builder, doubleInfDefault:number):void {
static addDoubleInfDefault(builder:flatbuffers.Builder, doubleInfDefault:number) {
builder.addFieldFloat64(61, doubleInfDefault, Infinity);
}
@@ -1292,11 +1292,11 @@ static endMonster(builder:flatbuffers.Builder):flatbuffers.Offset {
return offset;
}
static finishMonsterBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset):void {
static finishMonsterBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
builder.finish(offset, 'MONS');
}
static finishSizePrefixedMonsterBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset):void {
static finishSizePrefixedMonsterBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
builder.finish(offset, 'MONS', true);
}

View File

@@ -1,6 +1,6 @@
export declare enum Race {
None = -1,
Human = 0,
Dwarf = 1,
Elf = 2
None = -1,
Human = 0,
Dwarf = 1,
Elf = 2,
}

View File

@@ -1,9 +1,10 @@
// 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 */
export var Race;
(function (Race) {
Race[Race["None"] = -1] = "None";
Race[Race["Human"] = 0] = "Human";
Race[Race["Dwarf"] = 1] = "Dwarf";
Race[Race["Elf"] = 2] = "Elf";
(function(Race) {
Race[Race['None'] = -1] = 'None';
Race[Race['Human'] = 0] = 'Human';
Race[Race['Dwarf'] = 1] = 'Dwarf';
Race[Race['Elf'] = 2] = 'Elf';
})(Race || (Race = {}));

View File

@@ -1,24 +1,35 @@
import * as flatbuffers from 'flatbuffers';
export declare class Referrable implements flatbuffers.IUnpackableObject<ReferrableT> {
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): Referrable;
static getRootAsReferrable(bb: flatbuffers.ByteBuffer, obj?: Referrable): Referrable;
static getSizePrefixedRootAsReferrable(bb: flatbuffers.ByteBuffer, obj?: Referrable): Referrable;
id(): bigint;
mutate_id(value: bigint): boolean;
static getFullyQualifiedName(): "MyGame.Example.Referrable";
static startReferrable(builder: flatbuffers.Builder): void;
static addId(builder: flatbuffers.Builder, id: bigint): void;
static endReferrable(builder: flatbuffers.Builder): flatbuffers.Offset;
static createReferrable(builder: flatbuffers.Builder, id: bigint): flatbuffers.Offset;
serialize(): Uint8Array;
static deserialize(buffer: Uint8Array): Referrable;
unpack(): ReferrableT;
unpackTo(_o: ReferrableT): void;
export declare class Referrable
implements flatbuffers.IUnpackableObject<ReferrableT>
{
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): Referrable;
static getRootAsReferrable(
bb: flatbuffers.ByteBuffer,
obj?: Referrable,
): Referrable;
static getSizePrefixedRootAsReferrable(
bb: flatbuffers.ByteBuffer,
obj?: Referrable,
): Referrable;
id(): bigint;
mutate_id(value: bigint): boolean;
static getFullyQualifiedName(): string;
static startReferrable(builder: flatbuffers.Builder): void;
static addId(builder: flatbuffers.Builder, id: bigint): void;
static endReferrable(builder: flatbuffers.Builder): flatbuffers.Offset;
static createReferrable(
builder: flatbuffers.Builder,
id: bigint,
): flatbuffers.Offset;
serialize(): Uint8Array;
static deserialize(buffer: Uint8Array): Referrable;
unpack(): ReferrableT;
unpackTo(_o: ReferrableT): void;
}
export declare class ReferrableT implements flatbuffers.IGeneratedObject {
id: bigint;
constructor(id?: bigint);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
id: bigint;
constructor(id?: bigint);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

@@ -1,71 +1,74 @@
// 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';
export class Referrable {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsReferrable(bb, obj) {
return (obj || new Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsReferrable(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
id() {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
}
mutate_id(value) {
const offset = this.bb.__offset(this.bb_pos, 4);
if (offset === 0) {
return false;
}
this.bb.writeUint64(this.bb_pos + offset, value);
return true;
}
static getFullyQualifiedName() {
return 'MyGame.Example.Referrable';
}
static startReferrable(builder) {
builder.startObject(1);
}
static addId(builder, id) {
builder.addFieldInt64(0, id, BigInt('0'));
}
static endReferrable(builder) {
const offset = builder.endObject();
return offset;
}
static createReferrable(builder, id) {
Referrable.startReferrable(builder);
Referrable.addId(builder, id);
return Referrable.endReferrable(builder);
}
serialize() {
return this.bb.bytes();
}
static deserialize(buffer) {
return Referrable.getRootAsReferrable(new flatbuffers.ByteBuffer(buffer));
}
unpack() {
return new ReferrableT(this.id());
}
unpackTo(_o) {
_o.id = this.id();
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsReferrable(bb, obj) {
return (obj || new Referrable())
.__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsReferrable(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Referrable())
.__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
id() {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
}
mutate_id(value) {
const offset = this.bb.__offset(this.bb_pos, 4);
if (offset === 0) {
return false;
}
this.bb.writeUint64(this.bb_pos + offset, value);
return true;
}
static getFullyQualifiedName() {
return 'MyGame.Example.Referrable';
}
static startReferrable(builder) {
builder.startObject(1);
}
static addId(builder, id) {
builder.addFieldInt64(0, id, BigInt('0'));
}
static endReferrable(builder) {
const offset = builder.endObject();
return offset;
}
static createReferrable(builder, id) {
Referrable.startReferrable(builder);
Referrable.addId(builder, id);
return Referrable.endReferrable(builder);
}
serialize() {
return this.bb.bytes();
}
static deserialize(buffer) {
return Referrable.getRootAsReferrable(new flatbuffers.ByteBuffer(buffer));
}
unpack() {
return new ReferrableT(this.id());
}
unpackTo(_o) {
_o.id = this.id();
}
}
export class ReferrableT {
constructor(id = BigInt('0')) {
this.id = id;
}
pack(builder) {
return Referrable.createReferrable(builder, this.id);
}
constructor(id = BigInt('0')) {
this.id = id;
}
pack(builder) {
return Referrable.createReferrable(builder, this.id);
}
}

View File

@@ -8,7 +8,7 @@ import * as flatbuffers from 'flatbuffers';
export class Referrable implements flatbuffers.IUnpackableObject<ReferrableT> {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos: number = 0;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Referrable {
this.bb_pos = i;
this.bb = bb;
@@ -44,11 +44,11 @@ static getFullyQualifiedName(): "MyGame.Example.Referrable" {
return 'MyGame.Example.Referrable';
}
static startReferrable(builder:flatbuffers.Builder):void {
static startReferrable(builder:flatbuffers.Builder) {
builder.startObject(1);
}
static addId(builder:flatbuffers.Builder, id:bigint):void {
static addId(builder:flatbuffers.Builder, id:bigint) {
builder.addFieldInt64(0, id, BigInt('0'));
}

View File

@@ -1,32 +1,43 @@
import * as flatbuffers from 'flatbuffers';
export declare class Stat implements flatbuffers.IUnpackableObject<StatT> {
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): Stat;
static getRootAsStat(bb: flatbuffers.ByteBuffer, obj?: Stat): Stat;
static getSizePrefixedRootAsStat(bb: flatbuffers.ByteBuffer, obj?: Stat): Stat;
id(): string | null;
id(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
val(): bigint;
mutate_val(value: bigint): boolean;
count(): number;
mutate_count(value: number): boolean;
static getFullyQualifiedName(): "MyGame.Example.Stat";
static startStat(builder: flatbuffers.Builder): void;
static addId(builder: flatbuffers.Builder, idOffset: flatbuffers.Offset): void;
static addVal(builder: flatbuffers.Builder, val: bigint): void;
static addCount(builder: flatbuffers.Builder, count: number): void;
static endStat(builder: flatbuffers.Builder): flatbuffers.Offset;
static createStat(builder: flatbuffers.Builder, idOffset: flatbuffers.Offset, val: bigint, count: number): flatbuffers.Offset;
serialize(): Uint8Array;
static deserialize(buffer: Uint8Array): Stat;
unpack(): StatT;
unpackTo(_o: StatT): void;
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): Stat;
static getRootAsStat(bb: flatbuffers.ByteBuffer, obj?: Stat): Stat;
static getSizePrefixedRootAsStat(
bb: flatbuffers.ByteBuffer,
obj?: Stat,
): Stat;
id(): string | null;
id(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
val(): bigint;
mutate_val(value: bigint): boolean;
count(): number;
mutate_count(value: number): boolean;
static getFullyQualifiedName(): string;
static startStat(builder: flatbuffers.Builder): void;
static addId(
builder: flatbuffers.Builder,
idOffset: flatbuffers.Offset,
): void;
static addVal(builder: flatbuffers.Builder, val: bigint): void;
static addCount(builder: flatbuffers.Builder, count: number): void;
static endStat(builder: flatbuffers.Builder): flatbuffers.Offset;
static createStat(
builder: flatbuffers.Builder,
idOffset: flatbuffers.Offset,
val: bigint,
count: number,
): flatbuffers.Offset;
serialize(): Uint8Array;
static deserialize(buffer: Uint8Array): Stat;
unpack(): StatT;
unpackTo(_o: StatT): void;
}
export declare class StatT implements flatbuffers.IGeneratedObject {
id: string | Uint8Array | null;
val: bigint;
count: number;
constructor(id?: string | Uint8Array | null, val?: bigint, count?: number);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
id: string | Uint8Array | null;
val: bigint;
count: number;
constructor(id?: string | Uint8Array | null, val?: bigint, count?: number);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

@@ -1,100 +1,104 @@
// 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';
export class Stat {
constructor() {
this.bb = null;
this.bb_pos = 0;
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsStat(bb, obj) {
return (obj || new Stat())
.__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsStat(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Stat())
.__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
id(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) :
null;
}
val() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
}
mutate_val(value) {
const offset = this.bb.__offset(this.bb_pos, 6);
if (offset === 0) {
return false;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
static getRootAsStat(bb, obj) {
return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getSizePrefixedRootAsStat(bb, obj) {
bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
id(optionalEncoding) {
const offset = this.bb.__offset(this.bb_pos, 4);
return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
}
val() {
const offset = this.bb.__offset(this.bb_pos, 6);
return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
}
mutate_val(value) {
const offset = this.bb.__offset(this.bb_pos, 6);
if (offset === 0) {
return false;
}
this.bb.writeInt64(this.bb_pos + offset, value);
return true;
}
count() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
}
mutate_count(value) {
const offset = this.bb.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb.writeUint16(this.bb_pos + offset, value);
return true;
}
static getFullyQualifiedName() {
return 'MyGame.Example.Stat';
}
static startStat(builder) {
builder.startObject(3);
}
static addId(builder, idOffset) {
builder.addFieldOffset(0, idOffset, 0);
}
static addVal(builder, val) {
builder.addFieldInt64(1, val, BigInt('0'));
}
static addCount(builder, count) {
builder.addFieldInt16(2, count, 0);
}
static endStat(builder) {
const offset = builder.endObject();
return offset;
}
static createStat(builder, idOffset, val, count) {
Stat.startStat(builder);
Stat.addId(builder, idOffset);
Stat.addVal(builder, val);
Stat.addCount(builder, count);
return Stat.endStat(builder);
}
serialize() {
return this.bb.bytes();
}
static deserialize(buffer) {
return Stat.getRootAsStat(new flatbuffers.ByteBuffer(buffer));
}
unpack() {
return new StatT(this.id(), this.val(), this.count());
}
unpackTo(_o) {
_o.id = this.id();
_o.val = this.val();
_o.count = this.count();
this.bb.writeInt64(this.bb_pos + offset, value);
return true;
}
count() {
const offset = this.bb.__offset(this.bb_pos, 8);
return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
}
mutate_count(value) {
const offset = this.bb.__offset(this.bb_pos, 8);
if (offset === 0) {
return false;
}
this.bb.writeUint16(this.bb_pos + offset, value);
return true;
}
static getFullyQualifiedName() {
return 'MyGame.Example.Stat';
}
static startStat(builder) {
builder.startObject(3);
}
static addId(builder, idOffset) {
builder.addFieldOffset(0, idOffset, 0);
}
static addVal(builder, val) {
builder.addFieldInt64(1, val, BigInt('0'));
}
static addCount(builder, count) {
builder.addFieldInt16(2, count, 0);
}
static endStat(builder) {
const offset = builder.endObject();
return offset;
}
static createStat(builder, idOffset, val, count) {
Stat.startStat(builder);
Stat.addId(builder, idOffset);
Stat.addVal(builder, val);
Stat.addCount(builder, count);
return Stat.endStat(builder);
}
serialize() {
return this.bb.bytes();
}
static deserialize(buffer) {
return Stat.getRootAsStat(new flatbuffers.ByteBuffer(buffer));
}
unpack() {
return new StatT(this.id(), this.val(), this.count());
}
unpackTo(_o) {
_o.id = this.id();
_o.val = this.val();
_o.count = this.count();
}
}
export class StatT {
constructor(id = null, val = BigInt('0'), count = 0) {
this.id = id;
this.val = val;
this.count = count;
}
pack(builder) {
const id = (this.id !== null ? builder.createString(this.id) : 0);
return Stat.createStat(builder, id, this.val, this.count);
}
constructor(id = null, val = BigInt('0'), count = 0) {
this.id = id;
this.val = val;
this.count = count;
}
pack(builder) {
const id = (this.id !== null ? builder.createString(this.id) : 0);
return Stat.createStat(builder, id, this.val, this.count);
}
}

View File

@@ -8,7 +8,7 @@ import * as flatbuffers from 'flatbuffers';
export class Stat implements flatbuffers.IUnpackableObject<StatT> {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos: number = 0;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):Stat {
this.bb_pos = i;
this.bb = bb;
@@ -67,19 +67,19 @@ static getFullyQualifiedName(): "MyGame.Example.Stat" {
return 'MyGame.Example.Stat';
}
static startStat(builder:flatbuffers.Builder):void {
static startStat(builder:flatbuffers.Builder) {
builder.startObject(3);
}
static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset):void {
static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) {
builder.addFieldOffset(0, idOffset, 0);
}
static addVal(builder:flatbuffers.Builder, val:bigint):void {
static addVal(builder:flatbuffers.Builder, val:bigint) {
builder.addFieldInt64(1, val, BigInt('0'));
}
static addCount(builder:flatbuffers.Builder, count:number):void {
static addCount(builder:flatbuffers.Builder, count:number) {
builder.addFieldInt16(2, count, 0);
}

View File

@@ -1,18 +1,33 @@
import * as flatbuffers from 'flatbuffers';
import { StructOfStructs, StructOfStructsT } from './struct-of-structs.js';
export declare class StructOfStructsOfStructs implements flatbuffers.IUnpackableObject<StructOfStructsOfStructsT> {
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): StructOfStructsOfStructs;
a(obj?: StructOfStructs): StructOfStructs | null;
static getFullyQualifiedName(): "MyGame.Example.StructOfStructsOfStructs";
static sizeOf(): number;
static createStructOfStructsOfStructs(builder: flatbuffers.Builder, a_a_id: number, a_a_distance: number, a_b_a: number, a_b_b: number, a_c_id: number, a_c_distance: number): flatbuffers.Offset;
unpack(): StructOfStructsOfStructsT;
unpackTo(_o: StructOfStructsOfStructsT): void;
import {
StructOfStructs,
StructOfStructsT,
} from '../../my-game/example/struct-of-structs.js';
export declare class StructOfStructsOfStructs
implements flatbuffers.IUnpackableObject<StructOfStructsOfStructsT>
{
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): StructOfStructsOfStructs;
a(obj?: StructOfStructs): StructOfStructs | null;
static getFullyQualifiedName(): string;
static sizeOf(): number;
static createStructOfStructsOfStructs(
builder: flatbuffers.Builder,
a_a_id: number,
a_a_distance: number,
a_b_a: number,
a_b_b: number,
a_c_id: number,
a_c_distance: number,
): flatbuffers.Offset;
unpack(): StructOfStructsOfStructsT;
unpackTo(_o: StructOfStructsOfStructsT): void;
}
export declare class StructOfStructsOfStructsT implements flatbuffers.IGeneratedObject {
a: StructOfStructsT | null;
constructor(a?: StructOfStructsT | null);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
export declare class StructOfStructsOfStructsT
implements flatbuffers.IGeneratedObject
{
a: StructOfStructsT | null;
constructor(a?: StructOfStructsT | null);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

@@ -1,51 +1,56 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { StructOfStructs } from './struct-of-structs.js';
import {StructOfStructs} from '../../my-game/example/struct-of-structs.js';
export class StructOfStructsOfStructs {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
a(obj) {
return (obj || new StructOfStructs()).__init(this.bb_pos, this.bb);
}
static getFullyQualifiedName() {
return 'MyGame.Example.StructOfStructsOfStructs';
}
static sizeOf() {
return 20;
}
static createStructOfStructsOfStructs(builder, a_a_id, a_a_distance, a_b_a, a_b_b, a_c_id, a_c_distance) {
builder.prep(4, 20);
builder.prep(4, 20);
builder.prep(4, 8);
builder.writeInt32(a_c_distance);
builder.writeInt32(a_c_id);
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(a_b_b);
builder.writeInt16(a_b_a);
builder.prep(4, 8);
builder.writeInt32(a_a_distance);
builder.writeInt32(a_a_id);
return builder.offset();
}
unpack() {
return new StructOfStructsOfStructsT((this.a() !== null ? this.a().unpack() : null));
}
unpackTo(_o) {
_o.a = (this.a() !== null ? this.a().unpack() : null);
}
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
a(obj) {
return (obj || new StructOfStructs()).__init(this.bb_pos, this.bb);
}
static getFullyQualifiedName() {
return 'MyGame.Example.StructOfStructsOfStructs';
}
static sizeOf() {
return 20;
}
static createStructOfStructsOfStructs(
builder, a_a_id, a_a_distance, a_b_a, a_b_b, a_c_id, a_c_distance) {
builder.prep(4, 20);
builder.prep(4, 20);
builder.prep(4, 8);
builder.writeInt32(a_c_distance);
builder.writeInt32(a_c_id);
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(a_b_b);
builder.writeInt16(a_b_a);
builder.prep(4, 8);
builder.writeInt32(a_a_distance);
builder.writeInt32(a_a_id);
return builder.offset();
}
unpack() {
return new StructOfStructsOfStructsT(
(this.a() !== null ? this.a().unpack() : null));
}
unpackTo(_o) {
_o.a = (this.a() !== null ? this.a().unpack() : null);
}
}
export class StructOfStructsOfStructsT {
constructor(a = null) {
this.a = a;
}
pack(builder) {
return StructOfStructsOfStructs.createStructOfStructsOfStructs(builder, (this.a?.a?.id ?? 0), (this.a?.a?.distance ?? 0), (this.a?.b?.a ?? 0), (this.a?.b?.b ?? 0), (this.a?.c?.id ?? 0), (this.a?.c?.distance ?? 0));
}
constructor(a = null) {
this.a = a;
}
pack(builder) {
return StructOfStructsOfStructs.createStructOfStructsOfStructs(
builder, (this.a?.a?.id ?? 0), (this.a?.a?.distance ?? 0),
(this.a?.b?.a ?? 0), (this.a?.b?.b ?? 0), (this.a?.c?.id ?? 0),
(this.a?.c?.distance ?? 0));
}
}

View File

@@ -9,7 +9,7 @@ import { StructOfStructs, StructOfStructsT } from './struct-of-structs.js';
export class StructOfStructsOfStructs implements flatbuffers.IUnpackableObject<StructOfStructsOfStructsT> {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos: number = 0;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructsOfStructs {
this.bb_pos = i;
this.bb = bb;

View File

@@ -1,23 +1,33 @@
import * as flatbuffers from 'flatbuffers';
import { Ability, AbilityT } from './ability.js';
import { Test, TestT } from './test.js';
export declare class StructOfStructs implements flatbuffers.IUnpackableObject<StructOfStructsT> {
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): StructOfStructs;
a(obj?: Ability): Ability | null;
b(obj?: Test): Test | null;
c(obj?: Ability): Ability | null;
static getFullyQualifiedName(): "MyGame.Example.StructOfStructs";
static sizeOf(): number;
static createStructOfStructs(builder: flatbuffers.Builder, a_id: number, a_distance: number, b_a: number, b_b: number, c_id: number, c_distance: number): flatbuffers.Offset;
unpack(): StructOfStructsT;
unpackTo(_o: StructOfStructsT): void;
import {Ability, AbilityT} from '../../my-game/example/ability.js';
import {Test, TestT} from '../../my-game/example/test.js';
export declare class StructOfStructs
implements flatbuffers.IUnpackableObject<StructOfStructsT>
{
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): StructOfStructs;
a(obj?: Ability): Ability | null;
b(obj?: Test): Test | null;
c(obj?: Ability): Ability | null;
static getFullyQualifiedName(): string;
static sizeOf(): number;
static createStructOfStructs(
builder: flatbuffers.Builder,
a_id: number,
a_distance: number,
b_a: number,
b_b: number,
c_id: number,
c_distance: number,
): flatbuffers.Offset;
unpack(): StructOfStructsT;
unpackTo(_o: StructOfStructsT): void;
}
export declare class StructOfStructsT implements flatbuffers.IGeneratedObject {
a: AbilityT | null;
b: TestT | null;
c: AbilityT | null;
constructor(a?: AbilityT | null, b?: TestT | null, c?: AbilityT | null);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
a: AbilityT | null;
b: TestT | null;
c: AbilityT | null;
constructor(a?: AbilityT | null, b?: TestT | null, c?: AbilityT | null);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

View File

@@ -1,61 +1,67 @@
// automatically generated by the FlatBuffers compiler, do not modify
import { Ability } from './ability.js';
import { Test } from './test.js';
import {Ability} from '../../my-game/example/ability.js';
import {Test} from '../../my-game/example/test.js';
export class StructOfStructs {
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
a(obj) {
return (obj || new Ability()).__init(this.bb_pos, this.bb);
}
b(obj) {
return (obj || new Test()).__init(this.bb_pos + 8, this.bb);
}
c(obj) {
return (obj || new Ability()).__init(this.bb_pos + 12, this.bb);
}
static getFullyQualifiedName() {
return 'MyGame.Example.StructOfStructs';
}
static sizeOf() {
return 20;
}
static createStructOfStructs(builder, a_id, a_distance, b_a, b_b, c_id, c_distance) {
builder.prep(4, 20);
builder.prep(4, 8);
builder.writeInt32(c_distance);
builder.writeInt32(c_id);
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(b_b);
builder.writeInt16(b_a);
builder.prep(4, 8);
builder.writeInt32(a_distance);
builder.writeInt32(a_id);
return builder.offset();
}
unpack() {
return new StructOfStructsT((this.a() !== null ? this.a().unpack() : null), (this.b() !== null ? this.b().unpack() : null), (this.c() !== null ? this.c().unpack() : null));
}
unpackTo(_o) {
_o.a = (this.a() !== null ? this.a().unpack() : null);
_o.b = (this.b() !== null ? this.b().unpack() : null);
_o.c = (this.c() !== null ? this.c().unpack() : null);
}
constructor() {
this.bb = null;
this.bb_pos = 0;
}
__init(i, bb) {
this.bb_pos = i;
this.bb = bb;
return this;
}
a(obj) {
return (obj || new Ability()).__init(this.bb_pos, this.bb);
}
b(obj) {
return (obj || new Test()).__init(this.bb_pos + 8, this.bb);
}
c(obj) {
return (obj || new Ability()).__init(this.bb_pos + 12, this.bb);
}
static getFullyQualifiedName() {
return 'MyGame.Example.StructOfStructs';
}
static sizeOf() {
return 20;
}
static createStructOfStructs(
builder, a_id, a_distance, b_a, b_b, c_id, c_distance) {
builder.prep(4, 20);
builder.prep(4, 8);
builder.writeInt32(c_distance);
builder.writeInt32(c_id);
builder.prep(2, 4);
builder.pad(1);
builder.writeInt8(b_b);
builder.writeInt16(b_a);
builder.prep(4, 8);
builder.writeInt32(a_distance);
builder.writeInt32(a_id);
return builder.offset();
}
unpack() {
return new StructOfStructsT(
(this.a() !== null ? this.a().unpack() : null),
(this.b() !== null ? this.b().unpack() : null),
(this.c() !== null ? this.c().unpack() : null));
}
unpackTo(_o) {
_o.a = (this.a() !== null ? this.a().unpack() : null);
_o.b = (this.b() !== null ? this.b().unpack() : null);
_o.c = (this.c() !== null ? this.c().unpack() : null);
}
}
export class StructOfStructsT {
constructor(a = null, b = null, c = null) {
this.a = a;
this.b = b;
this.c = c;
}
pack(builder) {
return StructOfStructs.createStructOfStructs(builder, (this.a?.id ?? 0), (this.a?.distance ?? 0), (this.b?.a ?? 0), (this.b?.b ?? 0), (this.c?.id ?? 0), (this.c?.distance ?? 0));
}
constructor(a = null, b = null, c = null) {
this.a = a;
this.b = b;
this.c = c;
}
pack(builder) {
return StructOfStructs.createStructOfStructs(
builder, (this.a?.id ?? 0), (this.a?.distance ?? 0), (this.b?.a ?? 0),
(this.b?.b ?? 0), (this.c?.id ?? 0), (this.c?.distance ?? 0));
}
}

View File

@@ -10,7 +10,7 @@ import { Test, TestT } from './test.js';
export class StructOfStructs implements flatbuffers.IUnpackableObject<StructOfStructsT> {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos: number = 0;
bb_pos = 0;
__init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructs {
this.bb_pos = i;
this.bb = bb;

View File

@@ -1,25 +1,40 @@
import * as flatbuffers from 'flatbuffers';
import { Color } from './color.js';
export declare class TestSimpleTableWithEnum implements flatbuffers.IUnpackableObject<TestSimpleTableWithEnumT> {
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): TestSimpleTableWithEnum;
static getRootAsTestSimpleTableWithEnum(bb: flatbuffers.ByteBuffer, obj?: TestSimpleTableWithEnum): TestSimpleTableWithEnum;
static getSizePrefixedRootAsTestSimpleTableWithEnum(bb: flatbuffers.ByteBuffer, obj?: TestSimpleTableWithEnum): TestSimpleTableWithEnum;
color(): Color;
mutate_color(value: Color): boolean;
static getFullyQualifiedName(): "MyGame.Example.TestSimpleTableWithEnum";
static startTestSimpleTableWithEnum(builder: flatbuffers.Builder): void;
static addColor(builder: flatbuffers.Builder, color: Color): void;
static endTestSimpleTableWithEnum(builder: flatbuffers.Builder): flatbuffers.Offset;
static createTestSimpleTableWithEnum(builder: flatbuffers.Builder, color: Color): flatbuffers.Offset;
serialize(): Uint8Array;
static deserialize(buffer: Uint8Array): TestSimpleTableWithEnum;
unpack(): TestSimpleTableWithEnumT;
unpackTo(_o: TestSimpleTableWithEnumT): void;
import {Color} from '../../my-game/example/color.js';
export declare class TestSimpleTableWithEnum
implements flatbuffers.IUnpackableObject<TestSimpleTableWithEnumT>
{
bb: flatbuffers.ByteBuffer | null;
bb_pos: number;
__init(i: number, bb: flatbuffers.ByteBuffer): TestSimpleTableWithEnum;
static getRootAsTestSimpleTableWithEnum(
bb: flatbuffers.ByteBuffer,
obj?: TestSimpleTableWithEnum,
): TestSimpleTableWithEnum;
static getSizePrefixedRootAsTestSimpleTableWithEnum(
bb: flatbuffers.ByteBuffer,
obj?: TestSimpleTableWithEnum,
): TestSimpleTableWithEnum;
color(): Color;
mutate_color(value: Color): boolean;
static getFullyQualifiedName(): string;
static startTestSimpleTableWithEnum(builder: flatbuffers.Builder): void;
static addColor(builder: flatbuffers.Builder, color: Color): void;
static endTestSimpleTableWithEnum(
builder: flatbuffers.Builder,
): flatbuffers.Offset;
static createTestSimpleTableWithEnum(
builder: flatbuffers.Builder,
color: Color,
): flatbuffers.Offset;
serialize(): Uint8Array;
static deserialize(buffer: Uint8Array): TestSimpleTableWithEnum;
unpack(): TestSimpleTableWithEnumT;
unpackTo(_o: TestSimpleTableWithEnumT): void;
}
export declare class TestSimpleTableWithEnumT implements flatbuffers.IGeneratedObject {
color: Color;
constructor(color?: Color);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
export declare class TestSimpleTableWithEnumT
implements flatbuffers.IGeneratedObject
{
color: Color;
constructor(color?: Color);
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
}

Some files were not shown because too many files have changed in this diff Show More