Squashed 'third_party/flatbuffers/' changes from e5f331db9..bc44fad35
bc44fad35 UnPackTo disable merge by default (#7527)
4fca4dc60 [TS/JS] Move TS tests to dedicated folder and deps upgrade (#7508)
036032373 Bump junit from 4.13 to 4.13.1 in /java (#7526)
89dfb43f3 Replace `bash JavaTest.sh` with `mvn test` (#7500)
c49aff4b6 enabled cpp17 tests in CI (#7524)
56e60223c prevent force_align attribute on enums (#7523)
89b1f5aa1 remove travis config (#7522)
b90159823 [Java][Flexbuffers] Add API to add nullables into the buffer. (#7521)
8cdc6a288 Install BuildFlatBuffers.cmake (#7519)
a67e35aff Moves all of the swift test code into tests/swift (#7509)
f124e41ae Updated Readme
4c954181c [Java][FlexBuffers] throwing exception for untyped fixed vectors (#7507)
7f7547737 [Android] Remove maven dependency of flatbuffers and use source folder (#7503)
a79d61ea8 Fixes issue with cocoapods failing to be published because of docc (#7505)
d465b39c3 [CMake]: fix breaking find_package change (#7499) (#7502)
c5a609dc2 [C#] Prepares for official Nuget release (#7496)
5634dc3d0 [ISSUE-6268] returns NaN insteadof nan (#7498)
37e37b8ca Updates cocoapods version (#7497)
8fd4534fb update android multidex setting (#7495)
d5427da52 Disable Android Build (#7494)
06c5c7ed0 FlatBuffers Version 2.0.8 (#7492)
b190ce11b Verifier Refinements (#7490)
bf5d23230 Namer applied to Typescript generator (#7488)
ce382d6dd [TS/JS] Add rollup and config to generate iife flatbuffers bundle (#7449)
41d9add7e C++: Add option to skip verifying nested flatbuffers (#7489)
6a8742754 [C++] support native_inline attribute for vector of tables (#7479)
694add668 Refactor test.cpp (#7487)
7edf8c908 Update scorecard to 1.1.2
b86387442 Fix typos (#7483)
e2eb5ee67 Include <array> head in stl_emulation.h (#7480)
994502b6d Version number in file package.json updated to 2.0.7 (#7476)
fa41e8367 [C++] Fixed crash when copying table with empty shared strings (#7477)
799cc8f7b Use type traits for specialization (#7475)
b7eb44147 Disable RTTI and rework use in idl_gen_ts.cpp (#7474)
8d01c5859 CMake project version detection made more robust (#7473)
237e8b71f Moved compiler warnings around (#7471)
eeb8fd60d Include builder.addOffset for vector of structs (#7470)
fef2ffc4d Use schema include name for keep-prefix (#7469)
8367664f1 Flatbuffers Version 2.0.7 (#7462)
d6f06c33f Reworked keep prefix (#7456)
627e8bf36 update grpc version (#7457)
883c42b7d disabling unpackto optimization (#7459)
7aae0af30 Remove old GRPC bash script and convert to python3 (#7454)
b057aa917 Grouped anonymous namespaces together, (#7455)
f1b26ff7f Change to GetTypeName (#7453)
9610a666b Generate SLSA signatures for Released zip files (#7450)
1e0f75a64 [WIP] speedup (#7452)
82b75407a Wrap types in namespace for --ts-flat-files and --gen-all (#7451)
f7c511957 Audit and fixups for GCC and Clang (#7212)
a66de58af Partial support for --ts-flat-files and --gen-all (#7446)
a3508f36d [Kotlin] Make sure namespace path exist for code generation (#7357)
137fec716 Stop using __has_trivial_copy on recent clang versions. (#7443)
214125e41 [C#] Rework how sorted vectors are looked up (#7441)
44a7dc999 Define minimum buffer size (#7440)
3cc2daa78 make_span overloads for pointer to vector (#7374) (#7435)
fa1174aa7 [TypeScript] Fix namespaceless schema generation (#7432)
83d4e2a10 Add checks to verifier (#7438)
8a09f3fb0 Fix FlexBuffers JS/TS bug https://github.com/google/flatbuffers/issues/6934 (#7434)
9dbe819ef Add flatc python tests to CI (#7437)
67c414958 Update TypeScriptTest.py to work better cross platform (#7436)
8b8c7dbdf Update gitingore to reflect name change (#7431)
2ee20a5f3 Remove auto including locale functions (#7430)
4be605604 [C++] Set StructDef::has_key property when deserializing from binary schema (#7386) (#7428)
fc5d86f1e [C++] Make template parameter in stl_emulation.h more explicit to avoid conflicts with cpprestsdk U macro (#7424)
9dce287ad Issue#6959 :Updated Automatically generated rust files. (#7425)
7798be3bb avoid zero-as-null-pointer warning (#7423)
966362e07 [C++] Vector of Tables equality (#7415)
a89c279ed [golang] Perform keyword escaping after case conversion (#7421)
a212b3c03 Turn of fail fast for C++ CI
9230f600d Remove stringop-overflow from error (#7422)
c79362156 [golang] Add support for text parsing with json struct tags (#7353)
ee2ced236 Moved TypeScriptTests to python script (#7411)
468c00a3f Rebased: grpc/compiler: Respect filename suffix and extension during code generation (#7414)
47c757f71 Add tests for flatc (#7405)
9a5ff8900 Add FLATBUFFERS_STRICT_MODE (#7408)
950444a34 [TS] Use TextEncoder and TextDecoder (#7400)
30d76198c Compilation issue msys2 #7399 (#7409)
cce3a66f0 Delete .travis directory
8d1cc6ac7 Revert "Compilation issue msys2 (#7403)" (#7407)
5b207639a Update readme.md
359e0f9d6 Revert "grpc/compiler: Respect filename suffix and extension during code generation (#7343)" (#7406)
ebbed0513 Delete cpp-linter.yml
aa395e5a5 (#7323) Rename CMake files according to project name (#7378)
32328075d Fix error msg format when generate GRPC failed (#7350)
97e89c5ac grpc/compiler: Respect filename suffix and extension during code generation (#7343)
5f6672be4 Fix Clang-Cl compile on Windows (#7308)
28e858c85 [TS/Bazel] Minor improvements to typescript.bzl (#7300)
987bebe67 [TS] fix incorrect reverse when writting array of structs (#7271)
ec0129369 Fix FlexBuffers Verifier tracking vectors reuse at wrong offset
50dd385b3 Add missing const (#7401)
da702cfd8 Compilation issue msys2 (#7403)
6e2791640 keep-prefix keeps relative pathing (#7394)
52fce5e53 fix(#7360): grpc used deprecated functions (#7361)
b7f13cd8e cpp_generator: comment out unused parameter to avoid warnings (#7381)
e42985e5a Updated Newtonsoft.Json to 13.0.1 (#7393)
0a8064637 Fix references to LICENSE file (#7377)
b9eea76a8 [Dart] Implement putBool to fix errors when serializing structs with bools (#7359)
1b9030015 Bump Newtonsoft.Json from 12.0.3 to 13.0.1 in /tests/FlatBuffers.Test (#7363)
83a43fc79 Reenable optional json (#7352)
5f0137602 Only include direct included filed (#7348)
9a1913a87 Revert "Implement optional scalars for JSON (#7322)" (#7351)
b4647beb8 Revert "Move reflection_ts_fbs into a separate directory (#7342)" (#7349)
d6060977a Remove asserting in verifier for flattests
987aa5b5e move -Wextra-semi to GCC 8.0+
42acdb63c [TS] Don't generate self-imports with --ts-flat-file (#7340)
0cc1aeb8c [golang] Create missing namespace directory structure (#7324) (#7325)
ba6c67170 [Kotlin] Remove download benchmark files dependency (#7314)
d2f33fc45 Disable Android on Linux CI build
0d1b72cbc [TS] fix ts import path issue (#7298)
9fce2fbf2 replace io/ioutil to os (#7281)
a18ea40d6 Implement optional scalars for JSON (#7322)
090caa280 Move reflection_ts_fbs into a separate directory (#7342)
49e1ea333 Implement optional scalars for Python (#7318)
11a198870 Started implementation for private flags in rust (#7269)
967df08b1 Adds full supposed for Wasm in the swift lib (#7328)
9aa08a429 Use keep case for Rust union discriminant type. (#7321)
9e8c758f5 Add explicit return types to lobster generated code (#7312)
74a25536b Add size check to fix out of bounds read risk (#7304)
12917af8a Update Rust docs page (#7296)
1ea2472f7 [swift] add had<ArrayName> property for arrays to check presence in a message (#7280)
0fe13cb28 Remove span ConstIterator/cbegin()/cend(). (#7295)
385dddc66 Namerkot (#7245)
750dde766 Make `flatc` generate Rust files not requiring `std` (#7273)
9917a168c [swift] Make swift module public (#7274)
76d3cca19 Rust: fix a name conflict when building with "no_std" feature (#7268)
c86e6d0e3 json inf parsing
d34dc32c2 fix include order
234d86c92 fixed off-by-one in parser
746c73b91 Add Annotations for Monster schema and example buffer
0bbfd4b2e fixes for annotator
716521953 Update readme.md (#7257)
a45f564cf [performance] Add aggressive systematic inlining in ByteBuffer and FlatBufferBuilder (#7253)
9d45a6403 more google merge fixes
ccfb4c20b Handle +/-inf in protos (#7256)
7bcd857b8 Specialize CreateVector with std::initializer_list (#7254)
23c8ab34c Swift update performance benchmark infrastructure (#7255)
70002dc5c various fixes for google merge
6e0e79f24 Add test for nested buffer verifier (#7252)
b856368d7 Turn off go modules temporary until we get a proper fix (#7251)
e37156a30 Keep the underlying storage capacity when clearing the FlatBufferBuilder. Gives a significant performance boost for serialisation of many small messages. (#7250)
a10b0e546 Java namer variable keep case (#7249)
275b73994 allow overriding FLATBUFFERS_MAX_ALIGNMENT
9d1ce9a10 Add parameter back to EndVector (#7246)
79afe6c3d Make Java namespaces keep case by default (#7243)
c6dbb2230 Add write permissions for labeller
18bacd3ea Expand test to make sure {}-initializers are properly understood by template. (#7242)
a2c913aec Add -Wnon-virtual-dtor
67b33b294 set workflows permissions to read-only (#7239)
7b5fd2bd0 [Kotlin] Fix key lookup returning null clashing with default value (#7237)
7181d7770 [Java] Fix key lookup returning null clashing with default value (#7236)
7f663b120 Allow CreateVectorOfStrings() to work with any string-type. (#7238)
173ebb694 Fixes a bug where the create function doesnt optional + required items (#7228)
d65823948 [Kotlin] Update gradle to 7.4.1 and simplify config files. (#7231)
ab4bf59e8 remove toascii (#7234)
eee44bbb2 disable cpp-linter (#7229)
a63fa51a1 Create cpp-linter.yml (#7208)
2049e5210 Adds a way to verify/exposes Entities ids (#7221)
832c618f5 Adds implementation flag for swift (#7202)
14615699f Started to migrate to target_compile_options (#7222)
20aad0c41 [C++] stl_emulation span::count_ is not const anymore (#7226) (#7227)
f083b33f2 code gen flexbuffer verifier (#7207)
bf17df346 [C++] generate sorted #include directives (#7213)
35281dedb Fix for [C++] flatc generates invalid Code in the default constructor for structs, when --cpp-field-case-style is used #7209 (#7211)
c9651b742 Add overloads for C# ByteBuffer/FlatBufferBuilder to allow adding vector blocks from ArraySegments or IntPtr (#7193)
26c3b3ada Update codeql.yml
da6e1b985 Update codeql.yml
ad27d751e Added Oss fuzz badge
0aab623cb Create codeql.yml
6a446bdd8 maximize parallel builds in CI (#7206)
21fb5cbbc Create scorecards.yml
0da6f9486 [C++] Static assert on Flatbuffers Version (#7203)
59e971308 reduce fuzzing time to 1 minute in CI
40866a892 fixed padding in struct for annotated binary (#7199)
b71d968fa Apply Namer prefix/suffix to other generators (#7197)
fac0d7be0 Apply Namer to Java. (#7194)
6c5603fd9 [C#] Fix collision of field name and type name (#7149)
2d21853a7 monster fuzzer fix for json default scalars
fec1a8d01 [swift] Add bazel configuration for Swift (#7195)
7fd857623 structured comments (#7192)
a4cb1599d Namerdart (#7187)
ae4ce7265 fuzzed binary annotator (#7188)
e2be0c0b0 Handle root offset and root table vtable invalidation (#7177)
2ad408697 [TS] Fix generation of struct members in object api (#7148)
4213d9105 VerifySizePrefixed (reflection::Schema) and GetAnySizePrefixedRoot added (#7181)
5a13f622c Correctly parse lists of enums in Dart generated code (#7157)
23a7e4e0b Adds no-includes flags to the swift code generator (#7182)
eeb49c275 Move flatbuffer_ts_library to typescript.bzl (#7183)
824763b31 Typo in flatc options (warning-as-errors instead of warnings-as-errors) (#7180)
d3aeee32b Annotated Flatbuffer Binary (#7174)
0bceba24d [Lua] Apply Namer to Lua (#7171)
b8c77d404 Make inclusion of header <optional> opt-out via macro (#7168)
8468eab83 Namersw (#7167)
2b2e8d4ae Nameroverloads (#7164)
b80b32bfa Use DESCRIPTION only if CMake version >= 3.9 (#7166)
Change-Id: Ic2681dabb1a798b7515e62753ee06aecb9933260
git-subtree-dir: third_party/flatbuffers
git-subtree-split: bc44fad35271e43fd7a79b4d691ac9e41708797f
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/tests/BUILD.bazel b/tests/BUILD.bazel
index 11af9b4..3330bfc 100644
--- a/tests/BUILD.bazel
+++ b/tests/BUILD.bazel
@@ -1,5 +1,5 @@
load("@rules_cc//cc:defs.bzl", "cc_test")
-load("//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_ts_library")
+load("//:build_defs.bzl", "flatbuffer_cc_library")
package(default_visibility = ["//visibility:private"])
@@ -8,20 +8,42 @@
name = "flatbuffers_test",
testonly = 1,
srcs = [
+ "evolution_test.cpp",
+ "evolution_test.h",
"evolution_test/evolution_v1_generated.h",
"evolution_test/evolution_v2_generated.h",
+ "flexbuffers_test.cpp",
+ "flexbuffers_test.h",
+ "fuzz_test.cpp",
+ "fuzz_test.h",
+ "is_quiet_nan.h",
+ "json_test.cpp",
+ "json_test.h",
+ "monster_test.cpp",
+ "monster_test.h",
"monster_test_bfbs_generated.h",
"namespace_test/namespace_test1_generated.h",
"namespace_test/namespace_test2_generated.h",
+ "native_inline_table_test_generated.h",
"native_type_test_impl.cpp",
"native_type_test_impl.h",
"optional_scalars_generated.h",
+ "optional_scalars_test.cpp",
+ "optional_scalars_test.h",
+ "parser_test.cpp",
+ "parser_test.h",
+ "proto_test.cpp",
+ "proto_test.h",
+ "reflection_test.cpp",
+ "reflection_test.h",
"test.cpp",
"test_assert.cpp",
"test_assert.h",
"test_builder.cpp",
"test_builder.h",
"union_vector/union_vector_generated.h",
+ "util_test.cpp",
+ "util_test.h",
],
copts = [
"-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
@@ -49,6 +71,8 @@
":name_clash_test/valid_test2.fbs",
":native_type_test.fbs",
":optional_scalars.fbs",
+ ":optional_scalars.json",
+ ":optional_scalars_defaults.json",
":prototest/imported.proto",
":prototest/test.golden",
":prototest/test.proto",
@@ -190,12 +214,3 @@
"--cpp-ptr-type flatbuffers::unique_ptr",
],
)
-
-flatbuffer_ts_library(
- name = "typescript_ts_fbs",
- srcs = ["typescript_keywords.fbs"],
- deps = [
- "//tests/test_dir:include_ts_fbs",
- "//tests/test_dir:typescript_transitive_ts_fbs",
- ],
-)
diff --git a/tests/DartTest.sh b/tests/DartTest.sh
index 36d1b14..e2ac6c7 100755
--- a/tests/DartTest.sh
+++ b/tests/DartTest.sh
@@ -25,6 +25,9 @@
cd ../dart
+../flatc --dart --gen-object-api -o ./test ./test/list_of_enums.fbs
+../flatc --dart --gen-object-api -o ./test ./test/bool_structs.fbs
+
# update packages
dart pub get
# Execute the sample.
diff --git a/tests/DictionaryLookup/LongFloatEntry.java b/tests/DictionaryLookup/LongFloatEntry.java
new file mode 100644
index 0000000..0419f79
--- /dev/null
+++ b/tests/DictionaryLookup/LongFloatEntry.java
@@ -0,0 +1,75 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+package DictionaryLookup;
+
+import java.nio.*;
+import java.lang.*;
+import java.util.*;
+import com.google.flatbuffers.*;
+
+@SuppressWarnings("unused")
+public final class LongFloatEntry extends Table {
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
+ public static LongFloatEntry getRootAsLongFloatEntry(ByteBuffer _bb) { return getRootAsLongFloatEntry(_bb, new LongFloatEntry()); }
+ public static LongFloatEntry getRootAsLongFloatEntry(ByteBuffer _bb, LongFloatEntry obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
+ public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
+ public LongFloatEntry __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
+
+ public long key() { int o = __offset(4); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
+ public float value() { int o = __offset(6); return o != 0 ? bb.getFloat(o + bb_pos) : 0.0f; }
+
+ public static int createLongFloatEntry(FlatBufferBuilder builder,
+ long key,
+ float value) {
+ builder.startTable(2);
+ LongFloatEntry.addKey(builder, key);
+ LongFloatEntry.addValue(builder, value);
+ return LongFloatEntry.endLongFloatEntry(builder);
+ }
+
+ public static void startLongFloatEntry(FlatBufferBuilder builder) { builder.startTable(2); }
+ public static void addKey(FlatBufferBuilder builder, long key) { builder.addLong(key); builder.slot(0); }
+ public static void addValue(FlatBufferBuilder builder, float value) { builder.addFloat(1, value, 0.0f); }
+ public static int endLongFloatEntry(FlatBufferBuilder builder) {
+ int o = builder.endTable();
+ return o;
+ }
+
+ @Override
+ protected int keysCompare(Integer o1, Integer o2, ByteBuffer _bb) {
+ long val_1 = _bb.getLong(__offset(4, o1, _bb));
+ long val_2 = _bb.getLong(__offset(4, o2, _bb));
+ return val_1 > val_2 ? 1 : val_1 < val_2 ? -1 : 0;
+ }
+
+ public static LongFloatEntry __lookup_by_key(LongFloatEntry obj, int vectorLocation, long key, ByteBuffer bb) {
+ int span = bb.getInt(vectorLocation - 4);
+ int start = 0;
+ while (span != 0) {
+ int middle = span / 2;
+ int tableOffset = __indirect(vectorLocation + 4 * (start + middle), bb);
+ long val = bb.getLong(__offset(4, bb.capacity() - tableOffset, bb));
+ int comp = val > key ? 1 : val < key ? -1 : 0;
+ if (comp > 0) {
+ span = middle;
+ } else if (comp < 0) {
+ middle++;
+ start += middle;
+ span -= middle;
+ } else {
+ return (obj == null ? new LongFloatEntry() : obj).__assign(tableOffset, bb);
+ }
+ }
+ return null;
+ }
+
+ public static final class Vector extends BaseVector {
+ public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
+
+ public LongFloatEntry get(int j) { return get(new LongFloatEntry(), j); }
+ public LongFloatEntry get(LongFloatEntry obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
+ public LongFloatEntry getByKey(long key) { return __lookup_by_key(null, __vector(), key, bb); }
+ public LongFloatEntry getByKey(LongFloatEntry obj, long key) { return __lookup_by_key(obj, __vector(), key, bb); }
+ }
+}
+
diff --git a/tests/DictionaryLookup/LongFloatEntry.kt b/tests/DictionaryLookup/LongFloatEntry.kt
new file mode 100644
index 0000000..6b1e500
--- /dev/null
+++ b/tests/DictionaryLookup/LongFloatEntry.kt
@@ -0,0 +1,80 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+package DictionaryLookup
+
+import java.nio.*
+import kotlin.math.sign
+import com.google.flatbuffers.*
+
+@Suppress("unused")
+class LongFloatEntry : Table() {
+
+ fun __init(_i: Int, _bb: ByteBuffer) {
+ __reset(_i, _bb)
+ }
+ fun __assign(_i: Int, _bb: ByteBuffer) : LongFloatEntry {
+ __init(_i, _bb)
+ return this
+ }
+ val key : Long
+ get() {
+ val o = __offset(4)
+ return if(o != 0) bb.getLong(o + bb_pos) else 0L
+ }
+ val value : Float
+ get() {
+ val o = __offset(6)
+ return if(o != 0) bb.getFloat(o + bb_pos) else 0.0f
+ }
+ override fun keysCompare(o1: Int, o2: Int, _bb: ByteBuffer) : Int {
+ val val_1 = _bb.getLong(__offset(4, o1, _bb))
+ val val_2 = _bb.getLong(__offset(4, o2, _bb))
+ return (val_1 - val_2).sign
+ }
+ companion object {
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
+ fun getRootAsLongFloatEntry(_bb: ByteBuffer): LongFloatEntry = getRootAsLongFloatEntry(_bb, LongFloatEntry())
+ fun getRootAsLongFloatEntry(_bb: ByteBuffer, obj: LongFloatEntry): LongFloatEntry {
+ _bb.order(ByteOrder.LITTLE_ENDIAN)
+ return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
+ }
+ fun createLongFloatEntry(builder: FlatBufferBuilder, key: Long, value: Float) : Int {
+ builder.startTable(2)
+ addKey(builder, key)
+ addValue(builder, value)
+ return endLongFloatEntry(builder)
+ }
+ fun startLongFloatEntry(builder: FlatBufferBuilder) = builder.startTable(2)
+ fun addKey(builder: FlatBufferBuilder, key: Long) {
+ builder.addLong(key)
+ builder.slot(0)
+ }
+ fun addValue(builder: FlatBufferBuilder, value: Float) = builder.addFloat(1, value, 0.0)
+ fun endLongFloatEntry(builder: FlatBufferBuilder) : Int {
+ val o = builder.endTable()
+ return o
+ }
+ fun __lookup_by_key(obj: LongFloatEntry?, vectorLocation: Int, key: Long, bb: ByteBuffer) : LongFloatEntry? {
+ var span = bb.getInt(vectorLocation - 4)
+ var start = 0
+ while (span != 0) {
+ var middle = span / 2
+ val tableOffset = __indirect(vectorLocation + 4 * (start + middle), bb)
+ val value = bb.getLong(__offset(4, bb.capacity() - tableOffset, bb))
+ val comp = value.compareTo(key)
+ when {
+ comp > 0 -> span = middle
+ comp < 0 -> {
+ middle++
+ start += middle
+ span -= middle
+ }
+ else -> {
+ return (obj ?: LongFloatEntry()).__assign(tableOffset, bb)
+ }
+ }
+ }
+ return null
+ }
+ }
+}
diff --git a/tests/DictionaryLookup/LongFloatMap.java b/tests/DictionaryLookup/LongFloatMap.java
new file mode 100644
index 0000000..9cc3500
--- /dev/null
+++ b/tests/DictionaryLookup/LongFloatMap.java
@@ -0,0 +1,51 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+package DictionaryLookup;
+
+import java.nio.*;
+import java.lang.*;
+import java.util.*;
+import com.google.flatbuffers.*;
+
+@SuppressWarnings("unused")
+public final class LongFloatMap extends Table {
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
+ public static LongFloatMap getRootAsLongFloatMap(ByteBuffer _bb) { return getRootAsLongFloatMap(_bb, new LongFloatMap()); }
+ public static LongFloatMap getRootAsLongFloatMap(ByteBuffer _bb, LongFloatMap obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
+ public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
+ public LongFloatMap __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
+
+ public DictionaryLookup.LongFloatEntry entries(int j) { return entries(new DictionaryLookup.LongFloatEntry(), j); }
+ public DictionaryLookup.LongFloatEntry entries(DictionaryLookup.LongFloatEntry obj, int j) { int o = __offset(4); return o != 0 ? obj.__assign(__indirect(__vector(o) + j * 4), bb) : null; }
+ public int entriesLength() { int o = __offset(4); return o != 0 ? __vector_len(o) : 0; }
+ public DictionaryLookup.LongFloatEntry entriesByKey(long key) { int o = __offset(4); return o != 0 ? DictionaryLookup.LongFloatEntry.__lookup_by_key(null, __vector(o), key, bb) : null; }
+ public DictionaryLookup.LongFloatEntry entriesByKey(DictionaryLookup.LongFloatEntry obj, long key) { int o = __offset(4); return o != 0 ? DictionaryLookup.LongFloatEntry.__lookup_by_key(obj, __vector(o), key, bb) : null; }
+ public DictionaryLookup.LongFloatEntry.Vector entriesVector() { return entriesVector(new DictionaryLookup.LongFloatEntry.Vector()); }
+ public DictionaryLookup.LongFloatEntry.Vector entriesVector(DictionaryLookup.LongFloatEntry.Vector obj) { int o = __offset(4); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; }
+
+ public static int createLongFloatMap(FlatBufferBuilder builder,
+ int entriesOffset) {
+ builder.startTable(1);
+ LongFloatMap.addEntries(builder, entriesOffset);
+ return LongFloatMap.endLongFloatMap(builder);
+ }
+
+ public static void startLongFloatMap(FlatBufferBuilder builder) { builder.startTable(1); }
+ public static void addEntries(FlatBufferBuilder builder, int entriesOffset) { builder.addOffset(0, entriesOffset, 0); }
+ public static int createEntriesVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); }
+ public static void startEntriesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); }
+ public static int endLongFloatMap(FlatBufferBuilder builder) {
+ int o = builder.endTable();
+ return o;
+ }
+ public static void finishLongFloatMapBuffer(FlatBufferBuilder builder, int offset) { builder.finish(offset); }
+ public static void finishSizePrefixedLongFloatMapBuffer(FlatBufferBuilder builder, int offset) { builder.finishSizePrefixed(offset); }
+
+ public static final class Vector extends BaseVector {
+ public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
+
+ public LongFloatMap get(int j) { return get(new LongFloatMap(), j); }
+ public LongFloatMap get(LongFloatMap obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); }
+ }
+}
+
diff --git a/tests/DictionaryLookup/LongFloatMap.kt b/tests/DictionaryLookup/LongFloatMap.kt
new file mode 100644
index 0000000..3ac15aa
--- /dev/null
+++ b/tests/DictionaryLookup/LongFloatMap.kt
@@ -0,0 +1,77 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+package DictionaryLookup
+
+import java.nio.*
+import kotlin.math.sign
+import com.google.flatbuffers.*
+
+@Suppress("unused")
+class LongFloatMap : Table() {
+
+ fun __init(_i: Int, _bb: ByteBuffer) {
+ __reset(_i, _bb)
+ }
+ fun __assign(_i: Int, _bb: ByteBuffer) : LongFloatMap {
+ __init(_i, _bb)
+ return this
+ }
+ fun entries(j: Int) : DictionaryLookup.LongFloatEntry? = entries(DictionaryLookup.LongFloatEntry(), j)
+ fun entries(obj: DictionaryLookup.LongFloatEntry, j: Int) : DictionaryLookup.LongFloatEntry? {
+ val o = __offset(4)
+ return if (o != 0) {
+ obj.__assign(__indirect(__vector(o) + j * 4), bb)
+ } else {
+ null
+ }
+ }
+ val entriesLength : Int
+ get() {
+ val o = __offset(4); return if (o != 0) __vector_len(o) else 0
+ }
+ fun entriesByKey(key: Long) : DictionaryLookup.LongFloatEntry? {
+ val o = __offset(4)
+ return if (o != 0) {
+ DictionaryLookup.LongFloatEntry.__lookup_by_key(null, __vector(o), key, bb)
+ } else {
+ null
+ }
+ }
+ fun entriesByKey(obj: DictionaryLookup.LongFloatEntry, key: Long) : DictionaryLookup.LongFloatEntry? {
+ val o = __offset(4)
+ return if (o != 0) {
+ DictionaryLookup.LongFloatEntry.__lookup_by_key(obj, __vector(o), key, bb)
+ } else {
+ null
+ }
+ }
+ companion object {
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
+ fun getRootAsLongFloatMap(_bb: ByteBuffer): LongFloatMap = getRootAsLongFloatMap(_bb, LongFloatMap())
+ fun getRootAsLongFloatMap(_bb: ByteBuffer, obj: LongFloatMap): LongFloatMap {
+ _bb.order(ByteOrder.LITTLE_ENDIAN)
+ return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb))
+ }
+ fun createLongFloatMap(builder: FlatBufferBuilder, entriesOffset: Int) : Int {
+ builder.startTable(1)
+ addEntries(builder, entriesOffset)
+ return endLongFloatMap(builder)
+ }
+ fun startLongFloatMap(builder: FlatBufferBuilder) = builder.startTable(1)
+ fun addEntries(builder: FlatBufferBuilder, entries: Int) = builder.addOffset(0, entries, 0)
+ fun createEntriesVector(builder: FlatBufferBuilder, data: IntArray) : Int {
+ builder.startVector(4, data.size, 4)
+ for (i in data.size - 1 downTo 0) {
+ builder.addOffset(data[i])
+ }
+ return builder.endVector()
+ }
+ fun startEntriesVector(builder: FlatBufferBuilder, numElems: Int) = builder.startVector(4, numElems, 4)
+ fun endLongFloatMap(builder: FlatBufferBuilder) : Int {
+ val o = builder.endTable()
+ return o
+ }
+ fun finishLongFloatMapBuffer(builder: FlatBufferBuilder, offset: Int) = builder.finish(offset)
+ fun finishSizePrefixedLongFloatMapBuffer(builder: FlatBufferBuilder, offset: Int) = builder.finishSizePrefixed(offset)
+ }
+}
diff --git a/tests/FlatBuffers.Benchmarks.swift/Sources/FlatBuffers.Benchmarks.swift/main.swift b/tests/FlatBuffers.Benchmarks.swift/Sources/FlatBuffers.Benchmarks.swift/main.swift
deleted file mode 100644
index 4949004..0000000
--- a/tests/FlatBuffers.Benchmarks.swift/Sources/FlatBuffers.Benchmarks.swift/main.swift
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright 2021 Google Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import CoreFoundation
-import FlatBuffers
-
-struct Benchmark {
- var name: String
- var value: Double
-
- var description: String {
- "\(String(format: "|\t%@\t\t|\t\t%fs\t|", name, value))"}
-}
-
-func run(name: String, runs: Int, action: () -> Void) -> Benchmark {
- action()
- let start = CFAbsoluteTimeGetCurrent()
- for _ in 0..<runs {
- action()
- }
- let ends = CFAbsoluteTimeGetCurrent()
- let value = Double(ends - start) / Double(runs)
- print("done \(name): in \(value)")
- return Benchmark(name: name, value: value)
-}
-
-
-func createDocument(Benchmarks: [Benchmark]) -> String {
- let separator = "-------------------------------------"
- var document = "\(separator)\n"
- document += "\(String(format: "|\t%@\t\t |\t\t%@\t\t|", "Name", "Scores"))\n"
- document += "\(separator)\n"
- for i in Benchmarks {
- document += "\(i.description) \n"
- document += "\(separator)\n"
- }
- return document
-}
-
-@inlinable
-func create10Strings() {
- var fb = FlatBufferBuilder(initialSize: 1<<20)
- for _ in 0..<10_000 {
- _ = fb.create(string: "foobarbaz")
- }
-}
-
-@inlinable
-func create100Strings(str: String) {
- var fb = FlatBufferBuilder(initialSize: 1<<20)
- for _ in 0..<10_000 {
- _ = fb.create(string: str)
- }
-}
-
-@inlinable
-func benchmarkFiveHundredAdds() {
- var fb = FlatBufferBuilder(initialSize: 1024 * 1024 * 32)
- for _ in 0..<500_000 {
- let off = fb.create(string: "T")
- let s = fb.startTable(with: 4)
- fb.add(element: 3.2, def: 0, at: 2)
- fb.add(element: 4.2, def: 0, at: 4)
- fb.add(element: 5.2, def: 0, at: 6)
- fb.add(offset: off, at: 8)
- _ = fb.endTable(at: s)
- }
-}
-
-@inlinable
-func benchmarkThreeMillionStructs() {
- let structCount = 3_000_000
-
- let rawSize = ((16 * 5) * structCount) / 1024
-
- var fb = FlatBufferBuilder(initialSize: Int32(rawSize * 1600))
-
- var offsets: [Offset] = []
- for _ in 0..<structCount {
- fb.startVector(
- 5 * MemoryLayout<AA>.size,
- elementSize: MemoryLayout<AA>.alignment)
- for _ in 0..<5 {
- _ = fb.create(struct: AA(a: 2.4, b: 2.4))
- }
- let vector = fb.endVector(len: 5)
- let start = fb.startTable(with: 1)
- fb.add(offset: vector, at: 4)
- offsets.append(Offset(offset: fb.endTable(at: start)))
- }
- let vector = fb.createVector(ofOffsets: offsets)
- let start = fb.startTable(with: 1)
- fb.add(offset: vector, at: 4)
- let root = Offset(offset: fb.endTable(at: start))
- fb.finish(offset: root)
-}
-
-@usableFromInline
-struct AA: NativeStruct {
- public init(a: Double, b: Double) {
- self.a = a
- self.b = b
- }
- var a: Double
- var b: Double
-
-}
-
-func benchmark(numberOfRuns runs: Int) {
- var benchmarks: [Benchmark] = []
- let str = (0...99).map { _ -> String in "x" }.joined()
- benchmarks.append(run(
- name: "500_000",
- runs: runs,
- action: benchmarkFiveHundredAdds))
- benchmarks.append(run(name: "10 str", runs: runs, action: create10Strings))
- let hundredStr = run(name: "100 str", runs: runs) {
- create100Strings(str: str)
- }
- benchmarks.append(run(
- name: "3M strc",
- runs: 1,
- action: benchmarkThreeMillionStructs))
- benchmarks.append(hundredStr)
- print(createDocument(Benchmarks: benchmarks))
-}
-
-benchmark(numberOfRuns: 20)
diff --git a/tests/FlatBuffers.Benchmarks/FlatBufferBuilderBenchmark.cs b/tests/FlatBuffers.Benchmarks/FlatBufferBuilderBenchmark.cs
index 1df5ac3..b385885 100644
--- a/tests/FlatBuffers.Benchmarks/FlatBufferBuilderBenchmark.cs
+++ b/tests/FlatBuffers.Benchmarks/FlatBufferBuilderBenchmark.cs
@@ -17,7 +17,7 @@
using BenchmarkDotNet.Attributes;
using MyGame.Example;
-namespace FlatBuffers.Benchmarks
+namespace Google.FlatBuffers.Benchmarks
{
//[EtwProfiler] - needs elevated privileges
[MemoryDiagnoser]
diff --git a/tests/FlatBuffers.Benchmarks/Program.cs b/tests/FlatBuffers.Benchmarks/Program.cs
index 9e63b4b..fa152ca 100644
--- a/tests/FlatBuffers.Benchmarks/Program.cs
+++ b/tests/FlatBuffers.Benchmarks/Program.cs
@@ -16,7 +16,7 @@
using BenchmarkDotNet.Running;
-namespace FlatBuffers.Benchmarks
+namespace Google.FlatBuffers.Benchmarks
{
public static class Program
{
diff --git a/tests/FlatBuffers.Test.Swift/SwiftTest.sh b/tests/FlatBuffers.Test.Swift/SwiftTest.sh
deleted file mode 100755
index 99ab1f1..0000000
--- a/tests/FlatBuffers.Test.Swift/SwiftTest.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-swift_dir=`pwd`
-cd ..
-test_dir=`pwd`
-alias fbc='${test_dir}/../flatc'
-shopt -s expand_aliases
-
-cd ${swift_dir}/Tests/FlatBuffers.Test.SwiftTests
-fbc --swift --gen-mutable --grpc --gen-json-emit --gen-object-api -I ${test_dir}/include_test ${test_dir}/monster_test.fbs ${test_dir}/union_vector/union_vector.fbs
-fbc --swift --gen-json-emit ${test_dir}/optional_scalars.fbs
-fbc --swift --gen-json-emit --gen-object-api ${test_dir}/more_defaults.fbs
-fbc --swift --gen-json-emit --gen-mutable --gen-object-api ${test_dir}/MutatingBool.fbs
-cd ${swift_dir}
-
-cd ${swift_dir}/Sources/SwiftFlatBuffers
-# create better fuzzing test file
-fbc --swift --gen-json-emit fuzzer.fbs
-cd ${swift_dir}
-
-swift build --build-tests
-swift test
-
-if [ $(uname -s) != Darwin ]; then
- echo fuzzing
- swift build -c debug -Xswiftc -sanitize=fuzzer,address -Xswiftc -parse-as-library
- swift build -c release -Xswiftc -sanitize=fuzzer,address -Xswiftc -parse-as-library
-fi
diff --git a/tests/FlatBuffers.Test/Assert.cs b/tests/FlatBuffers.Test/Assert.cs
index 488c338..7bb8004 100644
--- a/tests/FlatBuffers.Test/Assert.cs
+++ b/tests/FlatBuffers.Test/Assert.cs
@@ -19,7 +19,7 @@
using System.Linq;
using System.Text;
-namespace FlatBuffers.Test
+namespace Google.FlatBuffers.Test
{
public class AssertFailedException : Exception
diff --git a/tests/FlatBuffers.Test/ByteBufferTests.cs b/tests/FlatBuffers.Test/ByteBufferTests.cs
index 98e917c..6bff2ac 100644
--- a/tests/FlatBuffers.Test/ByteBufferTests.cs
+++ b/tests/FlatBuffers.Test/ByteBufferTests.cs
@@ -15,8 +15,9 @@
*/
using System;
+using System.Runtime.InteropServices;
-namespace FlatBuffers.Test
+namespace Google.FlatBuffers.Test
{
[FlatBuffersTestClass]
public class ByteBufferTests
@@ -408,6 +409,60 @@
Assert.ArrayEqual(data, bbArray);
}
+ public void ByteBuffer_Put_ArraySegment_Helper<T>(ArraySegment<T> data, int typeSize)
+ where T : struct
+ {
+ // Create the Byte Buffer
+ var uut = new ByteBuffer(1024);
+
+ // Put the data into the buffer and make sure the offset is
+ // calculated correctly
+ int nOffset = uut.Put(1024, data);
+ Assert.AreEqual(1024 - typeSize * data.Count, nOffset);
+
+ // Get the full array back out and ensure they are equivalent
+ var bbArray = uut.ToArray<T>(nOffset, data.Count);
+ Assert.ArrayEqual(data.ToArray(), bbArray);
+ }
+
+ public unsafe void ByteBuffer_Put_IntPtr_Helper<T>(T[] data, int typeSize)
+ where T : struct
+ {
+ GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);
+ try
+ {
+ var dataPtr = handle.AddrOfPinnedObject();
+ var sizeInBytes = data.Length * typeSize;
+
+ // Create the Byte Buffer
+ var uut = new ByteBuffer(1024);
+
+ // Put the data into the buffer and make sure the offset is
+ // calculated correctly
+ int nOffset = uut.Put<T>(1024, dataPtr, sizeInBytes);
+ Assert.AreEqual(1024 - sizeInBytes, nOffset);
+
+ // Get the full array back out and ensure they are equivalent
+ var bbArray = uut.ToArray<T>(nOffset, data.Length);
+ Assert.ArrayEqual(data, bbArray);
+ }
+ finally
+ {
+ handle.Free();
+ }
+ }
+
+ public void ByteBuffer_Put_ArrayTypes_Helper<T>(T[] data, int typeSize)
+ where T : struct
+ {
+ ByteBuffer_Put_Array_Helper(data, typeSize);
+
+ var arraySegment = CreateArraySegment(data);
+ ByteBuffer_Put_ArraySegment_Helper(arraySegment, typeSize);
+
+ ByteBuffer_Put_IntPtr_Helper(data, typeSize);
+ }
+
[FlatBuffersTestMethod]
public void ByteBuffer_Put_Array_Float()
{
@@ -425,7 +480,7 @@
data[7] = 15.9994F;
data[8] = 18.9984F;
- ByteBuffer_Put_Array_Helper(data, sizeof(float));
+ ByteBuffer_Put_ArrayTypes_Helper(data, sizeof(float));
}
[FlatBuffersTestMethod]
@@ -445,7 +500,7 @@
data[7] = 15.9994;
data[8] = 18.9984;
- ByteBuffer_Put_Array_Helper(data, sizeof(double));
+ ByteBuffer_Put_ArrayTypes_Helper(data, sizeof(double));
}
[FlatBuffersTestMethod]
@@ -465,7 +520,7 @@
data[7] = 15;
data[8] = 18;
- ByteBuffer_Put_Array_Helper(data, sizeof(int));
+ ByteBuffer_Put_ArrayTypes_Helper(data, sizeof(int));
}
@@ -486,7 +541,7 @@
data[7] = 15;
data[8] = 18;
- ByteBuffer_Put_Array_Helper(data, sizeof(uint));
+ ByteBuffer_Put_ArrayTypes_Helper(data, sizeof(uint));
}
[FlatBuffersTestMethod]
@@ -506,7 +561,7 @@
data[7] = true;
data[8] = false;
- ByteBuffer_Put_Array_Helper(data, sizeof(bool));
+ ByteBuffer_Put_ArrayTypes_Helper(data, sizeof(bool));
}
[FlatBuffersTestMethod]
@@ -526,7 +581,7 @@
data[7] = 15;
data[8] = 18;
- ByteBuffer_Put_Array_Helper(data, sizeof(long));
+ ByteBuffer_Put_ArrayTypes_Helper(data, sizeof(long));
}
[FlatBuffersTestMethod]
@@ -546,7 +601,7 @@
data[7] = 15;
data[8] = 18;
- ByteBuffer_Put_Array_Helper(data, sizeof(byte));
+ ByteBuffer_Put_ArrayTypes_Helper(data, sizeof(byte));
}
[FlatBuffersTestMethod]
@@ -566,7 +621,16 @@
data[7] = 15;
data[8] = 18;
- ByteBuffer_Put_Array_Helper(data, sizeof(sbyte));
+ ByteBuffer_Put_ArrayTypes_Helper(data, sizeof(sbyte));
+ }
+
+ private static ArraySegment<T> CreateArraySegment<T>(T[] data)
+ where T : struct
+ {
+ const int arraySegmentPadding = 7;
+ var newData = new T[data.Length + 2 * arraySegmentPadding];
+ Array.Copy(data, 0, newData, arraySegmentPadding, data.Length);
+ return new ArraySegment<T>(newData, arraySegmentPadding, data.Length);
}
[FlatBuffersTestMethod]
@@ -578,10 +642,17 @@
// create a null array and try to put it into the buffer
float[] data = null;
Assert.Throws<ArgumentNullException>(() => uut.Put(1024, data));
+
+ ArraySegment<float> dataArraySegment = default;
+ Assert.Throws<ArgumentNullException>(() => uut.Put(1024, dataArraySegment));
+
+ IntPtr dataPtr = IntPtr.Zero;
+ int dataPtrLength = 100;
+ Assert.Throws<ArgumentNullException>(() => uut.Put<float>(1024, dataPtr, dataPtrLength));
}
[FlatBuffersTestMethod]
- public void ByteBuffer_Put_Array_Empty_Throws()
+ public unsafe void ByteBuffer_Put_Array_Empty_Throws()
{
// Create the Byte Buffer
var uut = new ByteBuffer(1024);
@@ -589,6 +660,32 @@
// create an array of length == 0, and try to put it into the buffer
float[] data = new float[0];
Assert.Throws<ArgumentException>(() => uut.Put(1024, data));
+
+ var dataArraySegment = new ArraySegment<float>(new float[10], 5, 0);
+ Assert.Throws<ArgumentException>(() => uut.Put(1024, dataArraySegment));
+
+ fixed(float* floatPtr = data)
+ {
+ var dataPtr = (IntPtr)floatPtr;
+ var dataPtrLength = 0;
+ Assert.Throws<ArgumentException>(() => uut.Put<float>(1024, dataPtr, dataPtrLength));
+ }
+ }
+
+ [FlatBuffersTestMethod]
+ public unsafe void ByteBuffer_Put_IntPtr_NegativeSize_Throws()
+ {
+ // Create the Byte Buffer
+ var uut = new ByteBuffer(1024);
+
+ // create an array of length == 0, and try to put it into the buffer
+ float[] data = new float[10];
+ fixed(float* floatPtr = data)
+ {
+ var dataPtr = (IntPtr)floatPtr;
+ var dataPtrLength = -1;
+ Assert.Throws<ArgumentException>(() => uut.Put<float>(1024, dataPtr, dataPtrLength));
+ }
}
#pragma warning disable 0169
@@ -601,7 +698,7 @@
#pragma warning restore 0169
[FlatBuffersTestMethod]
- public void ByteBuffer_Put_Array_IncorrectType_Throws()
+ public unsafe void ByteBuffer_Put_Array_IncorrectType_Throws()
{
// Create the Byte Buffer
var uut = new ByteBuffer(1024);
@@ -610,6 +707,16 @@
// able to be put into the buffer
var data = new dummyStruct[10];
Assert.Throws<ArgumentException>(() => uut.Put(1024, data));
+
+ var dataArraySegment = new ArraySegment<dummyStruct>(data);
+ Assert.Throws<ArgumentException>(() => uut.Put(1024, dataArraySegment));
+
+ fixed(dummyStruct* floatPtr = data)
+ {
+ var dataPtr = (IntPtr)floatPtr;
+ var dataPtrLength = data.Length * sizeof(dummyStruct);
+ Assert.Throws<ArgumentException>(() => uut.Put<dummyStruct>(1024, dataPtr, dataPtrLength));
+ }
}
[FlatBuffersTestMethod]
diff --git a/tests/FlatBuffers.Test/FlatBufferBuilderTests.cs b/tests/FlatBuffers.Test/FlatBufferBuilderTests.cs
index e2b72c7..7fe9740 100644
--- a/tests/FlatBuffers.Test/FlatBufferBuilderTests.cs
+++ b/tests/FlatBuffers.Test/FlatBufferBuilderTests.cs
@@ -16,7 +16,7 @@
using System;
-namespace FlatBuffers.Test
+namespace Google.FlatBuffers.Test
{
[FlatBuffersTestClass]
public class FlatBufferBuilderTests
@@ -553,6 +553,18 @@
Assert.Throws<ArgumentNullException>(() => fbb.Add(data));
}
+
+ [FlatBuffersTestMethod]
+ public unsafe void FlatBufferBuilder_Add_Array_UnsupportedType_Throws()
+ {
+ var fbb = CreateBuffer(false);
+
+ var storedOffset = fbb.Offset;
+
+ // Construct the data array
+ var data = new DummyStruct[10];
+ Assert.Throws<ArgumentException>(() => fbb.Add(data));
+ }
[FlatBuffersTestMethod]
public void FlatBufferBuilder_Add_Array_Empty_Noop()
@@ -570,6 +582,159 @@
var endOffset = fbb.Offset;
Assert.AreEqual(endOffset, storedOffset);
}
+
+ [FlatBuffersTestMethod]
+ public void FlatBufferBuilder_Add_ArraySegment_Default_Throws()
+ {
+ var fbb = CreateBuffer(false);
+
+ // Construct the data array
+ ArraySegment<float> data = default;
+
+ Assert.Throws<ArgumentNullException>(() => fbb.Add(data));
+ }
+
+ [FlatBuffersTestMethod]
+ public unsafe void FlatBufferBuilder_Add_ArraySegment_UnsupportedType_Throws()
+ {
+ var fbb = CreateBuffer(false);
+
+ var storedOffset = fbb.Offset;
+
+ // Construct the data array
+ var array = new DummyStruct[10];
+ var data = new ArraySegment<DummyStruct>(array);
+ Assert.Throws<ArgumentException>(() => fbb.Add(data));
+ }
+
+ [FlatBuffersTestMethod]
+ public void FlatBufferBuilder_Add_ArraySegment_Empty_Noop()
+ {
+ var fbb = CreateBuffer(false);
+
+ var storedOffset = fbb.Offset;
+
+ // Construct the data array
+ var array = new float[10];
+ var data = new ArraySegment<float>(array, 5, 0);
+ fbb.Add(data);
+
+ // Make sure the offset didn't change since nothing
+ // was really added
+ var endOffset = fbb.Offset;
+ Assert.AreEqual(endOffset, storedOffset);
+ }
+
+ [FlatBuffersTestMethod]
+ public void FlatBufferBuilder_Add_IntPtr_Zero_Throws()
+ {
+ var fbb = CreateBuffer(false);
+
+ // Construct the data array
+ var data = IntPtr.Zero;
+ var length = 100;
+
+ Assert.Throws<ArgumentNullException>(() => fbb.Add<float>(data, length));
+ }
+
+ [FlatBuffersTestMethod]
+ public unsafe void FlatBufferBuilder_Add_IntPtr_SizeNegative_Throws()
+ {
+ var fbb = CreateBuffer(false);
+
+ // Construct the data array
+ var array = new float[10];
+ fixed(float* ptr = array)
+ {
+ var data = (IntPtr)ptr;
+ var length = -1;
+ Assert.Throws<ArgumentOutOfRangeException>(() => fbb.Add<float>(data, length));
+ }
+ }
+
+ [FlatBuffersTestMethod]
+ public void FlatBufferBuilder_Add_IntPtr_Zero_Empty_Noop()
+ {
+ var fbb = CreateBuffer(false);
+
+ var storedOffset = fbb.Offset;
+
+ // Construct the data array
+ var data = IntPtr.Zero;
+ var length = 0;
+
+ fbb.Add<float>(data, length);
+
+ // make sure that a length of 0 doesn't throw also if ptr is Zero as well
+ // and that nothing was really added
+ var endOffset = fbb.Offset;
+ Assert.AreEqual(endOffset, storedOffset);
+ }
+
+ [FlatBuffersTestMethod]
+ public unsafe void FlatBufferBuilder_Add_IntPtr_Empty_Noop()
+ {
+ var fbb = CreateBuffer(false);
+
+ var storedOffset = fbb.Offset;
+
+ // Construct the data array
+ var array = new float[10];
+ fixed(float* ptr = array)
+ {
+ var data = (IntPtr)ptr;
+ var length = 0;
+ fbb.Add<float>(data, length);
+ }
+
+ // Make sure the offset didn't change since nothing
+ // was really added
+ var endOffset = fbb.Offset;
+ Assert.AreEqual(endOffset, storedOffset);
+ }
+
+ [FlatBuffersTestMethod]
+ public unsafe void FlatBufferBuilder_Add_IntPtr_SizeInBytesNotMatchingDataType_Throws()
+ {
+ var fbb = CreateBuffer(false);
+
+ var storedOffset = fbb.Offset;
+
+ // Construct the data array
+ var array = new float[10];
+ fixed(float* ptr = array)
+ {
+ const int invalidBytes = 1;
+ var data = (IntPtr)ptr;
+ // add some invalid bytes to the length
+ var length = 2 * sizeof(float) + invalidBytes;
+
+ Assert.Throws<ArgumentException>(() => fbb.Add<float>(data, length));
+ }
+ }
+
+ [FlatBuffersTestMethod]
+ public unsafe void FlatBufferBuilder_Add_IntPtr_UnsupportedType_Throws()
+ {
+ var fbb = CreateBuffer(false);
+
+ var storedOffset = fbb.Offset;
+
+ // Construct the data array
+ var array = new DummyStruct[10];
+ fixed(DummyStruct* ptr = array)
+ {
+ var data = (IntPtr)ptr;
+ var length = 10 * sizeof(DummyStruct);
+
+ Assert.Throws<ArgumentException>(() => fbb.Add<DummyStruct>(data, length));
+ }
+ }
+
+ private struct DummyStruct
+ {
+ int value;
+ }
[FlatBuffersTestMethod]
public void FlatBufferBuilder_Add_null_String()
diff --git a/tests/FlatBuffers.Test/FlatBuffers.Core.Test.csproj b/tests/FlatBuffers.Test/FlatBuffers.Core.Test.csproj
index 6cd4e78..a769785 100644
--- a/tests/FlatBuffers.Test/FlatBuffers.Core.Test.csproj
+++ b/tests/FlatBuffers.Test/FlatBuffers.Core.Test.csproj
@@ -19,6 +19,14 @@
<DefineConstants>$(DefineConstants);ENABLE_SPAN_T</DefineConstants>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+
<ItemGroup>
<Compile Include="..\..\net\FlatBuffers\ByteBuffer.cs">
<Link>FlatBuffers\ByteBuffer.cs</Link>
@@ -183,7 +191,7 @@
</ItemGroup>
<ItemGroup>
- <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
+ <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
</Project>
diff --git a/tests/FlatBuffers.Test/FlatBuffers.Test.csproj b/tests/FlatBuffers.Test/FlatBuffers.Test.csproj
index 1247599..0f683cb 100644
--- a/tests/FlatBuffers.Test/FlatBuffers.Test.csproj
+++ b/tests/FlatBuffers.Test/FlatBuffers.Test.csproj
@@ -21,6 +21,7 @@
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -29,6 +30,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
@@ -38,14 +40,9 @@
<DefineConstants>$(DefineConstants);UNSAFE_BYTEBUFFER</DefineConstants>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Newtonsoft.Json">
- <Version>12.0.3</Version>
- </PackageReference>
+ <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
- <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
- <HintPath>packages\Newtonsoft.Json.12.0.3\lib\net35\Newtonsoft.Json.dll</HintPath>
- </Reference>
<Reference Include="System" />
<Reference Include="System.Core">
</Reference>
diff --git a/tests/FlatBuffers.Test/FlatBuffersExampleTests.cs b/tests/FlatBuffers.Test/FlatBuffersExampleTests.cs
index ec3b2ea..6c9e309 100644
--- a/tests/FlatBuffers.Test/FlatBuffersExampleTests.cs
+++ b/tests/FlatBuffers.Test/FlatBuffersExampleTests.cs
@@ -21,7 +21,7 @@
using optional_scalars;
using KeywordTest;
-namespace FlatBuffers.Test
+namespace Google.FlatBuffers.Test
{
[FlatBuffersTestClass]
public class FlatBuffersExampleTests
@@ -156,8 +156,11 @@
// Example of searching for a table by the key
Assert.IsTrue(monster.TestarrayoftablesByKey("Frodo") != null);
+ Assert.AreEqual(monster.TestarrayoftablesByKey("Frodo").Value.Name, "Frodo");
Assert.IsTrue(monster.TestarrayoftablesByKey("Barney") != null);
+ Assert.AreEqual(monster.TestarrayoftablesByKey("Barney").Value.Name, "Barney");
Assert.IsTrue(monster.TestarrayoftablesByKey("Wilma") != null);
+ Assert.AreEqual(monster.TestarrayoftablesByKey("Wilma").Value.Name, "Wilma");
// testType is an existing field
Assert.AreEqual(monster.TestType, Any.Monster);
@@ -1152,5 +1155,41 @@
ScalarStuff scalarStuff = ScalarStuff.GetRootAsScalarStuff(fbb.DataBuffer);
Assert.AreEqual(null, scalarStuff.MaybeEnum);
}
+
+
+ [FlatBuffersTestMethod]
+ public void SortKey_WithDefaultedValue_IsFindable() {
+ // This checks if using the `key` attribute that includes the
+ // default value (e.g., 0) is still searchable. This is a regression
+ // test for https://github.com/google/flatbuffers/issues/7380.
+ var fbb = new FlatBufferBuilder(1);
+
+ // Create a vector of Stat objects, with Count being the key.
+ var stat_offsets = new Offset<Stat>[4];
+ for(ushort i = 0; i < stat_offsets.Length; i++) {
+ Stat.StartStat(fbb);
+ Stat.AddCount(fbb, i);
+ stat_offsets[stat_offsets.Length - 1 - i] = Stat.EndStat(fbb);
+ }
+
+ // Ensure the sort works.
+ var sort = Stat.CreateSortedVectorOfStat(fbb, stat_offsets);
+
+ // Create the monster with the sorted vector of Stat objects.
+ var str = fbb.CreateString("MyMonster");
+ Monster.StartMonster(fbb);
+ Monster.AddName(fbb, str);
+ Monster.AddScalarKeySortedTables(fbb, sort);
+ fbb.Finish(Monster.EndMonster(fbb).Value);
+
+ // Get the monster.
+ var monster = Monster.GetRootAsMonster(fbb.DataBuffer);
+
+ // Ensure each key is findable.
+ for(ushort i =0 ; i < stat_offsets.Length; i++) {
+ Assert.IsTrue(monster.ScalarKeySortedTablesByKey(i) != null);
+ Assert.AreEqual(monster.ScalarKeySortedTablesByKey(i).Value.Count, i);
+ }
+ }
}
}
diff --git a/tests/FlatBuffers.Test/FlatBuffersFuzzTests.cs b/tests/FlatBuffers.Test/FlatBuffersFuzzTests.cs
index b6c60ea..0377a7b 100644
--- a/tests/FlatBuffers.Test/FlatBuffersFuzzTests.cs
+++ b/tests/FlatBuffers.Test/FlatBuffersFuzzTests.cs
@@ -16,7 +16,7 @@
using System;
-namespace FlatBuffers.Test
+namespace Google.FlatBuffers.Test
{
[FlatBuffersTestClass]
public class FlatBuffersFuzzTests
diff --git a/tests/FlatBuffers.Test/FlatBuffersTestClassAttribute.cs b/tests/FlatBuffers.Test/FlatBuffersTestClassAttribute.cs
index f31e38b..7ad7df6 100644
--- a/tests/FlatBuffers.Test/FlatBuffersTestClassAttribute.cs
+++ b/tests/FlatBuffers.Test/FlatBuffersTestClassAttribute.cs
@@ -19,7 +19,7 @@
using System.Linq;
using System.Text;
-namespace FlatBuffers.Test
+namespace Google.FlatBuffers.Test
{
[AttributeUsage(AttributeTargets.Class)]
public class FlatBuffersTestClassAttribute : Attribute
diff --git a/tests/FlatBuffers.Test/FlatBuffersTestMethodAttribute.cs b/tests/FlatBuffers.Test/FlatBuffersTestMethodAttribute.cs
index 989dae5..4276b74 100644
--- a/tests/FlatBuffers.Test/FlatBuffersTestMethodAttribute.cs
+++ b/tests/FlatBuffers.Test/FlatBuffersTestMethodAttribute.cs
@@ -16,7 +16,7 @@
using System;
-namespace FlatBuffers.Test
+namespace Google.FlatBuffers.Test
{
[AttributeUsage(AttributeTargets.Method)]
public class FlatBuffersTestMethodAttribute : Attribute
diff --git a/tests/FlatBuffers.Test/FuzzTestData.cs b/tests/FlatBuffers.Test/FuzzTestData.cs
index 119e44e..186e312 100644
--- a/tests/FlatBuffers.Test/FuzzTestData.cs
+++ b/tests/FlatBuffers.Test/FuzzTestData.cs
@@ -16,7 +16,7 @@
using System;
-namespace FlatBuffers.Test
+namespace Google.FlatBuffers.Test
{
internal static class FuzzTestData
{
diff --git a/tests/FlatBuffers.Test/Lcg.cs b/tests/FlatBuffers.Test/Lcg.cs
index c329ed8..c6322d5 100644
--- a/tests/FlatBuffers.Test/Lcg.cs
+++ b/tests/FlatBuffers.Test/Lcg.cs
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-namespace FlatBuffers.Test
+namespace Google.FlatBuffers.Test
{
/// <summary>
/// Lcg Pseudo RNG
diff --git a/tests/FlatBuffers.Test/Program.cs b/tests/FlatBuffers.Test/Program.cs
index f8cec4e..cd04d25 100644
--- a/tests/FlatBuffers.Test/Program.cs
+++ b/tests/FlatBuffers.Test/Program.cs
@@ -19,7 +19,7 @@
using System.Linq;
using System.Reflection;
-namespace FlatBuffers.Test
+namespace Google.FlatBuffers.Test
{
static class Program
{
diff --git a/tests/FlatBuffers.Test/TestTable.cs b/tests/FlatBuffers.Test/TestTable.cs
index 4f663f0..659ac8f 100644
--- a/tests/FlatBuffers.Test/TestTable.cs
+++ b/tests/FlatBuffers.Test/TestTable.cs
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-namespace FlatBuffers.Test
+namespace Google.FlatBuffers.Test
{
/// <summary>
/// A test Table object that gives easy access to the slot data
diff --git a/tests/FlatBuffers.Test/packages.config b/tests/FlatBuffers.Test/packages.config
index d766d04..1d41d8e 100644
--- a/tests/FlatBuffers.Test/packages.config
+++ b/tests/FlatBuffers.Test/packages.config
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net35" />
+ <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net35" />
</packages>
\ No newline at end of file
diff --git a/tests/GoTest.sh b/tests/GoTest.sh
index 9f7ad76..85253c1 100755
--- a/tests/GoTest.sh
+++ b/tests/GoTest.sh
@@ -41,6 +41,11 @@
cp -a ./go_test.go ./go_gen/src/flatbuffers_test/
cp -a optional_scalars/*.go ./go_gen/src/optional_scalars
+# https://stackoverflow.com/a/63545857/7024978
+# We need to turn off go modules for this script
+# to work.
+go env -w GO111MODULE=off
+
# Run tests with necessary flags.
# Developers may wish to see more detail by appending the verbosity flag
# -test.v to arguments for this command, as in:
diff --git a/tests/JavaTest.bat b/tests/JavaTest.bat
deleted file mode 100644
index 921815a..0000000
--- a/tests/JavaTest.bat
+++ /dev/null
@@ -1,21 +0,0 @@
-@echo off
-rem Copyright 2014 Google Inc. All rights reserved.
-rem
-rem Licensed under the Apache License, Version 2.0 (the "License");
-rem you may not use this file except in compliance with the License.
-rem You may obtain a copy of the License at
-rem
-rem http://www.apache.org/licenses/LICENSE-2.0
-rem
-rem Unless required by applicable law or agreed to in writing, software
-rem distributed under the License is distributed on an "AS IS" BASIS,
-rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-rem See the License for the specific language governing permissions and
-rem limitations under the License.
-
-rem Compile then run the Java test.
-
-set batch_file_dir=%~d0%~p0
-
-javac -g -classpath %batch_file_dir%\..\java;%batch_file_dir%;%batch_file_dir%\namespace_test;%batch_file_dir%\union_vector JavaTest.java
-java -classpath %batch_file_dir%\..\java;%batch_file_dir%;%batch_file_dir%\namespace_test;%batch_file_dir%\union_vector JavaTest
diff --git a/tests/JavaTest.java b/tests/JavaTest.java
deleted file mode 100644
index 0f2ad12..0000000
--- a/tests/JavaTest.java
+++ /dev/null
@@ -1,1558 +0,0 @@
-
-import static com.google.flatbuffers.Constants.*;
-
-import MyGame.Example.*;
-import optional_scalars.ScalarStuff;
-import optional_scalars.OptionalByte;
-import MyGame.MonsterExtra;
-import NamespaceA.*;
-import NamespaceA.NamespaceB.*;
-import com.google.flatbuffers.ByteBufferUtil;
-import com.google.flatbuffers.ByteVector;
-import com.google.flatbuffers.FlatBufferBuilder;
-import com.google.flatbuffers.FlexBuffers;
-import com.google.flatbuffers.FlexBuffersBuilder;
-import com.google.flatbuffers.StringVector;
-import com.google.flatbuffers.UnionVector;
-
-import com.google.flatbuffers.FlexBuffers.FlexBufferException;
-import com.google.flatbuffers.FlexBuffers.Reference;
-import com.google.flatbuffers.FlexBuffers.Vector;
-import com.google.flatbuffers.ArrayReadWriteBuf;
-import com.google.flatbuffers.FlexBuffers.KeyVector;
-
-import java.io.*;
-import java.math.BigInteger;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.CharBuffer;
-import java.nio.channels.FileChannel;
-import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-/*
- * Copyright 2014 Google Inc. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-class JavaTest {
- public static void main(String[] args) {
-
- // First, let's test reading a FlatBuffer generated by C++ code:
- // This file was generated from monsterdata_test.json
-
- byte[] data = null;
- File file = new File("monsterdata_test.mon");
- RandomAccessFile f = null;
- try {
- f = new RandomAccessFile(file, "r");
- data = new byte[(int)f.length()];
- f.readFully(data);
- f.close();
- } catch(java.io.IOException e) {
- System.out.println("FlatBuffers test: couldn't read file");
- return;
- }
-
- // Now test it:
-
- ByteBuffer bb = ByteBuffer.wrap(data);
- TestBuffer(bb);
-
- // Second, let's create a FlatBuffer from scratch in Java, and test it also.
- // We use an initial size of 1 to exercise the reallocation algorithm,
- // normally a size larger than the typical FlatBuffer you generate would be
- // better for performance.
- FlatBufferBuilder fbb = new FlatBufferBuilder(1);
-
- TestBuilderBasics(fbb, true);
- TestBuilderBasics(fbb, false);
-
- TestExtendedBuffer(fbb.dataBuffer().asReadOnlyBuffer());
-
- TestNamespaceNesting();
-
- TestNestedFlatBuffer();
-
- TestCreateByteVector();
-
- TestCreateUninitializedVector();
-
- TestByteBufferFactory();
-
- TestSizedInputStream();
-
- TestVectorOfUnions();
-
- TestFixedLengthArrays();
-
- TestFlexBuffers();
-
- TestVectorOfBytes();
-
- TestSharedStringPool();
-
- TestScalarOptional();
-
- TestPackUnpack(bb);
-
- System.out.println("FlatBuffers test: completed successfully");
- }
-
- static void TestEnums() {
- TestEq(Color.name(Color.Red), "Red");
- TestEq(Color.name(Color.Blue), "Blue");
- TestEq(Any.name(Any.NONE), "NONE");
- TestEq(Any.name(Any.Monster), "Monster");
- }
-
- static void TestBuffer(ByteBuffer bb) {
- TestEq(Monster.MonsterBufferHasIdentifier(bb), true);
-
- Monster monster = Monster.getRootAsMonster(bb);
-
- TestEq(monster.hp(), (short)80);
- TestEq(monster.mana(), (short)150); // default
-
- TestEq(monster.name(), "MyMonster");
- // monster.friendly() // can't access, deprecated
-
- Vec3 pos = monster.pos();
- TestEq(pos.x(), 1.0f);
- TestEq(pos.y(), 2.0f);
- TestEq(pos.z(), 3.0f);
- TestEq(pos.test1(), 3.0);
- // issue: int != byte
- TestEq(pos.test2(), (int) Color.Green);
- Test t = pos.test3();
- TestEq(t.a(), (short)5);
- TestEq(t.b(), (byte)6);
-
- TestEq(monster.testType(), (byte)Any.Monster);
- Monster monster2 = new Monster();
- TestEq(monster.test(monster2) != null, true);
- TestEq(monster2.name(), "Fred");
-
- TestEq(monster.inventoryLength(), 5);
- int invsum = 0;
- for (int i = 0; i < monster.inventoryLength(); i++)
- invsum += monster.inventory(i);
- TestEq(invsum, 10);
-
- // Method using a vector access object:
- ByteVector inventoryVector = monster.inventoryVector();
- TestEq(inventoryVector.length(), 5);
- invsum = 0;
- for (int i = 0; i < inventoryVector.length(); i++)
- invsum += inventoryVector.getAsUnsigned(i);
- TestEq(invsum, 10);
-
- // Alternative way of accessing a vector:
- ByteBuffer ibb = monster.inventoryAsByteBuffer();
- invsum = 0;
- while (ibb.position() < ibb.limit())
- invsum += ibb.get();
- TestEq(invsum, 10);
-
- Test test_0 = monster.test4(0);
- Test test_1 = monster.test4(1);
- TestEq(monster.test4Length(), 2);
- TestEq(test_0.a() + test_0.b() + test_1.a() + test_1.b(), 100);
-
- Test.Vector test4Vector = monster.test4Vector();
- test_0 = test4Vector.get(0);
- test_1 = test4Vector.get(1);
- TestEq(test4Vector.length(), 2);
- TestEq(test_0.a() + test_0.b() + test_1.a() + test_1.b(), 100);
-
- TestEq(monster.testarrayofstringLength(), 2);
- TestEq(monster.testarrayofstring(0),"test1");
- TestEq(monster.testarrayofstring(1),"test2");
-
- // Method using a vector access object:
- StringVector testarrayofstringVector = monster.testarrayofstringVector();
- TestEq(testarrayofstringVector.length(), 2);
- TestEq(testarrayofstringVector.get(0),"test1");
- TestEq(testarrayofstringVector.get(1),"test2");
-
- TestEq(monster.testbool(), true);
- }
-
- // this method checks additional fields not present in the binary buffer read from file
- // these new tests are performed on top of the regular tests
- static void TestExtendedBuffer(ByteBuffer bb) {
- TestBuffer(bb);
-
- Monster monster = Monster.getRootAsMonster(bb);
-
- TestEq(monster.testhashu32Fnv1(), Integer.MAX_VALUE + 1L);
- }
-
- static void TestNamespaceNesting() {
- // reference / manipulate these to verify compilation
- FlatBufferBuilder fbb = new FlatBufferBuilder(1);
-
- TableInNestedNS.startTableInNestedNS(fbb);
- TableInNestedNS.addFoo(fbb, 1234);
- int nestedTableOff = TableInNestedNS.endTableInNestedNS(fbb);
-
- TableInFirstNS.startTableInFirstNS(fbb);
- TableInFirstNS.addFooTable(fbb, nestedTableOff);
- int off = TableInFirstNS.endTableInFirstNS(fbb);
- }
-
- static void TestNestedFlatBuffer() {
- final String nestedMonsterName = "NestedMonsterName";
- final short nestedMonsterHp = 600;
- final short nestedMonsterMana = 1024;
-
- FlatBufferBuilder fbb1 = new FlatBufferBuilder(16);
- int str1 = fbb1.createString(nestedMonsterName);
- Monster.startMonster(fbb1);
- Monster.addName(fbb1, str1);
- Monster.addHp(fbb1, nestedMonsterHp);
- Monster.addMana(fbb1, nestedMonsterMana);
- int monster1 = Monster.endMonster(fbb1);
- Monster.finishMonsterBuffer(fbb1, monster1);
- byte[] fbb1Bytes = fbb1.sizedByteArray();
- fbb1 = null;
-
- FlatBufferBuilder fbb2 = new FlatBufferBuilder(16);
- int str2 = fbb2.createString("My Monster");
- int nestedBuffer = Monster.createTestnestedflatbufferVector(fbb2, fbb1Bytes);
- Monster.startMonster(fbb2);
- Monster.addName(fbb2, str2);
- Monster.addHp(fbb2, (short)50);
- Monster.addMana(fbb2, (short)32);
- Monster.addTestnestedflatbuffer(fbb2, nestedBuffer);
- int monster = Monster.endMonster(fbb2);
- Monster.finishMonsterBuffer(fbb2, monster);
-
- // Now test the data extracted from the nested buffer
- Monster mons = Monster.getRootAsMonster(fbb2.dataBuffer());
- Monster nestedMonster = mons.testnestedflatbufferAsMonster();
-
- TestEq(nestedMonsterMana, nestedMonster.mana());
- TestEq(nestedMonsterHp, nestedMonster.hp());
- TestEq(nestedMonsterName, nestedMonster.name());
- }
-
- static void TestCreateByteVector() {
- FlatBufferBuilder fbb = new FlatBufferBuilder(16);
- int str = fbb.createString("MyMonster");
- byte[] inventory = new byte[] { 0, 1, 2, 3, 4 };
- int vec = fbb.createByteVector(inventory);
- Monster.startMonster(fbb);
- Monster.addInventory(fbb, vec);
- Monster.addName(fbb, str);
- int monster1 = Monster.endMonster(fbb);
- Monster.finishMonsterBuffer(fbb, monster1);
- Monster monsterObject = Monster.getRootAsMonster(fbb.dataBuffer());
-
- TestEq(monsterObject.inventory(1), (int)inventory[1]);
- TestEq(monsterObject.inventoryLength(), inventory.length);
- ByteVector inventoryVector = monsterObject.inventoryVector();
- TestEq(inventoryVector.getAsUnsigned(1), (int)inventory[1]);
- TestEq(inventoryVector.length(), inventory.length);
-
- TestEq(ByteBuffer.wrap(inventory), monsterObject.inventoryAsByteBuffer());
- }
-
- static void TestCreateUninitializedVector() {
- FlatBufferBuilder fbb = new FlatBufferBuilder(16);
- int str = fbb.createString("MyMonster");
- byte[] inventory = new byte[] { 0, 1, 2, 3, 4 };
- ByteBuffer bb = fbb.createUnintializedVector(1, inventory.length, 1);
- for (byte i:inventory) {
- bb.put(i);
- }
- int vec = fbb.endVector();
- Monster.startMonster(fbb);
- Monster.addInventory(fbb, vec);
- Monster.addName(fbb, str);
- int monster1 = Monster.endMonster(fbb);
- Monster.finishMonsterBuffer(fbb, monster1);
- Monster monsterObject = Monster.getRootAsMonster(fbb.dataBuffer());
-
- TestEq(monsterObject.inventory(1), (int)inventory[1]);
- TestEq(monsterObject.inventoryLength(), inventory.length);
- ByteVector inventoryVector = monsterObject.inventoryVector();
- TestEq(inventoryVector.getAsUnsigned(1), (int)inventory[1]);
- TestEq(inventoryVector.length(), inventory.length);
- TestEq(ByteBuffer.wrap(inventory), monsterObject.inventoryAsByteBuffer());
- }
-
- static void TestByteBufferFactory() {
- final class MappedByteBufferFactory extends FlatBufferBuilder.ByteBufferFactory {
- @Override
- public ByteBuffer newByteBuffer(int capacity) {
- ByteBuffer bb;
- try {
- RandomAccessFile f = new RandomAccessFile("javatest.bin", "rw");
- bb = f.getChannel().map(FileChannel.MapMode.READ_WRITE, 0, capacity).order(ByteOrder.LITTLE_ENDIAN);
- f.close();
- } catch(Throwable e) {
- System.out.println("FlatBuffers test: couldn't map ByteBuffer to a file");
- bb = null;
- }
- return bb;
- }
- }
-
- FlatBufferBuilder fbb = new FlatBufferBuilder(1, new MappedByteBufferFactory());
-
- TestBuilderBasics(fbb, false);
- }
-
- static void TestSizedInputStream() {
- // Test on default FlatBufferBuilder that uses HeapByteBuffer
- FlatBufferBuilder fbb = new FlatBufferBuilder(1);
-
- TestBuilderBasics(fbb, false);
-
- InputStream in = fbb.sizedInputStream();
- byte[] array = fbb.sizedByteArray();
- int count = 0;
- int currentVal = 0;
-
- while (currentVal != -1 && count < array.length) {
- try {
- currentVal = in.read();
- } catch(java.io.IOException e) {
- System.out.println("FlatBuffers test: couldn't read from InputStream");
- return;
- }
- TestEq((byte)currentVal, array[count]);
- count++;
- }
- TestEq(count, array.length);
- }
-
- static void TestBuilderBasics(FlatBufferBuilder fbb, boolean sizePrefix) {
- int[] names = {fbb.createString("Frodo"), fbb.createString("Barney"), fbb.createString("Wilma")};
- int[] off = new int[3];
- Monster.startMonster(fbb);
- Monster.addName(fbb, names[0]);
- off[0] = Monster.endMonster(fbb);
- Monster.startMonster(fbb);
- Monster.addName(fbb, names[1]);
- off[1] = Monster.endMonster(fbb);
- Monster.startMonster(fbb);
- Monster.addName(fbb, names[2]);
- off[2] = Monster.endMonster(fbb);
- int sortMons = fbb.createSortedVectorOfTables(new Monster(), off);
-
- // We set up the same values as monsterdata.json:
-
- int str = fbb.createString("MyMonster");
-
- int inv = Monster.createInventoryVector(fbb, new byte[] { 0, 1, 2, 3, 4 });
-
- int fred = fbb.createString("Fred");
- Monster.startMonster(fbb);
- Monster.addName(fbb, fred);
- int mon2 = Monster.endMonster(fbb);
-
- Monster.startTest4Vector(fbb, 2);
- Test.createTest(fbb, (short)10, (byte)20);
- Test.createTest(fbb, (short)30, (byte)40);
- int test4 = fbb.endVector();
-
- int testArrayOfString = Monster.createTestarrayofstringVector(fbb, new int[] {
- fbb.createString("test1"),
- fbb.createString("test2")
- });
-
- Monster.startMonster(fbb);
- Monster.addPos(fbb, Vec3.createVec3(fbb, 1.0f, 2.0f, 3.0f, 3.0,
- Color.Green, (short)5, (byte)6));
- Monster.addHp(fbb, (short)80);
- Monster.addName(fbb, str);
- Monster.addInventory(fbb, inv);
- Monster.addTestType(fbb, (byte)Any.Monster);
- Monster.addTest(fbb, mon2);
- Monster.addTest4(fbb, test4);
- Monster.addTestarrayofstring(fbb, testArrayOfString);
- Monster.addTestbool(fbb, true);
- Monster.addTesthashu32Fnv1(fbb, Integer.MAX_VALUE + 1L);
- Monster.addTestarrayoftables(fbb, sortMons);
- int mon = Monster.endMonster(fbb);
-
- if (sizePrefix) {
- Monster.finishSizePrefixedMonsterBuffer(fbb, mon);
- } else {
- Monster.finishMonsterBuffer(fbb, mon);
- }
-
- // Write the result to a file for debugging purposes:
- // Note that the binaries are not necessarily identical, since the JSON
- // parser may serialize in a slightly different order than the above
- // Java code. They are functionally equivalent though.
-
- try {
- String filename = "monsterdata_java_wire" + (sizePrefix ? "_sp" : "") + ".mon";
- FileChannel fc = new FileOutputStream(filename).getChannel();
- fc.write(fbb.dataBuffer().duplicate());
- fc.close();
- } catch(java.io.IOException e) {
- System.out.println("FlatBuffers test: couldn't write file");
- return;
- }
-
- // Test it:
- ByteBuffer dataBuffer = fbb.dataBuffer();
- if (sizePrefix) {
- TestEq(ByteBufferUtil.getSizePrefix(dataBuffer) + SIZE_PREFIX_LENGTH,
- dataBuffer.remaining());
- dataBuffer = ByteBufferUtil.removeSizePrefix(dataBuffer);
- }
- TestExtendedBuffer(dataBuffer);
-
- // Make sure it also works with read only ByteBuffers. This is slower,
- // since creating strings incurs an additional copy
- // (see Table.__string).
- TestExtendedBuffer(dataBuffer.asReadOnlyBuffer());
-
- TestEnums();
-
- //Attempt to mutate Monster fields and check whether the buffer has been mutated properly
- // revert to original values after testing
- Monster monster = Monster.getRootAsMonster(dataBuffer);
-
- // mana is optional and does not exist in the buffer so the mutation should fail
- // the mana field should retain its default value
- TestEq(monster.mutateMana((short)10), false);
- TestEq(monster.mana(), (short)150);
-
- // Accessing a vector of sorted by the key tables
- TestEq(monster.testarrayoftables(0).name(), "Barney");
- TestEq(monster.testarrayoftables(1).name(), "Frodo");
- TestEq(monster.testarrayoftables(2).name(), "Wilma");
- Monster.Vector testarrayoftablesVector = monster.testarrayoftablesVector();
- TestEq(testarrayoftablesVector.get(0).name(), "Barney");
- TestEq(testarrayoftablesVector.get(1).name(), "Frodo");
- TestEq(testarrayoftablesVector.get(2).name(), "Wilma");
-
- // Example of searching for a table by the key
- TestEq(monster.testarrayoftablesByKey("Frodo").name(), "Frodo");
- TestEq(monster.testarrayoftablesByKey("Barney").name(), "Barney");
- TestEq(monster.testarrayoftablesByKey("Wilma").name(), "Wilma");
- TestEq(testarrayoftablesVector.getByKey("Frodo").name(), "Frodo");
- TestEq(testarrayoftablesVector.getByKey("Barney").name(), "Barney");
- TestEq(testarrayoftablesVector.getByKey("Wilma").name(), "Wilma");
-
- // testType is an existing field and mutating it should succeed
- TestEq(monster.testType(), (byte)Any.Monster);
-
- //mutate the inventory vector
- TestEq(monster.mutateInventory(0, 1), true);
- TestEq(monster.mutateInventory(1, 2), true);
- TestEq(monster.mutateInventory(2, 3), true);
- TestEq(monster.mutateInventory(3, 4), true);
- TestEq(monster.mutateInventory(4, 5), true);
-
- for (int i = 0; i < monster.inventoryLength(); i++) {
- TestEq(monster.inventory(i), i + 1);
- }
- ByteVector inventoryVector = monster.inventoryVector();
- for (int i = 0; i < inventoryVector.length(); i++) {
- TestEq((int)inventoryVector.get(i), i + 1);
- }
-
- //reverse mutation
- TestEq(monster.mutateInventory(0, 0), true);
- TestEq(monster.mutateInventory(1, 1), true);
- TestEq(monster.mutateInventory(2, 2), true);
- TestEq(monster.mutateInventory(3, 3), true);
- TestEq(monster.mutateInventory(4, 4), true);
-
- // get a struct field and edit one of its fields
- Vec3 pos = monster.pos();
- TestEq(pos.x(), 1.0f);
- pos.mutateX(55.0f);
- TestEq(pos.x(), 55.0f);
- pos.mutateX(1.0f);
- TestEq(pos.x(), 1.0f);
- }
-
- static void TestVectorOfUnions() {
- final FlatBufferBuilder fbb = new FlatBufferBuilder();
-
- final int swordAttackDamage = 1;
-
- final int[] characterVector = new int[] {
- Attacker.createAttacker(fbb, swordAttackDamage),
- };
-
- final byte[] characterTypeVector = new byte[]{
- Character.MuLan,
- };
-
- Movie.finishMovieBuffer(
- fbb,
- Movie.createMovie(
- fbb,
- (byte)0,
- (byte)0,
- Movie.createCharactersTypeVector(fbb, characterTypeVector),
- Movie.createCharactersVector(fbb, characterVector)
- )
- );
-
- final Movie movie = Movie.getRootAsMovie(fbb.dataBuffer());
- ByteVector charactersTypeByteVector = movie.charactersTypeVector();
- UnionVector charactersVector = movie.charactersVector();
-
- TestEq(movie.charactersTypeLength(), characterTypeVector.length);
- TestEq(charactersTypeByteVector.length(), characterTypeVector.length);
- TestEq(movie.charactersLength(), characterVector.length);
- TestEq(charactersVector.length(), characterVector.length);
-
- TestEq(movie.charactersType(0), characterTypeVector[0]);
- TestEq(charactersTypeByteVector.get(0), characterTypeVector[0]);
-
- TestEq(((Attacker)movie.characters(new Attacker(), 0)).swordAttackDamage(), swordAttackDamage);
- }
-
- static void TestFixedLengthArrays() {
- FlatBufferBuilder builder = new FlatBufferBuilder(0);
-
- float a;
- int[] b = new int[15];
- byte c;
- int[][] d_a = new int[2][2];
- byte[] d_b = new byte[2];
- byte[][] d_c = new byte[2][2];
- long[][] d_d = new long[2][2];
- int e;
- long[] f = new long[2];
-
- a = 0.5f;
- for (int i = 0; i < 15; i++) b[i] = i;
- c = 1;
- d_a[0][0] = 1;
- d_a[0][1] = 2;
- d_a[1][0] = 3;
- d_a[1][1] = 4;
- d_b[0] = TestEnum.B;
- d_b[1] = TestEnum.C;
- d_c[0][0] = TestEnum.A;
- d_c[0][1] = TestEnum.B;
- d_c[1][0] = TestEnum.C;
- d_c[1][1] = TestEnum.B;
- d_d[0][0] = -1;
- d_d[0][1] = 1;
- d_d[1][0] = -2;
- d_d[1][1] = 2;
- e = 2;
- f[0] = -1;
- f[1] = 1;
-
- int arrayOffset = ArrayStruct.createArrayStruct(builder,
- a, b, c, d_a, d_b, d_c, d_d, e, f);
-
- // Create a table with the ArrayStruct.
- ArrayTable.startArrayTable(builder);
- ArrayTable.addA(builder, arrayOffset);
- int tableOffset = ArrayTable.endArrayTable(builder);
-
- ArrayTable.finishArrayTableBuffer(builder, tableOffset);
-
- ArrayTable table = ArrayTable.getRootAsArrayTable(builder.dataBuffer());
- NestedStruct nested = new NestedStruct();
-
- TestEq(table.a().a(), 0.5f);
- for (int i = 0; i < 15; i++) TestEq(table.a().b(i), i);
- TestEq(table.a().c(), (byte)1);
- TestEq(table.a().d(nested, 0).a(0), 1);
- TestEq(table.a().d(nested, 0).a(1), 2);
- TestEq(table.a().d(nested, 1).a(0), 3);
- TestEq(table.a().d(nested, 1).a(1), 4);
- TestEq(table.a().d(nested, 0).b(), TestEnum.B);
- TestEq(table.a().d(nested, 1).b(), TestEnum.C);
- TestEq(table.a().d(nested, 0).c(0), TestEnum.A);
- TestEq(table.a().d(nested, 0).c(1), TestEnum.B);
- TestEq(table.a().d(nested, 1).c(0), TestEnum.C);
- TestEq(table.a().d(nested, 1).c(1), TestEnum.B);
- TestEq(table.a().d(nested, 0).d(0), (long)-1);
- TestEq(table.a().d(nested, 0).d(1), (long)1);
- TestEq(table.a().d(nested, 1).d(0), (long)-2);
- TestEq(table.a().d(nested, 1).d(1), (long)2);
- TestEq(table.a().e(), 2);
- TestEq(table.a().f(0), (long)-1);
- TestEq(table.a().f(1), (long)1);
- }
-
- public static void testFlexBuffersTest() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder(ByteBuffer.allocate(512),
- FlexBuffersBuilder.BUILDER_FLAG_SHARE_KEYS_AND_STRINGS);
- testFlexBuffersTest(builder);
- int bufferLimit1 = ((ArrayReadWriteBuf) builder.getBuffer()).limit();
-
- // Repeat after clearing the builder to ensure the builder is reusable
- builder.clear();
- testFlexBuffersTest(builder);
- int bufferLimit2 = ((ArrayReadWriteBuf) builder.getBuffer()).limit();
- TestEq(bufferLimit1, bufferLimit2);
- }
-
- public static void testFlexBuffersTest(FlexBuffersBuilder builder) {
- // Write the equivalent of:
- // { vec: [ -100, "Fred", 4.0, false ], bar: [ 1, 2, 3 ], bar3: [ 1, 2, 3 ],
- // foo: 100, bool: true, mymap: { foo: "Fred" } }
- // It's possible to do this without std::function support as well.
- int map1 = builder.startMap();
-
- int vec1 = builder.startVector();
- builder.putInt(-100);
- builder.putString("Fred");
- builder.putBlob(new byte[]{(byte) 77});
- builder.putBoolean(false);
- builder.putInt(Long.MAX_VALUE);
-
- int map2 = builder.startMap();
- builder.putInt("test", 200);
- builder.endMap(null, map2);
-
- builder.putFloat(150.9);
- builder.putFloat(150.9999998);
- builder.endVector("vec", vec1, false, false);
-
- vec1 = builder.startVector();
- builder.putInt(1);
- builder.putInt(2);
- builder.putInt(3);
- builder.endVector("bar", vec1, true, false);
-
- vec1 = builder.startVector();
- builder.putBoolean(true);
- builder.putBoolean(false);
- builder.putBoolean(true);
- builder.putBoolean(false);
- builder.endVector("bools", vec1, true, false);
-
- builder.putBoolean("bool", true);
- builder.putFloat("foo", 100);
-
- map2 = builder.startMap();
- builder.putString("bar", "Fred"); // Testing key and string reuse.
- builder.putInt("int", -120);
- builder.putFloat("float", -123.0f);
- builder.putBlob("blob", new byte[]{ 65, 67 });
- builder.endMap("mymap", map2);
-
- builder.endMap(null, map1);
- builder.finish();
-
- FlexBuffers.Map m = FlexBuffers.getRoot(builder.getBuffer()).asMap();
-
- TestEq(m.size(), 6);
-
- // test empty (an null)
- TestEq(m.get("no_key").asString(), ""); // empty if fail
- TestEq(m.get("no_key").asMap(), FlexBuffers.Map.empty()); // empty if fail
- TestEq(m.get("no_key").asKey(), FlexBuffers.Key.empty()); // empty if fail
- TestEq(m.get("no_key").asVector(), FlexBuffers.Vector.empty()); // empty if fail
- TestEq(m.get("no_key").asBlob(), FlexBuffers.Blob.empty()); // empty if fail
- assert(m.get("no_key").asVector().isEmpty()); // empty if fail
-
- // testing "vec" field
- FlexBuffers.Vector vec = m.get("vec").asVector();
- TestEq(vec.size(), 8);
- TestEq(vec.get(0).asLong(), (long) -100);
- TestEq(vec.get(1).asString(), "Fred");
- TestEq(vec.get(2).isBlob(), true);
- TestEq(vec.get(2).asBlob().size(), 1);
- TestEq(vec.get(2).asBlob().data().get(0), (byte) 77);
- TestEq(vec.get(3).isBoolean(), true); // Check if type is a bool
- TestEq(vec.get(3).asBoolean(), false); // Check if value is false
- TestEq(vec.get(4).asLong(), Long.MAX_VALUE);
- TestEq(vec.get(5).isMap(), true);
- TestEq(vec.get(5).asMap().get("test").asInt(), 200);
- TestEq(Float.compare((float)vec.get(6).asFloat(), 150.9f), 0);
- TestEq(Double.compare(vec.get(7).asFloat(), 150.9999998), 0);
- TestEq((long)0, (long)vec.get(1).asLong()); //conversion fail returns 0 as C++
-
- // bar vector
- FlexBuffers.Vector tvec = m.get("bar").asVector();
- TestEq(tvec.size(), 3);
- TestEq(tvec.get(0).asInt(), 1);
- TestEq(tvec.get(1).asInt(), 2);
- TestEq(tvec.get(2).asInt(), 3);
- TestEq(((FlexBuffers.TypedVector) tvec).getElemType(), FlexBuffers.FBT_INT);
-
- // bools vector
- FlexBuffers.Vector bvec = m.get("bools").asVector();
- TestEq(bvec.size(), 4);
- TestEq(bvec.get(0).asBoolean(), true);
- TestEq(bvec.get(1).asBoolean(), false);
- TestEq(bvec.get(2).asBoolean(), true);
- TestEq(bvec.get(3).asBoolean(), false);
- TestEq(((FlexBuffers.TypedVector) bvec).getElemType(), FlexBuffers.FBT_BOOL);
-
-
- TestEq((float)m.get("foo").asFloat(), (float) 100);
- TestEq(m.get("unknown").isNull(), true);
-
- // mymap vector
- FlexBuffers.Map mymap = m.get("mymap").asMap();
- TestEq(mymap.keys().get(0), m.keys().get(0)); // These should be equal by pointer equality, since key and value are shared.
- TestEq(mymap.keys().get(0).toString(), "bar");
- TestEq(mymap.values().get(0).asString(), vec.get(1).asString());
- TestEq(mymap.get("int").asInt(), -120);
- TestEq((float)mymap.get("float").asFloat(), -123.0f);
- TestEq(Arrays.equals(mymap.get("blob").asBlob().getBytes(), new byte[]{ 65, 67 }), true);
- TestEq(mymap.get("blob").asBlob().toString(), "AC");
- TestEq(mymap.get("blob").toString(), "\"AC\"");
- }
-
- public static void testFlexBufferVectorStrings() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder(ByteBuffer.allocate(10000000));
-
- int size = 3000;
- StringBuilder sb = new StringBuilder();
- for (int i=0; i< size; i++) {
- sb.append("a");
- }
-
- String text = sb.toString();
- TestEq(text.length(), size);
-
- int pos = builder.startVector();
-
- for (int i=0; i<size; i++) {
- builder.putString(text);
- }
-
- try {
- builder.endVector(null, pos, true, false);
- // this should raise an exception as
- // typed vector of string was deprecated
- assert false;
- } catch(FlexBufferException fb) {
- // no op
- }
- // we finish the vector again as non-typed
- builder.endVector(null, pos, false, false);
-
- ByteBuffer b = builder.finish();
- Vector v = FlexBuffers.getRoot(b).asVector();
-
- TestEq(v.size(), size);
- for (int i=0; i<size; i++) {
- TestEq(v.get(i).asString().length(), size);
- TestEq(v.get(i).asString(), text);
- }
- }
-
- public static void testDeprecatedTypedVectorString() {
- // tests whether we are able to support reading deprecated typed vector string
- // data is equivalent to [ "abc", "abc", "abc", "abc"]
- byte[] data = new byte[] {0x03, 0x61, 0x62, 0x63, 0x00, 0x03, 0x61, 0x62, 0x63, 0x00,
- 0x03, 0x61, 0x62, 0x63, 0x00, 0x03, 0x61, 0x62, 0x63, 0x00, 0x04, 0x14, 0x10,
- 0x0c, 0x08, 0x04, 0x3c, 0x01};
- Reference ref = FlexBuffers.getRoot(ByteBuffer.wrap(data));
- TestEq(ref.getType(), FlexBuffers.FBT_VECTOR_STRING_DEPRECATED);
- TestEq(ref.isTypedVector(), true);
- Vector vec = ref.asVector();
- for (int i=0; i< vec.size(); i++) {
- TestEq("abc", vec.get(i).asString());
- }
- }
-
- public static void testSingleElementBoolean() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder(ByteBuffer.allocate(100));
- builder.putBoolean(true);
- ByteBuffer b = builder.finish();
- assert(FlexBuffers.getRoot(b).asBoolean());
- }
-
- public static void testSingleElementByte() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder();
- builder.putInt(10);
- ByteBuffer b = builder.finish();
- TestEq(10, FlexBuffers.getRoot(b).asInt());
- }
-
- public static void testSingleElementShort() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder();
- builder.putInt(Short.MAX_VALUE);
- ByteBuffer b = builder.finish();
- TestEq(Short.MAX_VALUE, (short)FlexBuffers.getRoot(b).asInt());
- }
-
- public static void testSingleElementInt() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder();
- builder.putInt(Integer.MIN_VALUE);
- ByteBuffer b = builder.finish();
- TestEq(Integer.MIN_VALUE, FlexBuffers.getRoot(b).asInt());
- }
-
- public static void testSingleElementLong() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder();
- builder.putInt(Long.MAX_VALUE);
- ByteBuffer b = builder.finish();
- TestEq(Long.MAX_VALUE, FlexBuffers.getRoot(b).asLong());
- }
-
- public static void testSingleElementFloat() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder();
- builder.putFloat(Float.MAX_VALUE);
- ByteBuffer b = builder.finish();
- TestEq(Float.compare(Float.MAX_VALUE, (float) FlexBuffers.getRoot(b).asFloat()), 0);
- }
-
- public static void testSingleElementDouble() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder();
- builder.putFloat(Double.MAX_VALUE);
- ByteBuffer b = builder.finish();
- TestEq(Double.compare(Double.MAX_VALUE, FlexBuffers.getRoot(b).asFloat()), 0);
- }
-
- public static void testSingleElementBigString() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder(ByteBuffer.allocate(10000));
- StringBuilder sb = new StringBuilder();
-
- for (int i=0; i< 3000; i++) {
- sb.append("a");
- }
-
- builder.putString(sb.toString());
- ByteBuffer b = builder.finish();
-
- FlexBuffers.Reference r = FlexBuffers.getRoot(b);
-
- TestEq(FlexBuffers.FBT_STRING, r.getType());
- TestEq(sb.toString(), r.asString());
- }
-
- public static void testSingleElementSmallString() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder(ByteBuffer.allocate(10000));
-
- builder.putString("aa");
- ByteBuffer b = builder.finish();
- FlexBuffers.Reference r = FlexBuffers.getRoot(b);
-
- TestEq(FlexBuffers.FBT_STRING, r.getType());
- TestEq("aa", r.asString());
- }
-
- public static void testSingleElementBlob() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder();
- builder.putBlob(new byte[]{5, 124, 118, -1});
- ByteBuffer b = builder.finish();
- FlexBuffers.Reference r = FlexBuffers.getRoot(b);
- byte[] result = r.asBlob().getBytes();
- TestEq((byte)5, result[0]);
- TestEq((byte)124, result[1]);
- TestEq((byte)118, result[2]);
- TestEq((byte)-1, result[3]);
- }
-
- public static void testSingleElementLongBlob() {
-
- // verifies blobs of up to 2^16 in length
- for (int i = 2; i <= 1<<16; i = i<<1) {
- byte[] input = new byte[i-1];
- for (int index = 0; index < input.length; index++) {
- input[index] = (byte)(index % 64);
- }
-
- FlexBuffersBuilder builder = new FlexBuffersBuilder();
- builder.putBlob(input);
- ByteBuffer b = builder.finish();
- FlexBuffers.Reference r = FlexBuffers.getRoot(b);
- byte[] result = r.asBlob().getBytes();
-
- for (int index = 0; index < input.length; index++) {
- TestEq((byte)(index % 64), result[index]);
- }
- }
- }
-
- public static void testSingleElementUByte() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder();
- builder.putUInt(0xFF);
- ByteBuffer b = builder.finish();
- FlexBuffers.Reference r = FlexBuffers.getRoot(b);
- TestEq(255, (int)r.asUInt());
- }
-
- public static void testSingleElementUShort() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder();
- builder.putUInt(0xFFFF);
- ByteBuffer b = builder.finish();
- FlexBuffers.Reference r = FlexBuffers.getRoot(b);
- TestEq(65535, (int)r.asUInt());
- }
-
- public static void testSingleElementUInt() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder();
- builder.putUInt(0xFFFF_FFFFL);
- ByteBuffer b = builder.finish();
- FlexBuffers.Reference r = FlexBuffers.getRoot(b);
- TestEq(4294967295L, r.asUInt());
- }
-
- public static void testSingleFixedTypeVector() {
-
- int[] ints = new int[]{5, 124, 118, -1};
- float[] floats = new float[]{5.5f, 124.124f, 118.118f, -1.1f};
- String[] strings = new String[]{"This", "is", "a", "typed", "array"};
- boolean[] booleans = new boolean[]{false, true, true, false};
-
-
- FlexBuffersBuilder builder = new FlexBuffersBuilder(ByteBuffer.allocate(512),
- FlexBuffersBuilder.BUILDER_FLAG_NONE);
-
- int mapPos = builder.startMap();
-
- int vecPos = builder.startVector();
- for (final int i : ints) {
- builder.putInt(i);
- }
- builder.endVector("ints", vecPos, true, false);
-
- vecPos = builder.startVector();
- for (final float i : floats) {
- builder.putFloat(i);
- }
- builder.endVector("floats", vecPos, true, false);
-
- vecPos = builder.startVector();
- for (final boolean i : booleans) {
- builder.putBoolean(i);
- }
- builder.endVector("booleans", vecPos, true, false);
-
- builder.endMap(null, mapPos);
-
-
- ByteBuffer b = builder.finish();
- FlexBuffers.Reference r = FlexBuffers.getRoot(b);
- assert(r.asMap().get("ints").isTypedVector());
- assert(r.asMap().get("floats").isTypedVector());
- assert(r.asMap().get("booleans").isTypedVector());
- }
-
- public static void testSingleElementVector() {
- FlexBuffersBuilder b = new FlexBuffersBuilder();
-
- int vecPos = b.startVector();
- b.putInt(99);
- b.putString("wow");
- int vecpos2 = b.startVector();
- b.putInt(99);
- b.putString("wow");
- b.endVector(null, vecpos2, false, false);
- b.endVector(null, vecPos, false, false);
- b.finish();
-
- FlexBuffers.Reference r = FlexBuffers.getRoot(b.getBuffer());
- TestEq(FlexBuffers.FBT_VECTOR, r.getType());
- FlexBuffers.Vector vec = FlexBuffers.getRoot(b.getBuffer()).asVector();
- TestEq(3, vec.size());
- TestEq(99, vec.get(0).asInt());
- TestEq("wow", vec.get(1).asString());
- TestEq("[ 99, \"wow\" ]", vec.get(2).toString());
- TestEq("[ 99, \"wow\", [ 99, \"wow\" ] ]", FlexBuffers.getRoot(b.getBuffer()).toString());
- }
-
- public static void testSingleElementMap() {
- FlexBuffersBuilder b = new FlexBuffersBuilder();
-
- int mapPost = b.startMap();
- b.putInt("myInt", 0x7fffffbbbfffffffL);
- b.putString("myString", "wow");
- b.putString("myString2", "incredible");
- int start = b.startVector();
- b.putInt(99);
- b.putString("wow");
- b.endVector("myVec", start, false, false);
-
- b.putFloat("double", 0x1.ffffbbbffffffP+1023);
- b.endMap(null, mapPost);
- b.finish();
-
- FlexBuffers.Reference r = FlexBuffers.getRoot(b.getBuffer());
- TestEq(FlexBuffers.FBT_MAP, r.getType());
- FlexBuffers.Map map = FlexBuffers.getRoot(b.getBuffer()).asMap();
- TestEq(5, map.size());
- TestEq(0x7fffffbbbfffffffL, map.get("myInt").asLong());
- TestEq("wow", map.get("myString").asString());
- TestEq("incredible", map.get("myString2").asString());
- TestEq(99, map.get("myVec").asVector().get(0).asInt());
- TestEq("wow", map.get("myVec").asVector().get(1).asString());
- TestEq(Double.compare(0x1.ffffbbbffffffP+1023, map.get("double").asFloat()), 0);
- TestEq("{ \"double\" : 1.7976894783391937E308, \"myInt\" : 9223371743723257855, \"myString\" : \"wow\", \"myString2\" : \"incredible\", \"myVec\" : [ 99, \"wow\" ] }",
- FlexBuffers.getRoot(b.getBuffer()).toString());
- }
-
- public static void testFlexBuferEmpty() {
- FlexBuffers.Blob blob = FlexBuffers.Blob.empty();
- FlexBuffers.Map ary = FlexBuffers.Map.empty();
- FlexBuffers.Vector map = FlexBuffers.Vector.empty();
- FlexBuffers.TypedVector typedAry = FlexBuffers.TypedVector.empty();
- TestEq(blob.size(), 0);
- TestEq(map.size(), 0);
- TestEq(ary.size(), 0);
- TestEq(typedAry.size(), 0);
- }
-
- public static void testHashMapToMap() {
- int entriesCount = 12;
-
- HashMap<String, String> source = new HashMap<>();
- for (int i = 0; i < entriesCount; i++) {
- source.put("foo_param_" + i, "foo_value_" + i);
- }
-
- FlexBuffersBuilder builder = new FlexBuffersBuilder(1000);
- int mapStart = builder.startMap();
- for (Map.Entry<String, String> entry : source.entrySet()) {
- builder.putString(entry.getKey(), entry.getValue());
- }
- builder.endMap(null, mapStart);
- ByteBuffer bb = builder.finish();
- bb.rewind();
-
- FlexBuffers.Reference rootReference = FlexBuffers.getRoot(bb);
-
- TestEq(rootReference.isMap(), true);
-
- FlexBuffers.Map flexMap = rootReference.asMap();
-
- FlexBuffers.KeyVector keys = flexMap.keys();
- FlexBuffers.Vector values = flexMap.values();
-
- TestEq(entriesCount, keys.size());
- TestEq(entriesCount, values.size());
-
- HashMap<String, String> result = new HashMap<>();
- for (int i = 0; i < keys.size(); i++) {
- result.put(keys.get(i).toString(), values.get(i).asString());
- }
-
- TestEq(source, result);
- }
-
- public static void testBuilderGrowth() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder();
- String someString = "This is a small string";
- builder.putString(someString);
- ByteBuffer b = builder.finish();
- TestEq(someString, FlexBuffers.getRoot(b).asString());
-
- FlexBuffersBuilder failBuilder = new FlexBuffersBuilder(ByteBuffer.allocate(1));
- failBuilder.putString(someString);
- }
-
- public static void testFlexBuffersUtf8Map() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder(ByteBuffer.allocate(512),
- FlexBuffersBuilder.BUILDER_FLAG_SHARE_KEYS_AND_STRINGS);
-
- String key0 = "😨 face1";
- String key1 = "😩 face2";
- String key2 = "😨 face3";
- String key3 = "trademark ®";
- String key4 = "€ euro";
- String utf8keys[] = { "😨 face1", "😩 face2", "😨 face3", "trademark ®", "€ euro"};
-
- int map = builder.startMap();
-
- for (int i=0; i< utf8keys.length; i++) {
- builder.putString(utf8keys[i], utf8keys[i]); // Testing key and string reuse.
- }
- builder.endMap(null, map);
- builder.finish();
-
- FlexBuffers.Map m = FlexBuffers.getRoot(builder.getBuffer()).asMap();
-
- TestEq(m.size(), 5);
-
- KeyVector kv = m.keys();
- for (int i=0; i< utf8keys.length; i++) {
- TestEq(kv.get(i).toString(), m.get(i).asString());
- }
-
- TestEq(m.get(key0).asString(), utf8keys[0]);
- TestEq(m.get(key1).asString(), utf8keys[1]);
- TestEq(m.get(key2).asString(), utf8keys[2]);
- TestEq(m.get(key3).asString(), utf8keys[3]);
- TestEq(m.get(key4).asString(), utf8keys[4]);
- }
-
- public static void testFlexBuffersMapLookup() {
- FlexBuffersBuilder builder = new FlexBuffersBuilder(ByteBuffer.allocate(512),
- FlexBuffersBuilder.BUILDER_FLAG_SHARE_KEYS_AND_STRINGS);
-
- String key0 = "123";
- String key1 = "1234";
- String key2 = "12345";
- String[] keys = new String[]{key0, key1, key2};
-
- int map = builder.startMap();
-
- for (int i=0; i< keys.length; i++) {
- builder.putString(keys[i], keys[i]); // Testing key and string reuse.
- }
- builder.endMap(null, map);
- builder.finish();
-
- FlexBuffers.Map m = FlexBuffers.getRoot(builder.getBuffer()).asMap();
- for (int i=0; i< keys.length; i++) {
- TestEq(m.get(keys[i]).asString(), keys[i]);
- TestEq(m.get(keys[i].getBytes(StandardCharsets.UTF_8)).asString(), keys[i]);
- }
- }
-
- public static void TestFlexBuffers() {
- testSingleElementByte();
- testSingleElementShort();
- testSingleElementInt();
- testSingleElementLong();
- testSingleElementFloat();
- testSingleElementDouble();
- testSingleElementSmallString();
- testSingleElementBigString();
- testSingleElementBlob();
- testSingleElementLongBlob();
- testSingleElementVector();
- testSingleFixedTypeVector();
- testSingleElementUShort();
- testSingleElementUInt();
- testSingleElementUByte();
- testSingleElementMap();
- testFlexBuffersTest();
- testHashMapToMap();
- testFlexBuferEmpty();
- testFlexBufferVectorStrings();
- testDeprecatedTypedVectorString();
- testBuilderGrowth();
- testFlexBuffersUtf8Map();
- testFlexBuffersMapLookup();
- }
-
- static void TestVectorOfBytes() {
- FlatBufferBuilder fbb = new FlatBufferBuilder(16);
- int str = fbb.createString("ByteMonster");
- byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int offset = Monster.createInventoryVector(fbb, data);
- Monster.startMonster(fbb);
- Monster.addName(fbb, str);
- Monster.addInventory(fbb, offset);
- int monster1 = Monster.endMonster(fbb);
- Monster.finishMonsterBuffer(fbb, monster1);
- Monster monsterObject = Monster.getRootAsMonster(fbb.dataBuffer());
-
- TestEq(monsterObject.inventoryLength(), data.length);
- TestEq(monsterObject.inventory(4), (int) data[4]);
- TestEq(ByteBuffer.wrap(data), monsterObject.inventoryAsByteBuffer());
-
- fbb.clear();
- ByteBuffer bb = ByteBuffer.wrap(data);
- offset = fbb.createByteVector(bb);
- str = fbb.createString("ByteMonster");
- Monster.startMonster(fbb);
- Monster.addName(fbb, str);
- Monster.addInventory(fbb, offset);
- monster1 = Monster.endMonster(fbb);
- Monster.finishMonsterBuffer(fbb, monster1);
- Monster monsterObject2 = Monster.getRootAsMonster(fbb.dataBuffer());
-
- TestEq(monsterObject2.inventoryLength(), data.length);
- for (int i = 0; i < data.length; i++) {
- TestEq(monsterObject2.inventory(i), (int) bb.get(i));
- }
-
- fbb.clear();
- offset = fbb.createByteVector(data, 3, 4);
- str = fbb.createString("ByteMonster");
- Monster.startMonster(fbb);
- Monster.addName(fbb, str);
- Monster.addInventory(fbb, offset);
- monster1 = Monster.endMonster(fbb);
- Monster.finishMonsterBuffer(fbb, monster1);
- Monster monsterObject3 = Monster.getRootAsMonster(fbb.dataBuffer());
-
- TestEq(monsterObject3.inventoryLength(), 4);
- TestEq(monsterObject3.inventory(0), (int) data[3]);
-
- fbb.clear();
- bb = ByteBuffer.wrap(data);
- offset = Monster.createInventoryVector(fbb, bb);
- str = fbb.createString("ByteMonster");
- Monster.startMonster(fbb);
- Monster.addName(fbb, str);
- Monster.addInventory(fbb, offset);
- monster1 = Monster.endMonster(fbb);
- Monster.finishMonsterBuffer(fbb, monster1);
- Monster monsterObject4 = Monster.getRootAsMonster(fbb.dataBuffer());
-
- TestEq(monsterObject4.inventoryLength(), data.length);
- TestEq(monsterObject4.inventory(8), (int) 8);
-
- fbb.clear();
- byte[] largeData = new byte[1024];
- offset = fbb.createByteVector(largeData);
- str = fbb.createString("ByteMonster");
- Monster.startMonster(fbb);
- Monster.addName(fbb, str);
- Monster.addInventory(fbb, offset);
- monster1 = Monster.endMonster(fbb);
- Monster.finishMonsterBuffer(fbb, monster1);
- Monster monsterObject5 = Monster.getRootAsMonster(fbb.dataBuffer());
-
- TestEq(monsterObject5.inventoryLength(), largeData.length);
- TestEq(monsterObject5.inventory(25), (int) largeData[25]);
-
- fbb.clear();
- bb = ByteBuffer.wrap(largeData);
- bb.position(512);
- ByteBuffer bb2 = bb.slice();
- TestEq(bb2.arrayOffset(), 512);
- offset = fbb.createByteVector(bb2);
- str = fbb.createString("ByteMonster");
- Monster.startMonster(fbb);
- Monster.addName(fbb, str);
- Monster.addInventory(fbb, offset);
- monster1 = Monster.endMonster(fbb);
- Monster.finishMonsterBuffer(fbb, monster1);
- Monster monsterObject6 = Monster.getRootAsMonster(fbb.dataBuffer());
-
- TestEq(monsterObject6.inventoryLength(), 512);
- TestEq(monsterObject6.inventory(0), (int) largeData[512]);
-
- fbb.clear();
- bb = ByteBuffer.wrap(largeData);
- bb.limit(256);
- offset = fbb.createByteVector(bb);
- str = fbb.createString("ByteMonster");
- Monster.startMonster(fbb);
- Monster.addName(fbb, str);
- Monster.addInventory(fbb, offset);
- monster1 = Monster.endMonster(fbb);
- Monster.finishMonsterBuffer(fbb, monster1);
- Monster monsterObject7 = Monster.getRootAsMonster(fbb.dataBuffer());
-
- TestEq(monsterObject7.inventoryLength(), 256);
-
- fbb.clear();
- bb = ByteBuffer.allocateDirect(2048);
- offset = fbb.createByteVector(bb);
- str = fbb.createString("ByteMonster");
- Monster.startMonster(fbb);
- Monster.addName(fbb, str);
- Monster.addInventory(fbb, offset);
- monster1 = Monster.endMonster(fbb);
- Monster.finishMonsterBuffer(fbb, monster1);
- Monster monsterObject8 = Monster.getRootAsMonster(fbb.dataBuffer());
-
- TestEq(monsterObject8.inventoryLength(), 2048);
- }
-
- static void TestSharedStringPool() {
- FlatBufferBuilder fb = new FlatBufferBuilder(1);
- String testString = "My string";
- int offset = fb.createSharedString(testString);
- for (int i=0; i< 10; i++) {
- TestEq(offset, fb.createSharedString(testString));
- }
- }
-
- static void TestScalarOptional() {
- FlatBufferBuilder fbb = new FlatBufferBuilder(1);
- ScalarStuff.startScalarStuff(fbb);
- int pos = ScalarStuff.endScalarStuff(fbb);
- fbb.finish(pos);
-
- ScalarStuff scalarStuff = ScalarStuff.getRootAsScalarStuff(fbb.dataBuffer());
- TestEq(scalarStuff.justI8(), (byte)0);
- TestEq(scalarStuff.maybeI8(), (byte)0);
- TestEq(scalarStuff.defaultI8(), (byte)42);
- TestEq(scalarStuff.justU8(), 0);
- TestEq(scalarStuff.maybeU8(), 0);
- TestEq(scalarStuff.defaultU8(), 42);
- TestEq(scalarStuff.justI16(), (short)0);
- TestEq(scalarStuff.maybeI16(), (short)0);
- TestEq(scalarStuff.defaultI16(), (short)42);
- TestEq(scalarStuff.justU16(), 0);
- TestEq(scalarStuff.maybeU16(), 0);
- TestEq(scalarStuff.defaultU16(), 42);
- TestEq(scalarStuff.justI32(), 0);
- TestEq(scalarStuff.maybeI32(), 0);
- TestEq(scalarStuff.defaultI32(), 42);
- TestEq(scalarStuff.justU32(), 0L);
- TestEq(scalarStuff.maybeU32(), 0L);
- TestEq(scalarStuff.defaultU32(), 42L);
- TestEq(scalarStuff.justI64(), 0L);
- TestEq(scalarStuff.maybeI64(), 0L);
- TestEq(scalarStuff.defaultI64(), 42L);
- TestEq(scalarStuff.justU64(), 0L);
- TestEq(scalarStuff.maybeU64(), 0L);
- TestEq(scalarStuff.defaultU64(), 42L);
- TestEq(scalarStuff.justF32(), 0.0f);
- TestEq(scalarStuff.maybeF32(), 0f);
- TestEq(scalarStuff.defaultF32(), 42.0f);
- TestEq(scalarStuff.justF64(), 0.0);
- TestEq(scalarStuff.maybeF64(), 0.0);
- TestEq(scalarStuff.defaultF64(), 42.0);
- TestEq(scalarStuff.justBool(), false);
- TestEq(scalarStuff.maybeBool(), false);
- TestEq(scalarStuff.defaultBool(), true);
- TestEq(scalarStuff.justEnum(), OptionalByte.None);
- TestEq(scalarStuff.maybeEnum(), OptionalByte.None);
- TestEq(scalarStuff.defaultEnum(), OptionalByte.One);
-
- TestEq(scalarStuff.hasMaybeI8(), false);
- TestEq(scalarStuff.hasMaybeI16(), false);
- TestEq(scalarStuff.hasMaybeI32(), false);
- TestEq(scalarStuff.hasMaybeI64(), false);
- TestEq(scalarStuff.hasMaybeU8(), false);
- TestEq(scalarStuff.hasMaybeU16(), false);
- TestEq(scalarStuff.hasMaybeU32(), false);
- TestEq(scalarStuff.hasMaybeU64(), false);
- TestEq(scalarStuff.hasMaybeF32(), false);
- TestEq(scalarStuff.hasMaybeF64(), false);
- TestEq(scalarStuff.hasMaybeBool(), false);
- TestEq(scalarStuff.hasMaybeEnum(), false);
-
- fbb.clear();
-
- ScalarStuff.startScalarStuff(fbb);
- ScalarStuff.addJustI8(fbb, (byte)5);
- ScalarStuff.addMaybeI8(fbb, (byte)5);
- ScalarStuff.addDefaultI8(fbb, (byte)5);
- ScalarStuff.addJustU8(fbb, 6);
- ScalarStuff.addMaybeU8(fbb, 6);
- ScalarStuff.addDefaultU8(fbb, 6);
- ScalarStuff.addJustI16(fbb, (short)7);
- ScalarStuff.addMaybeI16(fbb, (short)7);
- ScalarStuff.addDefaultI16(fbb, (short)7);
- ScalarStuff.addJustU16(fbb, 8);
- ScalarStuff.addMaybeU16(fbb, 8);
- ScalarStuff.addDefaultU16(fbb, 8);
- ScalarStuff.addJustI32(fbb, 9);
- ScalarStuff.addMaybeI32(fbb, 9);
- ScalarStuff.addDefaultI32(fbb, 9);
- ScalarStuff.addJustU32(fbb, (long)10);
- ScalarStuff.addMaybeU32(fbb, (long)10);
- ScalarStuff.addDefaultU32(fbb, (long)10);
- ScalarStuff.addJustI64(fbb, 11L);
- ScalarStuff.addMaybeI64(fbb, 11L);
- ScalarStuff.addDefaultI64(fbb, 11L);
- ScalarStuff.addJustU64(fbb, 12L);
- ScalarStuff.addMaybeU64(fbb, 12L);
- ScalarStuff.addDefaultU64(fbb, 12L);
- ScalarStuff.addJustF32(fbb, 13.0f);
- ScalarStuff.addMaybeF32(fbb, 13.0f);
- ScalarStuff.addDefaultF32(fbb, 13.0f);
- ScalarStuff.addJustF64(fbb, 14.0);
- ScalarStuff.addMaybeF64(fbb, 14.0);
- ScalarStuff.addDefaultF64(fbb, 14.0);
- ScalarStuff.addJustBool(fbb, true);
- ScalarStuff.addMaybeBool(fbb, true);
- ScalarStuff.addDefaultBool(fbb, true);
- ScalarStuff.addJustEnum(fbb, OptionalByte.Two);
- ScalarStuff.addMaybeEnum(fbb, OptionalByte.Two);
- ScalarStuff.addDefaultEnum(fbb, OptionalByte.Two);
-
- pos = ScalarStuff.endScalarStuff(fbb);
-
- fbb.finish(pos);
-
- scalarStuff = ScalarStuff.getRootAsScalarStuff(fbb.dataBuffer());
-
- TestEq(scalarStuff.justI8(), (byte)5);
- TestEq(scalarStuff.maybeI8(), (byte)5);
- TestEq(scalarStuff.defaultI8(), (byte)5);
- TestEq(scalarStuff.justU8(), 6);
- TestEq(scalarStuff.maybeU8(), 6);
- TestEq(scalarStuff.defaultU8(), 6);
- TestEq(scalarStuff.justI16(), (short)7);
- TestEq(scalarStuff.maybeI16(), (short)7);
- TestEq(scalarStuff.defaultI16(), (short)7);
- TestEq(scalarStuff.justU16(), 8);
- TestEq(scalarStuff.maybeU16(), 8);
- TestEq(scalarStuff.defaultU16(), 8);
- TestEq(scalarStuff.justI32(), 9);
- TestEq(scalarStuff.maybeI32(), 9);
- TestEq(scalarStuff.defaultI32(), 9);
- TestEq(scalarStuff.justU32(), 10L);
- TestEq(scalarStuff.maybeU32(), 10L);
- TestEq(scalarStuff.defaultU32(), 10L);
- TestEq(scalarStuff.justI64(), 11L);
- TestEq(scalarStuff.maybeI64(), 11L);
- TestEq(scalarStuff.defaultI64(), 11L);
- TestEq(scalarStuff.justU64(), 12L);
- TestEq(scalarStuff.maybeU64(), 12L);
- TestEq(scalarStuff.defaultU64(), 12L);
- TestEq(scalarStuff.justF32(), 13.0f);
- TestEq(scalarStuff.maybeF32(), 13.0f);
- TestEq(scalarStuff.defaultF32(), 13.0f);
- TestEq(scalarStuff.justF64(), 14.0);
- TestEq(scalarStuff.maybeF64(), 14.0);
- TestEq(scalarStuff.defaultF64(), 14.0);
- TestEq(scalarStuff.justBool(), true);
- TestEq(scalarStuff.maybeBool(), true);
- TestEq(scalarStuff.defaultBool(), true);
- TestEq(scalarStuff.justEnum(), OptionalByte.Two);
- TestEq(scalarStuff.maybeEnum(), OptionalByte.Two);
- TestEq(scalarStuff.defaultEnum(), OptionalByte.Two);
-
- TestEq(scalarStuff.hasMaybeI8(), true);
- TestEq(scalarStuff.hasMaybeI16(), true);
- TestEq(scalarStuff.hasMaybeI32(), true);
- TestEq(scalarStuff.hasMaybeI64(), true);
- TestEq(scalarStuff.hasMaybeU8(), true);
- TestEq(scalarStuff.hasMaybeU16(), true);
- TestEq(scalarStuff.hasMaybeU32(), true);
- TestEq(scalarStuff.hasMaybeU64(), true);
- TestEq(scalarStuff.hasMaybeF32(), true);
- TestEq(scalarStuff.hasMaybeF64(), true);
- TestEq(scalarStuff.hasMaybeBool(), true);
- TestEq(scalarStuff.hasMaybeEnum(), true);
- }
-
- static void TestObject(MonsterT monster) {
- TestEq(monster.getHp(), (short) 80);
- TestEq(monster.getMana(), (short) 150); // default
-
- TestEq(monster.getName(), "MyMonster");
- TestEq(monster.getColor(), Color.Blue);
- // monster.friendly() // can't access, deprecated
-
- Vec3T pos = monster.getPos();
- TestEq(pos.getX(), 1.0f);
- TestEq(pos.getY(), 2.0f);
- TestEq(pos.getZ(), 3.0f);
- TestEq(pos.getTest1(), 3.0);
- // issue: int != byte
- TestEq(pos.getTest2(), (int) Color.Green);
- TestT t = pos.getTest3();
- TestEq(t.getA(), (short) 5);
- TestEq(t.getB(), (byte) 6);
-
- TestEq(monster.getTest().getType(), (byte) Any.Monster);
- MonsterT monster2 = (MonsterT) monster.getTest().getValue();
- TestEq(monster2 != null, true);
- TestEq(monster2.getName(), "Fred");
-
- int[] inv = monster.getInventory();
- TestEq(inv.length, 5);
- int[] expInv = {0, 1, 2, 3, 4};
- for (int i = 0; i < inv.length; i++)
- TestEq(expInv[i], inv[i]);
-
- TestT[] test4 = monster.getTest4();
- TestT test_0 = test4[0];
- TestT test_1 = test4[1];
- TestEq(test4.length, 2);
- TestEq(test_0.getA(), (short) 10);
- TestEq(test_0.getB(), (byte) 20);
- TestEq(test_1.getA(), (short) 30);
- TestEq(test_1.getB(), (byte) 40);
-
- String[] testarrayofstring = monster.getTestarrayofstring();
- TestEq(testarrayofstring.length, 2);
- TestEq(testarrayofstring[0], "test1");
- TestEq(testarrayofstring[1], "test2");
-
- MonsterT[] testarrayoftables = monster.getTestarrayoftables();
- TestEq(testarrayoftables.length, 0);
-
- MonsterT enemy = monster.getEnemy();
- TestEq(enemy != null, true);
- TestEq(enemy.getName(), "Fred");
-
- int[] testnestedflatbuffer = monster.getTestnestedflatbuffer();
- TestEq(testnestedflatbuffer.length, 0);
-
- TestEq(monster.getTestempty() == null, true);
-
- TestEq(monster.getTestbool(), true);
-
- boolean[] testarrayofbools = monster.getTestarrayofbools();
- TestEq(testarrayofbools.length, 3);
- TestEq(testarrayofbools[0], true);
- TestEq(testarrayofbools[1], false);
- TestEq(testarrayofbools[2], true);
-
- TestEq(monster.getTestf(), 3.14159f);
- TestEq(monster.getTestf2(), 3.0f);
- TestEq(monster.getTestf3(), 0.0f);
- TestEq(monster.getTestf3(), 0.0f);
-
- AbilityT[] testarrayofsortedstruct = monster.getTestarrayofsortedstruct();
- TestEq(testarrayofsortedstruct.length, 3);
- TestEq(testarrayofsortedstruct[0].getId(), (long) 0);
- TestEq(testarrayofsortedstruct[1].getId(), (long) 1);
- TestEq(testarrayofsortedstruct[2].getId(), (long) 5);
- TestEq(testarrayofsortedstruct[0].getDistance(), (long) 45);
- TestEq(testarrayofsortedstruct[1].getDistance(), (long) 21);
- TestEq(testarrayofsortedstruct[2].getDistance(), (long) 12);
-
- int[] flex = monster.getFlex();
- TestEq(flex.length, 0);
-
- long[] vectorOfLongs = monster.getVectorOfLongs();
- TestEq(vectorOfLongs.length, 5);
- long l = 1;
- for (int i = 0; i < vectorOfLongs.length; i++) {
- TestEq(vectorOfLongs[i], l);
- l *= 100;
- }
-
- double[] vectorOfDoubles = monster.getVectorOfDoubles();
- TestEq(vectorOfDoubles.length, 3);
- TestEq(vectorOfDoubles[0], -1.7976931348623157E308);
- TestEq(vectorOfDoubles[1], 0.0);
- TestEq(vectorOfDoubles[2], 1.7976931348623157E308);
-
- TestEq(monster.getParentNamespaceTest() == null, true);
- ReferrableT[] vectorOfReferrables = monster.getVectorOfReferrables();
- TestEq(vectorOfReferrables.length, 0);
-
- TestEq(monster.getSignedEnum(), (byte) -1);
- }
-
- static void TestPackUnpack(ByteBuffer bb) {
- Monster m = Monster.getRootAsMonster(bb);
- MonsterT mObject = m.unpack();
- TestObject(mObject);
- FlatBufferBuilder fbb = new FlatBufferBuilder();
- int monster = Monster.pack(fbb, mObject);
- Monster.finishMonsterBuffer(fbb, monster);
- TestBuffer(fbb.dataBuffer());
-
- byte[] bytes = mObject.serializeToBinary();
- MonsterT newMonsterT = MonsterT.deserializeFromBinary(bytes);
- TestObject(newMonsterT);
- }
-
- static <T> void TestEq(T a, T b) {
- if ((a == null && a != b) || (a != null && !a.equals(b))) {
- System.out.println("" + a.getClass().getName() + " " + b.getClass().getName());
- System.out.println("FlatBuffers test FAILED: \'" + a + "\' != \'" + b + "\'");
- new Throwable().printStackTrace();
- assert false;
- System.exit(1);
- }
- }
-
-}
diff --git a/tests/JavaTest.sh b/tests/JavaTest.sh
deleted file mode 100755
index 099447e..0000000
--- a/tests/JavaTest.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2014 Google Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -o errexit
-
-echo Compile then run the Java test.
-
-java -version
-
-testdir=$(dirname $0)
-
-targetdir="${testdir}/target"
-
-if [[ -e "${targetdir}" ]]; then
- echo "cleaning target"
- rm -rf "${targetdir}"
-fi
-
-mkdir -v "${targetdir}"
-
-if ! find "${testdir}/../java" -type f -name "*.class" -delete; then
- echo "failed to clean .class files from java directory" >&2
- exit 1
-fi
-
-javac -d "${targetdir}" -classpath "${testdir}/optional_scalars:${testdir}/../java:${testdir}:${testdir}/namespace_test:${testdir}/union_vector" "${testdir}/JavaTest.java"
-
-(cd "${testdir}" && java -ea -classpath "${targetdir}" JavaTest )
-
-rm -rf "${targetdir}"
diff --git a/tests/KeywordTest/KeywordsInTable.cs b/tests/KeywordTest/KeywordsInTable.cs
index 495671b..af2a375 100644
--- a/tests/KeywordTest/KeywordsInTable.cs
+++ b/tests/KeywordTest/KeywordsInTable.cs
@@ -7,13 +7,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct KeywordsInTable : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static KeywordsInTable GetRootAsKeywordsInTable(ByteBuffer _bb) { return GetRootAsKeywordsInTable(_bb, new KeywordsInTable()); }
public static KeywordsInTable GetRootAsKeywordsInTable(ByteBuffer _bb, KeywordsInTable obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
@@ -25,22 +25,27 @@
public bool MutatePrivate(KeywordTest.@public @private) { int o = __p.__offset(6); if (o != 0) { __p.bb.PutInt(o + __p.bb_pos, (int)@private); return true; } else { return false; } }
public int Type { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
public bool MutateType(int type) { int o = __p.__offset(8); if (o != 0) { __p.bb.PutInt(o + __p.bb_pos, type); return true; } else { return false; } }
+ public bool Default { get { int o = __p.__offset(10); return o != 0 ? 0!=__p.bb.Get(o + __p.bb_pos) : (bool)false; } }
+ public bool MutateDefault(bool @default) { int o = __p.__offset(10); if (o != 0) { __p.bb.Put(o + __p.bb_pos, (byte)(@default ? 1 : 0)); return true; } else { return false; } }
public static Offset<KeywordTest.KeywordsInTable> CreateKeywordsInTable(FlatBufferBuilder builder,
KeywordTest.ABC @is = KeywordTest.ABC.@void,
KeywordTest.@public @private = KeywordTest.@public.NONE,
- int type = 0) {
- builder.StartTable(3);
+ int type = 0,
+ bool @default = false) {
+ builder.StartTable(4);
KeywordsInTable.AddType(builder, type);
KeywordsInTable.AddPrivate(builder, @private);
KeywordsInTable.AddIs(builder, @is);
+ KeywordsInTable.AddDefault(builder, @default);
return KeywordsInTable.EndKeywordsInTable(builder);
}
- public static void StartKeywordsInTable(FlatBufferBuilder builder) { builder.StartTable(3); }
+ public static void StartKeywordsInTable(FlatBufferBuilder builder) { builder.StartTable(4); }
public static void AddIs(FlatBufferBuilder builder, KeywordTest.ABC @is) { builder.AddInt(0, (int)@is, 0); }
public static void AddPrivate(FlatBufferBuilder builder, KeywordTest.@public @private) { builder.AddInt(1, (int)@private, 0); }
public static void AddType(FlatBufferBuilder builder, int type) { builder.AddInt(2, type, 0); }
+ public static void AddDefault(FlatBufferBuilder builder, bool @default) { builder.AddBool(3, @default, false); }
public static Offset<KeywordTest.KeywordsInTable> EndKeywordsInTable(FlatBufferBuilder builder) {
int o = builder.EndTable();
return new Offset<KeywordTest.KeywordsInTable>(o);
@@ -54,6 +59,7 @@
_o.Is = this.Is;
_o.Private = this.Private;
_o.Type = this.Type;
+ _o.Default = this.Default;
}
public static Offset<KeywordTest.KeywordsInTable> Pack(FlatBufferBuilder builder, KeywordsInTableT _o) {
if (_o == null) return default(Offset<KeywordTest.KeywordsInTable>);
@@ -61,7 +67,8 @@
builder,
_o.Is,
_o.Private,
- _o.Type);
+ _o.Type,
+ _o.Default);
}
}
@@ -73,11 +80,14 @@
public KeywordTest.@public Private { get; set; }
[Newtonsoft.Json.JsonProperty("type")]
public int Type { get; set; }
+ [Newtonsoft.Json.JsonProperty("default")]
+ public bool Default { get; set; }
public KeywordsInTableT() {
this.Is = KeywordTest.ABC.@void;
this.Private = KeywordTest.@public.NONE;
this.Type = 0;
+ this.Default = false;
}
}
diff --git a/tests/KeywordTest/KeywordsInUnion.cs b/tests/KeywordTest/KeywordsInUnion.cs
index 68c050e..0efa066 100644
--- a/tests/KeywordTest/KeywordsInUnion.cs
+++ b/tests/KeywordTest/KeywordsInUnion.cs
@@ -28,7 +28,7 @@
public KeywordTest.KeywordsInTableT Asinternal() { return this.As<KeywordTest.KeywordsInTableT>(); }
public static KeywordsInUnionUnion Frominternal(KeywordTest.KeywordsInTableT _internal) { return new KeywordsInUnionUnion{ Type = KeywordsInUnion.@internal, Value = _internal }; }
- public static int Pack(FlatBuffers.FlatBufferBuilder builder, KeywordsInUnionUnion _o) {
+ public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, KeywordsInUnionUnion _o) {
switch (_o.Type) {
default: return 0;
case KeywordsInUnion.@static: return KeywordTest.KeywordsInTable.Pack(builder, _o.Asstatic()).Value;
diff --git a/tests/KotlinTest.kt b/tests/KotlinTest.kt
index cfb7056..9a8fe5f 100644
--- a/tests/KotlinTest.kt
+++ b/tests/KotlinTest.kt
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import DictionaryLookup.*;
import MyGame.Example.*
import optional_scalars.*
import com.google.flatbuffers.ByteBufferUtil
@@ -79,9 +80,29 @@
TestSharedStringPool()
TestScalarOptional()
+ TestDictionaryLookup()
println("FlatBuffers test: completed successfully")
}
+ fun TestDictionaryLookup() {
+ val fbb = FlatBufferBuilder(16)
+ val lfIndex = LongFloatEntry.createLongFloatEntry(fbb, 0, 99.0f)
+ val vectorEntriesIdx = LongFloatMap.createEntriesVector(fbb, intArrayOf(lfIndex))
+ val rootIdx = LongFloatMap.createLongFloatMap(fbb, vectorEntriesIdx)
+
+ LongFloatMap.finishLongFloatMapBuffer(fbb, rootIdx)
+ val map = LongFloatMap.getRootAsLongFloatMap(fbb.dataBuffer())
+ assert(map.entriesLength == 1)
+
+ val e = map.entries(0)!!
+ assert(e.key == 0L)
+ assert(e.value == 99.0f)
+
+ val e2 = map.entriesByKey(0)!!
+ assert(e2.key == 0L)
+ assert(e2.value == 99.0f)
+ }
+
fun TestEnums() {
assert(Color.name(Color.Red.toInt()) == "Red")
assert(Color.name(Color.Blue.toInt()) == "Blue")
diff --git a/tests/MyGame/Example/Ability.cs b/tests/MyGame/Example/Ability.cs
index ae6a5b4..e194063 100644
--- a/tests/MyGame/Example/Ability.cs
+++ b/tests/MyGame/Example/Ability.cs
@@ -7,7 +7,7 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct Ability : IFlatbufferObject
{
diff --git a/tests/MyGame/Example/Ability.go b/tests/MyGame/Example/Ability.go
index 9852a75..ae869aa 100644
--- a/tests/MyGame/Example/Ability.go
+++ b/tests/MyGame/Example/Ability.go
@@ -7,8 +7,8 @@
)
type AbilityT struct {
- Id uint32
- Distance uint32
+ Id uint32 `json:"id"`
+ Distance uint32 `json:"distance"`
}
func (t *AbilityT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
diff --git a/tests/MyGame/Example/Ability.lua b/tests/MyGame/Example/Ability.lua
index 870ff81..01c7480 100644
--- a/tests/MyGame/Example/Ability.lua
+++ b/tests/MyGame/Example/Ability.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/Example/Any.cs b/tests/MyGame/Example/Any.cs
index 2e1717b..90cd22b 100644
--- a/tests/MyGame/Example/Any.cs
+++ b/tests/MyGame/Example/Any.cs
@@ -31,7 +31,7 @@
public MyGame.Example2.MonsterT AsMyGame_Example2_Monster() { return this.As<MyGame.Example2.MonsterT>(); }
public static AnyUnion FromMyGame_Example2_Monster(MyGame.Example2.MonsterT _mygame_example2_monster) { return new AnyUnion{ Type = Any.MyGame_Example2_Monster, Value = _mygame_example2_monster }; }
- public static int Pack(FlatBuffers.FlatBufferBuilder builder, AnyUnion _o) {
+ public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, AnyUnion _o) {
switch (_o.Type) {
default: return 0;
case Any.Monster: return MyGame.Example.Monster.Pack(builder, _o.AsMonster()).Value;
diff --git a/tests/MyGame/Example/Any.lua b/tests/MyGame/Example/Any.lua
index 769a224..b99f4c6 100644
--- a/tests/MyGame/Example/Any.lua
+++ b/tests/MyGame/Example/Any.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/Example/AnyAmbiguousAliases.cs b/tests/MyGame/Example/AnyAmbiguousAliases.cs
index 9253cc9..eec4172 100644
--- a/tests/MyGame/Example/AnyAmbiguousAliases.cs
+++ b/tests/MyGame/Example/AnyAmbiguousAliases.cs
@@ -31,7 +31,7 @@
public MyGame.Example.MonsterT AsM3() { return this.As<MyGame.Example.MonsterT>(); }
public static AnyAmbiguousAliasesUnion FromM3(MyGame.Example.MonsterT _m3) { return new AnyAmbiguousAliasesUnion{ Type = AnyAmbiguousAliases.M3, Value = _m3 }; }
- public static int Pack(FlatBuffers.FlatBufferBuilder builder, AnyAmbiguousAliasesUnion _o) {
+ public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, AnyAmbiguousAliasesUnion _o) {
switch (_o.Type) {
default: return 0;
case AnyAmbiguousAliases.M1: return MyGame.Example.Monster.Pack(builder, _o.AsM1()).Value;
diff --git a/tests/MyGame/Example/AnyAmbiguousAliases.lua b/tests/MyGame/Example/AnyAmbiguousAliases.lua
index c0d3407..0d6106c 100644
--- a/tests/MyGame/Example/AnyAmbiguousAliases.lua
+++ b/tests/MyGame/Example/AnyAmbiguousAliases.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/Example/AnyUniqueAliases.cs b/tests/MyGame/Example/AnyUniqueAliases.cs
index ab33276..bb6a212 100644
--- a/tests/MyGame/Example/AnyUniqueAliases.cs
+++ b/tests/MyGame/Example/AnyUniqueAliases.cs
@@ -31,7 +31,7 @@
public MyGame.Example2.MonsterT AsM2() { return this.As<MyGame.Example2.MonsterT>(); }
public static AnyUniqueAliasesUnion FromM2(MyGame.Example2.MonsterT _m2) { return new AnyUniqueAliasesUnion{ Type = AnyUniqueAliases.M2, Value = _m2 }; }
- public static int Pack(FlatBuffers.FlatBufferBuilder builder, AnyUniqueAliasesUnion _o) {
+ public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, AnyUniqueAliasesUnion _o) {
switch (_o.Type) {
default: return 0;
case AnyUniqueAliases.M: return MyGame.Example.Monster.Pack(builder, _o.AsM()).Value;
diff --git a/tests/MyGame/Example/AnyUniqueAliases.lua b/tests/MyGame/Example/AnyUniqueAliases.lua
index 0042b93..7ab4f9c 100644
--- a/tests/MyGame/Example/AnyUniqueAliases.lua
+++ b/tests/MyGame/Example/AnyUniqueAliases.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/Example/ArrayStruct.cs b/tests/MyGame/Example/ArrayStruct.cs
index df0e2ac..70a8bdd 100644
--- a/tests/MyGame/Example/ArrayStruct.cs
+++ b/tests/MyGame/Example/ArrayStruct.cs
@@ -7,7 +7,7 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct ArrayStruct : IFlatbufferObject
{
diff --git a/tests/MyGame/Example/ArrayTable.cs b/tests/MyGame/Example/ArrayTable.cs
index 9dc3d45..a5e4e79 100644
--- a/tests/MyGame/Example/ArrayTable.cs
+++ b/tests/MyGame/Example/ArrayTable.cs
@@ -7,13 +7,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct ArrayTable : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static ArrayTable GetRootAsArrayTable(ByteBuffer _bb) { return GetRootAsArrayTable(_bb, new ArrayTable()); }
public static ArrayTable GetRootAsArrayTable(ByteBuffer _bb, ArrayTable obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public static bool ArrayTableBufferHasIdentifier(ByteBuffer _bb) { return Table.__has_identifier(_bb, "ARRT"); }
diff --git a/tests/MyGame/Example/ArrayTable.java b/tests/MyGame/Example/ArrayTable.java
index 8e3782b..c255da3 100644
--- a/tests/MyGame/Example/ArrayTable.java
+++ b/tests/MyGame/Example/ArrayTable.java
@@ -9,7 +9,7 @@
@SuppressWarnings("unused")
public final class ArrayTable extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static ArrayTable getRootAsArrayTable(ByteBuffer _bb) { return getRootAsArrayTable(_bb, new ArrayTable()); }
public static ArrayTable getRootAsArrayTable(ByteBuffer _bb, ArrayTable obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public static boolean ArrayTableBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "ARRT"); }
diff --git a/tests/MyGame/Example/Color.lua b/tests/MyGame/Example/Color.lua
index 1909a1b..c7a0b1e 100644
--- a/tests/MyGame/Example/Color.lua
+++ b/tests/MyGame/Example/Color.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/Example/LongEnum.lua b/tests/MyGame/Example/LongEnum.lua
index 00fb679..a4e3dc5 100644
--- a/tests/MyGame/Example/LongEnum.lua
+++ b/tests/MyGame/Example/LongEnum.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/Example/Monster.cs b/tests/MyGame/Example/Monster.cs
index 4a11389..87d8ef3 100644
--- a/tests/MyGame/Example/Monster.cs
+++ b/tests/MyGame/Example/Monster.cs
@@ -7,14 +7,14 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
/// an example documentation comment: "monster object"
public struct Monster : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static Monster GetRootAsMonster(ByteBuffer _bb) { return GetRootAsMonster(_bb, new Monster()); }
public static Monster GetRootAsMonster(ByteBuffer _bb, Monster obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public static bool MonsterBufferHasIdentifier(ByteBuffer _bb) { return Table.__has_identifier(_bb, "MONS"); }
@@ -335,6 +335,8 @@
public static void AddInventory(FlatBufferBuilder builder, VectorOffset inventoryOffset) { builder.AddOffset(5, inventoryOffset.Value, 0); }
public static VectorOffset CreateInventoryVector(FlatBufferBuilder builder, byte[] data) { builder.StartVector(1, data.Length, 1); for (int i = data.Length - 1; i >= 0; i--) builder.AddByte(data[i]); return builder.EndVector(); }
public static VectorOffset CreateInventoryVectorBlock(FlatBufferBuilder builder, byte[] data) { builder.StartVector(1, data.Length, 1); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateInventoryVectorBlock(FlatBufferBuilder builder, ArraySegment<byte> data) { builder.StartVector(1, data.Count, 1); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateInventoryVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<byte>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartInventoryVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(1, numElems, 1); }
public static void AddColor(FlatBufferBuilder builder, MyGame.Example.Color color) { builder.AddByte(6, (byte)color, 8); }
public static void AddTestType(FlatBufferBuilder builder, MyGame.Example.Any testType) { builder.AddByte(7, (byte)testType, 0); }
@@ -344,15 +346,21 @@
public static void AddTestarrayofstring(FlatBufferBuilder builder, VectorOffset testarrayofstringOffset) { builder.AddOffset(10, testarrayofstringOffset.Value, 0); }
public static VectorOffset CreateTestarrayofstringVector(FlatBufferBuilder builder, StringOffset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); }
public static VectorOffset CreateTestarrayofstringVectorBlock(FlatBufferBuilder builder, StringOffset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateTestarrayofstringVectorBlock(FlatBufferBuilder builder, ArraySegment<StringOffset> data) { builder.StartVector(4, data.Count, 4); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateTestarrayofstringVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<StringOffset>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartTestarrayofstringVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); }
public static void AddTestarrayoftables(FlatBufferBuilder builder, VectorOffset testarrayoftablesOffset) { builder.AddOffset(11, testarrayoftablesOffset.Value, 0); }
public static VectorOffset CreateTestarrayoftablesVector(FlatBufferBuilder builder, Offset<MyGame.Example.Monster>[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); }
public static VectorOffset CreateTestarrayoftablesVectorBlock(FlatBufferBuilder builder, Offset<MyGame.Example.Monster>[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateTestarrayoftablesVectorBlock(FlatBufferBuilder builder, ArraySegment<Offset<MyGame.Example.Monster>> data) { builder.StartVector(4, data.Count, 4); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateTestarrayoftablesVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<Offset<MyGame.Example.Monster>>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartTestarrayoftablesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); }
public static void AddEnemy(FlatBufferBuilder builder, Offset<MyGame.Example.Monster> enemyOffset) { builder.AddOffset(12, enemyOffset.Value, 0); }
public static void AddTestnestedflatbuffer(FlatBufferBuilder builder, VectorOffset testnestedflatbufferOffset) { builder.AddOffset(13, testnestedflatbufferOffset.Value, 0); }
public static VectorOffset CreateTestnestedflatbufferVector(FlatBufferBuilder builder, byte[] data) { builder.StartVector(1, data.Length, 1); for (int i = data.Length - 1; i >= 0; i--) builder.AddByte(data[i]); return builder.EndVector(); }
public static VectorOffset CreateTestnestedflatbufferVectorBlock(FlatBufferBuilder builder, byte[] data) { builder.StartVector(1, data.Length, 1); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateTestnestedflatbufferVectorBlock(FlatBufferBuilder builder, ArraySegment<byte> data) { builder.StartVector(1, data.Count, 1); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateTestnestedflatbufferVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<byte>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartTestnestedflatbufferVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(1, numElems, 1); }
public static void AddTestempty(FlatBufferBuilder builder, Offset<MyGame.Example.Stat> testemptyOffset) { builder.AddOffset(14, testemptyOffset.Value, 0); }
public static void AddTestbool(FlatBufferBuilder builder, bool testbool) { builder.AddBool(15, testbool, false); }
@@ -367,6 +375,8 @@
public static void AddTestarrayofbools(FlatBufferBuilder builder, VectorOffset testarrayofboolsOffset) { builder.AddOffset(24, testarrayofboolsOffset.Value, 0); }
public static VectorOffset CreateTestarrayofboolsVector(FlatBufferBuilder builder, bool[] data) { builder.StartVector(1, data.Length, 1); for (int i = data.Length - 1; i >= 0; i--) builder.AddBool(data[i]); return builder.EndVector(); }
public static VectorOffset CreateTestarrayofboolsVectorBlock(FlatBufferBuilder builder, bool[] data) { builder.StartVector(1, data.Length, 1); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateTestarrayofboolsVectorBlock(FlatBufferBuilder builder, ArraySegment<bool> data) { builder.StartVector(1, data.Count, 1); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateTestarrayofboolsVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<bool>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartTestarrayofboolsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(1, numElems, 1); }
public static void AddTestf(FlatBufferBuilder builder, float testf) { builder.AddFloat(25, testf, 3.14159f); }
public static void AddTestf2(FlatBufferBuilder builder, float testf2) { builder.AddFloat(26, testf2, 3.0f); }
@@ -374,46 +384,64 @@
public static void AddTestarrayofstring2(FlatBufferBuilder builder, VectorOffset testarrayofstring2Offset) { builder.AddOffset(28, testarrayofstring2Offset.Value, 0); }
public static VectorOffset CreateTestarrayofstring2Vector(FlatBufferBuilder builder, StringOffset[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); }
public static VectorOffset CreateTestarrayofstring2VectorBlock(FlatBufferBuilder builder, StringOffset[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateTestarrayofstring2VectorBlock(FlatBufferBuilder builder, ArraySegment<StringOffset> data) { builder.StartVector(4, data.Count, 4); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateTestarrayofstring2VectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<StringOffset>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartTestarrayofstring2Vector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); }
public static void AddTestarrayofsortedstruct(FlatBufferBuilder builder, VectorOffset testarrayofsortedstructOffset) { builder.AddOffset(29, testarrayofsortedstructOffset.Value, 0); }
public static void StartTestarrayofsortedstructVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(8, numElems, 4); }
public static void AddFlex(FlatBufferBuilder builder, VectorOffset flexOffset) { builder.AddOffset(30, flexOffset.Value, 0); }
public static VectorOffset CreateFlexVector(FlatBufferBuilder builder, byte[] data) { builder.StartVector(1, data.Length, 1); for (int i = data.Length - 1; i >= 0; i--) builder.AddByte(data[i]); return builder.EndVector(); }
public static VectorOffset CreateFlexVectorBlock(FlatBufferBuilder builder, byte[] data) { builder.StartVector(1, data.Length, 1); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateFlexVectorBlock(FlatBufferBuilder builder, ArraySegment<byte> data) { builder.StartVector(1, data.Count, 1); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateFlexVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<byte>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartFlexVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(1, numElems, 1); }
public static void AddTest5(FlatBufferBuilder builder, VectorOffset test5Offset) { builder.AddOffset(31, test5Offset.Value, 0); }
public static void StartTest5Vector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 2); }
public static void AddVectorOfLongs(FlatBufferBuilder builder, VectorOffset vectorOfLongsOffset) { builder.AddOffset(32, vectorOfLongsOffset.Value, 0); }
public static VectorOffset CreateVectorOfLongsVector(FlatBufferBuilder builder, long[] data) { builder.StartVector(8, data.Length, 8); for (int i = data.Length - 1; i >= 0; i--) builder.AddLong(data[i]); return builder.EndVector(); }
public static VectorOffset CreateVectorOfLongsVectorBlock(FlatBufferBuilder builder, long[] data) { builder.StartVector(8, data.Length, 8); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVectorOfLongsVectorBlock(FlatBufferBuilder builder, ArraySegment<long> data) { builder.StartVector(8, data.Count, 8); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVectorOfLongsVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<long>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartVectorOfLongsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(8, numElems, 8); }
public static void AddVectorOfDoubles(FlatBufferBuilder builder, VectorOffset vectorOfDoublesOffset) { builder.AddOffset(33, vectorOfDoublesOffset.Value, 0); }
public static VectorOffset CreateVectorOfDoublesVector(FlatBufferBuilder builder, double[] data) { builder.StartVector(8, data.Length, 8); for (int i = data.Length - 1; i >= 0; i--) builder.AddDouble(data[i]); return builder.EndVector(); }
public static VectorOffset CreateVectorOfDoublesVectorBlock(FlatBufferBuilder builder, double[] data) { builder.StartVector(8, data.Length, 8); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVectorOfDoublesVectorBlock(FlatBufferBuilder builder, ArraySegment<double> data) { builder.StartVector(8, data.Count, 8); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVectorOfDoublesVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<double>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartVectorOfDoublesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(8, numElems, 8); }
public static void AddParentNamespaceTest(FlatBufferBuilder builder, Offset<MyGame.InParentNamespace> parentNamespaceTestOffset) { builder.AddOffset(34, parentNamespaceTestOffset.Value, 0); }
public static void AddVectorOfReferrables(FlatBufferBuilder builder, VectorOffset vectorOfReferrablesOffset) { builder.AddOffset(35, vectorOfReferrablesOffset.Value, 0); }
public static VectorOffset CreateVectorOfReferrablesVector(FlatBufferBuilder builder, Offset<MyGame.Example.Referrable>[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); }
public static VectorOffset CreateVectorOfReferrablesVectorBlock(FlatBufferBuilder builder, Offset<MyGame.Example.Referrable>[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVectorOfReferrablesVectorBlock(FlatBufferBuilder builder, ArraySegment<Offset<MyGame.Example.Referrable>> data) { builder.StartVector(4, data.Count, 4); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVectorOfReferrablesVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<Offset<MyGame.Example.Referrable>>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartVectorOfReferrablesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); }
public static void AddSingleWeakReference(FlatBufferBuilder builder, ulong singleWeakReference) { builder.AddUlong(36, singleWeakReference, 0); }
public static void AddVectorOfWeakReferences(FlatBufferBuilder builder, VectorOffset vectorOfWeakReferencesOffset) { builder.AddOffset(37, vectorOfWeakReferencesOffset.Value, 0); }
public static VectorOffset CreateVectorOfWeakReferencesVector(FlatBufferBuilder builder, ulong[] data) { builder.StartVector(8, data.Length, 8); for (int i = data.Length - 1; i >= 0; i--) builder.AddUlong(data[i]); return builder.EndVector(); }
public static VectorOffset CreateVectorOfWeakReferencesVectorBlock(FlatBufferBuilder builder, ulong[] data) { builder.StartVector(8, data.Length, 8); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVectorOfWeakReferencesVectorBlock(FlatBufferBuilder builder, ArraySegment<ulong> data) { builder.StartVector(8, data.Count, 8); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVectorOfWeakReferencesVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<ulong>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartVectorOfWeakReferencesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(8, numElems, 8); }
public static void AddVectorOfStrongReferrables(FlatBufferBuilder builder, VectorOffset vectorOfStrongReferrablesOffset) { builder.AddOffset(38, vectorOfStrongReferrablesOffset.Value, 0); }
public static VectorOffset CreateVectorOfStrongReferrablesVector(FlatBufferBuilder builder, Offset<MyGame.Example.Referrable>[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); }
public static VectorOffset CreateVectorOfStrongReferrablesVectorBlock(FlatBufferBuilder builder, Offset<MyGame.Example.Referrable>[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVectorOfStrongReferrablesVectorBlock(FlatBufferBuilder builder, ArraySegment<Offset<MyGame.Example.Referrable>> data) { builder.StartVector(4, data.Count, 4); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVectorOfStrongReferrablesVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<Offset<MyGame.Example.Referrable>>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartVectorOfStrongReferrablesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); }
public static void AddCoOwningReference(FlatBufferBuilder builder, ulong coOwningReference) { builder.AddUlong(39, coOwningReference, 0); }
public static void AddVectorOfCoOwningReferences(FlatBufferBuilder builder, VectorOffset vectorOfCoOwningReferencesOffset) { builder.AddOffset(40, vectorOfCoOwningReferencesOffset.Value, 0); }
public static VectorOffset CreateVectorOfCoOwningReferencesVector(FlatBufferBuilder builder, ulong[] data) { builder.StartVector(8, data.Length, 8); for (int i = data.Length - 1; i >= 0; i--) builder.AddUlong(data[i]); return builder.EndVector(); }
public static VectorOffset CreateVectorOfCoOwningReferencesVectorBlock(FlatBufferBuilder builder, ulong[] data) { builder.StartVector(8, data.Length, 8); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVectorOfCoOwningReferencesVectorBlock(FlatBufferBuilder builder, ArraySegment<ulong> data) { builder.StartVector(8, data.Count, 8); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVectorOfCoOwningReferencesVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<ulong>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartVectorOfCoOwningReferencesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(8, numElems, 8); }
public static void AddNonOwningReference(FlatBufferBuilder builder, ulong nonOwningReference) { builder.AddUlong(41, nonOwningReference, 0); }
public static void AddVectorOfNonOwningReferences(FlatBufferBuilder builder, VectorOffset vectorOfNonOwningReferencesOffset) { builder.AddOffset(42, vectorOfNonOwningReferencesOffset.Value, 0); }
public static VectorOffset CreateVectorOfNonOwningReferencesVector(FlatBufferBuilder builder, ulong[] data) { builder.StartVector(8, data.Length, 8); for (int i = data.Length - 1; i >= 0; i--) builder.AddUlong(data[i]); return builder.EndVector(); }
public static VectorOffset CreateVectorOfNonOwningReferencesVectorBlock(FlatBufferBuilder builder, ulong[] data) { builder.StartVector(8, data.Length, 8); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVectorOfNonOwningReferencesVectorBlock(FlatBufferBuilder builder, ArraySegment<ulong> data) { builder.StartVector(8, data.Count, 8); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVectorOfNonOwningReferencesVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<ulong>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartVectorOfNonOwningReferencesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(8, numElems, 8); }
public static void AddAnyUniqueType(FlatBufferBuilder builder, MyGame.Example.AnyUniqueAliases anyUniqueType) { builder.AddByte(43, (byte)anyUniqueType, 0); }
public static void AddAnyUnique(FlatBufferBuilder builder, int anyUniqueOffset) { builder.AddOffset(44, anyUniqueOffset, 0); }
@@ -422,15 +450,21 @@
public static void AddVectorOfEnums(FlatBufferBuilder builder, VectorOffset vectorOfEnumsOffset) { builder.AddOffset(47, vectorOfEnumsOffset.Value, 0); }
public static VectorOffset CreateVectorOfEnumsVector(FlatBufferBuilder builder, MyGame.Example.Color[] data) { builder.StartVector(1, data.Length, 1); for (int i = data.Length - 1; i >= 0; i--) builder.AddByte((byte)data[i]); return builder.EndVector(); }
public static VectorOffset CreateVectorOfEnumsVectorBlock(FlatBufferBuilder builder, MyGame.Example.Color[] data) { builder.StartVector(1, data.Length, 1); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVectorOfEnumsVectorBlock(FlatBufferBuilder builder, ArraySegment<MyGame.Example.Color> data) { builder.StartVector(1, data.Count, 1); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVectorOfEnumsVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<MyGame.Example.Color>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartVectorOfEnumsVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(1, numElems, 1); }
public static void AddSignedEnum(FlatBufferBuilder builder, MyGame.Example.Race signedEnum) { builder.AddSbyte(48, (sbyte)signedEnum, -1); }
public static void AddTestrequirednestedflatbuffer(FlatBufferBuilder builder, VectorOffset testrequirednestedflatbufferOffset) { builder.AddOffset(49, testrequirednestedflatbufferOffset.Value, 0); }
public static VectorOffset CreateTestrequirednestedflatbufferVector(FlatBufferBuilder builder, byte[] data) { builder.StartVector(1, data.Length, 1); for (int i = data.Length - 1; i >= 0; i--) builder.AddByte(data[i]); return builder.EndVector(); }
public static VectorOffset CreateTestrequirednestedflatbufferVectorBlock(FlatBufferBuilder builder, byte[] data) { builder.StartVector(1, data.Length, 1); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateTestrequirednestedflatbufferVectorBlock(FlatBufferBuilder builder, ArraySegment<byte> data) { builder.StartVector(1, data.Count, 1); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateTestrequirednestedflatbufferVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<byte>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartTestrequirednestedflatbufferVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(1, numElems, 1); }
public static void AddScalarKeySortedTables(FlatBufferBuilder builder, VectorOffset scalarKeySortedTablesOffset) { builder.AddOffset(50, scalarKeySortedTablesOffset.Value, 0); }
public static VectorOffset CreateScalarKeySortedTablesVector(FlatBufferBuilder builder, Offset<MyGame.Example.Stat>[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); }
public static VectorOffset CreateScalarKeySortedTablesVectorBlock(FlatBufferBuilder builder, Offset<MyGame.Example.Stat>[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateScalarKeySortedTablesVectorBlock(FlatBufferBuilder builder, ArraySegment<Offset<MyGame.Example.Stat>> data) { builder.StartVector(4, data.Count, 4); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateScalarKeySortedTablesVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<Offset<MyGame.Example.Stat>>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartScalarKeySortedTablesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); }
public static void AddNativeInline(FlatBufferBuilder builder, Offset<MyGame.Example.Test> nativeInlineOffset) { builder.AddStruct(51, nativeInlineOffset.Value, 0); }
public static void AddLongEnumNonEnumDefault(FlatBufferBuilder builder, MyGame.Example.LongEnum longEnumNonEnumDefault) { builder.AddUlong(52, (ulong)longEnumNonEnumDefault, 0); }
@@ -444,18 +478,21 @@
public static void FinishSizePrefixedMonsterBuffer(FlatBufferBuilder builder, Offset<MyGame.Example.Monster> offset) { builder.FinishSizePrefixed(offset.Value, "MONS"); }
public static VectorOffset CreateSortedVectorOfMonster(FlatBufferBuilder builder, Offset<Monster>[] offsets) {
- Array.Sort(offsets, (Offset<Monster> o1, Offset<Monster> o2) => Table.CompareStrings(Table.__offset(10, o1.Value, builder.DataBuffer), Table.__offset(10, o2.Value, builder.DataBuffer), builder.DataBuffer));
+ Array.Sort(offsets,
+ (Offset<Monster> o1, Offset<Monster> o2) =>
+ new Monster().__assign(builder.DataBuffer.Length - o1.Value, builder.DataBuffer).Name.CompareTo(new Monster().__assign(builder.DataBuffer.Length - o2.Value, builder.DataBuffer).Name));
return builder.CreateVectorOfTables(offsets);
}
public static Monster? __lookup_by_key(int vectorLocation, string key, ByteBuffer bb) {
- byte[] byteKey = System.Text.Encoding.UTF8.GetBytes(key);
+ Monster obj_ = new Monster();
int span = bb.GetInt(vectorLocation - 4);
int start = 0;
while (span != 0) {
int middle = span / 2;
int tableOffset = Table.__indirect(vectorLocation + 4 * (start + middle), bb);
- int comp = Table.CompareStrings(Table.__offset(10, bb.Length - tableOffset, bb), byteKey, bb);
+ obj_.__assign(tableOffset, bb);
+ int comp = obj_.Name.CompareTo(key);
if (comp > 0) {
span = middle;
} else if (comp < 0) {
@@ -463,7 +500,7 @@
start += middle;
span -= middle;
} else {
- return new Monster().__assign(tableOffset, bb);
+ return obj_;
}
}
return null;
diff --git a/tests/MyGame/Example/Monster.go b/tests/MyGame/Example/Monster.go
index 067be0d..237896c 100644
--- a/tests/MyGame/Example/Monster.go
+++ b/tests/MyGame/Example/Monster.go
@@ -10,56 +10,56 @@
/// an example documentation comment: "monster object"
type MonsterT struct {
- Pos *Vec3T
- Mana int16
- Hp int16
- Name string
- Inventory []byte
- Color Color
- Test *AnyT
- Test4 []*TestT
- Testarrayofstring []string
- Testarrayoftables []*MonsterT
- Enemy *MonsterT
- Testnestedflatbuffer []byte
- Testempty *StatT
- Testbool bool
- Testhashs32Fnv1 int32
- Testhashu32Fnv1 uint32
- Testhashs64Fnv1 int64
- Testhashu64Fnv1 uint64
- Testhashs32Fnv1a int32
- Testhashu32Fnv1a uint32
- Testhashs64Fnv1a int64
- Testhashu64Fnv1a uint64
- Testarrayofbools []bool
- Testf float32
- Testf2 float32
- Testf3 float32
- Testarrayofstring2 []string
- Testarrayofsortedstruct []*AbilityT
- Flex []byte
- Test5 []*TestT
- VectorOfLongs []int64
- VectorOfDoubles []float64
- ParentNamespaceTest *MyGame.InParentNamespaceT
- VectorOfReferrables []*ReferrableT
- SingleWeakReference uint64
- VectorOfWeakReferences []uint64
- VectorOfStrongReferrables []*ReferrableT
- CoOwningReference uint64
- VectorOfCoOwningReferences []uint64
- NonOwningReference uint64
- VectorOfNonOwningReferences []uint64
- AnyUnique *AnyUniqueAliasesT
- AnyAmbiguous *AnyAmbiguousAliasesT
- VectorOfEnums []Color
- SignedEnum Race
- Testrequirednestedflatbuffer []byte
- ScalarKeySortedTables []*StatT
- NativeInline *TestT
- LongEnumNonEnumDefault LongEnum
- LongEnumNormalDefault LongEnum
+ Pos *Vec3T `json:"pos"`
+ Mana int16 `json:"mana"`
+ Hp int16 `json:"hp"`
+ Name string `json:"name"`
+ Inventory []byte `json:"inventory"`
+ Color Color `json:"color"`
+ Test *AnyT `json:"test"`
+ Test4 []*TestT `json:"test4"`
+ Testarrayofstring []string `json:"testarrayofstring"`
+ Testarrayoftables []*MonsterT `json:"testarrayoftables"`
+ Enemy *MonsterT `json:"enemy"`
+ Testnestedflatbuffer []byte `json:"testnestedflatbuffer"`
+ Testempty *StatT `json:"testempty"`
+ Testbool bool `json:"testbool"`
+ Testhashs32Fnv1 int32 `json:"testhashs32_fnv1"`
+ Testhashu32Fnv1 uint32 `json:"testhashu32_fnv1"`
+ Testhashs64Fnv1 int64 `json:"testhashs64_fnv1"`
+ Testhashu64Fnv1 uint64 `json:"testhashu64_fnv1"`
+ Testhashs32Fnv1a int32 `json:"testhashs32_fnv1a"`
+ Testhashu32Fnv1a uint32 `json:"testhashu32_fnv1a"`
+ Testhashs64Fnv1a int64 `json:"testhashs64_fnv1a"`
+ Testhashu64Fnv1a uint64 `json:"testhashu64_fnv1a"`
+ Testarrayofbools []bool `json:"testarrayofbools"`
+ Testf float32 `json:"testf"`
+ Testf2 float32 `json:"testf2"`
+ Testf3 float32 `json:"testf3"`
+ Testarrayofstring2 []string `json:"testarrayofstring2"`
+ Testarrayofsortedstruct []*AbilityT `json:"testarrayofsortedstruct"`
+ Flex []byte `json:"flex"`
+ Test5 []*TestT `json:"test5"`
+ VectorOfLongs []int64 `json:"vector_of_longs"`
+ VectorOfDoubles []float64 `json:"vector_of_doubles"`
+ ParentNamespaceTest *MyGame.InParentNamespaceT `json:"parent_namespace_test"`
+ VectorOfReferrables []*ReferrableT `json:"vector_of_referrables"`
+ SingleWeakReference uint64 `json:"single_weak_reference"`
+ VectorOfWeakReferences []uint64 `json:"vector_of_weak_references"`
+ VectorOfStrongReferrables []*ReferrableT `json:"vector_of_strong_referrables"`
+ CoOwningReference uint64 `json:"co_owning_reference"`
+ VectorOfCoOwningReferences []uint64 `json:"vector_of_co_owning_references"`
+ NonOwningReference uint64 `json:"non_owning_reference"`
+ VectorOfNonOwningReferences []uint64 `json:"vector_of_non_owning_references"`
+ AnyUnique *AnyUniqueAliasesT `json:"any_unique"`
+ AnyAmbiguous *AnyAmbiguousAliasesT `json:"any_ambiguous"`
+ VectorOfEnums []Color `json:"vector_of_enums"`
+ SignedEnum Race `json:"signed_enum"`
+ Testrequirednestedflatbuffer []byte `json:"testrequirednestedflatbuffer"`
+ ScalarKeySortedTables []*StatT `json:"scalar_key_sorted_tables"`
+ NativeInline *TestT `json:"native_inline"`
+ LongEnumNonEnumDefault LongEnum `json:"long_enum_non_enum_default"`
+ LongEnumNormalDefault LongEnum `json:"long_enum_normal_default"`
}
func (t *MonsterT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
diff --git a/tests/MyGame/Example/Monster.java b/tests/MyGame/Example/Monster.java
index aeae257..5339054 100644
--- a/tests/MyGame/Example/Monster.java
+++ b/tests/MyGame/Example/Monster.java
@@ -12,7 +12,7 @@
*/
@SuppressWarnings("unused")
public final class Monster extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static Monster getRootAsMonster(ByteBuffer _bb) { return getRootAsMonster(_bb, new Monster()); }
public static Monster getRootAsMonster(ByteBuffer _bb, Monster obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public static boolean MonsterBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "MONS"); }
@@ -221,7 +221,7 @@
public static void addPos(FlatBufferBuilder builder, int posOffset) { builder.addStruct(0, posOffset, 0); }
public static void addMana(FlatBufferBuilder builder, short mana) { builder.addShort(1, mana, 150); }
public static void addHp(FlatBufferBuilder builder, short hp) { builder.addShort(2, hp, 100); }
- public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(3, nameOffset, 0); }
+ public static void addName(FlatBufferBuilder builder, int nameOffset) { builder.addOffset(nameOffset); builder.slot(3); }
public static void addInventory(FlatBufferBuilder builder, int inventoryOffset) { builder.addOffset(5, inventoryOffset, 0); }
public static int createInventoryVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); }
public static int createInventoryVector(FlatBufferBuilder builder, ByteBuffer data) { return builder.createByteVector(data); }
@@ -549,8 +549,9 @@
int _test4 = 0;
MyGame.Example.TestT[] _oTest4 = _o.getTest4();
if (_oTest4 != null) {
+ int _unused_offset = 0;
startTest4Vector(builder, _oTest4.length);
- for (int _j = _oTest4.length - 1; _j >=0; _j--) { MyGame.Example.Test.pack(builder, _oTest4[_j]);}
+ for (int _j = _oTest4.length - 1; _j >=0; _j--) { _unused_offset = MyGame.Example.Test.pack(builder, _oTest4[_j]);}
_test4 = builder.endVector();
}
int _testarrayofstring = 0;
@@ -590,8 +591,9 @@
int _testarrayofsortedstruct = 0;
MyGame.Example.AbilityT[] _oTestarrayofsortedstruct = _o.getTestarrayofsortedstruct();
if (_oTestarrayofsortedstruct != null) {
+ int _unused_offset = 0;
startTestarrayofsortedstructVector(builder, _oTestarrayofsortedstruct.length);
- for (int _j = _oTestarrayofsortedstruct.length - 1; _j >=0; _j--) { MyGame.Example.Ability.pack(builder, _oTestarrayofsortedstruct[_j]);}
+ for (int _j = _oTestarrayofsortedstruct.length - 1; _j >=0; _j--) { _unused_offset = MyGame.Example.Ability.pack(builder, _oTestarrayofsortedstruct[_j]);}
_testarrayofsortedstruct = builder.endVector();
}
int _flex = 0;
@@ -604,8 +606,9 @@
int _test5 = 0;
MyGame.Example.TestT[] _oTest5 = _o.getTest5();
if (_oTest5 != null) {
+ int _unused_offset = 0;
startTest5Vector(builder, _oTest5.length);
- for (int _j = _oTest5.length - 1; _j >=0; _j--) { MyGame.Example.Test.pack(builder, _oTest5[_j]);}
+ for (int _j = _oTest5.length - 1; _j >=0; _j--) { _unused_offset = MyGame.Example.Test.pack(builder, _oTest5[_j]);}
_test5 = builder.endVector();
}
int _vectorOfLongs = 0;
@@ -616,7 +619,7 @@
if (_o.getVectorOfDoubles() != null) {
_vectorOfDoubles = createVectorOfDoublesVector(builder, _o.getVectorOfDoubles());
}
- int _parent_namespace_test = _o.getParentNamespaceTest() == null ? 0 : MyGame.InParentNamespace.pack(builder, _o.getParentNamespaceTest());
+ int _parentNamespaceTest = _o.getParentNamespaceTest() == null ? 0 : MyGame.InParentNamespace.pack(builder, _o.getParentNamespaceTest());
int _vectorOfReferrables = 0;
if (_o.getVectorOfReferrables() != null) {
int[] __vectorOfReferrables = new int[_o.getVectorOfReferrables().length];
@@ -702,7 +705,7 @@
addTest5(builder, _test5);
addVectorOfLongs(builder, _vectorOfLongs);
addVectorOfDoubles(builder, _vectorOfDoubles);
- addParentNamespaceTest(builder, _parent_namespace_test);
+ addParentNamespaceTest(builder, _parentNamespaceTest);
addVectorOfReferrables(builder, _vectorOfReferrables);
addSingleWeakReference(builder, _o.getSingleWeakReference());
addVectorOfWeakReferences(builder, _vectorOfWeakReferences);
diff --git a/tests/MyGame/Example/Monster.kt b/tests/MyGame/Example/Monster.kt
index 1abe05c..fecf665 100644
--- a/tests/MyGame/Example/Monster.kt
+++ b/tests/MyGame/Example/Monster.kt
@@ -874,7 +874,7 @@
return compareStrings(__offset(10, o1, _bb), __offset(10, o2, _bb), _bb)
}
companion object {
- fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
fun getRootAsMonster(_bb: ByteBuffer): Monster = getRootAsMonster(_bb, Monster())
fun getRootAsMonster(_bb: ByteBuffer, obj: Monster): Monster {
_bb.order(ByteOrder.LITTLE_ENDIAN)
@@ -885,7 +885,10 @@
fun addPos(builder: FlatBufferBuilder, pos: Int) = builder.addStruct(0, pos, 0)
fun addMana(builder: FlatBufferBuilder, mana: Short) = builder.addShort(1, mana, 150)
fun addHp(builder: FlatBufferBuilder, hp: Short) = builder.addShort(2, hp, 100)
- fun addName(builder: FlatBufferBuilder, name: Int) = builder.addOffset(3, name, 0)
+ fun addName(builder: FlatBufferBuilder, name: Int) {
+ builder.addOffset(name)
+ builder.slot(3)
+ }
fun addInventory(builder: FlatBufferBuilder, inventory: Int) = builder.addOffset(5, inventory, 0)
fun createInventoryVector(builder: FlatBufferBuilder, data: UByteArray) : Int {
builder.startVector(1, data.size, 1)
diff --git a/tests/MyGame/Example/Monster.lua b/tests/MyGame/Example/Monster.lua
index 75108e5..6697c9b 100644
--- a/tests/MyGame/Example/Monster.lua
+++ b/tests/MyGame/Example/Monster.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/Example/NestedStruct.cs b/tests/MyGame/Example/NestedStruct.cs
index f323342..78173ac 100644
--- a/tests/MyGame/Example/NestedStruct.cs
+++ b/tests/MyGame/Example/NestedStruct.cs
@@ -7,7 +7,7 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct NestedStruct : IFlatbufferObject
{
diff --git a/tests/MyGame/Example/Race.lua b/tests/MyGame/Example/Race.lua
index f241870..7aa37e5 100644
--- a/tests/MyGame/Example/Race.lua
+++ b/tests/MyGame/Example/Race.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/Example/Referrable.cs b/tests/MyGame/Example/Referrable.cs
index e6f3146..a9b59c4 100644
--- a/tests/MyGame/Example/Referrable.cs
+++ b/tests/MyGame/Example/Referrable.cs
@@ -7,13 +7,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct Referrable : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static Referrable GetRootAsReferrable(ByteBuffer _bb) { return GetRootAsReferrable(_bb, new Referrable()); }
public static Referrable GetRootAsReferrable(ByteBuffer _bb, Referrable obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
@@ -37,17 +37,21 @@
}
public static VectorOffset CreateSortedVectorOfReferrable(FlatBufferBuilder builder, Offset<Referrable>[] offsets) {
- Array.Sort(offsets, (Offset<Referrable> o1, Offset<Referrable> o2) => builder.DataBuffer.GetUlong(Table.__offset(4, o1.Value, builder.DataBuffer)).CompareTo(builder.DataBuffer.GetUlong(Table.__offset(4, o2.Value, builder.DataBuffer))));
+ Array.Sort(offsets,
+ (Offset<Referrable> o1, Offset<Referrable> o2) =>
+ new Referrable().__assign(builder.DataBuffer.Length - o1.Value, builder.DataBuffer).Id.CompareTo(new Referrable().__assign(builder.DataBuffer.Length - o2.Value, builder.DataBuffer).Id));
return builder.CreateVectorOfTables(offsets);
}
public static Referrable? __lookup_by_key(int vectorLocation, ulong key, ByteBuffer bb) {
+ Referrable obj_ = new Referrable();
int span = bb.GetInt(vectorLocation - 4);
int start = 0;
while (span != 0) {
int middle = span / 2;
int tableOffset = Table.__indirect(vectorLocation + 4 * (start + middle), bb);
- int comp = bb.GetUlong(Table.__offset(4, bb.Length - tableOffset, bb)).CompareTo(key);
+ obj_.__assign(tableOffset, bb);
+ int comp = obj_.Id.CompareTo(key);
if (comp > 0) {
span = middle;
} else if (comp < 0) {
@@ -55,7 +59,7 @@
start += middle;
span -= middle;
} else {
- return new Referrable().__assign(tableOffset, bb);
+ return obj_;
}
}
return null;
diff --git a/tests/MyGame/Example/Referrable.go b/tests/MyGame/Example/Referrable.go
index 66c5972..aa27079 100644
--- a/tests/MyGame/Example/Referrable.go
+++ b/tests/MyGame/Example/Referrable.go
@@ -7,7 +7,7 @@
)
type ReferrableT struct {
- Id uint64
+ Id uint64 `json:"id"`
}
func (t *ReferrableT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
diff --git a/tests/MyGame/Example/Referrable.java b/tests/MyGame/Example/Referrable.java
index da8dea6..f28d6cb 100644
--- a/tests/MyGame/Example/Referrable.java
+++ b/tests/MyGame/Example/Referrable.java
@@ -9,7 +9,7 @@
@SuppressWarnings("unused")
public final class Referrable extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static Referrable getRootAsReferrable(ByteBuffer _bb) { return getRootAsReferrable(_bb, new Referrable()); }
public static Referrable getRootAsReferrable(ByteBuffer _bb, Referrable obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
@@ -26,7 +26,7 @@
}
public static void startReferrable(FlatBufferBuilder builder) { builder.startTable(1); }
- public static void addId(FlatBufferBuilder builder, long id) { builder.addLong(0, id, 0L); }
+ public static void addId(FlatBufferBuilder builder, long id) { builder.addLong(id); builder.slot(0); }
public static int endReferrable(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
diff --git a/tests/MyGame/Example/Referrable.kt b/tests/MyGame/Example/Referrable.kt
index 7f728a7..6d4b63e 100644
--- a/tests/MyGame/Example/Referrable.kt
+++ b/tests/MyGame/Example/Referrable.kt
@@ -36,7 +36,7 @@
return (val_1 - val_2).sign
}
companion object {
- fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
fun getRootAsReferrable(_bb: ByteBuffer): Referrable = getRootAsReferrable(_bb, Referrable())
fun getRootAsReferrable(_bb: ByteBuffer, obj: Referrable): Referrable {
_bb.order(ByteOrder.LITTLE_ENDIAN)
@@ -48,7 +48,10 @@
return endReferrable(builder)
}
fun startReferrable(builder: FlatBufferBuilder) = builder.startTable(1)
- fun addId(builder: FlatBufferBuilder, id: ULong) = builder.addLong(0, id.toLong(), 0)
+ fun addId(builder: FlatBufferBuilder, id: ULong) {
+ builder.addLong(id.toLong())
+ builder.slot(0)
+ }
fun endReferrable(builder: FlatBufferBuilder) : Int {
val o = builder.endTable()
return o
diff --git a/tests/MyGame/Example/Referrable.lua b/tests/MyGame/Example/Referrable.lua
index 3bd6b0a..1911906 100644
--- a/tests/MyGame/Example/Referrable.lua
+++ b/tests/MyGame/Example/Referrable.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/Example/Stat.cs b/tests/MyGame/Example/Stat.cs
index 149b136..32c05dc 100644
--- a/tests/MyGame/Example/Stat.cs
+++ b/tests/MyGame/Example/Stat.cs
@@ -7,13 +7,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct Stat : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static Stat GetRootAsStat(ByteBuffer _bb) { return GetRootAsStat(_bb, new Stat()); }
public static Stat GetRootAsStat(ByteBuffer _bb, Stat obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
@@ -52,17 +52,21 @@
}
public static VectorOffset CreateSortedVectorOfStat(FlatBufferBuilder builder, Offset<Stat>[] offsets) {
- Array.Sort(offsets, (Offset<Stat> o1, Offset<Stat> o2) => builder.DataBuffer.GetUshort(Table.__offset(8, o1.Value, builder.DataBuffer)).CompareTo(builder.DataBuffer.GetUshort(Table.__offset(8, o2.Value, builder.DataBuffer))));
+ Array.Sort(offsets,
+ (Offset<Stat> o1, Offset<Stat> o2) =>
+ new Stat().__assign(builder.DataBuffer.Length - o1.Value, builder.DataBuffer).Count.CompareTo(new Stat().__assign(builder.DataBuffer.Length - o2.Value, builder.DataBuffer).Count));
return builder.CreateVectorOfTables(offsets);
}
public static Stat? __lookup_by_key(int vectorLocation, ushort key, ByteBuffer bb) {
+ Stat obj_ = new Stat();
int span = bb.GetInt(vectorLocation - 4);
int start = 0;
while (span != 0) {
int middle = span / 2;
int tableOffset = Table.__indirect(vectorLocation + 4 * (start + middle), bb);
- int comp = bb.GetUshort(Table.__offset(8, bb.Length - tableOffset, bb)).CompareTo(key);
+ obj_.__assign(tableOffset, bb);
+ int comp = obj_.Count.CompareTo(key);
if (comp > 0) {
span = middle;
} else if (comp < 0) {
@@ -70,7 +74,7 @@
start += middle;
span -= middle;
} else {
- return new Stat().__assign(tableOffset, bb);
+ return obj_;
}
}
return null;
diff --git a/tests/MyGame/Example/Stat.go b/tests/MyGame/Example/Stat.go
index 5c060d1..7149640 100644
--- a/tests/MyGame/Example/Stat.go
+++ b/tests/MyGame/Example/Stat.go
@@ -7,9 +7,9 @@
)
type StatT struct {
- Id string
- Val int64
- Count uint16
+ Id string `json:"id"`
+ Val int64 `json:"val"`
+ Count uint16 `json:"count"`
}
func (t *StatT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
diff --git a/tests/MyGame/Example/Stat.java b/tests/MyGame/Example/Stat.java
index efc2673..3044421 100644
--- a/tests/MyGame/Example/Stat.java
+++ b/tests/MyGame/Example/Stat.java
@@ -9,7 +9,7 @@
@SuppressWarnings("unused")
public final class Stat extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static Stat getRootAsStat(ByteBuffer _bb) { return getRootAsStat(_bb, new Stat()); }
public static Stat getRootAsStat(ByteBuffer _bb, Stat obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
@@ -37,7 +37,7 @@
public static void startStat(FlatBufferBuilder builder) { builder.startTable(3); }
public static void addId(FlatBufferBuilder builder, int idOffset) { builder.addOffset(0, idOffset, 0); }
public static void addVal(FlatBufferBuilder builder, long val) { builder.addLong(1, val, 0L); }
- public static void addCount(FlatBufferBuilder builder, int count) { builder.addShort(2, (short) count, (short) 0); }
+ public static void addCount(FlatBufferBuilder builder, int count) { builder.addShort((short) count); builder.slot(2); }
public static int endStat(FlatBufferBuilder builder) {
int o = builder.endTable();
return o;
diff --git a/tests/MyGame/Example/Stat.kt b/tests/MyGame/Example/Stat.kt
index e6cc94c..ef6f31f 100644
--- a/tests/MyGame/Example/Stat.kt
+++ b/tests/MyGame/Example/Stat.kt
@@ -57,7 +57,7 @@
return (val_1 - val_2).sign
}
companion object {
- fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
fun getRootAsStat(_bb: ByteBuffer): Stat = getRootAsStat(_bb, Stat())
fun getRootAsStat(_bb: ByteBuffer, obj: Stat): Stat {
_bb.order(ByteOrder.LITTLE_ENDIAN)
@@ -73,7 +73,10 @@
fun startStat(builder: FlatBufferBuilder) = builder.startTable(3)
fun addId(builder: FlatBufferBuilder, id: Int) = builder.addOffset(0, id, 0)
fun addVal_(builder: FlatBufferBuilder, val_: Long) = builder.addLong(1, val_, 0L)
- fun addCount(builder: FlatBufferBuilder, count: UShort) = builder.addShort(2, count.toShort(), 0)
+ fun addCount(builder: FlatBufferBuilder, count: UShort) {
+ builder.addShort(count.toShort())
+ builder.slot(2)
+ }
fun endStat(builder: FlatBufferBuilder) : Int {
val o = builder.endTable()
return o
diff --git a/tests/MyGame/Example/Stat.lua b/tests/MyGame/Example/Stat.lua
index f621fd0..bf5704b 100644
--- a/tests/MyGame/Example/Stat.lua
+++ b/tests/MyGame/Example/Stat.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/Example/StructOfStructs.cs b/tests/MyGame/Example/StructOfStructs.cs
index 3a1607d..955aeab 100644
--- a/tests/MyGame/Example/StructOfStructs.cs
+++ b/tests/MyGame/Example/StructOfStructs.cs
@@ -7,7 +7,7 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct StructOfStructs : IFlatbufferObject
{
diff --git a/tests/MyGame/Example/StructOfStructs.go b/tests/MyGame/Example/StructOfStructs.go
index 35ccfcb..22281b6 100644
--- a/tests/MyGame/Example/StructOfStructs.go
+++ b/tests/MyGame/Example/StructOfStructs.go
@@ -7,9 +7,9 @@
)
type StructOfStructsT struct {
- A *AbilityT
- B *TestT
- C *AbilityT
+ A *AbilityT `json:"a"`
+ B *TestT `json:"b"`
+ C *AbilityT `json:"c"`
}
func (t *StructOfStructsT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
diff --git a/tests/MyGame/Example/StructOfStructs.lua b/tests/MyGame/Example/StructOfStructs.lua
index 7f56b34..be0148b 100644
--- a/tests/MyGame/Example/StructOfStructs.lua
+++ b/tests/MyGame/Example/StructOfStructs.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/Example/StructOfStructsOfStructs.cs b/tests/MyGame/Example/StructOfStructsOfStructs.cs
new file mode 100644
index 0000000..90cfc29
--- /dev/null
+++ b/tests/MyGame/Example/StructOfStructsOfStructs.cs
@@ -0,0 +1,74 @@
+// <auto-generated>
+// automatically generated by the FlatBuffers compiler, do not modify
+// </auto-generated>
+
+namespace MyGame.Example
+{
+
+using global::System;
+using global::System.Collections.Generic;
+using global::Google.FlatBuffers;
+
+public struct StructOfStructsOfStructs : IFlatbufferObject
+{
+ private Struct __p;
+ public ByteBuffer ByteBuffer { get { return __p.bb; } }
+ public void __init(int _i, ByteBuffer _bb) { __p = new Struct(_i, _bb); }
+ public StructOfStructsOfStructs __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
+
+ public MyGame.Example.StructOfStructs A { get { return (new MyGame.Example.StructOfStructs()).__assign(__p.bb_pos + 0, __p.bb); } }
+
+ public static Offset<MyGame.Example.StructOfStructsOfStructs> CreateStructOfStructsOfStructs(FlatBufferBuilder builder, uint a_a_Id, uint a_a_Distance, short a_b_A, sbyte a_b_B, uint a_c_Id, uint a_c_Distance) {
+ builder.Prep(4, 20);
+ builder.Prep(4, 20);
+ builder.Prep(4, 8);
+ builder.PutUint(a_c_Distance);
+ builder.PutUint(a_c_Id);
+ builder.Prep(2, 4);
+ builder.Pad(1);
+ builder.PutSbyte(a_b_B);
+ builder.PutShort(a_b_A);
+ builder.Prep(4, 8);
+ builder.PutUint(a_a_Distance);
+ builder.PutUint(a_a_Id);
+ return new Offset<MyGame.Example.StructOfStructsOfStructs>(builder.Offset);
+ }
+ public StructOfStructsOfStructsT UnPack() {
+ var _o = new StructOfStructsOfStructsT();
+ this.UnPackTo(_o);
+ return _o;
+ }
+ public void UnPackTo(StructOfStructsOfStructsT _o) {
+ _o.A = this.A.UnPack();
+ }
+ public static Offset<MyGame.Example.StructOfStructsOfStructs> Pack(FlatBufferBuilder builder, StructOfStructsOfStructsT _o) {
+ if (_o == null) return default(Offset<MyGame.Example.StructOfStructsOfStructs>);
+ var _a_a_id = _o.A.A.Id;
+ var _a_a_distance = _o.A.A.Distance;
+ var _a_b_a = _o.A.B.A;
+ var _a_b_b = _o.A.B.B;
+ var _a_c_id = _o.A.C.Id;
+ var _a_c_distance = _o.A.C.Distance;
+ return CreateStructOfStructsOfStructs(
+ builder,
+ _a_a_id,
+ _a_a_distance,
+ _a_b_a,
+ _a_b_b,
+ _a_c_id,
+ _a_c_distance);
+ }
+}
+
+public class StructOfStructsOfStructsT
+{
+ [Newtonsoft.Json.JsonProperty("a")]
+ public MyGame.Example.StructOfStructsT A { get; set; }
+
+ public StructOfStructsOfStructsT() {
+ this.A = new MyGame.Example.StructOfStructsT();
+ }
+}
+
+
+}
diff --git a/tests/MyGame/Example/StructOfStructsOfStructs.go b/tests/MyGame/Example/StructOfStructsOfStructs.go
new file mode 100644
index 0000000..b8f32a0
--- /dev/null
+++ b/tests/MyGame/Example/StructOfStructsOfStructs.go
@@ -0,0 +1,63 @@
+// Code generated by the FlatBuffers compiler. DO NOT EDIT.
+
+package Example
+
+import (
+ flatbuffers "github.com/google/flatbuffers/go"
+)
+
+type StructOfStructsOfStructsT struct {
+ A *StructOfStructsT `json:"a"`
+}
+
+func (t *StructOfStructsOfStructsT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
+ if t == nil { return 0 }
+ return CreateStructOfStructsOfStructs(builder, t.A.A.Id, t.A.A.Distance, t.A.B.A, t.A.B.B, t.A.C.Id, t.A.C.Distance)
+}
+func (rcv *StructOfStructsOfStructs) UnPackTo(t *StructOfStructsOfStructsT) {
+ t.A = rcv.A(nil).UnPack()
+}
+
+func (rcv *StructOfStructsOfStructs) UnPack() *StructOfStructsOfStructsT {
+ if rcv == nil { return nil }
+ t := &StructOfStructsOfStructsT{}
+ rcv.UnPackTo(t)
+ return t
+}
+
+type StructOfStructsOfStructs struct {
+ _tab flatbuffers.Struct
+}
+
+func (rcv *StructOfStructsOfStructs) Init(buf []byte, i flatbuffers.UOffsetT) {
+ rcv._tab.Bytes = buf
+ rcv._tab.Pos = i
+}
+
+func (rcv *StructOfStructsOfStructs) Table() flatbuffers.Table {
+ return rcv._tab.Table
+}
+
+func (rcv *StructOfStructsOfStructs) A(obj *StructOfStructs) *StructOfStructs {
+ if obj == nil {
+ obj = new(StructOfStructs)
+ }
+ obj.Init(rcv._tab.Bytes, rcv._tab.Pos+0)
+ return obj
+}
+
+func CreateStructOfStructsOfStructs(builder *flatbuffers.Builder, a_a_id uint32, a_a_distance uint32, a_b_a int16, a_b_b int8, a_c_id uint32, a_c_distance uint32) flatbuffers.UOffsetT {
+ builder.Prep(4, 20)
+ builder.Prep(4, 20)
+ builder.Prep(4, 8)
+ builder.PrependUint32(a_c_distance)
+ builder.PrependUint32(a_c_id)
+ builder.Prep(2, 4)
+ builder.Pad(1)
+ builder.PrependInt8(a_b_b)
+ builder.PrependInt16(a_b_a)
+ builder.Prep(4, 8)
+ builder.PrependUint32(a_a_distance)
+ builder.PrependUint32(a_a_id)
+ return builder.Offset()
+}
diff --git a/tests/MyGame/Example/StructOfStructsOfStructs.java b/tests/MyGame/Example/StructOfStructsOfStructs.java
new file mode 100644
index 0000000..5d5f00f
--- /dev/null
+++ b/tests/MyGame/Example/StructOfStructsOfStructs.java
@@ -0,0 +1,66 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+package MyGame.Example;
+
+import java.nio.*;
+import java.lang.*;
+import java.util.*;
+import com.google.flatbuffers.*;
+
+@SuppressWarnings("unused")
+public final class StructOfStructsOfStructs extends Struct {
+ public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
+ public StructOfStructsOfStructs __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
+
+ public MyGame.Example.StructOfStructs a() { return a(new MyGame.Example.StructOfStructs()); }
+ public MyGame.Example.StructOfStructs a(MyGame.Example.StructOfStructs obj) { return obj.__assign(bb_pos + 0, bb); }
+
+ public static int createStructOfStructsOfStructs(FlatBufferBuilder builder, long a_a_id, long a_a_distance, short a_b_a, byte a_b_b, long a_c_id, long a_c_distance) {
+ builder.prep(4, 20);
+ builder.prep(4, 20);
+ builder.prep(4, 8);
+ builder.putInt((int) a_c_distance);
+ builder.putInt((int) a_c_id);
+ builder.prep(2, 4);
+ builder.pad(1);
+ builder.putByte(a_b_b);
+ builder.putShort(a_b_a);
+ builder.prep(4, 8);
+ builder.putInt((int) a_a_distance);
+ builder.putInt((int) a_a_id);
+ return builder.offset();
+ }
+
+ public static final class Vector extends BaseVector {
+ public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; }
+
+ public StructOfStructsOfStructs get(int j) { return get(new StructOfStructsOfStructs(), j); }
+ public StructOfStructsOfStructs get(StructOfStructsOfStructs obj, int j) { return obj.__assign(__element(j), bb); }
+ }
+ public StructOfStructsOfStructsT unpack() {
+ StructOfStructsOfStructsT _o = new StructOfStructsOfStructsT();
+ unpackTo(_o);
+ return _o;
+ }
+ public void unpackTo(StructOfStructsOfStructsT _o) {
+ a().unpackTo(_o.getA());
+ }
+ public static int pack(FlatBufferBuilder builder, StructOfStructsOfStructsT _o) {
+ if (_o == null) return 0;
+ int _a_a_id = _o.getA().getA().getId();
+ int _a_a_distance = _o.getA().getA().getDistance();
+ short _a_b_a = _o.getA().getB().getA();
+ byte _a_b_b = _o.getA().getB().getB();
+ int _a_c_id = _o.getA().getC().getId();
+ int _a_c_distance = _o.getA().getC().getDistance();
+ return createStructOfStructsOfStructs(
+ builder,
+ _a_a_id,
+ _a_a_distance,
+ _a_b_a,
+ _a_b_b,
+ _a_c_id,
+ _a_c_distance);
+ }
+}
+
diff --git a/tests/MyGame/Example/StructOfStructsOfStructs.kt b/tests/MyGame/Example/StructOfStructsOfStructs.kt
new file mode 100644
index 0000000..955b600
--- /dev/null
+++ b/tests/MyGame/Example/StructOfStructsOfStructs.kt
@@ -0,0 +1,38 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+package MyGame.Example
+
+import java.nio.*
+import kotlin.math.sign
+import com.google.flatbuffers.*
+
+@Suppress("unused")
+class StructOfStructsOfStructs : Struct() {
+
+ fun __init(_i: Int, _bb: ByteBuffer) {
+ __reset(_i, _bb)
+ }
+ fun __assign(_i: Int, _bb: ByteBuffer) : StructOfStructsOfStructs {
+ __init(_i, _bb)
+ return this
+ }
+ val a : MyGame.Example.StructOfStructs? get() = a(MyGame.Example.StructOfStructs())
+ fun a(obj: MyGame.Example.StructOfStructs) : MyGame.Example.StructOfStructs? = obj.__assign(bb_pos + 0, bb)
+ companion object {
+ fun createStructOfStructsOfStructs(builder: FlatBufferBuilder, a_a_id: UInt, a_a_distance: UInt, a_b_a: Short, a_b_b: Byte, a_c_id: UInt, a_c_distance: UInt) : Int {
+ builder.prep(4, 20)
+ builder.prep(4, 20)
+ builder.prep(4, 8)
+ builder.putInt(a_c_distance.toInt())
+ builder.putInt(a_c_id.toInt())
+ builder.prep(2, 4)
+ builder.pad(1)
+ builder.putByte(a_b_b)
+ builder.putShort(a_b_a)
+ builder.prep(4, 8)
+ builder.putInt(a_a_distance.toInt())
+ builder.putInt(a_a_id.toInt())
+ return builder.offset()
+ }
+ }
+}
diff --git a/tests/MyGame/Example/StructOfStructsOfStructs.lua b/tests/MyGame/Example/StructOfStructsOfStructs.lua
new file mode 100644
index 0000000..f8587c1
--- /dev/null
+++ b/tests/MyGame/Example/StructOfStructsOfStructs.lua
@@ -0,0 +1,49 @@
+--[[ MyGame.Example.StructOfStructsOfStructs
+
+ Automatically generated by the FlatBuffers compiler, do not modify.
+ Or modify. I'm a message, not a cop.
+
+ flatc version: 2.0.8
+
+ Declared by : //monster_test.fbs
+ Rooting type : MyGame.Example.Monster (//monster_test.fbs)
+
+--]]
+
+local flatbuffers = require('flatbuffers')
+
+local StructOfStructsOfStructs = {}
+local mt = {}
+
+function StructOfStructsOfStructs.New()
+ local o = {}
+ setmetatable(o, {__index = mt})
+ return o
+end
+
+function mt:Init(buf, pos)
+ self.view = flatbuffers.view.New(buf, pos)
+end
+
+function mt:A(obj)
+ obj:Init(self.view.bytes, self.view.pos + 0)
+ return obj
+end
+
+function StructOfStructsOfStructs.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:PrependUint32(a_c_distance)
+ builder:PrependUint32(a_c_id)
+ builder:Prep(2, 4)
+ builder:Pad(1)
+ builder:PrependInt8(a_b_b)
+ builder:PrependInt16(a_b_a)
+ builder:Prep(4, 8)
+ builder:PrependUint32(a_a_distance)
+ builder:PrependUint32(a_a_id)
+ return builder:Offset()
+end
+
+return StructOfStructsOfStructs
\ No newline at end of file
diff --git a/tests/MyGame/Example/StructOfStructsOfStructs.php b/tests/MyGame/Example/StructOfStructsOfStructs.php
new file mode 100644
index 0000000..bcdcca0
--- /dev/null
+++ b/tests/MyGame/Example/StructOfStructsOfStructs.php
@@ -0,0 +1,55 @@
+<?php
+// automatically generated by the FlatBuffers compiler, do not modify
+
+namespace MyGame\Example;
+
+use \Google\FlatBuffers\Struct;
+use \Google\FlatBuffers\Table;
+use \Google\FlatBuffers\ByteBuffer;
+use \Google\FlatBuffers\FlatBufferBuilder;
+
+class StructOfStructsOfStructs extends Struct
+{
+ /**
+ * @param int $_i offset
+ * @param ByteBuffer $_bb
+ * @return StructOfStructsOfStructs
+ **/
+ public function init($_i, ByteBuffer $_bb)
+ {
+ $this->bb_pos = $_i;
+ $this->bb = $_bb;
+ return $this;
+ }
+
+ /**
+ * @return StructOfStructs
+ */
+ public function getA()
+ {
+ $obj = new StructOfStructs();
+ $obj->init($this->bb_pos + 0, $this->bb);
+ return $obj;
+ }
+
+
+ /**
+ * @return int offset
+ */
+ public static function createStructOfStructsOfStructs(FlatBufferBuilder $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->putUint($a_c_distance);
+ $builder->putUint($a_c_id);
+ $builder->prep(2, 4);
+ $builder->pad(1);
+ $builder->putSbyte($a_b_b);
+ $builder->putShort($a_b_a);
+ $builder->prep(4, 8);
+ $builder->putUint($a_a_distance);
+ $builder->putUint($a_a_id);
+ return $builder->offset();
+ }
+}
diff --git a/tests/MyGame/Example/StructOfStructsOfStructs.py b/tests/MyGame/Example/StructOfStructsOfStructs.py
new file mode 100644
index 0000000..edba982
--- /dev/null
+++ b/tests/MyGame/Example/StructOfStructsOfStructs.py
@@ -0,0 +1,74 @@
+# automatically generated by the FlatBuffers compiler, do not modify
+
+# namespace: Example
+
+import flatbuffers
+from flatbuffers.compat import import_numpy
+np = import_numpy()
+
+class StructOfStructsOfStructs(object):
+ __slots__ = ['_tab']
+
+ @classmethod
+ def SizeOf(cls):
+ return 20
+
+ # StructOfStructsOfStructs
+ def Init(self, buf, pos):
+ self._tab = flatbuffers.table.Table(buf, pos)
+
+ # StructOfStructsOfStructs
+ def A(self, obj):
+ obj.Init(self._tab.Bytes, self._tab.Pos + 0)
+ return obj
+
+
+def 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.PrependUint32(a_c_distance)
+ builder.PrependUint32(a_c_id)
+ builder.Prep(2, 4)
+ builder.Pad(1)
+ builder.PrependInt8(a_b_b)
+ builder.PrependInt16(a_b_a)
+ builder.Prep(4, 8)
+ builder.PrependUint32(a_a_distance)
+ builder.PrependUint32(a_a_id)
+ return builder.Offset()
+
+import MyGame.Example.StructOfStructs
+try:
+ from typing import Optional
+except:
+ pass
+
+class StructOfStructsOfStructsT(object):
+
+ # StructOfStructsOfStructsT
+ def __init__(self):
+ self.a = None # type: Optional[MyGame.Example.StructOfStructs.StructOfStructsT]
+
+ @classmethod
+ def InitFromBuf(cls, buf, pos):
+ structOfStructsOfStructs = StructOfStructsOfStructs()
+ structOfStructsOfStructs.Init(buf, pos)
+ return cls.InitFromObj(structOfStructsOfStructs)
+
+ @classmethod
+ def InitFromObj(cls, structOfStructsOfStructs):
+ x = StructOfStructsOfStructsT()
+ x._UnPack(structOfStructsOfStructs)
+ return x
+
+ # StructOfStructsOfStructsT
+ def _UnPack(self, structOfStructsOfStructs):
+ if structOfStructsOfStructs is None:
+ return
+ if structOfStructsOfStructs.A(MyGame.Example.StructOfStructs.StructOfStructs()) is not None:
+ self.a = MyGame.Example.StructOfStructs.StructOfStructsT.InitFromObj(structOfStructsOfStructs.A(MyGame.Example.StructOfStructs.StructOfStructs()))
+
+ # StructOfStructsOfStructsT
+ def Pack(self, builder):
+ return CreateStructOfStructsOfStructs(builder, self.a.a.id, self.a.a.distance, self.a.b.a, self.a.b.b, self.a.c.id, self.a.c.distance)
diff --git a/tests/MyGame/Example/StructOfStructsOfStructsT.java b/tests/MyGame/Example/StructOfStructsOfStructsT.java
new file mode 100644
index 0000000..3f23040
--- /dev/null
+++ b/tests/MyGame/Example/StructOfStructsOfStructsT.java
@@ -0,0 +1,22 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+package MyGame.Example;
+
+import java.nio.*;
+import java.lang.*;
+import java.util.*;
+import com.google.flatbuffers.*;
+
+public class StructOfStructsOfStructsT {
+ private MyGame.Example.StructOfStructsT a;
+
+ public MyGame.Example.StructOfStructsT getA() { return a; }
+
+ public void setA(MyGame.Example.StructOfStructsT a) { this.a = a; }
+
+
+ public StructOfStructsOfStructsT() {
+ this.a = new MyGame.Example.StructOfStructsT();
+ }
+}
+
diff --git a/tests/MyGame/Example/Test.cs b/tests/MyGame/Example/Test.cs
index a805218..68f3354 100644
--- a/tests/MyGame/Example/Test.cs
+++ b/tests/MyGame/Example/Test.cs
@@ -7,7 +7,7 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct Test : IFlatbufferObject
{
diff --git a/tests/MyGame/Example/Test.go b/tests/MyGame/Example/Test.go
index cbf7e29..1491711 100644
--- a/tests/MyGame/Example/Test.go
+++ b/tests/MyGame/Example/Test.go
@@ -7,8 +7,8 @@
)
type TestT struct {
- A int16
- B int8
+ A int16 `json:"a"`
+ B int8 `json:"b"`
}
func (t *TestT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
diff --git a/tests/MyGame/Example/Test.lua b/tests/MyGame/Example/Test.lua
index 63b566c..74217cc 100644
--- a/tests/MyGame/Example/Test.lua
+++ b/tests/MyGame/Example/Test.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.cs b/tests/MyGame/Example/TestSimpleTableWithEnum.cs
index 99a498b..837ad19 100644
--- a/tests/MyGame/Example/TestSimpleTableWithEnum.cs
+++ b/tests/MyGame/Example/TestSimpleTableWithEnum.cs
@@ -7,13 +7,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
internal partial struct TestSimpleTableWithEnum : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static TestSimpleTableWithEnum GetRootAsTestSimpleTableWithEnum(ByteBuffer _bb) { return GetRootAsTestSimpleTableWithEnum(_bb, new TestSimpleTableWithEnum()); }
public static TestSimpleTableWithEnum GetRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.go b/tests/MyGame/Example/TestSimpleTableWithEnum.go
index b8cde12..553867f 100644
--- a/tests/MyGame/Example/TestSimpleTableWithEnum.go
+++ b/tests/MyGame/Example/TestSimpleTableWithEnum.go
@@ -7,7 +7,7 @@
)
type TestSimpleTableWithEnumT struct {
- Color Color
+ Color Color `json:"color"`
}
func (t *TestSimpleTableWithEnumT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.java b/tests/MyGame/Example/TestSimpleTableWithEnum.java
index 92d0d69..39f9421 100644
--- a/tests/MyGame/Example/TestSimpleTableWithEnum.java
+++ b/tests/MyGame/Example/TestSimpleTableWithEnum.java
@@ -9,7 +9,7 @@
@SuppressWarnings("unused")
final class TestSimpleTableWithEnum extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb) { return getRootAsTestSimpleTableWithEnum(_bb, new TestSimpleTableWithEnum()); }
public static TestSimpleTableWithEnum getRootAsTestSimpleTableWithEnum(ByteBuffer _bb, TestSimpleTableWithEnum obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.kt b/tests/MyGame/Example/TestSimpleTableWithEnum.kt
index 64bf7e2..cb081fc 100644
--- a/tests/MyGame/Example/TestSimpleTableWithEnum.kt
+++ b/tests/MyGame/Example/TestSimpleTableWithEnum.kt
@@ -31,7 +31,7 @@
}
}
companion object {
- fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
fun getRootAsTestSimpleTableWithEnum(_bb: ByteBuffer): TestSimpleTableWithEnum = getRootAsTestSimpleTableWithEnum(_bb, TestSimpleTableWithEnum())
fun getRootAsTestSimpleTableWithEnum(_bb: ByteBuffer, obj: TestSimpleTableWithEnum): TestSimpleTableWithEnum {
_bb.order(ByteOrder.LITTLE_ENDIAN)
diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.lua b/tests/MyGame/Example/TestSimpleTableWithEnum.lua
index 000e6e1..90dcf79 100644
--- a/tests/MyGame/Example/TestSimpleTableWithEnum.lua
+++ b/tests/MyGame/Example/TestSimpleTableWithEnum.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/Example/TypeAliases.cs b/tests/MyGame/Example/TypeAliases.cs
index 1801dc8..f936ad6 100644
--- a/tests/MyGame/Example/TypeAliases.cs
+++ b/tests/MyGame/Example/TypeAliases.cs
@@ -7,13 +7,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct TypeAliases : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static TypeAliases GetRootAsTypeAliases(ByteBuffer _bb) { return GetRootAsTypeAliases(_bb, new TypeAliases()); }
public static TypeAliases GetRootAsTypeAliases(ByteBuffer _bb, TypeAliases obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
@@ -101,10 +101,14 @@
public static void AddV8(FlatBufferBuilder builder, VectorOffset v8Offset) { builder.AddOffset(10, v8Offset.Value, 0); }
public static VectorOffset CreateV8Vector(FlatBufferBuilder builder, sbyte[] data) { builder.StartVector(1, data.Length, 1); for (int i = data.Length - 1; i >= 0; i--) builder.AddSbyte(data[i]); return builder.EndVector(); }
public static VectorOffset CreateV8VectorBlock(FlatBufferBuilder builder, sbyte[] data) { builder.StartVector(1, data.Length, 1); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateV8VectorBlock(FlatBufferBuilder builder, ArraySegment<sbyte> data) { builder.StartVector(1, data.Count, 1); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateV8VectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<sbyte>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartV8Vector(FlatBufferBuilder builder, int numElems) { builder.StartVector(1, numElems, 1); }
public static void AddVf64(FlatBufferBuilder builder, VectorOffset vf64Offset) { builder.AddOffset(11, vf64Offset.Value, 0); }
public static VectorOffset CreateVf64Vector(FlatBufferBuilder builder, double[] data) { builder.StartVector(8, data.Length, 8); for (int i = data.Length - 1; i >= 0; i--) builder.AddDouble(data[i]); return builder.EndVector(); }
public static VectorOffset CreateVf64VectorBlock(FlatBufferBuilder builder, double[] data) { builder.StartVector(8, data.Length, 8); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVf64VectorBlock(FlatBufferBuilder builder, ArraySegment<double> data) { builder.StartVector(8, data.Count, 8); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateVf64VectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<double>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartVf64Vector(FlatBufferBuilder builder, int numElems) { builder.StartVector(8, numElems, 8); }
public static Offset<MyGame.Example.TypeAliases> EndTypeAliases(FlatBufferBuilder builder) {
int o = builder.EndTable();
diff --git a/tests/MyGame/Example/TypeAliases.go b/tests/MyGame/Example/TypeAliases.go
index d018fa1..9ded35e 100644
--- a/tests/MyGame/Example/TypeAliases.go
+++ b/tests/MyGame/Example/TypeAliases.go
@@ -7,18 +7,18 @@
)
type TypeAliasesT struct {
- I8 int8
- U8 byte
- I16 int16
- U16 uint16
- I32 int32
- U32 uint32
- I64 int64
- U64 uint64
- F32 float32
- F64 float64
- V8 []int8
- Vf64 []float64
+ I8 int8 `json:"i8"`
+ U8 byte `json:"u8"`
+ I16 int16 `json:"i16"`
+ U16 uint16 `json:"u16"`
+ I32 int32 `json:"i32"`
+ U32 uint32 `json:"u32"`
+ I64 int64 `json:"i64"`
+ U64 uint64 `json:"u64"`
+ F32 float32 `json:"f32"`
+ F64 float64 `json:"f64"`
+ V8 []int8 `json:"v8"`
+ Vf64 []float64 `json:"vf64"`
}
func (t *TypeAliasesT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
diff --git a/tests/MyGame/Example/TypeAliases.java b/tests/MyGame/Example/TypeAliases.java
index db757cc..d91ca65 100644
--- a/tests/MyGame/Example/TypeAliases.java
+++ b/tests/MyGame/Example/TypeAliases.java
@@ -9,7 +9,7 @@
@SuppressWarnings("unused")
public final class TypeAliases extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static TypeAliases getRootAsTypeAliases(ByteBuffer _bb) { return getRootAsTypeAliases(_bb, new TypeAliases()); }
public static TypeAliases getRootAsTypeAliases(ByteBuffer _bb, TypeAliases obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
diff --git a/tests/MyGame/Example/TypeAliases.kt b/tests/MyGame/Example/TypeAliases.kt
index cdc82b5..8a2d80e 100644
--- a/tests/MyGame/Example/TypeAliases.kt
+++ b/tests/MyGame/Example/TypeAliases.kt
@@ -203,7 +203,7 @@
}
}
companion object {
- fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
fun getRootAsTypeAliases(_bb: ByteBuffer): TypeAliases = getRootAsTypeAliases(_bb, TypeAliases())
fun getRootAsTypeAliases(_bb: ByteBuffer, obj: TypeAliases): TypeAliases {
_bb.order(ByteOrder.LITTLE_ENDIAN)
diff --git a/tests/MyGame/Example/TypeAliases.lua b/tests/MyGame/Example/TypeAliases.lua
index 111ae3e..cd406c3 100644
--- a/tests/MyGame/Example/TypeAliases.lua
+++ b/tests/MyGame/Example/TypeAliases.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/Example/Vec3.cs b/tests/MyGame/Example/Vec3.cs
index 31c9f7e..a4861fa 100644
--- a/tests/MyGame/Example/Vec3.cs
+++ b/tests/MyGame/Example/Vec3.cs
@@ -7,7 +7,7 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct Vec3 : IFlatbufferObject
{
diff --git a/tests/MyGame/Example/Vec3.go b/tests/MyGame/Example/Vec3.go
index 08311ed..16a05cd 100644
--- a/tests/MyGame/Example/Vec3.go
+++ b/tests/MyGame/Example/Vec3.go
@@ -7,12 +7,12 @@
)
type Vec3T struct {
- X float32
- Y float32
- Z float32
- Test1 float64
- Test2 Color
- Test3 *TestT
+ X float32 `json:"x"`
+ Y float32 `json:"y"`
+ Z float32 `json:"z"`
+ Test1 float64 `json:"test1"`
+ Test2 Color `json:"test2"`
+ Test3 *TestT `json:"test3"`
}
func (t *Vec3T) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
diff --git a/tests/MyGame/Example/Vec3.lua b/tests/MyGame/Example/Vec3.lua
index ef51051..796ac7a 100644
--- a/tests/MyGame/Example/Vec3.lua
+++ b/tests/MyGame/Example/Vec3.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/Example2/Monster.cs b/tests/MyGame/Example2/Monster.cs
index 3232bd6..af736e7 100644
--- a/tests/MyGame/Example2/Monster.cs
+++ b/tests/MyGame/Example2/Monster.cs
@@ -7,13 +7,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct Monster : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static Monster GetRootAsMonster(ByteBuffer _bb) { return GetRootAsMonster(_bb, new Monster()); }
public static Monster GetRootAsMonster(ByteBuffer _bb, Monster obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
diff --git a/tests/MyGame/Example2/Monster.java b/tests/MyGame/Example2/Monster.java
index 6323def..8065218 100644
--- a/tests/MyGame/Example2/Monster.java
+++ b/tests/MyGame/Example2/Monster.java
@@ -9,7 +9,7 @@
@SuppressWarnings("unused")
public final class Monster extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static Monster getRootAsMonster(ByteBuffer _bb) { return getRootAsMonster(_bb, new Monster()); }
public static Monster getRootAsMonster(ByteBuffer _bb, Monster obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
diff --git a/tests/MyGame/Example2/Monster.kt b/tests/MyGame/Example2/Monster.kt
index 88b9d05..b5a148f 100644
--- a/tests/MyGame/Example2/Monster.kt
+++ b/tests/MyGame/Example2/Monster.kt
@@ -17,7 +17,7 @@
return this
}
companion object {
- fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
fun getRootAsMonster(_bb: ByteBuffer): Monster = getRootAsMonster(_bb, Monster())
fun getRootAsMonster(_bb: ByteBuffer, obj: Monster): Monster {
_bb.order(ByteOrder.LITTLE_ENDIAN)
diff --git a/tests/MyGame/Example2/Monster.lua b/tests/MyGame/Example2/Monster.lua
index 9c33904..ddf4738 100644
--- a/tests/MyGame/Example2/Monster.lua
+++ b/tests/MyGame/Example2/Monster.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/InParentNamespace.cs b/tests/MyGame/InParentNamespace.cs
index b266aae..6237e7c 100644
--- a/tests/MyGame/InParentNamespace.cs
+++ b/tests/MyGame/InParentNamespace.cs
@@ -7,13 +7,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct InParentNamespace : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static InParentNamespace GetRootAsInParentNamespace(ByteBuffer _bb) { return GetRootAsInParentNamespace(_bb, new InParentNamespace()); }
public static InParentNamespace GetRootAsInParentNamespace(ByteBuffer _bb, InParentNamespace obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
diff --git a/tests/MyGame/InParentNamespace.java b/tests/MyGame/InParentNamespace.java
index a3e6819..c525ed5 100644
--- a/tests/MyGame/InParentNamespace.java
+++ b/tests/MyGame/InParentNamespace.java
@@ -9,7 +9,7 @@
@SuppressWarnings("unused")
public final class InParentNamespace extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static InParentNamespace getRootAsInParentNamespace(ByteBuffer _bb) { return getRootAsInParentNamespace(_bb, new InParentNamespace()); }
public static InParentNamespace getRootAsInParentNamespace(ByteBuffer _bb, InParentNamespace obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
diff --git a/tests/MyGame/InParentNamespace.kt b/tests/MyGame/InParentNamespace.kt
index beb414a..7bed058 100644
--- a/tests/MyGame/InParentNamespace.kt
+++ b/tests/MyGame/InParentNamespace.kt
@@ -17,7 +17,7 @@
return this
}
companion object {
- fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
fun getRootAsInParentNamespace(_bb: ByteBuffer): InParentNamespace = getRootAsInParentNamespace(_bb, InParentNamespace())
fun getRootAsInParentNamespace(_bb: ByteBuffer, obj: InParentNamespace): InParentNamespace {
_bb.order(ByteOrder.LITTLE_ENDIAN)
diff --git a/tests/MyGame/InParentNamespace.lua b/tests/MyGame/InParentNamespace.lua
index 8112c25..9115666 100644
--- a/tests/MyGame/InParentNamespace.lua
+++ b/tests/MyGame/InParentNamespace.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/MonsterExtra.cs b/tests/MyGame/MonsterExtra.cs
index 6af9932..0236856 100644
--- a/tests/MyGame/MonsterExtra.cs
+++ b/tests/MyGame/MonsterExtra.cs
@@ -7,13 +7,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct MonsterExtra : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static MonsterExtra GetRootAsMonsterExtra(ByteBuffer _bb) { return GetRootAsMonsterExtra(_bb, new MonsterExtra()); }
public static MonsterExtra GetRootAsMonsterExtra(ByteBuffer _bb, MonsterExtra obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public static bool MonsterExtraBufferHasIdentifier(ByteBuffer _bb) { return Table.__has_identifier(_bb, "MONE"); }
@@ -92,10 +92,14 @@
public static void AddDvec(FlatBufferBuilder builder, VectorOffset dvecOffset) { builder.AddOffset(8, dvecOffset.Value, 0); }
public static VectorOffset CreateDvecVector(FlatBufferBuilder builder, double[] data) { builder.StartVector(8, data.Length, 8); for (int i = data.Length - 1; i >= 0; i--) builder.AddDouble(data[i]); return builder.EndVector(); }
public static VectorOffset CreateDvecVectorBlock(FlatBufferBuilder builder, double[] data) { builder.StartVector(8, data.Length, 8); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateDvecVectorBlock(FlatBufferBuilder builder, ArraySegment<double> data) { builder.StartVector(8, data.Count, 8); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateDvecVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<double>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartDvecVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(8, numElems, 8); }
public static void AddFvec(FlatBufferBuilder builder, VectorOffset fvecOffset) { builder.AddOffset(9, fvecOffset.Value, 0); }
public static VectorOffset CreateFvecVector(FlatBufferBuilder builder, float[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddFloat(data[i]); return builder.EndVector(); }
public static VectorOffset CreateFvecVectorBlock(FlatBufferBuilder builder, float[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateFvecVectorBlock(FlatBufferBuilder builder, ArraySegment<float> data) { builder.StartVector(4, data.Count, 4); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateFvecVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<float>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartFvecVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); }
public static Offset<MyGame.MonsterExtra> EndMonsterExtra(FlatBufferBuilder builder) {
int o = builder.EndTable();
diff --git a/tests/MyGame/MonsterExtra.java b/tests/MyGame/MonsterExtra.java
index a2c342d..fdaf40b 100644
--- a/tests/MyGame/MonsterExtra.java
+++ b/tests/MyGame/MonsterExtra.java
@@ -9,7 +9,7 @@
@SuppressWarnings("unused")
public final class MonsterExtra extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static MonsterExtra getRootAsMonsterExtra(ByteBuffer _bb) { return getRootAsMonsterExtra(_bb, new MonsterExtra()); }
public static MonsterExtra getRootAsMonsterExtra(ByteBuffer _bb, MonsterExtra obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public static boolean MonsterExtraBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "MONE"); }
diff --git a/tests/MyGame/MonsterExtra.kt b/tests/MyGame/MonsterExtra.kt
index f222647..3c8760c 100644
--- a/tests/MyGame/MonsterExtra.kt
+++ b/tests/MyGame/MonsterExtra.kt
@@ -175,7 +175,7 @@
}
}
companion object {
- fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
fun getRootAsMonsterExtra(_bb: ByteBuffer): MonsterExtra = getRootAsMonsterExtra(_bb, MonsterExtra())
fun getRootAsMonsterExtra(_bb: ByteBuffer, obj: MonsterExtra): MonsterExtra {
_bb.order(ByteOrder.LITTLE_ENDIAN)
diff --git a/tests/MyGame/OtherNameSpace/FromInclude.lua b/tests/MyGame/OtherNameSpace/FromInclude.lua
index 2c2bf0a..64d894e 100644
--- a/tests/MyGame/OtherNameSpace/FromInclude.lua
+++ b/tests/MyGame/OtherNameSpace/FromInclude.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //include_test/sub/include_test2.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/OtherNameSpace/TableB.lua b/tests/MyGame/OtherNameSpace/TableB.lua
index bfa8b03..1f76c88 100644
--- a/tests/MyGame/OtherNameSpace/TableB.lua
+++ b/tests/MyGame/OtherNameSpace/TableB.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //include_test/sub/include_test2.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/MyGame/OtherNameSpace/Unused.lua b/tests/MyGame/OtherNameSpace/Unused.lua
index 2769625..155a04e 100644
--- a/tests/MyGame/OtherNameSpace/Unused.lua
+++ b/tests/MyGame/OtherNameSpace/Unused.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //include_test/sub/include_test2.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/TableA.lua b/tests/TableA.lua
index 90b9c95..312f82d 100644
--- a/tests/TableA.lua
+++ b/tests/TableA.lua
@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop.
- flatc version: 2.0.6
+ flatc version: 2.0.8
Declared by : //include_test/include_test1.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs)
diff --git a/tests/TestAll.sh b/tests/TestAll.sh
index 06548a2..3a3fcd7 100755
--- a/tests/TestAll.sh
+++ b/tests/TestAll.sh
@@ -16,7 +16,7 @@
echo "************************ TypeScript:"
-sh TypeScriptTest.sh
+python3 TypeScriptTest.py
echo "************************ C++:"
diff --git a/tests/TypeScriptTest.bat b/tests/TypeScriptTest.bat
deleted file mode 100755
index daa5451..0000000
--- a/tests/TypeScriptTest.bat
+++ /dev/null
@@ -1,9 +0,0 @@
-npm install
-../flatc.exe --ts --gen-name-strings --gen-mutable --gen-object-api -I include_test monster_test.fbs
-../flatc.exe --gen-object-api -b -I include_test monster_test.fbs unicode_test.json
-../flatc.exe --ts --gen-name-strings --gen-mutable --gen-object-api -o union_vector union_vector/union_vector.fbs
-../flatc.exe --ts --gen-name-strings optional_scalars.fbs
-tsc
-node -r esm JavaScriptTest
-node -r esm JavaScriptUnionVectorTest
-node -r esm JavaScriptFlexBuffersTest
diff --git a/tests/TypeScriptTest.sh b/tests/TypeScriptTest.sh
deleted file mode 100755
index fd7b82d..0000000
--- a/tests/TypeScriptTest.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-#
-# Copyright 2016 Google Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -e
-
-# clean node_modules to make sure we depend on latest local flatbuffers at ../
-rm -rf node_modules
-npm install
-
-if [ -x ../flatc ]; then
- ../flatc --ts --gen-name-strings --gen-mutable --gen-object-api -I include_test monster_test.fbs
- ../flatc --gen-object-api -b -I include_test monster_test.fbs unicode_test.json
- ../flatc --ts --gen-name-strings --gen-mutable --gen-object-api -o union_vector union_vector/union_vector.fbs
- ../flatc --ts --gen-name-strings optional_scalars.fbs
- ../flatc --ts --gen-name-strings --gen-object-api --gen-mutable -I ../ ./typescript_keywords.fbs test_dir/typescript_include.fbs test_dir/typescript_transitive_include.fbs ../reflection/reflection.fbs
- ../flatc --ts --gen-name-strings --gen-object-api --gen-mutable --ts-flat-files -I ../ ./typescript_keywords.fbs test_dir/typescript_include.fbs test_dir/typescript_transitive_include.fbs ../reflection/reflection.fbs
-fi
-tsc
-node -r esm JavaScriptTest
-node -r esm JavaScriptUnionVectorTest
-node -r esm JavaScriptFlexBuffersTest
diff --git a/tests/annotated_binary/README.md b/tests/annotated_binary/README.md
new file mode 100644
index 0000000..0cb0461
--- /dev/null
+++ b/tests/annotated_binary/README.md
@@ -0,0 +1,101 @@
+# Annotated Flatbuffer Binary
+
+This directory demonstrates the ability of flatc to annotate binary flatbuffers
+with helpful annotations. The resulting annotated flatbuffer binary (afb)
+contains all the binary data with line-by-line annotations.
+
+## Usage
+
+Given a `schema` in either plain-text (.fbs) or already compiled to a binary
+schema (.bfbs) and `binary` file(s) that was created by the `schema`.
+
+```sh
+flatc --annotate {schema_file} -- {binary_file}...
+```
+
+### Example
+
+The following command should produce `annotated_binary.afb` in this directory:
+
+```sh
+cd tests\annotated_binary
+..\..\flatc --annotate annotated_binary.fbs -- annotated_binary.bin
+```
+
+The `annotated_binary.bin` is the flatbufer binary of the data contained within
+ `annotated_binary.json`, which was made by the following command:
+
+```sh
+..\..\flatc -b annotated_binary.fbs annotated_binary.json
+```
+
+## Text Format
+
+Currently there is a built-in text-based format for outputting the annotations.
+The `annotated_binary.afb` is an example of the text format of a binary
+`annotated_binary.bin` and the `annotated_binary.fbs` (or
+`annotated_binary.bfbs`) schema.
+
+The file is ordered in increasing the offsets from the beginning of the binary.
+The offset is the 1st column, expressed in hexadecimal format (e.g. `+0x003c`).
+
+### Binary Sections
+
+Binary sections are comprised of contigious [binary regions](#binary-regions)
+that are logically grouped together. For example, a binary section may be a
+single instance of a flatbuffer `Table` or its `vtable`. The sections may be
+labelled with the name of the associated type, as defined in the input schema.
+
+Example of a `vtable` Binary Section that is associated with the user-defined
+`AnnotateBinary.Bar` table.
+
+```
+vtable (AnnotatedBinary.Bar):
+ +0x00A0 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+ +0x00A2 | 13 00 | uint16_t | 0x0013 (19) | size of referring table
+ +0x00A4 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `a` (id: 0)
+ +0x00A6 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+```
+
+### Binary Regions
+
+Binary regions are contigious bytes regions that are grouped together to form
+some sort of value, e.g. a `scalar` or an array of scalars. A binary region may
+be split up over multiple text lines, if the size of the region is large.
+
+Looking at an example binary region:
+
+```
+vtable (AnnotatedBinary.Bar):
+ +0x00A0 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+```
+
+The first column (`+0x00A0`) is the offset to this region from the beginning of
+the buffer.
+
+The second column are the raw bytes (hexadecimal) that make up this
+region. These are expressed in the little-endian format that flatbuffers uses
+for the wire format.
+
+The third column is the type to interpret the bytes as. Some types are special
+to flatbuffer internals (e.g. `SOffet32`, `Offset32`, and `VOffset16`) which are
+used by flatbuffers to point to various offsetes. The other types are specified
+as C++-like types which are the standard fix-width scalars. For the above
+example, the type is `uint16_t` which is a 16-bit unsigned integer type.
+
+The fourth column shows the raw bytes as a compacted, big-endian value. The raw
+bytes are duplicated in this fashion since it is more intutive to read the data
+in the big-endian format (e.g., `0x0008`). This value is followed by the decimal
+representation of the value (e.g., `(8)`). (For strings, the raw string value
+is shown instead).
+
+The fifth column is a textual comment on what the value is. As much metadata as
+known is provided.
+
+#### Offsets
+
+If the type in the 3rd column is of an absolute offset (`SOffet32` or
+`Offset32`), the fourth column also shows an `Loc: +0x025A` value which shows
+where in the binary this region is pointing to. These values are absolute from
+the beginning of the file, their calculation from the raw value in the 4th
+column depends on the context.
diff --git a/tests/annotated_binary/annotated_binary.afb b/tests/annotated_binary/annotated_binary.afb
new file mode 100644
index 0000000..6bd84d7
--- /dev/null
+++ b/tests/annotated_binary/annotated_binary.afb
@@ -0,0 +1,297 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: annotated_binary.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x0008 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x000A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x000C | 68 00 | uint16_t | 0x0068 (104) | size of referring table
+ +0x000E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x0010 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x0012 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x0014 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x0016 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x0018 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x001A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `name` (id: 6)
+ +0x001C | 34 00 | VOffset16 | 0x0034 (52) | offset to field `bars` (id: 7)
+ +0x001E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x0020 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `bar_baz` (id: 9)
+ +0x0022 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `accounts` (id: 10)
+ +0x0024 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `bob` (id: 11)
+ +0x0026 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `alice` (id: 12)
+ +0x0028 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x002A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x002C | 48 00 | VOffset16 | 0x0048 (72) | offset to field `just_i32` (id: 15)
+ +0x002E | 4C 00 | VOffset16 | 0x004C (76) | offset to field `names` (id: 16)
+ +0x0030 | 50 00 | VOffset16 | 0x0050 (80) | offset to field `points_of_interest` (id: 17)
+ +0x0032 | 54 00 | VOffset16 | 0x0054 (84) | offset to field `foobars_type` (id: 18)
+ +0x0034 | 58 00 | VOffset16 | 0x0058 (88) | offset to field `foobars` (id: 19)
+ +0x0036 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x0038 | 5C 00 | VOffset16 | 0x005C (92) | offset to field `measurement` (id: 21)
+ +0x003A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x003C | 60 00 | VOffset16 | 0x0060 (96) | offset to field `anything` (id: 23)
+ +0x003E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x0040 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x0042 | 64 00 | VOffset16 | 0x0064 (100) | offset to field `charlie` (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x0044 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x000A | offset to vtable
+ +0x0048 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x004B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x004C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x004D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x004E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x004F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x0050 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x0054 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x027C | offset to field `bar` (table)
+ +0x0058 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x005C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x0060 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x0064 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values`[0] (Int)
+ +0x0068 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | array field `AnnotatedBinary.Dimension.values`[1] (Int)
+ +0x006C | 14 00 00 00 | uint32_t | 0x00000014 (20) | array field `AnnotatedBinary.Dimension.values`[2] (Int)
+ +0x0070 | 01 | uint8_t | 0x01 (1) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0071 | 02 | uint8_t | 0x02 (2) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0072 | 03 | uint8_t | 0x03 (3) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0073 | 00 | uint8_t[1] | . | padding
+ +0x0074 | C8 01 00 00 | UOffset32 | 0x000001C8 (456) Loc: +0x023C | offset to field `name` (string)
+ +0x0078 | 5C 01 00 00 | UOffset32 | 0x0000015C (348) Loc: +0x01D4 | offset to field `bars` (vector)
+ +0x007C | 50 01 00 00 | UOffset32 | 0x00000150 (336) Loc: +0x01CC | offset to field `bar_baz` (union of type `Baz`)
+ +0x0080 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x01B4 | offset to field `accounts` (vector)
+ +0x0084 | 24 01 00 00 | UOffset32 | 0x00000124 (292) Loc: +0x01A8 | offset to field `bob` (string)
+ +0x0088 | 14 01 00 00 | UOffset32 | 0x00000114 (276) Loc: +0x019C | offset to field `alice` (string)
+ +0x008C | 0D 00 00 00 | uint32_t | 0x0000000D (13) | table field `just_i32` (Int)
+ +0x0090 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x016C | offset to field `names` (vector)
+ +0x0094 | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x0134 | offset to field `points_of_interest` (vector)
+ +0x0098 | 94 00 00 00 | UOffset32 | 0x00000094 (148) Loc: +0x012C | offset to field `foobars_type` (vector)
+ +0x009C | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x00D4 | offset to field `foobars` (vector)
+ +0x00A0 | 33 00 00 00 | UOffset32 | 0x00000033 (51) Loc: +0x00D3 | offset to field `measurement` (union of type `Tolerance`)
+ +0x00A4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x00C0 | offset to field `anything` (union of type `Bar`)
+ +0x00A8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00AC | offset to field `charlie` (string)
+
+string (AnnotatedBinary.Foo.charlie):
+ +0x00AC | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x00B0 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x00B5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x00B6 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x00B8 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+ +0x00BA | 13 00 | uint16_t | 0x0013 (19) | size of referring table
+ +0x00BC | 08 00 | VOffset16 | 0x0008 (8) | offset to field `a` (id: 0)
+ +0x00BE | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+
+table (AnnotatedBinary.Bar):
+ +0x00C0 | 08 00 00 00 | SOffset32 | 0x00000008 (8) Loc: +0x00B8 | offset to vtable
+ +0x00C4 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00C8 | 00 00 00 00 00 10 74 40 | double | 0x4074100000000000 (321) | table field `a` (Double)
+ +0x00D0 | 00 00 00 | uint8_t[3] | ... | padding
+
+union (AnnotatedBinary.Tolerance.measurement):
+ +0x00D3 | 05 | uint8_t | 0x05 (5) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+
+vector (AnnotatedBinary.Foo.foobars):
+ +0x00D4 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x00D8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x010C | offset to union[0] (`Bar`)
+ +0x00DC | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0108 | offset to union[1] (`Baz`)
+ +0x00E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00E4 | offset to union[2] (`Bar`)
+
+table (AnnotatedBinary.Bar):
+ +0x00E4 | D2 FE FF FF | SOffset32 | 0xFFFFFED2 (-302) Loc: +0x0212 | offset to vtable
+ +0x00E8 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00EC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x00FC | offset to field `c` (table)
+ +0x00F0 | 00 00 00 00 00 D8 8E 40 | double | 0x408ED80000000000 (987) | table field `a` (Double)
+ +0x00F8 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x00FC | 6A FE FF FF | SOffset32 | 0xFFFFFE6A (-406) Loc: +0x0292 | offset to vtable
+ +0x0100 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0103 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vtable (AnnotatedBinary.Baz):
+ +0x0104 | 04 00 | uint16_t | 0x0004 (4) | size of this vtable
+ +0x0106 | 04 00 | uint16_t | 0x0004 (4) | size of referring table
+
+table (AnnotatedBinary.Baz):
+ +0x0108 | 04 00 00 00 | SOffset32 | 0x00000004 (4) Loc: +0x0104 | offset to vtable
+
+table (AnnotatedBinary.Bar):
+ +0x010C | FA FE FF FF | SOffset32 | 0xFFFFFEFA (-262) Loc: +0x0212 | offset to vtable
+ +0x0110 | 00 00 E4 43 | float | 0x43E40000 (456) | table field `b` (Float)
+ +0x0114 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0124 | offset to field `c` (table)
+ +0x0118 | 00 00 00 00 00 C0 5E 40 | double | 0x405EC00000000000 (123) | table field `a` (Double)
+ +0x0120 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x0124 | 92 FE FF FF | SOffset32 | 0xFFFFFE92 (-366) Loc: +0x0292 | offset to vtable
+ +0x0128 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x012B | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
+
+vector (AnnotatedBinary.Foo.foobars_type):
+ +0x012C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0130 | 01 | UType8 | 0x01 (1) | value[0]
+ +0x0131 | 02 | UType8 | 0x02 (2) | value[1]
+ +0x0132 | 01 | UType8 | 0x01 (1) | value[2]
+
+vector (AnnotatedBinary.Foo.points_of_interest):
+ +0x0134 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0138 | 33 33 33 33 33 A3 45 40 | double | 0x4045A33333333333 (43.275) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0140 | 7E 57 04 FF 5B 87 53 C0 | double | 0xC053875BFF04577E (-78.115) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0148 | 8D F0 F6 20 04 B6 42 40 | double | 0x4042B60420F6F08D (37.422) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0150 | 9F 77 63 41 61 85 5E C0 | double | 0xC05E85614163779F (-122.084) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0158 | 8F 35 23 83 DC 35 4B C0 | double | 0xC04B35DC8323358F (-54.4208) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0160 | F6 97 DD 93 87 C5 0A 40 | double | 0x400AC58793DD97F6 (3.34645) | struct field `AnnotatedBinary.Location.longitude` (Double)
+
+padding:
+ +0x0168 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (AnnotatedBinary.Foo.names):
+ +0x016C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0170 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0190 | offset to string[0]
+ +0x0174 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0188 | offset to string[1]
+ +0x0178 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x017C | offset to string[2]
+
+string (AnnotatedBinary.Foo.names):
+ +0x017C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x0180 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x0187 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0188 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x018C | 62 6F 62 | char[3] | bob | string literal
+ +0x018F | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0190 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x0194 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x0199 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x019A | 00 00 | uint8_t[2] | .. | padding
+
+string (AnnotatedBinary.Foo.alice):
+ +0x019C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01A0 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01A7 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.bob):
+ +0x01A8 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01AC | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01B3 | 00 | char | 0x00 (0) | string terminator
+
+vector (AnnotatedBinary.Foo.accounts):
+ +0x01B4 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of vector (# items)
+ +0x01B8 | 09 00 | uint16_t | 0x0009 (9) | value[0]
+ +0x01BA | 08 00 | uint16_t | 0x0008 (8) | value[1]
+ +0x01BC | 07 00 | uint16_t | 0x0007 (7) | value[2]
+ +0x01BE | 01 00 | uint16_t | 0x0001 (1) | value[3]
+ +0x01C0 | 02 00 | uint16_t | 0x0002 (2) | value[4]
+ +0x01C2 | 03 00 | uint16_t | 0x0003 (3) | value[5]
+ +0x01C4 | 06 00 | uint16_t | 0x0006 (6) | value[6]
+ +0x01C6 | 05 00 | uint16_t | 0x0005 (5) | value[7]
+ +0x01C8 | 04 00 | uint16_t | 0x0004 (4) | value[8]
+
+padding:
+ +0x01CA | 00 00 | uint8_t[2] | .. | padding
+
+table (AnnotatedBinary.Baz):
+ +0x01CC | 3A FF FF FF | SOffset32 | 0xFFFFFF3A (-198) Loc: +0x0292 | offset to vtable
+ +0x01D0 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x01D3 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vector (AnnotatedBinary.Foo.bars):
+ +0x01D4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x01D8 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x021C | offset to table[0]
+ +0x01DC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x01EC | offset to table[1]
+
+padding:
+ +0x01E0 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x01E2 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x01E4 | 1A 00 | uint16_t | 0x001A (26) | size of referring table
+ +0x01E6 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x01E8 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x01EA | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x01EC | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x01E2 | offset to vtable
+ +0x01F0 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x01F4 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x020C | offset to field `c` (table)
+ +0x01F8 | 00 00 00 00 00 D8 8E 40 | double | 0x408ED80000000000 (987) | table field `a` (Double)
+ +0x0200 | 00 00 00 00 00 00 | uint8_t[6] | ...... | padding
+
+vtable (AnnotatedBinary.Baz):
+ +0x0206 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x0208 | 06 00 | uint16_t | 0x0006 (6) | size of referring table
+ +0x020A | 05 00 | VOffset16 | 0x0005 (5) | offset to field `meal` (id: 0)
+
+table (AnnotatedBinary.Baz):
+ +0x020C | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: +0x0206 | offset to vtable
+ +0x0210 | 00 | uint8_t[1] | . | padding
+ +0x0211 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vtable (AnnotatedBinary.Bar):
+ +0x0212 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x0214 | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x0216 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x0218 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x021A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x021C | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x0212 | offset to vtable
+ +0x0220 | 00 00 E4 43 | float | 0x43E40000 (456) | table field `b` (Float)
+ +0x0224 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0234 | offset to field `c` (table)
+ +0x0228 | 00 00 00 00 00 C0 5E 40 | double | 0x405EC00000000000 (123) | table field `a` (Double)
+ +0x0230 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x0234 | A2 FF FF FF | SOffset32 | 0xFFFFFFA2 (-94) Loc: +0x0292 | offset to vtable
+ +0x0238 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x023B | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
+
+string (AnnotatedBinary.Foo.name):
+ +0x023C | 2F 00 00 00 | uint32_t | 0x0000002F (47) | length of string
+ +0x0240 | 54 68 69 73 20 69 73 20 | char[47] | This is | string literal
+ +0x0248 | 61 20 6C 6F 6E 67 20 73 | | a long s
+ +0x0250 | 74 72 69 6E 67 20 74 6F | | tring to
+ +0x0258 | 20 73 68 6F 77 20 68 6F | | show ho
+ +0x0260 | 77 20 69 74 20 62 72 65 | | w it bre
+ +0x0268 | 61 6B 73 20 75 70 2E | | aks up.
+ +0x026F | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0270 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x0272 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x0274 | 16 00 | uint16_t | 0x0016 (22) | size of referring table
+ +0x0276 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x0278 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x027A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x027C | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x0272 | offset to vtable
+ +0x0280 | 65 20 71 49 | float | 0x49712065 (987654) | table field `b` (Float)
+ +0x0284 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0298 | offset to field `c` (table)
+ +0x0288 | C9 76 BE 9F 0C 24 FE 40 | double | 0x40FE240C9FBE76C9 (123457) | table field `a` (Double)
+ +0x0290 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Baz):
+ +0x0292 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x0294 | 08 00 | uint16_t | 0x0008 (8) | size of referring table
+ +0x0296 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `meal` (id: 0)
+
+table (AnnotatedBinary.Baz):
+ +0x0298 | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: +0x0292 | offset to vtable
+ +0x029C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x029F | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
diff --git a/tests/annotated_binary/annotated_binary.bfbs b/tests/annotated_binary/annotated_binary.bfbs
new file mode 100644
index 0000000..b4cf419
--- /dev/null
+++ b/tests/annotated_binary/annotated_binary.bfbs
Binary files differ
diff --git a/tests/annotated_binary/annotated_binary.bin b/tests/annotated_binary/annotated_binary.bin
new file mode 100644
index 0000000..2557aaf
--- /dev/null
+++ b/tests/annotated_binary/annotated_binary.bin
Binary files differ
diff --git a/tests/annotated_binary/annotated_binary.fbs b/tests/annotated_binary/annotated_binary.fbs
new file mode 100644
index 0000000..60e320f
--- /dev/null
+++ b/tests/annotated_binary/annotated_binary.fbs
@@ -0,0 +1,92 @@
+namespace AnnotatedBinary;
+
+enum Food : byte {
+ None = 0,
+ Apple = 1,
+ Banana = 2,
+ Kiwi = 3,
+}
+
+table Baz {
+ meal:Food = Banana;
+}
+
+table Bar {
+ a:double = 3.14;
+ b:float = 1.68;
+ c:Baz;
+}
+
+union BarBaz {
+ Bar, Baz
+}
+
+union Measurement {
+ Tolerance, Dimension
+}
+
+struct Tolerance {
+ width:uint8;
+}
+
+union Any {
+ Bar, Tolerance
+}
+
+struct Dimension {
+ values:[int:3];
+ tolerances:[Tolerance:3];
+}
+
+struct Building {
+ floors:int;
+ doors:int;
+ windows:int;
+ dimensions:Dimension;
+}
+
+struct Location {
+ latitude:double;
+ longitude:double;
+}
+
+table Foo {
+ counter:int;
+ healthy:bool;
+ level:long = 99;
+ meal:Food = Apple;
+ bar:Bar;
+ home:Building;
+ name:string;
+ // Vector of tables
+ bars:[Bar];
+ // Union of tables
+ bar_baz:BarBaz;
+ // Vector of Scalars
+ accounts:[uint16];
+ bob:string;
+ alice:string;
+ // Optional Scalars
+ maybe_i32: int32 = null;
+ default_i32: int32 = 42;
+ just_i32: int32;
+ // Vector of strings
+ names:[string];
+ // Vector of structs
+ points_of_interest:[Location];
+ // Vector of unions
+ foobars:[BarBaz];
+ // Union of structs
+ measurement:Measurement;
+ // Union of struct/table
+ anything:Any;
+ // Default floating point
+ temperature:float=98.6;
+ // Not present object
+ teetotaler:Bar;
+ charlie:string;
+}
+
+file_identifier "ANNO";
+
+root_type Foo;
\ No newline at end of file
diff --git a/tests/annotated_binary/annotated_binary.json b/tests/annotated_binary/annotated_binary.json
new file mode 100644
index 0000000..744e274
--- /dev/null
+++ b/tests/annotated_binary/annotated_binary.json
@@ -0,0 +1,124 @@
+{
+ "counter": 1234,
+ "healthy": true,
+ "meal": "Banana",
+ "bar": {
+ "a": 123456.789,
+ "b": 987654.321,
+ "c": {
+ "meal": "Apple"
+ }
+ },
+ "home": {
+ "floors": 1,
+ "doors": 2,
+ "windows": 12,
+ "dimensions": {
+ "values": [
+ 10,
+ 12,
+ 20
+ ],
+ "tolerances": [
+ {
+ "width": 1
+ },
+ {
+ "width": 2
+ },
+ {
+ "width": 3
+ }
+ ]
+ }
+ },
+ "name": "This is a long string to show how it breaks up.",
+ "bars": [
+ {
+ "a": 123,
+ "b": 456,
+ "c": {
+ "meal": "Apple"
+ }
+ },
+ {
+ "a": 987,
+ "b": 654,
+ "c": {
+ "meal": "Kiwi"
+ }
+ }
+ ],
+ "bar_baz_type": "Baz",
+ "bar_baz": {
+ "meal": "Kiwi"
+ },
+ "accounts": [
+ 9,
+ 8,
+ 7,
+ 1,
+ 2,
+ 3,
+ 6,
+ 5,
+ 4,
+ ],
+ // Use the same string to show shared string support
+ "bob": "charlie",
+ "alice": "charlie",
+ "just_i32": 13,
+ "names": [
+ "alice",
+ "bob",
+ "charlie"
+ ],
+ "points_of_interest": [
+ {
+ "latitude": 43.275,
+ "longitude": -78.114990
+ },
+ {
+ "latitude": 37.422001,
+ "longitude": -122.084061
+ },
+ {
+ "latitude": -54.420792,
+ "longitude": 3.346450
+ }
+ ],
+ "foobars_type": [
+ "Bar",
+ "Baz",
+ "Bar"
+ ],
+ "foobars" : [
+ {
+ "a": 123,
+ "b": 456,
+ "c": {
+ "meal": "Apple"
+ }
+ },
+ {
+ "meal": "Banana"
+ },
+ {
+ "a": 987,
+ "b": 654,
+ "c": {
+ "meal": "Kiwi"
+ }
+ }
+ ],
+ "measurement_type": "Tolerance",
+ "measurement": {
+ "width": 5
+ },
+ "anything_type": "Bar",
+ "anything": {
+ "a": 321,
+ "b": 654
+ },
+ "charlie": "alice"
+}
\ No newline at end of file
diff --git a/tests/annotated_binary/annotated_binary_old.afb b/tests/annotated_binary/annotated_binary_old.afb
new file mode 100644
index 0000000..9a0e5b0
--- /dev/null
+++ b/tests/annotated_binary/annotated_binary_old.afb
@@ -0,0 +1,293 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary_old.fbs
+// Binary file: annotated_binary.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x0008 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x000A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x000C | 68 00 | uint16_t | 0x0068 (104) | size of referring table
+ +0x000E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x0010 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x0012 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x0014 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x0016 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x0018 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x001A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `name` (id: 6)
+ +0x001C | 34 00 | VOffset16 | 0x0034 (52) | offset to field `bars` (id: 7)
+ +0x001E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x0020 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `bar_baz` (id: 9)
+ +0x0022 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `accounts` (id: 10)
+ +0x0024 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `bob` (id: 11)
+ +0x0026 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `alice` (id: 12)
+ +0x0028 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x002A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x002C | 48 00 | VOffset16 | 0x0048 (72) | offset to field `just_i32` (id: 15)
+ +0x002E | 4C 00 | VOffset16 | 0x004C (76) | offset to field `names` (id: 16)
+ +0x0030 | 50 00 | VOffset16 | 0x0050 (80) | offset to field `points_of_interest` (id: 17)
+ +0x0032 | 54 00 | VOffset16 | 0x0054 (84) | offset to field `foobars_type` (id: 18)
+ +0x0034 | 58 00 | VOffset16 | 0x0058 (88) | offset to field `foobars` (id: 19)
+ +0x0036 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x0038 | 5C 00 | VOffset16 | 0x005C (92) | offset to field `measurement` (id: 21)
+ +0x003A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x003C | 60 00 | VOffset16 | 0x0060 (96) | offset to field `anything` (id: 23)
+ +0x003E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x0040 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x0042 | 64 00 | VOffset16 | 0x0064 (100) | offset to unknown field (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x0044 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x000A | offset to vtable
+ +0x0048 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x004B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x004C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x004D | 02 | uint8_t | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x004E | 01 | uint8_t | 0x01 (1) | table field `measurement_type` (UType)
+ +0x004F | 01 | uint8_t | 0x01 (1) | table field `anything_type` (UType)
+ +0x0050 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x0054 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x027C | offset to field `bar`
+ +0x0058 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x005C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x0060 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x0064 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values[0]` (Int)
+ +0x0068 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | array field `AnnotatedBinary.Dimension.values[1]` (Int)
+ +0x006C | 14 00 00 00 | uint32_t | 0x00000014 (20) | array field `AnnotatedBinary.Dimension.values[2]` (Int)
+ +0x0070 | 01 | uint8_t | 0x01 (1) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0071 | 02 | uint8_t | 0x02 (2) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0072 | 03 | uint8_t | 0x03 (3) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0073 | 00 | uint8_t[1] | . | padding
+ +0x0074 | C8 01 00 00 | UOffset32 | 0x000001C8 (456) Loc: +0x023C | offset to field `name`
+ +0x0078 | 5C 01 00 00 | UOffset32 | 0x0000015C (348) Loc: +0x01D4 | offset to field `bars`
+ +0x007C | 50 01 00 00 | UOffset32 | 0x00000150 (336) Loc: +0x01CC | offset to field `bar_baz` (union of type `Baz`)
+ +0x0080 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x01B4 | offset to field `accounts`
+ +0x0084 | 24 01 00 00 | UOffset32 | 0x00000124 (292) Loc: +0x01A8 | offset to field `bob`
+ +0x0088 | 14 01 00 00 | UOffset32 | 0x00000114 (276) Loc: +0x019C | offset to field `alice`
+ +0x008C | 0D 00 00 00 | uint32_t | 0x0000000D (13) | table field `just_i32` (Int)
+ +0x0090 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x016C | offset to field `names`
+ +0x0094 | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x0134 | offset to field `points_of_interest`
+ +0x0098 | 94 00 00 00 | UOffset32 | 0x00000094 (148) Loc: +0x012C | offset to field `foobars_type`
+ +0x009C | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x00D4 | offset to field `foobars`
+ +0x00A0 | 33 00 00 00 | UOffset32 | 0x00000033 (51) Loc: +0x00D3 | offset to field `measurement` (union of type `Tolerance`)
+ +0x00A4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x00C0 | offset to field `anything` (union of type `Bar`)
+ +0x00A8 | 04 00 00 00 | ?uint8_t[4] | .... | Unknown field <possibly an offset? Check Loc: +0x000000AC>
+
+unknown (no known references):
+ +0x00AC | 05 00 00 00 61 6C 69 63 | ?uint8_t[12] | ....alic | WARN: nothing refers to this. Check if any `Unkown Field`s point to this.
+ +0x00B4 | 65 00 00 00 | | e...
+
+vtable (AnnotatedBinary.Bar):
+ +0x00B8 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+ +0x00BA | 13 00 | uint16_t | 0x0013 (19) | size of referring table
+ +0x00BC | 08 00 | VOffset16 | 0x0008 (8) | offset to field `a` (id: 0)
+ +0x00BE | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+
+table (AnnotatedBinary.Bar):
+ +0x00C0 | 08 00 00 00 | SOffset32 | 0x00000008 (8) Loc: +0x00B8 | offset to vtable
+ +0x00C4 | 00 80 23 44 | float | 0x44238000 (654.000000) | table field `b` (Float)
+ +0x00C8 | 00 00 00 00 00 10 74 40 | double | 0x4074100000000000 (321.000000) | table field `a` (Double)
+ +0x00D0 | 00 00 00 | uint8_t[3] | ... | padding
+
+union (AnnotatedBinary.Tolerance.measurement):
+ +0x00D3 | 05 | uint8_t | 0x05 (5) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+
+vector (AnnotatedBinary.Foo.foobars):
+ +0x00D4 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x00D8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x010C | offset to union[0] (`Bar`)
+ +0x00DC | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0108 | offset to union[1] (`Baz`)
+ +0x00E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00E4 | offset to union[2] (`Bar`)
+
+table (AnnotatedBinary.Bar):
+ +0x00E4 | D2 FE FF FF | SOffset32 | 0xFFFFFED2 (-302) Loc: +0x0212 | offset to vtable
+ +0x00E8 | 00 80 23 44 | float | 0x44238000 (654.000000) | table field `b` (Float)
+ +0x00EC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x00FC | offset to field `c`
+ +0x00F0 | 00 00 00 00 00 D8 8E 40 | double | 0x408ED80000000000 (987.000000) | table field `a` (Double)
+ +0x00F8 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x00FC | 6A FE FF FF | SOffset32 | 0xFFFFFE6A (-406) Loc: +0x0292 | offset to vtable
+ +0x0100 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0103 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vtable (AnnotatedBinary.Baz):
+ +0x0104 | 04 00 | uint16_t | 0x0004 (4) | size of this vtable
+ +0x0106 | 04 00 | uint16_t | 0x0004 (4) | size of referring table
+
+table (AnnotatedBinary.Baz):
+ +0x0108 | 04 00 00 00 | SOffset32 | 0x00000004 (4) Loc: +0x0104 | offset to vtable
+
+table (AnnotatedBinary.Bar):
+ +0x010C | FA FE FF FF | SOffset32 | 0xFFFFFEFA (-262) Loc: +0x0212 | offset to vtable
+ +0x0110 | 00 00 E4 43 | float | 0x43E40000 (456.000000) | table field `b` (Float)
+ +0x0114 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0124 | offset to field `c`
+ +0x0118 | 00 00 00 00 00 C0 5E 40 | double | 0x405EC00000000000 (123.000000) | table field `a` (Double)
+ +0x0120 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x0124 | 92 FE FF FF | SOffset32 | 0xFFFFFE92 (-366) Loc: +0x0292 | offset to vtable
+ +0x0128 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x012B | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
+
+vector (AnnotatedBinary.Foo.foobars_type):
+ +0x012C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0130 | 01 | uint8_t | 0x01 (1) | value[0]
+ +0x0131 | 02 | uint8_t | 0x02 (2) | value[1]
+ +0x0132 | 01 | uint8_t | 0x01 (1) | value[2]
+
+vector (AnnotatedBinary.Foo.points_of_interest):
+ +0x0134 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0138 | 33 33 33 33 33 A3 45 40 | double | 0x4045A33333333333 (43.275000) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0140 | 7E 57 04 FF 5B 87 53 C0 | double | 0xC053875BFF04577E (-78.114990) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0148 | 8D F0 F6 20 04 B6 42 40 | double | 0x4042B60420F6F08D (37.422001) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0150 | 9F 77 63 41 61 85 5E C0 | double | 0xC05E85614163779F (-122.084061) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0158 | 8F 35 23 83 DC 35 4B C0 | double | 0xC04B35DC8323358F (-54.420792) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0160 | F6 97 DD 93 87 C5 0A 40 | double | 0x400AC58793DD97F6 (3.346450) | struct field `AnnotatedBinary.Location.longitude` (Double)
+
+padding:
+ +0x0168 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (AnnotatedBinary.Foo.names):
+ +0x016C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0170 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0190 | offset to string[0]
+ +0x0174 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0188 | offset to string[1]
+ +0x0178 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x017C | offset to string[2]
+
+string (AnnotatedBinary.Foo.names):
+ +0x017C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x0180 | 63 68 61 72 6C 69 65 | char[7] | charlie
+ +0x0187 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0188 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x018C | 62 6F 62 | char[3] | bob
+ +0x018F | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0190 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x0194 | 61 6C 69 63 65 | char[5] | alice
+ +0x0199 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x019A | 00 00 | uint8_t[2] | .. | padding
+
+string (AnnotatedBinary.Foo.alice):
+ +0x019C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01A0 | 63 68 61 72 6C 69 65 | char[7] | charlie
+ +0x01A7 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.bob):
+ +0x01A8 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01AC | 63 68 61 72 6C 69 65 | char[7] | charlie
+ +0x01B3 | 00 | char | 0x00 (0) | string terminator
+
+vector (AnnotatedBinary.Foo.accounts):
+ +0x01B4 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of vector (# items)
+ +0x01B8 | 09 00 | uint16_t | 0x0009 (9) | value[0]
+ +0x01BA | 08 00 | uint16_t | 0x0008 (8) | value[1]
+ +0x01BC | 07 00 | uint16_t | 0x0007 (7) | value[2]
+ +0x01BE | 01 00 | uint16_t | 0x0001 (1) | value[3]
+ +0x01C0 | 02 00 | uint16_t | 0x0002 (2) | value[4]
+ +0x01C2 | 03 00 | uint16_t | 0x0003 (3) | value[5]
+ +0x01C4 | 06 00 | uint16_t | 0x0006 (6) | value[6]
+ +0x01C6 | 05 00 | uint16_t | 0x0005 (5) | value[7]
+ +0x01C8 | 04 00 | uint16_t | 0x0004 (4) | value[8]
+
+padding:
+ +0x01CA | 00 00 | uint8_t[2] | .. | padding
+
+table (AnnotatedBinary.Baz):
+ +0x01CC | 3A FF FF FF | SOffset32 | 0xFFFFFF3A (-198) Loc: +0x0292 | offset to vtable
+ +0x01D0 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x01D3 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vector (AnnotatedBinary.Foo.bars):
+ +0x01D4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x01D8 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x021C | offset to table[0]
+ +0x01DC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x01EC | offset to table[1]
+
+padding:
+ +0x01E0 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x01E2 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x01E4 | 1A 00 | uint16_t | 0x001A (26) | size of referring table
+ +0x01E6 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x01E8 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x01EA | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x01EC | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x01E2 | offset to vtable
+ +0x01F0 | 00 80 23 44 | float | 0x44238000 (654.000000) | table field `b` (Float)
+ +0x01F4 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x020C | offset to field `c`
+ +0x01F8 | 00 00 00 00 00 D8 8E 40 | double | 0x408ED80000000000 (987.000000) | table field `a` (Double)
+ +0x0200 | 00 00 00 00 00 00 | uint8_t[6] | ...... | padding
+
+vtable (AnnotatedBinary.Baz):
+ +0x0206 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x0208 | 06 00 | uint16_t | 0x0006 (6) | size of referring table
+ +0x020A | 05 00 | VOffset16 | 0x0005 (5) | offset to field `meal` (id: 0)
+
+table (AnnotatedBinary.Baz):
+ +0x020C | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: +0x0206 | offset to vtable
+ +0x0210 | 00 | uint8_t[1] | . | padding
+ +0x0211 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vtable (AnnotatedBinary.Bar):
+ +0x0212 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x0214 | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x0216 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x0218 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x021A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x021C | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x0212 | offset to vtable
+ +0x0220 | 00 00 E4 43 | float | 0x43E40000 (456.000000) | table field `b` (Float)
+ +0x0224 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0234 | offset to field `c`
+ +0x0228 | 00 00 00 00 00 C0 5E 40 | double | 0x405EC00000000000 (123.000000) | table field `a` (Double)
+ +0x0230 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x0234 | A2 FF FF FF | SOffset32 | 0xFFFFFFA2 (-94) Loc: +0x0292 | offset to vtable
+ +0x0238 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x023B | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
+
+string (AnnotatedBinary.Foo.name):
+ +0x023C | 2F 00 00 00 | uint32_t | 0x0000002F (47) | length of string
+ +0x0240 | 54 68 69 73 20 69 73 20 | char[47] | This is
+ +0x0248 | 61 20 6C 6F 6E 67 20 73 | | a long s
+ +0x0250 | 74 72 69 6E 67 20 74 6F | | tring to
+ +0x0258 | 20 73 68 6F 77 20 68 6F | | show ho
+ +0x0260 | 77 20 69 74 20 62 72 65 | | w it bre
+ +0x0268 | 61 6B 73 20 75 70 2E | | aks up.
+ +0x026F | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0270 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x0272 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x0274 | 16 00 | uint16_t | 0x0016 (22) | size of referring table
+ +0x0276 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x0278 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x027A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x027C | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x0272 | offset to vtable
+ +0x0280 | 65 20 71 49 | float | 0x49712065 (987654.312500) | table field `b` (Float)
+ +0x0284 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0298 | offset to field `c`
+ +0x0288 | C9 76 BE 9F 0C 24 FE 40 | double | 0x40FE240C9FBE76C9 (123456.789000) | table field `a` (Double)
+ +0x0290 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Baz):
+ +0x0292 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x0294 | 08 00 | uint16_t | 0x0008 (8) | size of referring table
+ +0x0296 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `meal` (id: 0)
+
+table (AnnotatedBinary.Baz):
+ +0x0298 | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: +0x0292 | offset to vtable
+ +0x029C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x029F | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
diff --git a/tests/annotated_binary/annotated_binary_old.fbs b/tests/annotated_binary/annotated_binary_old.fbs
new file mode 100644
index 0000000..c22d6d2
--- /dev/null
+++ b/tests/annotated_binary/annotated_binary_old.fbs
@@ -0,0 +1,94 @@
+namespace AnnotatedBinary;
+
+enum Food : byte {
+ None = 0,
+ Apple = 1,
+ Banana = 2,
+ Kiwi = 3,
+}
+
+table Baz {
+ meal:Food = Banana;
+}
+
+table Bar {
+ a:double = 3.14;
+ b:float = 1.68;
+ c:Baz;
+}
+
+union BarBaz {
+ Bar, Baz
+}
+
+union Measurement {
+ Tolerance, Dimension
+}
+
+struct Tolerance {
+ width:uint8;
+}
+
+union Any {
+ Bar, Tolerance
+}
+
+struct Dimension {
+ values:[int:3];
+ tolerances:[Tolerance:3];
+}
+
+struct Building {
+ floors:int;
+ doors:int;
+ windows:int;
+ dimensions:Dimension;
+}
+
+struct Location {
+ latitude:double;
+ longitude:double;
+}
+
+table Foo {
+ counter:int;
+ healthy:bool;
+ level:long = 99;
+ meal:Food = Apple;
+ bar:Bar;
+ home:Building;
+ name:string;
+ // Vector of tables
+ bars:[Bar];
+ // Union of tables
+ bar_baz:BarBaz;
+ // Vector of Scalars
+ accounts:[uint16];
+ bob:string;
+ alice:string;
+ // Optional Scalars
+ maybe_i32: int32 = null;
+ default_i32: int32 = 42;
+ just_i32: int32;
+ // Vector of strings
+ names:[string];
+ // Vector of structs
+ points_of_interest:[Location];
+ // Vector of unions
+ foobars:[BarBaz];
+ // Union of structs
+ measurement:Measurement;
+ // Union of struct/table
+ anything:Any;
+ // Default floating point
+ temperature:float=98.6;
+ // Not present object
+ teetotaler:Bar;
+
+ // NOTE THIS IS A PURPOSELY OLD VERSION OF annotated_binary.fbs TO TEST
+ // PROCESSING OF NEWER BINARIES THAN THE SCHEMA. DO NOT ADD TO THIS.
+}
+
+file_identifier "ANNO";
+
+root_type Foo;
\ No newline at end of file
diff --git a/tests/annotated_binary/generate_annotations.py b/tests/annotated_binary/generate_annotations.py
new file mode 100755
index 0000000..bd5de2b
--- /dev/null
+++ b/tests/annotated_binary/generate_annotations.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python3
+#
+# Copyright 2021 Google Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import platform
+import subprocess
+from pathlib import Path
+
+# Get the path where this script is located so we can invoke the script from
+# any directory and have the paths work correctly.
+script_path = Path(__file__).parent.resolve()
+
+# Get the root path as an absolute path, so all derived paths are absolute.
+root_path = script_path.parent.parent.absolute()
+
+# Get the location of the flatc executable, reading from the first command line
+# argument or defaulting to default names.
+flatc_exe = Path(
+ ("flatc" if not platform.system() == "Windows" else "flatc.exe")
+)
+
+# Find and assert flatc compiler is present.
+if root_path in flatc_exe.parents:
+ flatc_exe = flatc_exe.relative_to(root_path)
+flatc_path = Path(root_path, flatc_exe)
+assert flatc_path.exists(), "Cannot find the flatc compiler " + str(flatc_path)
+
+# Specify the other paths that will be referenced
+tests_path = Path(script_path, "tests")
+
+
+def flatc_annotate(schema, file, cwd=script_path):
+ cmd = [str(flatc_path), "--annotate", schema, file]
+ result = subprocess.run(cmd, cwd=str(cwd), check=True)
+
+
+test_files = [
+ "annotated_binary.bin",
+ "tests/invalid_root_offset.bin",
+ "tests/invalid_root_table_too_short.bin",
+ "tests/invalid_root_table_vtable_offset.bin",
+ "tests/invalid_string_length.bin",
+ "tests/invalid_string_length_cut_short.bin",
+ "tests/invalid_struct_array_field_cut_short.bin",
+ "tests/invalid_struct_field_cut_short.bin",
+ "tests/invalid_table_field_size.bin",
+ "tests/invalid_table_field_offset.bin",
+ "tests/invalid_union_type_value.bin",
+ "tests/invalid_vector_length_cut_short.bin",
+ "tests/invalid_vector_scalars_cut_short.bin",
+ "tests/invalid_vector_strings_cut_short.bin",
+ "tests/invalid_vector_structs_cut_short.bin",
+ "tests/invalid_vector_tables_cut_short.bin",
+ "tests/invalid_vector_unions_cut_short.bin",
+ "tests/invalid_vector_union_type_value.bin",
+ "tests/invalid_vtable_ref_table_size_short.bin",
+ "tests/invalid_vtable_ref_table_size.bin",
+ "tests/invalid_vtable_size_short.bin",
+ "tests/invalid_vtable_size.bin",
+ "tests/invalid_vtable_field_offset.bin",
+]
+
+for test_file in test_files:
+ flatc_annotate("annotated_binary.fbs", test_file)
diff --git a/tests/annotated_binary/tests/README.md b/tests/annotated_binary/tests/README.md
new file mode 100644
index 0000000..c0d73f4
--- /dev/null
+++ b/tests/annotated_binary/tests/README.md
@@ -0,0 +1,125 @@
+# Tests for Annotated Binaries
+
+## Invalid Binary Tests
+
+The following is a collection of manually corrupted binaries based off of
+`..\annotated_binary.bin`. Each file changes some offset or length/size entry to
+point so an invalid spot, and the generated annotated binaries demonstrate that
+those corruptions can be spotted.
+
+Each of these files were ran with the following command:
+
+```sh
+cd .tests/annotated_binary
+../../flatc -annotate annotated_binary.fbs tests/{binary_file}...
+```
+
+### `invalid_root_offset.bin`
+
+Changed first two bytes from `4400` to `FFFF` which produces an offset larger
+than the binary.
+
+### `invalid_root_table_vtable_offset.bin`
+
+Changed two bytes at 0x0044 from `3A00` to `FFFF` which points to an offset
+outside the binary.
+
+### `invalid_root_table_too_short.bin`
+
+Truncated the file to 0x46 bytes, as that cuts into the vtable offset field of
+the root table.
+
+```sh
+truncate annotated_binary.bin --size=70 >> invalid_root_table_too_short.bin
+```
+
+### `invalid_vtable_size.bin`
+
+Changed two bytes at 0x000A from `3A00` to `FFFF` which size is larger than the
+binary.
+
+### `invalid_vtable_size_short.bin`
+
+Changed two bytes at 0x000A from `3A00` to `0100` which size is smaller than the
+minimum size of 4 bytes.
+
+### `invalid_vtable_ref_table_size.bin`
+
+Changed two bytes at 0x000C from `6800` to `FFFF` which size is larger than the
+binary.
+
+### `invalid_vtable_ref_table_size_short.bin`
+
+Changed two bytes at 0x000C from `6800` to `0100` which size is smaller than
+the minimum size of 4 bytes.
+
+### `invalid_vtable_field_offset.bin`
+
+Changed two bytes at 0x0016 from `1000` to `FFFF` which points to a field larger
+than the binary.
+
+### `invalid_table_field_size.bin`
+
+Truncated the file to 0x52 bytes, as that cuts a Uint32t value in half.
+
+### `invalid_table_field_offset.bin`
+
+Truncated the file to 0x96 bytes, as that cuts a UOffset32 value in half. Also,
+changed two bytes at 0x90 from `DC00` to `FFFF` which points to a section larger
+than the binary.
+
+### `invalid_string_length_cut_short.bin`
+
+Truncated the file to 0xAD bytes, as that cuts string length Uint32t value in
+half.
+
+### `invalid_string_length.bin`
+
+Changed two bytes at 0x00AC from `0500` to `FFFF` which is a string length
+larger than the binary.
+
+### `invalid_vector_length_cut_short.bin`
+
+Truncated the file to 0x0136 bytes, as that cuts vector length Uint32t value in
+half.
+
+### `invalid_struct_field_cut_short.bin`
+
+Truncated the file to 0x5d bytes, as that cuts struct field value in half.
+
+### `invalid_struct_array_field_cut_short.bin`
+
+Truncated the file to 0x6A bytes, as that cuts struct array field value in half.
+
+### `invalid_vector_structs_cut_short.bin`
+
+Truncated the file to 0x0154 bytes, as that cuts into a vector of structs.
+
+### `invalid_vector_tables_cut_short.bin`
+
+Truncated the file to 0x01DE bytes, as that cuts into a vector of table offsets.
+
+### `invalid_vector_strings_cut_short.bin`
+
+Truncated the file to 0x0176 bytes, as that cuts into a vector of string
+offsets.
+
+### `invalid_vector_scalars_cut_short.bin`
+
+Truncated the file to 0x01C1 bytes, as that cuts into a vector of scalars
+values.
+
+### `invalid_vector_unions_cut_short.bin`
+
+Truncated the file to 0x01DE bytes, as that cuts into a vector of union offset
+values.
+
+### `invalid_union_type_value.bin`
+
+Changed one byte at 0x004D from `02` to `FF` which is a union type value that is
+larger than the enum.
+
+### `invalid_vector_union_type_value.bin`
+
+Changed one byte at 0x0131 from `02` to `FF` which is a vector union type value
+that is larger than the enum.
\ No newline at end of file
diff --git a/tests/annotated_binary/tests/invalid_root_offset.afb b/tests/annotated_binary/tests/invalid_root_offset.afb
new file mode 100644
index 0000000..ff50417
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_root_offset.afb
@@ -0,0 +1,93 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_root_offset.bin
+
+header:
+ +0x0000 | FF FF 00 00 | UOffset32 | 0x0000FFFF (65535) Loc: +0xFFFF | ERROR: offset to root table `AnnotatedBinary.Foo`. Invalid offset, points outside the binary.
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+unknown (no known references):
+ +0x0008 | 00 00 3A 00 68 00 0C 00 | ?uint8_t[664] | ..:.h... | WARN: nothing refers to this section.
+ +0x0010 | 07 00 00 00 08 00 10 00 | | ........
+ +0x0018 | 14 00 30 00 34 00 09 00 | | ..0.4...
+ +0x0020 | 38 00 3C 00 40 00 44 00 | | 8.<.@.D.
+ +0x0028 | 00 00 00 00 48 00 4C 00 | | ....H.L.
+ +0x0030 | 50 00 54 00 58 00 0A 00 | | P.T.X...
+ +0x0038 | 5C 00 0B 00 60 00 00 00 | | \...`...
+ +0x0040 | 00 00 64 00 3A 00 00 00 | | ..d.:...
+ +0x0048 | 00 00 00 01 02 02 01 01 | | ........
+ +0x0050 | D2 04 00 00 28 02 00 00 | | ....(...
+ +0x0058 | 01 00 00 00 02 00 00 00 | | ........
+ +0x0060 | 0C 00 00 00 0A 00 00 00 | | ........
+ +0x0068 | 0C 00 00 00 14 00 00 00 | | ........
+ +0x0070 | 01 02 03 00 C8 01 00 00 | | ........
+ +0x0078 | 5C 01 00 00 50 01 00 00 | | \...P...
+ +0x0080 | 34 01 00 00 24 01 00 00 | | 4...$...
+ +0x0088 | 14 01 00 00 0D 00 00 00 | | ........
+ +0x0090 | DC 00 00 00 A0 00 00 00 | | ........
+ +0x0098 | 94 00 00 00 38 00 00 00 | | ....8...
+ +0x00A0 | 33 00 00 00 1C 00 00 00 | | 3.......
+ +0x00A8 | 04 00 00 00 05 00 00 00 | | ........
+ +0x00B0 | 61 6C 69 63 65 00 00 00 | | alice...
+ +0x00B8 | 08 00 13 00 08 00 04 00 | | ........
+ +0x00C0 | 08 00 00 00 00 80 23 44 | | ......#D
+ +0x00C8 | 00 00 00 00 00 10 74 40 | | ......t@
+ +0x00D0 | 00 00 00 05 03 00 00 00 | | ........
+ +0x00D8 | 34 00 00 00 2C 00 00 00 | | 4...,...
+ +0x00E0 | 04 00 00 00 D2 FE FF FF | | ........
+ +0x00E8 | 00 80 23 44 10 00 00 00 | | ..#D....
+ +0x00F0 | 00 00 00 00 00 D8 8E 40 | | .......@
+ +0x00F8 | 00 00 00 00 6A FE FF FF | | ....j...
+ +0x0100 | 00 00 00 03 04 00 04 00 | | ........
+ +0x0108 | 04 00 00 00 FA FE FF FF | | ........
+ +0x0110 | 00 00 E4 43 10 00 00 00 | | ...C....
+ +0x0118 | 00 00 00 00 00 C0 5E 40 | | ......^@
+ +0x0120 | 00 00 00 00 92 FE FF FF | | ........
+ +0x0128 | 00 00 00 01 03 00 00 00 | | ........
+ +0x0130 | 01 02 01 00 03 00 00 00 | | ........
+ +0x0138 | 33 33 33 33 33 A3 45 40 | | 33333.E@
+ +0x0140 | 7E 57 04 FF 5B 87 53 C0 | | ~W..[.S.
+ +0x0148 | 8D F0 F6 20 04 B6 42 40 | | ... ..B@
+ +0x0150 | 9F 77 63 41 61 85 5E C0 | | .wcAa.^.
+ +0x0158 | 8F 35 23 83 DC 35 4B C0 | | .5#..5K.
+ +0x0160 | F6 97 DD 93 87 C5 0A 40 | | .......@
+ +0x0168 | 00 00 00 00 03 00 00 00 | | ........
+ +0x0170 | 20 00 00 00 14 00 00 00 | | .......
+ +0x0178 | 04 00 00 00 07 00 00 00 | | ........
+ +0x0180 | 63 68 61 72 6C 69 65 00 | | charlie.
+ +0x0188 | 03 00 00 00 62 6F 62 00 | | ....bob.
+ +0x0190 | 05 00 00 00 61 6C 69 63 | | ....alic
+ +0x0198 | 65 00 00 00 07 00 00 00 | | e.......
+ +0x01A0 | 63 68 61 72 6C 69 65 00 | | charlie.
+ +0x01A8 | 07 00 00 00 63 68 61 72 | | ....char
+ +0x01B0 | 6C 69 65 00 09 00 00 00 | | lie.....
+ +0x01B8 | 09 00 08 00 07 00 01 00 | | ........
+ +0x01C0 | 02 00 03 00 06 00 05 00 | | ........
+ +0x01C8 | 04 00 00 00 3A FF FF FF | | ....:...
+ +0x01D0 | 00 00 00 03 02 00 00 00 | | ........
+ +0x01D8 | 44 00 00 00 10 00 00 00 | | D.......
+ +0x01E0 | 00 00 0A 00 1A 00 0C 00 | | ........
+ +0x01E8 | 04 00 08 00 0A 00 00 00 | | ........
+ +0x01F0 | 00 80 23 44 18 00 00 00 | | ..#D....
+ +0x01F8 | 00 00 00 00 00 D8 8E 40 | | .......@
+ +0x0200 | 00 00 00 00 00 00 06 00 | | ........
+ +0x0208 | 06 00 05 00 06 00 00 00 | | ........
+ +0x0210 | 00 03 0A 00 18 00 0C 00 | | ........
+ +0x0218 | 04 00 08 00 0A 00 00 00 | | ........
+ +0x0220 | 00 00 E4 43 10 00 00 00 | | ...C....
+ +0x0228 | 00 00 00 00 00 C0 5E 40 | | ......^@
+ +0x0230 | 00 00 00 00 A2 FF FF FF | | ........
+ +0x0238 | 00 00 00 01 2F 00 00 00 | | ..../...
+ +0x0240 | 54 68 69 73 20 69 73 20 | | This is
+ +0x0248 | 61 20 6C 6F 6E 67 20 73 | | a long s
+ +0x0250 | 74 72 69 6E 67 20 74 6F | | tring to
+ +0x0258 | 20 73 68 6F 77 20 68 6F | | show ho
+ +0x0260 | 77 20 69 74 20 62 72 65 | | w it bre
+ +0x0268 | 61 6B 73 20 75 70 2E 00 | | aks up..
+ +0x0270 | 00 00 0A 00 16 00 0C 00 | | ........
+ +0x0278 | 04 00 08 00 0A 00 00 00 | | ........
+ +0x0280 | 65 20 71 49 14 00 00 00 | | e qI....
+ +0x0288 | C9 76 BE 9F 0C 24 FE 40 | | .v...$.@
+ +0x0290 | 00 00 06 00 08 00 07 00 | | ........
+ +0x0298 | 06 00 00 00 00 00 00 01 | | ........
diff --git a/tests/annotated_binary/tests/invalid_root_offset.bin b/tests/annotated_binary/tests/invalid_root_offset.bin
new file mode 100644
index 0000000..c539a01
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_root_offset.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_root_table_too_short.afb b/tests/annotated_binary/tests/invalid_root_table_too_short.afb
new file mode 100644
index 0000000..2269d4e
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_root_table_too_short.afb
@@ -0,0 +1,21 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_root_table_too_short.bin
+
+header:
+ +0x00 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x44 | offset to root table `AnnotatedBinary.Foo`
+ +0x04 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+unknown (no known references):
+ +0x08 | 00 00 3A 00 68 00 0C 00 | ?uint8_t[60] | ..:.h... | WARN: nothing refers to this section.
+ +0x10 | 07 00 00 00 08 00 10 00 | | ........
+ +0x18 | 14 00 30 00 34 00 09 00 | | ..0.4...
+ +0x20 | 38 00 3C 00 40 00 44 00 | | 8.<.@.D.
+ +0x28 | 00 00 00 00 48 00 4C 00 | | ....H.L.
+ +0x30 | 50 00 54 00 58 00 0A 00 | | P.T.X...
+ +0x38 | 5C 00 0B 00 60 00 00 00 | | \...`...
+ +0x40 | 00 00 64 00 | | ..d.
+
+root_table (AnnotatedBinary.Foo):
+ +0x44 | 3A 00 | ?uint8_t[2] | :. | ERROR: offset to vtable. Incomplete binary, expected to read 4 bytes.
diff --git a/tests/annotated_binary/tests/invalid_root_table_too_short.bin b/tests/annotated_binary/tests/invalid_root_table_too_short.bin
new file mode 100644
index 0000000..bb1c7fc
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_root_table_too_short.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_root_table_vtable_offset.afb b/tests/annotated_binary/tests/invalid_root_table_vtable_offset.afb
new file mode 100644
index 0000000..d1c6260
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_root_table_vtable_offset.afb
@@ -0,0 +1,98 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_root_table_vtable_offset.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+unknown (no known references):
+ +0x0008 | 00 00 3A 00 68 00 0C 00 | ?uint8_t[60] | ..:.h... | WARN: nothing refers to this section.
+ +0x0010 | 07 00 00 00 08 00 10 00 | | ........
+ +0x0018 | 14 00 30 00 34 00 09 00 | | ..0.4...
+ +0x0020 | 38 00 3C 00 40 00 44 00 | | 8.<.@.D.
+ +0x0028 | 00 00 00 00 48 00 4C 00 | | ....H.L.
+ +0x0030 | 50 00 54 00 58 00 0A 00 | | P.T.X...
+ +0x0038 | 5C 00 0B 00 60 00 00 00 | | \...`...
+ +0x0040 | 00 00 64 00 | | ..d.
+
+root_table (AnnotatedBinary.Foo):
+ +0x0044 | FF FF 00 00 | SOffset32 | 0x0000FFFF (65535) Loc: +0xFFFFFFFFFFFF0045 | ERROR: offset to vtable. Invalid offset, points outside the binary.
+
+unknown (no known references):
+ +0x0048 | 00 00 00 01 02 02 01 01 | ?uint8_t[600] | ........ | WARN: nothing refers to this section.
+ +0x0050 | D2 04 00 00 28 02 00 00 | | ....(...
+ +0x0058 | 01 00 00 00 02 00 00 00 | | ........
+ +0x0060 | 0C 00 00 00 0A 00 00 00 | | ........
+ +0x0068 | 0C 00 00 00 14 00 00 00 | | ........
+ +0x0070 | 01 02 03 00 C8 01 00 00 | | ........
+ +0x0078 | 5C 01 00 00 50 01 00 00 | | \...P...
+ +0x0080 | 34 01 00 00 24 01 00 00 | | 4...$...
+ +0x0088 | 14 01 00 00 0D 00 00 00 | | ........
+ +0x0090 | DC 00 00 00 A0 00 00 00 | | ........
+ +0x0098 | 94 00 00 00 38 00 00 00 | | ....8...
+ +0x00A0 | 33 00 00 00 1C 00 00 00 | | 3.......
+ +0x00A8 | 04 00 00 00 05 00 00 00 | | ........
+ +0x00B0 | 61 6C 69 63 65 00 00 00 | | alice...
+ +0x00B8 | 08 00 13 00 08 00 04 00 | | ........
+ +0x00C0 | 08 00 00 00 00 80 23 44 | | ......#D
+ +0x00C8 | 00 00 00 00 00 10 74 40 | | ......t@
+ +0x00D0 | 00 00 00 05 03 00 00 00 | | ........
+ +0x00D8 | 34 00 00 00 2C 00 00 00 | | 4...,...
+ +0x00E0 | 04 00 00 00 D2 FE FF FF | | ........
+ +0x00E8 | 00 80 23 44 10 00 00 00 | | ..#D....
+ +0x00F0 | 00 00 00 00 00 D8 8E 40 | | .......@
+ +0x00F8 | 00 00 00 00 6A FE FF FF | | ....j...
+ +0x0100 | 00 00 00 03 04 00 04 00 | | ........
+ +0x0108 | 04 00 00 00 FA FE FF FF | | ........
+ +0x0110 | 00 00 E4 43 10 00 00 00 | | ...C....
+ +0x0118 | 00 00 00 00 00 C0 5E 40 | | ......^@
+ +0x0120 | 00 00 00 00 92 FE FF FF | | ........
+ +0x0128 | 00 00 00 01 03 00 00 00 | | ........
+ +0x0130 | 01 02 01 00 03 00 00 00 | | ........
+ +0x0138 | 33 33 33 33 33 A3 45 40 | | 33333.E@
+ +0x0140 | 7E 57 04 FF 5B 87 53 C0 | | ~W..[.S.
+ +0x0148 | 8D F0 F6 20 04 B6 42 40 | | ... ..B@
+ +0x0150 | 9F 77 63 41 61 85 5E C0 | | .wcAa.^.
+ +0x0158 | 8F 35 23 83 DC 35 4B C0 | | .5#..5K.
+ +0x0160 | F6 97 DD 93 87 C5 0A 40 | | .......@
+ +0x0168 | 00 00 00 00 03 00 00 00 | | ........
+ +0x0170 | 20 00 00 00 14 00 00 00 | | .......
+ +0x0178 | 04 00 00 00 07 00 00 00 | | ........
+ +0x0180 | 63 68 61 72 6C 69 65 00 | | charlie.
+ +0x0188 | 03 00 00 00 62 6F 62 00 | | ....bob.
+ +0x0190 | 05 00 00 00 61 6C 69 63 | | ....alic
+ +0x0198 | 65 00 00 00 07 00 00 00 | | e.......
+ +0x01A0 | 63 68 61 72 6C 69 65 00 | | charlie.
+ +0x01A8 | 07 00 00 00 63 68 61 72 | | ....char
+ +0x01B0 | 6C 69 65 00 09 00 00 00 | | lie.....
+ +0x01B8 | 09 00 08 00 07 00 01 00 | | ........
+ +0x01C0 | 02 00 03 00 06 00 05 00 | | ........
+ +0x01C8 | 04 00 00 00 3A FF FF FF | | ....:...
+ +0x01D0 | 00 00 00 03 02 00 00 00 | | ........
+ +0x01D8 | 44 00 00 00 10 00 00 00 | | D.......
+ +0x01E0 | 00 00 0A 00 1A 00 0C 00 | | ........
+ +0x01E8 | 04 00 08 00 0A 00 00 00 | | ........
+ +0x01F0 | 00 80 23 44 18 00 00 00 | | ..#D....
+ +0x01F8 | 00 00 00 00 00 D8 8E 40 | | .......@
+ +0x0200 | 00 00 00 00 00 00 06 00 | | ........
+ +0x0208 | 06 00 05 00 06 00 00 00 | | ........
+ +0x0210 | 00 03 0A 00 18 00 0C 00 | | ........
+ +0x0218 | 04 00 08 00 0A 00 00 00 | | ........
+ +0x0220 | 00 00 E4 43 10 00 00 00 | | ...C....
+ +0x0228 | 00 00 00 00 00 C0 5E 40 | | ......^@
+ +0x0230 | 00 00 00 00 A2 FF FF FF | | ........
+ +0x0238 | 00 00 00 01 2F 00 00 00 | | ..../...
+ +0x0240 | 54 68 69 73 20 69 73 20 | | This is
+ +0x0248 | 61 20 6C 6F 6E 67 20 73 | | a long s
+ +0x0250 | 74 72 69 6E 67 20 74 6F | | tring to
+ +0x0258 | 20 73 68 6F 77 20 68 6F | | show ho
+ +0x0260 | 77 20 69 74 20 62 72 65 | | w it bre
+ +0x0268 | 61 6B 73 20 75 70 2E 00 | | aks up..
+ +0x0270 | 00 00 0A 00 16 00 0C 00 | | ........
+ +0x0278 | 04 00 08 00 0A 00 00 00 | | ........
+ +0x0280 | 65 20 71 49 14 00 00 00 | | e qI....
+ +0x0288 | C9 76 BE 9F 0C 24 FE 40 | | .v...$.@
+ +0x0290 | 00 00 06 00 08 00 07 00 | | ........
+ +0x0298 | 06 00 00 00 00 00 00 01 | | ........
diff --git a/tests/annotated_binary/tests/invalid_root_table_vtable_offset.bin b/tests/annotated_binary/tests/invalid_root_table_vtable_offset.bin
new file mode 100644
index 0000000..a3075ea
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_root_table_vtable_offset.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_string_length.afb b/tests/annotated_binary/tests/invalid_string_length.afb
new file mode 100644
index 0000000..332cbaf
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_string_length.afb
@@ -0,0 +1,295 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_string_length.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x0008 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x000A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x000C | 68 00 | uint16_t | 0x0068 (104) | size of referring table
+ +0x000E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x0010 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x0012 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x0014 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x0016 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x0018 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x001A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `name` (id: 6)
+ +0x001C | 34 00 | VOffset16 | 0x0034 (52) | offset to field `bars` (id: 7)
+ +0x001E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x0020 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `bar_baz` (id: 9)
+ +0x0022 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `accounts` (id: 10)
+ +0x0024 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `bob` (id: 11)
+ +0x0026 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `alice` (id: 12)
+ +0x0028 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x002A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x002C | 48 00 | VOffset16 | 0x0048 (72) | offset to field `just_i32` (id: 15)
+ +0x002E | 4C 00 | VOffset16 | 0x004C (76) | offset to field `names` (id: 16)
+ +0x0030 | 50 00 | VOffset16 | 0x0050 (80) | offset to field `points_of_interest` (id: 17)
+ +0x0032 | 54 00 | VOffset16 | 0x0054 (84) | offset to field `foobars_type` (id: 18)
+ +0x0034 | 58 00 | VOffset16 | 0x0058 (88) | offset to field `foobars` (id: 19)
+ +0x0036 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x0038 | 5C 00 | VOffset16 | 0x005C (92) | offset to field `measurement` (id: 21)
+ +0x003A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x003C | 60 00 | VOffset16 | 0x0060 (96) | offset to field `anything` (id: 23)
+ +0x003E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x0040 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x0042 | 64 00 | VOffset16 | 0x0064 (100) | offset to field `charlie` (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x0044 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x000A | offset to vtable
+ +0x0048 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x004B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x004C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x004D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x004E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x004F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x0050 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x0054 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x027C | offset to field `bar` (table)
+ +0x0058 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x005C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x0060 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x0064 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values`[0] (Int)
+ +0x0068 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | array field `AnnotatedBinary.Dimension.values`[1] (Int)
+ +0x006C | 14 00 00 00 | uint32_t | 0x00000014 (20) | array field `AnnotatedBinary.Dimension.values`[2] (Int)
+ +0x0070 | 01 | uint8_t | 0x01 (1) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0071 | 02 | uint8_t | 0x02 (2) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0072 | 03 | uint8_t | 0x03 (3) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0073 | 00 | uint8_t[1] | . | padding
+ +0x0074 | C8 01 00 00 | UOffset32 | 0x000001C8 (456) Loc: +0x023C | offset to field `name` (string)
+ +0x0078 | 5C 01 00 00 | UOffset32 | 0x0000015C (348) Loc: +0x01D4 | offset to field `bars` (vector)
+ +0x007C | 50 01 00 00 | UOffset32 | 0x00000150 (336) Loc: +0x01CC | offset to field `bar_baz` (union of type `Baz`)
+ +0x0080 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x01B4 | offset to field `accounts` (vector)
+ +0x0084 | 24 01 00 00 | UOffset32 | 0x00000124 (292) Loc: +0x01A8 | offset to field `bob` (string)
+ +0x0088 | 14 01 00 00 | UOffset32 | 0x00000114 (276) Loc: +0x019C | offset to field `alice` (string)
+ +0x008C | 0D 00 00 00 | uint32_t | 0x0000000D (13) | table field `just_i32` (Int)
+ +0x0090 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x016C | offset to field `names` (vector)
+ +0x0094 | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x0134 | offset to field `points_of_interest` (vector)
+ +0x0098 | 94 00 00 00 | UOffset32 | 0x00000094 (148) Loc: +0x012C | offset to field `foobars_type` (vector)
+ +0x009C | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x00D4 | offset to field `foobars` (vector)
+ +0x00A0 | 33 00 00 00 | UOffset32 | 0x00000033 (51) Loc: +0x00D3 | offset to field `measurement` (union of type `Tolerance`)
+ +0x00A4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x00C0 | offset to field `anything` (union of type `Bar`)
+ +0x00A8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00AC | offset to field `charlie` (string)
+
+string (AnnotatedBinary.Foo.charlie):
+ +0x00AC | FF FF 00 00 | uint32_t | 0x0000FFFF (65535) | ERROR: length of string. Longer than the binary.
+
+unknown (no known references):
+ +0x00B0 | 61 6C 69 63 65 00 00 00 | ?uint8_t[8] | alice... | WARN: nothing refers to this section.
+
+vtable (AnnotatedBinary.Bar):
+ +0x00B8 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+ +0x00BA | 13 00 | uint16_t | 0x0013 (19) | size of referring table
+ +0x00BC | 08 00 | VOffset16 | 0x0008 (8) | offset to field `a` (id: 0)
+ +0x00BE | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+
+table (AnnotatedBinary.Bar):
+ +0x00C0 | 08 00 00 00 | SOffset32 | 0x00000008 (8) Loc: +0x00B8 | offset to vtable
+ +0x00C4 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00C8 | 00 00 00 00 00 10 74 40 | double | 0x4074100000000000 (321) | table field `a` (Double)
+ +0x00D0 | 00 00 00 | uint8_t[3] | ... | padding
+
+union (AnnotatedBinary.Tolerance.measurement):
+ +0x00D3 | 05 | uint8_t | 0x05 (5) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+
+vector (AnnotatedBinary.Foo.foobars):
+ +0x00D4 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x00D8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x010C | offset to union[0] (`Bar`)
+ +0x00DC | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0108 | offset to union[1] (`Baz`)
+ +0x00E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00E4 | offset to union[2] (`Bar`)
+
+table (AnnotatedBinary.Bar):
+ +0x00E4 | D2 FE FF FF | SOffset32 | 0xFFFFFED2 (-302) Loc: +0x0212 | offset to vtable
+ +0x00E8 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00EC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x00FC | offset to field `c` (table)
+ +0x00F0 | 00 00 00 00 00 D8 8E 40 | double | 0x408ED80000000000 (987) | table field `a` (Double)
+ +0x00F8 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x00FC | 6A FE FF FF | SOffset32 | 0xFFFFFE6A (-406) Loc: +0x0292 | offset to vtable
+ +0x0100 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0103 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vtable (AnnotatedBinary.Baz):
+ +0x0104 | 04 00 | uint16_t | 0x0004 (4) | size of this vtable
+ +0x0106 | 04 00 | uint16_t | 0x0004 (4) | size of referring table
+
+table (AnnotatedBinary.Baz):
+ +0x0108 | 04 00 00 00 | SOffset32 | 0x00000004 (4) Loc: +0x0104 | offset to vtable
+
+table (AnnotatedBinary.Bar):
+ +0x010C | FA FE FF FF | SOffset32 | 0xFFFFFEFA (-262) Loc: +0x0212 | offset to vtable
+ +0x0110 | 00 00 E4 43 | float | 0x43E40000 (456) | table field `b` (Float)
+ +0x0114 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0124 | offset to field `c` (table)
+ +0x0118 | 00 00 00 00 00 C0 5E 40 | double | 0x405EC00000000000 (123) | table field `a` (Double)
+ +0x0120 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x0124 | 92 FE FF FF | SOffset32 | 0xFFFFFE92 (-366) Loc: +0x0292 | offset to vtable
+ +0x0128 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x012B | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
+
+vector (AnnotatedBinary.Foo.foobars_type):
+ +0x012C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0130 | 01 | UType8 | 0x01 (1) | value[0]
+ +0x0131 | 02 | UType8 | 0x02 (2) | value[1]
+ +0x0132 | 01 | UType8 | 0x01 (1) | value[2]
+
+vector (AnnotatedBinary.Foo.points_of_interest):
+ +0x0134 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0138 | 33 33 33 33 33 A3 45 40 | double | 0x4045A33333333333 (43.275) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0140 | 7E 57 04 FF 5B 87 53 C0 | double | 0xC053875BFF04577E (-78.115) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0148 | 8D F0 F6 20 04 B6 42 40 | double | 0x4042B60420F6F08D (37.422) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0150 | 9F 77 63 41 61 85 5E C0 | double | 0xC05E85614163779F (-122.084) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0158 | 8F 35 23 83 DC 35 4B C0 | double | 0xC04B35DC8323358F (-54.4208) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0160 | F6 97 DD 93 87 C5 0A 40 | double | 0x400AC58793DD97F6 (3.34645) | struct field `AnnotatedBinary.Location.longitude` (Double)
+
+padding:
+ +0x0168 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (AnnotatedBinary.Foo.names):
+ +0x016C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0170 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0190 | offset to string[0]
+ +0x0174 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0188 | offset to string[1]
+ +0x0178 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x017C | offset to string[2]
+
+string (AnnotatedBinary.Foo.names):
+ +0x017C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x0180 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x0187 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0188 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x018C | 62 6F 62 | char[3] | bob | string literal
+ +0x018F | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0190 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x0194 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x0199 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x019A | 00 00 | uint8_t[2] | .. | padding
+
+string (AnnotatedBinary.Foo.alice):
+ +0x019C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01A0 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01A7 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.bob):
+ +0x01A8 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01AC | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01B3 | 00 | char | 0x00 (0) | string terminator
+
+vector (AnnotatedBinary.Foo.accounts):
+ +0x01B4 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of vector (# items)
+ +0x01B8 | 09 00 | uint16_t | 0x0009 (9) | value[0]
+ +0x01BA | 08 00 | uint16_t | 0x0008 (8) | value[1]
+ +0x01BC | 07 00 | uint16_t | 0x0007 (7) | value[2]
+ +0x01BE | 01 00 | uint16_t | 0x0001 (1) | value[3]
+ +0x01C0 | 02 00 | uint16_t | 0x0002 (2) | value[4]
+ +0x01C2 | 03 00 | uint16_t | 0x0003 (3) | value[5]
+ +0x01C4 | 06 00 | uint16_t | 0x0006 (6) | value[6]
+ +0x01C6 | 05 00 | uint16_t | 0x0005 (5) | value[7]
+ +0x01C8 | 04 00 | uint16_t | 0x0004 (4) | value[8]
+
+padding:
+ +0x01CA | 00 00 | uint8_t[2] | .. | padding
+
+table (AnnotatedBinary.Baz):
+ +0x01CC | 3A FF FF FF | SOffset32 | 0xFFFFFF3A (-198) Loc: +0x0292 | offset to vtable
+ +0x01D0 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x01D3 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vector (AnnotatedBinary.Foo.bars):
+ +0x01D4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x01D8 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x021C | offset to table[0]
+ +0x01DC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x01EC | offset to table[1]
+
+padding:
+ +0x01E0 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x01E2 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x01E4 | 1A 00 | uint16_t | 0x001A (26) | size of referring table
+ +0x01E6 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x01E8 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x01EA | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x01EC | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x01E2 | offset to vtable
+ +0x01F0 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x01F4 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x020C | offset to field `c` (table)
+ +0x01F8 | 00 00 00 00 00 D8 8E 40 | double | 0x408ED80000000000 (987) | table field `a` (Double)
+ +0x0200 | 00 00 00 00 00 00 | uint8_t[6] | ...... | padding
+
+vtable (AnnotatedBinary.Baz):
+ +0x0206 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x0208 | 06 00 | uint16_t | 0x0006 (6) | size of referring table
+ +0x020A | 05 00 | VOffset16 | 0x0005 (5) | offset to field `meal` (id: 0)
+
+table (AnnotatedBinary.Baz):
+ +0x020C | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: +0x0206 | offset to vtable
+ +0x0210 | 00 | uint8_t[1] | . | padding
+ +0x0211 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vtable (AnnotatedBinary.Bar):
+ +0x0212 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x0214 | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x0216 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x0218 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x021A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x021C | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x0212 | offset to vtable
+ +0x0220 | 00 00 E4 43 | float | 0x43E40000 (456) | table field `b` (Float)
+ +0x0224 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0234 | offset to field `c` (table)
+ +0x0228 | 00 00 00 00 00 C0 5E 40 | double | 0x405EC00000000000 (123) | table field `a` (Double)
+ +0x0230 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x0234 | A2 FF FF FF | SOffset32 | 0xFFFFFFA2 (-94) Loc: +0x0292 | offset to vtable
+ +0x0238 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x023B | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
+
+string (AnnotatedBinary.Foo.name):
+ +0x023C | 2F 00 00 00 | uint32_t | 0x0000002F (47) | length of string
+ +0x0240 | 54 68 69 73 20 69 73 20 | char[47] | This is | string literal
+ +0x0248 | 61 20 6C 6F 6E 67 20 73 | | a long s
+ +0x0250 | 74 72 69 6E 67 20 74 6F | | tring to
+ +0x0258 | 20 73 68 6F 77 20 68 6F | | show ho
+ +0x0260 | 77 20 69 74 20 62 72 65 | | w it bre
+ +0x0268 | 61 6B 73 20 75 70 2E | | aks up.
+ +0x026F | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0270 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x0272 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x0274 | 16 00 | uint16_t | 0x0016 (22) | size of referring table
+ +0x0276 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x0278 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x027A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x027C | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x0272 | offset to vtable
+ +0x0280 | 65 20 71 49 | float | 0x49712065 (987654) | table field `b` (Float)
+ +0x0284 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0298 | offset to field `c` (table)
+ +0x0288 | C9 76 BE 9F 0C 24 FE 40 | double | 0x40FE240C9FBE76C9 (123457) | table field `a` (Double)
+ +0x0290 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Baz):
+ +0x0292 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x0294 | 08 00 | uint16_t | 0x0008 (8) | size of referring table
+ +0x0296 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `meal` (id: 0)
+
+table (AnnotatedBinary.Baz):
+ +0x0298 | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: +0x0292 | offset to vtable
+ +0x029C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x029F | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
diff --git a/tests/annotated_binary/tests/invalid_string_length.bin b/tests/annotated_binary/tests/invalid_string_length.bin
new file mode 100644
index 0000000..c4ef678
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_string_length.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_string_length_cut_short.afb b/tests/annotated_binary/tests/invalid_string_length_cut_short.afb
new file mode 100644
index 0000000..66f397a
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_string_length_cut_short.afb
@@ -0,0 +1,80 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_string_length_cut_short.bin
+
+header:
+ +0x00 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x44 | offset to root table `AnnotatedBinary.Foo`
+ +0x04 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x08 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x0A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x0C | 68 00 | uint16_t | 0x0068 (104) | size of referring table
+ +0x0E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x10 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x12 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x14 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x16 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x18 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x1A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `name` (id: 6)
+ +0x1C | 34 00 | VOffset16 | 0x0034 (52) | offset to field `bars` (id: 7)
+ +0x1E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x20 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `bar_baz` (id: 9)
+ +0x22 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `accounts` (id: 10)
+ +0x24 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `bob` (id: 11)
+ +0x26 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `alice` (id: 12)
+ +0x28 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x2A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x2C | 48 00 | VOffset16 | 0x0048 (72) | offset to field `just_i32` (id: 15)
+ +0x2E | 4C 00 | VOffset16 | 0x004C (76) | offset to field `names` (id: 16)
+ +0x30 | 50 00 | VOffset16 | 0x0050 (80) | offset to field `points_of_interest` (id: 17)
+ +0x32 | 54 00 | VOffset16 | 0x0054 (84) | offset to field `foobars_type` (id: 18)
+ +0x34 | 58 00 | VOffset16 | 0x0058 (88) | offset to field `foobars` (id: 19)
+ +0x36 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x38 | 5C 00 | VOffset16 | 0x005C (92) | offset to field `measurement` (id: 21)
+ +0x3A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x3C | 60 00 | VOffset16 | 0x0060 (96) | offset to field `anything` (id: 23)
+ +0x3E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x40 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x42 | 64 00 | VOffset16 | 0x0064 (100) | offset to field `charlie` (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x44 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x0A | offset to vtable
+ +0x48 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x4B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x4C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x4D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x4E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x4F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x50 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x54 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x27C | ERROR: offset to field `bar`. Invalid offset, points outside the binary.
+ +0x58 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x5C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x60 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x64 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values`[0] (Int)
+ +0x68 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | array field `AnnotatedBinary.Dimension.values`[1] (Int)
+ +0x6C | 14 00 00 00 | uint32_t | 0x00000014 (20) | array field `AnnotatedBinary.Dimension.values`[2] (Int)
+ +0x70 | 01 | uint8_t | 0x01 (1) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x71 | 02 | uint8_t | 0x02 (2) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x72 | 03 | uint8_t | 0x03 (3) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x73 | 00 | uint8_t[1] | . | padding
+ +0x74 | C8 01 00 00 | UOffset32 | 0x000001C8 (456) Loc: +0x23C | ERROR: offset to field `name`. Invalid offset, points outside the binary.
+ +0x78 | 5C 01 00 00 | UOffset32 | 0x0000015C (348) Loc: +0x1D4 | ERROR: offset to field `bars`. Invalid offset, points outside the binary.
+ +0x7C | 50 01 00 00 | UOffset32 | 0x00000150 (336) Loc: +0x1CC | ERROR: offset to field `bar_baz`. Invalid offset, points outside the binary.
+ +0x80 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x1B4 | ERROR: offset to field `accounts`. Invalid offset, points outside the binary.
+ +0x84 | 24 01 00 00 | UOffset32 | 0x00000124 (292) Loc: +0x1A8 | ERROR: offset to field `bob`. Invalid offset, points outside the binary.
+ +0x88 | 14 01 00 00 | UOffset32 | 0x00000114 (276) Loc: +0x19C | ERROR: offset to field `alice`. Invalid offset, points outside the binary.
+ +0x8C | 0D 00 00 00 | uint32_t | 0x0000000D (13) | table field `just_i32` (Int)
+ +0x90 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x16C | ERROR: offset to field `names`. Invalid offset, points outside the binary.
+ +0x94 | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x134 | ERROR: offset to field `points_of_interest`. Invalid offset, points outside the binary.
+ +0x98 | 94 00 00 00 | UOffset32 | 0x00000094 (148) Loc: +0x12C | ERROR: offset to field `foobars_type`. Invalid offset, points outside the binary.
+ +0x9C | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0xD4 | ERROR: offset to field `foobars`. Invalid offset, points outside the binary.
+ +0xA0 | 33 00 00 00 | UOffset32 | 0x00000033 (51) Loc: +0xD3 | ERROR: offset to field `measurement`. Invalid offset, points outside the binary.
+ +0xA4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0xC0 | ERROR: offset to field `anything`. Invalid offset, points outside the binary.
+ +0xA8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0xAC | offset to field `charlie` (string)
+
+string (AnnotatedBinary.Foo.charlie):
+ +0xAC | 05 00 | ?uint8_t[2] | .. | ERROR: length of string. Incomplete binary, expected to read 4 bytes.
diff --git a/tests/annotated_binary/tests/invalid_string_length_cut_short.bin b/tests/annotated_binary/tests/invalid_string_length_cut_short.bin
new file mode 100644
index 0000000..69f7e11
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_string_length_cut_short.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_struct_array_field_cut_short.afb b/tests/annotated_binary/tests/invalid_struct_array_field_cut_short.afb
new file mode 100644
index 0000000..75be69a
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_struct_array_field_cut_short.afb
@@ -0,0 +1,72 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_struct_array_field_cut_short.bin
+
+header:
+ +0x00 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x44 | offset to root table `AnnotatedBinary.Foo`
+ +0x04 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x08 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x0A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x0C | 68 00 | uint16_t | 0x0068 (104) | ERROR: size of referring table. Longer than the binary.
+ +0x0E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x10 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x12 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x14 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x16 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x18 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x1A | 30 00 | VOffset16 | 0x0030 (48) | ERROR: offset to field `name` (id: 6). Invalid offset, points outside the binary.
+ +0x1C | 34 00 | VOffset16 | 0x0034 (52) | ERROR: offset to field `bars` (id: 7). Invalid offset, points outside the binary.
+ +0x1E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x20 | 38 00 | VOffset16 | 0x0038 (56) | ERROR: offset to field `bar_baz` (id: 9). Invalid offset, points outside the binary.
+ +0x22 | 3C 00 | VOffset16 | 0x003C (60) | ERROR: offset to field `accounts` (id: 10). Invalid offset, points outside the binary.
+ +0x24 | 40 00 | VOffset16 | 0x0040 (64) | ERROR: offset to field `bob` (id: 11). Invalid offset, points outside the binary.
+ +0x26 | 44 00 | VOffset16 | 0x0044 (68) | ERROR: offset to field `alice` (id: 12). Invalid offset, points outside the binary.
+ +0x28 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x2A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x2C | 48 00 | VOffset16 | 0x0048 (72) | ERROR: offset to field `just_i32` (id: 15). Invalid offset, points outside the binary.
+ +0x2E | 4C 00 | VOffset16 | 0x004C (76) | ERROR: offset to field `names` (id: 16). Invalid offset, points outside the binary.
+ +0x30 | 50 00 | VOffset16 | 0x0050 (80) | ERROR: offset to field `points_of_interest` (id: 17). Invalid offset, points outside the binary.
+ +0x32 | 54 00 | VOffset16 | 0x0054 (84) | ERROR: offset to field `foobars_type` (id: 18). Invalid offset, points outside the binary.
+ +0x34 | 58 00 | VOffset16 | 0x0058 (88) | ERROR: offset to field `foobars` (id: 19). Invalid offset, points outside the binary.
+ +0x36 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x38 | 5C 00 | VOffset16 | 0x005C (92) | ERROR: offset to field `measurement` (id: 21). Invalid offset, points outside the binary.
+ +0x3A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x3C | 60 00 | VOffset16 | 0x0060 (96) | ERROR: offset to field `anything` (id: 23). Invalid offset, points outside the binary.
+ +0x3E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x40 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x42 | 64 00 | VOffset16 | 0x0064 (100) | ERROR: offset to field `charlie` (id: 26). Invalid offset, points outside the binary.
+ +0x28 | 00 00 | VOffset16 | 0x0000 (0) | offset to unknown field (id: 13)
+ +0x2A | 00 00 | VOffset16 | 0x0000 (0) | offset to unknown field (id: 14)
+ +0x2C | 48 00 | VOffset16 | 0x0048 (72) | offset to unknown field (id: 15)
+ +0x2E | 4C 00 | VOffset16 | 0x004C (76) | offset to unknown field (id: 16)
+ +0x30 | 50 00 | VOffset16 | 0x0050 (80) | offset to unknown field (id: 17)
+ +0x32 | 54 00 | VOffset16 | 0x0054 (84) | offset to unknown field (id: 18)
+ +0x34 | 58 00 | VOffset16 | 0x0058 (88) | offset to unknown field (id: 19)
+ +0x36 | 0A 00 | VOffset16 | 0x000A (10) | offset to unknown field (id: 20)
+ +0x38 | 5C 00 | VOffset16 | 0x005C (92) | offset to unknown field (id: 21)
+ +0x3A | 0B 00 | VOffset16 | 0x000B (11) | offset to unknown field (id: 22)
+ +0x3C | 60 00 | VOffset16 | 0x0060 (96) | offset to unknown field (id: 23)
+ +0x3E | 00 00 | VOffset16 | 0x0000 (0) | offset to unknown field (id: 24)
+ +0x40 | 00 00 | VOffset16 | 0x0000 (0) | offset to unknown field (id: 25)
+ +0x42 | 64 00 | VOffset16 | 0x0064 (100) | offset to unknown field (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x44 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x0A | offset to vtable
+ +0x48 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x4B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x4C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x4D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x4E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x4F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x50 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x54 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x27C | ERROR: offset to field `bar`. Invalid offset, points outside the binary.
+ +0x58 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x5C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x60 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x64 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values`[0] (Int)
+ +0x68 | 0C 00 | ?uint8_t[2] | .. | ERROR: array field `AnnotatedBinary.Dimension.values`[1] (Int). Incomplete binary, expected to read 4 bytes.
diff --git a/tests/annotated_binary/tests/invalid_struct_array_field_cut_short.bin b/tests/annotated_binary/tests/invalid_struct_array_field_cut_short.bin
new file mode 100644
index 0000000..b701f73
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_struct_array_field_cut_short.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_struct_field_cut_short.afb b/tests/annotated_binary/tests/invalid_struct_field_cut_short.afb
new file mode 100644
index 0000000..59f646c
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_struct_field_cut_short.afb
@@ -0,0 +1,69 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_struct_field_cut_short.bin
+
+header:
+ +0x00 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x44 | offset to root table `AnnotatedBinary.Foo`
+ +0x04 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x08 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x0A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x0C | 68 00 | uint16_t | 0x0068 (104) | ERROR: size of referring table. Longer than the binary.
+ +0x0E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x10 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x12 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x14 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x16 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x18 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x1A | 30 00 | VOffset16 | 0x0030 (48) | ERROR: offset to field `name` (id: 6). Invalid offset, points outside the binary.
+ +0x1C | 34 00 | VOffset16 | 0x0034 (52) | ERROR: offset to field `bars` (id: 7). Invalid offset, points outside the binary.
+ +0x1E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x20 | 38 00 | VOffset16 | 0x0038 (56) | ERROR: offset to field `bar_baz` (id: 9). Invalid offset, points outside the binary.
+ +0x22 | 3C 00 | VOffset16 | 0x003C (60) | ERROR: offset to field `accounts` (id: 10). Invalid offset, points outside the binary.
+ +0x24 | 40 00 | VOffset16 | 0x0040 (64) | ERROR: offset to field `bob` (id: 11). Invalid offset, points outside the binary.
+ +0x26 | 44 00 | VOffset16 | 0x0044 (68) | ERROR: offset to field `alice` (id: 12). Invalid offset, points outside the binary.
+ +0x28 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x2A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x2C | 48 00 | VOffset16 | 0x0048 (72) | ERROR: offset to field `just_i32` (id: 15). Invalid offset, points outside the binary.
+ +0x2E | 4C 00 | VOffset16 | 0x004C (76) | ERROR: offset to field `names` (id: 16). Invalid offset, points outside the binary.
+ +0x30 | 50 00 | VOffset16 | 0x0050 (80) | ERROR: offset to field `points_of_interest` (id: 17). Invalid offset, points outside the binary.
+ +0x32 | 54 00 | VOffset16 | 0x0054 (84) | ERROR: offset to field `foobars_type` (id: 18). Invalid offset, points outside the binary.
+ +0x34 | 58 00 | VOffset16 | 0x0058 (88) | ERROR: offset to field `foobars` (id: 19). Invalid offset, points outside the binary.
+ +0x36 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x38 | 5C 00 | VOffset16 | 0x005C (92) | ERROR: offset to field `measurement` (id: 21). Invalid offset, points outside the binary.
+ +0x3A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x3C | 60 00 | VOffset16 | 0x0060 (96) | ERROR: offset to field `anything` (id: 23). Invalid offset, points outside the binary.
+ +0x3E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x40 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x42 | 64 00 | VOffset16 | 0x0064 (100) | ERROR: offset to field `charlie` (id: 26). Invalid offset, points outside the binary.
+ +0x28 | 00 00 | VOffset16 | 0x0000 (0) | offset to unknown field (id: 13)
+ +0x2A | 00 00 | VOffset16 | 0x0000 (0) | offset to unknown field (id: 14)
+ +0x2C | 48 00 | VOffset16 | 0x0048 (72) | offset to unknown field (id: 15)
+ +0x2E | 4C 00 | VOffset16 | 0x004C (76) | offset to unknown field (id: 16)
+ +0x30 | 50 00 | VOffset16 | 0x0050 (80) | offset to unknown field (id: 17)
+ +0x32 | 54 00 | VOffset16 | 0x0054 (84) | offset to unknown field (id: 18)
+ +0x34 | 58 00 | VOffset16 | 0x0058 (88) | offset to unknown field (id: 19)
+ +0x36 | 0A 00 | VOffset16 | 0x000A (10) | offset to unknown field (id: 20)
+ +0x38 | 5C 00 | VOffset16 | 0x005C (92) | offset to unknown field (id: 21)
+ +0x3A | 0B 00 | VOffset16 | 0x000B (11) | offset to unknown field (id: 22)
+ +0x3C | 60 00 | VOffset16 | 0x0060 (96) | offset to unknown field (id: 23)
+ +0x3E | 00 00 | VOffset16 | 0x0000 (0) | offset to unknown field (id: 24)
+ +0x40 | 00 00 | VOffset16 | 0x0000 (0) | offset to unknown field (id: 25)
+ +0x42 | 64 00 | VOffset16 | 0x0064 (100) | offset to unknown field (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x44 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x0A | offset to vtable
+ +0x48 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x4B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x4C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x4D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x4E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x4F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x50 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x54 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x27C | ERROR: offset to field `bar`. Invalid offset, points outside the binary.
+ +0x58 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x5C | 02 00 | ?uint8_t[2] | .. | ERROR: struct field `AnnotatedBinary.Building.doors` (Int). Incomplete binary, expected to read 4 bytes.
diff --git a/tests/annotated_binary/tests/invalid_struct_field_cut_short.bin b/tests/annotated_binary/tests/invalid_struct_field_cut_short.bin
new file mode 100644
index 0000000..537352d
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_struct_field_cut_short.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_table_field_offset.afb b/tests/annotated_binary/tests/invalid_table_field_offset.afb
new file mode 100644
index 0000000..4ccd3a7
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_table_field_offset.afb
@@ -0,0 +1,77 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_table_field_offset.bin
+
+header:
+ +0x00 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x44 | offset to root table `AnnotatedBinary.Foo`
+ +0x04 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x08 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x0A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x0C | 68 00 | uint16_t | 0x0068 (104) | ERROR: size of referring table. Longer than the binary.
+ +0x0E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x10 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x12 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x14 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x16 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x18 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x1A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `name` (id: 6)
+ +0x1C | 34 00 | VOffset16 | 0x0034 (52) | offset to field `bars` (id: 7)
+ +0x1E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x20 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `bar_baz` (id: 9)
+ +0x22 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `accounts` (id: 10)
+ +0x24 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `bob` (id: 11)
+ +0x26 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `alice` (id: 12)
+ +0x28 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x2A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x2C | 48 00 | VOffset16 | 0x0048 (72) | offset to field `just_i32` (id: 15)
+ +0x2E | 4C 00 | VOffset16 | 0x004C (76) | offset to field `names` (id: 16)
+ +0x30 | 50 00 | VOffset16 | 0x0050 (80) | offset to field `points_of_interest` (id: 17)
+ +0x32 | 54 00 | VOffset16 | 0x0054 (84) | ERROR: offset to field `foobars_type` (id: 18). Invalid offset, points outside the binary.
+ +0x34 | 58 00 | VOffset16 | 0x0058 (88) | ERROR: offset to field `foobars` (id: 19). Invalid offset, points outside the binary.
+ +0x36 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x38 | 5C 00 | VOffset16 | 0x005C (92) | ERROR: offset to field `measurement` (id: 21). Invalid offset, points outside the binary.
+ +0x3A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x3C | 60 00 | VOffset16 | 0x0060 (96) | ERROR: offset to field `anything` (id: 23). Invalid offset, points outside the binary.
+ +0x3E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x40 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x42 | 64 00 | VOffset16 | 0x0064 (100) | ERROR: offset to field `charlie` (id: 26). Invalid offset, points outside the binary.
+ +0x3A | 0B 00 | VOffset16 | 0x000B (11) | offset to unknown field (id: 22)
+ +0x3C | 60 00 | VOffset16 | 0x0060 (96) | offset to unknown field (id: 23)
+ +0x3E | 00 00 | VOffset16 | 0x0000 (0) | offset to unknown field (id: 24)
+ +0x40 | 00 00 | VOffset16 | 0x0000 (0) | offset to unknown field (id: 25)
+ +0x42 | 64 00 | VOffset16 | 0x0064 (100) | offset to unknown field (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x44 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x0A | offset to vtable
+ +0x48 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x4B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x4C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x4D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x4E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x4F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x50 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x54 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x27C | ERROR: offset to field `bar`. Invalid offset, points outside the binary.
+ +0x58 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x5C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x60 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x64 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values`[0] (Int)
+ +0x68 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | array field `AnnotatedBinary.Dimension.values`[1] (Int)
+ +0x6C | 14 00 00 00 | uint32_t | 0x00000014 (20) | array field `AnnotatedBinary.Dimension.values`[2] (Int)
+ +0x70 | 01 | uint8_t | 0x01 (1) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x71 | 02 | uint8_t | 0x02 (2) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x72 | 03 | uint8_t | 0x03 (3) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x73 | 00 | uint8_t[1] | . | padding
+ +0x74 | C8 01 00 00 | UOffset32 | 0x000001C8 (456) Loc: +0x23C | ERROR: offset to field `name`. Invalid offset, points outside the binary.
+ +0x78 | 5C 01 00 00 | UOffset32 | 0x0000015C (348) Loc: +0x1D4 | ERROR: offset to field `bars`. Invalid offset, points outside the binary.
+ +0x7C | 50 01 00 00 | UOffset32 | 0x00000150 (336) Loc: +0x1CC | ERROR: offset to field `bar_baz`. Invalid offset, points outside the binary.
+ +0x80 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x1B4 | ERROR: offset to field `accounts`. Invalid offset, points outside the binary.
+ +0x84 | 24 01 00 00 | UOffset32 | 0x00000124 (292) Loc: +0x1A8 | ERROR: offset to field `bob`. Invalid offset, points outside the binary.
+ +0x88 | 14 01 00 00 | UOffset32 | 0x00000114 (276) Loc: +0x19C | ERROR: offset to field `alice`. Invalid offset, points outside the binary.
+ +0x8C | 0D 00 00 00 | uint32_t | 0x0000000D (13) | table field `just_i32` (Int)
+ +0x90 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x16C | ERROR: offset to field `names`. Invalid offset, points outside the binary.
+ +0x94 | A0 00 | ?uint8_t[2] | .. | ERROR: offset to field `points_of_interest`. Incomplete binary, expected to read 4 bytes.
diff --git a/tests/annotated_binary/tests/invalid_table_field_offset.bin b/tests/annotated_binary/tests/invalid_table_field_offset.bin
new file mode 100644
index 0000000..f3a79ed
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_table_field_offset.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_table_field_size.afb b/tests/annotated_binary/tests/invalid_table_field_size.afb
new file mode 100644
index 0000000..f3ca3b9
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_table_field_size.afb
@@ -0,0 +1,68 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_table_field_size.bin
+
+header:
+ +0x00 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x44 | offset to root table `AnnotatedBinary.Foo`
+ +0x04 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x08 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x0A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x0C | 68 00 | uint16_t | 0x0068 (104) | ERROR: size of referring table. Longer than the binary.
+ +0x0E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x10 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x12 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x14 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x16 | 10 00 | VOffset16 | 0x0010 (16) | ERROR: offset to field `bar` (id: 4). Invalid offset, points outside the binary.
+ +0x18 | 14 00 | VOffset16 | 0x0014 (20) | ERROR: offset to field `home` (id: 5). Invalid offset, points outside the binary.
+ +0x1A | 30 00 | VOffset16 | 0x0030 (48) | ERROR: offset to field `name` (id: 6). Invalid offset, points outside the binary.
+ +0x1C | 34 00 | VOffset16 | 0x0034 (52) | ERROR: offset to field `bars` (id: 7). Invalid offset, points outside the binary.
+ +0x1E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x20 | 38 00 | VOffset16 | 0x0038 (56) | ERROR: offset to field `bar_baz` (id: 9). Invalid offset, points outside the binary.
+ +0x22 | 3C 00 | VOffset16 | 0x003C (60) | ERROR: offset to field `accounts` (id: 10). Invalid offset, points outside the binary.
+ +0x24 | 40 00 | VOffset16 | 0x0040 (64) | ERROR: offset to field `bob` (id: 11). Invalid offset, points outside the binary.
+ +0x26 | 44 00 | VOffset16 | 0x0044 (68) | ERROR: offset to field `alice` (id: 12). Invalid offset, points outside the binary.
+ +0x28 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x2A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x2C | 48 00 | VOffset16 | 0x0048 (72) | ERROR: offset to field `just_i32` (id: 15). Invalid offset, points outside the binary.
+ +0x2E | 4C 00 | VOffset16 | 0x004C (76) | ERROR: offset to field `names` (id: 16). Invalid offset, points outside the binary.
+ +0x30 | 50 00 | VOffset16 | 0x0050 (80) | ERROR: offset to field `points_of_interest` (id: 17). Invalid offset, points outside the binary.
+ +0x32 | 54 00 | VOffset16 | 0x0054 (84) | ERROR: offset to field `foobars_type` (id: 18). Invalid offset, points outside the binary.
+ +0x34 | 58 00 | VOffset16 | 0x0058 (88) | ERROR: offset to field `foobars` (id: 19). Invalid offset, points outside the binary.
+ +0x36 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x38 | 5C 00 | VOffset16 | 0x005C (92) | ERROR: offset to field `measurement` (id: 21). Invalid offset, points outside the binary.
+ +0x3A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x3C | 60 00 | VOffset16 | 0x0060 (96) | ERROR: offset to field `anything` (id: 23). Invalid offset, points outside the binary.
+ +0x3E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x40 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x42 | 64 00 | VOffset16 | 0x0064 (100) | ERROR: offset to field `charlie` (id: 26). Invalid offset, points outside the binary.
+ +0x24 | 40 00 | VOffset16 | 0x0040 (64) | offset to unknown field (id: 11)
+ +0x26 | 44 00 | VOffset16 | 0x0044 (68) | offset to unknown field (id: 12)
+ +0x28 | 00 00 | VOffset16 | 0x0000 (0) | offset to unknown field (id: 13)
+ +0x2A | 00 00 | VOffset16 | 0x0000 (0) | offset to unknown field (id: 14)
+ +0x2C | 48 00 | VOffset16 | 0x0048 (72) | offset to unknown field (id: 15)
+ +0x2E | 4C 00 | VOffset16 | 0x004C (76) | offset to unknown field (id: 16)
+ +0x30 | 50 00 | VOffset16 | 0x0050 (80) | offset to unknown field (id: 17)
+ +0x32 | 54 00 | VOffset16 | 0x0054 (84) | offset to unknown field (id: 18)
+ +0x34 | 58 00 | VOffset16 | 0x0058 (88) | offset to unknown field (id: 19)
+ +0x36 | 0A 00 | VOffset16 | 0x000A (10) | offset to unknown field (id: 20)
+ +0x38 | 5C 00 | VOffset16 | 0x005C (92) | offset to unknown field (id: 21)
+ +0x3A | 0B 00 | VOffset16 | 0x000B (11) | offset to unknown field (id: 22)
+ +0x3C | 60 00 | VOffset16 | 0x0060 (96) | offset to unknown field (id: 23)
+ +0x3E | 00 00 | VOffset16 | 0x0000 (0) | offset to unknown field (id: 24)
+ +0x40 | 00 00 | VOffset16 | 0x0000 (0) | offset to unknown field (id: 25)
+ +0x42 | 64 00 | VOffset16 | 0x0064 (100) | offset to unknown field (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x44 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x0A | offset to vtable
+ +0x48 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x4B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x4C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x4D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x4E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x4F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x50 | D2 04 | ?uint8_t[2] | .. | ERROR: table field `counter` (Int). Incomplete binary, expected to read 4 bytes.
diff --git a/tests/annotated_binary/tests/invalid_table_field_size.bin b/tests/annotated_binary/tests/invalid_table_field_size.bin
new file mode 100644
index 0000000..4fbbbdf
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_table_field_size.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_union_type_value.afb b/tests/annotated_binary/tests/invalid_union_type_value.afb
new file mode 100644
index 0000000..8e63852
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_union_type_value.afb
@@ -0,0 +1,293 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_union_type_value.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x0008 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x000A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x000C | 68 00 | uint16_t | 0x0068 (104) | size of referring table
+ +0x000E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x0010 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x0012 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x0014 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x0016 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x0018 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x001A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `name` (id: 6)
+ +0x001C | 34 00 | VOffset16 | 0x0034 (52) | offset to field `bars` (id: 7)
+ +0x001E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x0020 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `bar_baz` (id: 9)
+ +0x0022 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `accounts` (id: 10)
+ +0x0024 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `bob` (id: 11)
+ +0x0026 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `alice` (id: 12)
+ +0x0028 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x002A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x002C | 48 00 | VOffset16 | 0x0048 (72) | offset to field `just_i32` (id: 15)
+ +0x002E | 4C 00 | VOffset16 | 0x004C (76) | offset to field `names` (id: 16)
+ +0x0030 | 50 00 | VOffset16 | 0x0050 (80) | offset to field `points_of_interest` (id: 17)
+ +0x0032 | 54 00 | VOffset16 | 0x0054 (84) | offset to field `foobars_type` (id: 18)
+ +0x0034 | 58 00 | VOffset16 | 0x0058 (88) | offset to field `foobars` (id: 19)
+ +0x0036 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x0038 | 5C 00 | VOffset16 | 0x005C (92) | offset to field `measurement` (id: 21)
+ +0x003A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x003C | 60 00 | VOffset16 | 0x0060 (96) | offset to field `anything` (id: 23)
+ +0x003E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x0040 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x0042 | 64 00 | VOffset16 | 0x0064 (100) | offset to field `charlie` (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x0044 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x000A | offset to vtable
+ +0x0048 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x004B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x004C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x004D | FF | UType8 | 0xFF (255) | ERROR: table field `bar_baz_type` (UType). Invalid union type value.
+ +0x004E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x004F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x0050 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x0054 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x027C | offset to field `bar` (table)
+ +0x0058 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x005C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x0060 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x0064 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values`[0] (Int)
+ +0x0068 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | array field `AnnotatedBinary.Dimension.values`[1] (Int)
+ +0x006C | 14 00 00 00 | uint32_t | 0x00000014 (20) | array field `AnnotatedBinary.Dimension.values`[2] (Int)
+ +0x0070 | 01 | uint8_t | 0x01 (1) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0071 | 02 | uint8_t | 0x02 (2) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0072 | 03 | uint8_t | 0x03 (3) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0073 | 00 | uint8_t[1] | . | padding
+ +0x0074 | C8 01 00 00 | UOffset32 | 0x000001C8 (456) Loc: +0x023C | offset to field `name` (string)
+ +0x0078 | 5C 01 00 00 | UOffset32 | 0x0000015C (348) Loc: +0x01D4 | offset to field `bars` (vector)
+ +0x007C | 50 01 00 00 | ?uint8_t[4] | P... | WARN: nothing refers to this section.
+ +0x0080 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x01B4 | offset to field `accounts` (vector)
+ +0x0084 | 24 01 00 00 | UOffset32 | 0x00000124 (292) Loc: +0x01A8 | offset to field `bob` (string)
+ +0x0088 | 14 01 00 00 | UOffset32 | 0x00000114 (276) Loc: +0x019C | offset to field `alice` (string)
+ +0x008C | 0D 00 00 00 | uint32_t | 0x0000000D (13) | table field `just_i32` (Int)
+ +0x0090 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x016C | offset to field `names` (vector)
+ +0x0094 | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x0134 | offset to field `points_of_interest` (vector)
+ +0x0098 | 94 00 00 00 | UOffset32 | 0x00000094 (148) Loc: +0x012C | offset to field `foobars_type` (vector)
+ +0x009C | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x00D4 | offset to field `foobars` (vector)
+ +0x00A0 | 33 00 00 00 | UOffset32 | 0x00000033 (51) Loc: +0x00D3 | offset to field `measurement` (union of type `Tolerance`)
+ +0x00A4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x00C0 | offset to field `anything` (union of type `Bar`)
+ +0x00A8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00AC | offset to field `charlie` (string)
+
+string (AnnotatedBinary.Foo.charlie):
+ +0x00AC | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x00B0 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x00B5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x00B6 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x00B8 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+ +0x00BA | 13 00 | uint16_t | 0x0013 (19) | size of referring table
+ +0x00BC | 08 00 | VOffset16 | 0x0008 (8) | offset to field `a` (id: 0)
+ +0x00BE | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+
+table (AnnotatedBinary.Bar):
+ +0x00C0 | 08 00 00 00 | SOffset32 | 0x00000008 (8) Loc: +0x00B8 | offset to vtable
+ +0x00C4 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00C8 | 00 00 00 00 00 10 74 40 | double | 0x4074100000000000 (321) | table field `a` (Double)
+ +0x00D0 | 00 00 00 | uint8_t[3] | ... | padding
+
+union (AnnotatedBinary.Tolerance.measurement):
+ +0x00D3 | 05 | uint8_t | 0x05 (5) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+
+vector (AnnotatedBinary.Foo.foobars):
+ +0x00D4 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x00D8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x010C | offset to union[0] (`Bar`)
+ +0x00DC | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0108 | offset to union[1] (`Baz`)
+ +0x00E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00E4 | offset to union[2] (`Bar`)
+
+table (AnnotatedBinary.Bar):
+ +0x00E4 | D2 FE FF FF | SOffset32 | 0xFFFFFED2 (-302) Loc: +0x0212 | offset to vtable
+ +0x00E8 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00EC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x00FC | offset to field `c` (table)
+ +0x00F0 | 00 00 00 00 00 D8 8E 40 | double | 0x408ED80000000000 (987) | table field `a` (Double)
+ +0x00F8 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x00FC | 6A FE FF FF | SOffset32 | 0xFFFFFE6A (-406) Loc: +0x0292 | offset to vtable
+ +0x0100 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0103 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vtable (AnnotatedBinary.Baz):
+ +0x0104 | 04 00 | uint16_t | 0x0004 (4) | size of this vtable
+ +0x0106 | 04 00 | uint16_t | 0x0004 (4) | size of referring table
+
+table (AnnotatedBinary.Baz):
+ +0x0108 | 04 00 00 00 | SOffset32 | 0x00000004 (4) Loc: +0x0104 | offset to vtable
+
+table (AnnotatedBinary.Bar):
+ +0x010C | FA FE FF FF | SOffset32 | 0xFFFFFEFA (-262) Loc: +0x0212 | offset to vtable
+ +0x0110 | 00 00 E4 43 | float | 0x43E40000 (456) | table field `b` (Float)
+ +0x0114 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0124 | offset to field `c` (table)
+ +0x0118 | 00 00 00 00 00 C0 5E 40 | double | 0x405EC00000000000 (123) | table field `a` (Double)
+ +0x0120 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x0124 | 92 FE FF FF | SOffset32 | 0xFFFFFE92 (-366) Loc: +0x0292 | offset to vtable
+ +0x0128 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x012B | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
+
+vector (AnnotatedBinary.Foo.foobars_type):
+ +0x012C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0130 | 01 | UType8 | 0x01 (1) | value[0]
+ +0x0131 | 02 | UType8 | 0x02 (2) | value[1]
+ +0x0132 | 01 | UType8 | 0x01 (1) | value[2]
+
+vector (AnnotatedBinary.Foo.points_of_interest):
+ +0x0134 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0138 | 33 33 33 33 33 A3 45 40 | double | 0x4045A33333333333 (43.275) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0140 | 7E 57 04 FF 5B 87 53 C0 | double | 0xC053875BFF04577E (-78.115) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0148 | 8D F0 F6 20 04 B6 42 40 | double | 0x4042B60420F6F08D (37.422) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0150 | 9F 77 63 41 61 85 5E C0 | double | 0xC05E85614163779F (-122.084) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0158 | 8F 35 23 83 DC 35 4B C0 | double | 0xC04B35DC8323358F (-54.4208) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0160 | F6 97 DD 93 87 C5 0A 40 | double | 0x400AC58793DD97F6 (3.34645) | struct field `AnnotatedBinary.Location.longitude` (Double)
+
+padding:
+ +0x0168 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (AnnotatedBinary.Foo.names):
+ +0x016C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0170 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0190 | offset to string[0]
+ +0x0174 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0188 | offset to string[1]
+ +0x0178 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x017C | offset to string[2]
+
+string (AnnotatedBinary.Foo.names):
+ +0x017C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x0180 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x0187 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0188 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x018C | 62 6F 62 | char[3] | bob | string literal
+ +0x018F | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0190 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x0194 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x0199 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x019A | 00 00 | uint8_t[2] | .. | padding
+
+string (AnnotatedBinary.Foo.alice):
+ +0x019C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01A0 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01A7 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.bob):
+ +0x01A8 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01AC | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01B3 | 00 | char | 0x00 (0) | string terminator
+
+vector (AnnotatedBinary.Foo.accounts):
+ +0x01B4 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of vector (# items)
+ +0x01B8 | 09 00 | uint16_t | 0x0009 (9) | value[0]
+ +0x01BA | 08 00 | uint16_t | 0x0008 (8) | value[1]
+ +0x01BC | 07 00 | uint16_t | 0x0007 (7) | value[2]
+ +0x01BE | 01 00 | uint16_t | 0x0001 (1) | value[3]
+ +0x01C0 | 02 00 | uint16_t | 0x0002 (2) | value[4]
+ +0x01C2 | 03 00 | uint16_t | 0x0003 (3) | value[5]
+ +0x01C4 | 06 00 | uint16_t | 0x0006 (6) | value[6]
+ +0x01C6 | 05 00 | uint16_t | 0x0005 (5) | value[7]
+ +0x01C8 | 04 00 | uint16_t | 0x0004 (4) | value[8]
+
+unknown (no known references):
+ +0x01CA | 00 00 3A FF FF FF 00 00 | ?uint8_t[10] | ..:..... | WARN: nothing refers to this section.
+ +0x01D2 | 00 03 | | ..
+
+vector (AnnotatedBinary.Foo.bars):
+ +0x01D4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x01D8 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x021C | offset to table[0]
+ +0x01DC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x01EC | offset to table[1]
+
+padding:
+ +0x01E0 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x01E2 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x01E4 | 1A 00 | uint16_t | 0x001A (26) | size of referring table
+ +0x01E6 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x01E8 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x01EA | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x01EC | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x01E2 | offset to vtable
+ +0x01F0 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x01F4 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x020C | offset to field `c` (table)
+ +0x01F8 | 00 00 00 00 00 D8 8E 40 | double | 0x408ED80000000000 (987) | table field `a` (Double)
+ +0x0200 | 00 00 00 00 00 00 | uint8_t[6] | ...... | padding
+
+vtable (AnnotatedBinary.Baz):
+ +0x0206 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x0208 | 06 00 | uint16_t | 0x0006 (6) | size of referring table
+ +0x020A | 05 00 | VOffset16 | 0x0005 (5) | offset to field `meal` (id: 0)
+
+table (AnnotatedBinary.Baz):
+ +0x020C | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: +0x0206 | offset to vtable
+ +0x0210 | 00 | uint8_t[1] | . | padding
+ +0x0211 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vtable (AnnotatedBinary.Bar):
+ +0x0212 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x0214 | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x0216 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x0218 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x021A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x021C | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x0212 | offset to vtable
+ +0x0220 | 00 00 E4 43 | float | 0x43E40000 (456) | table field `b` (Float)
+ +0x0224 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0234 | offset to field `c` (table)
+ +0x0228 | 00 00 00 00 00 C0 5E 40 | double | 0x405EC00000000000 (123) | table field `a` (Double)
+ +0x0230 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x0234 | A2 FF FF FF | SOffset32 | 0xFFFFFFA2 (-94) Loc: +0x0292 | offset to vtable
+ +0x0238 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x023B | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
+
+string (AnnotatedBinary.Foo.name):
+ +0x023C | 2F 00 00 00 | uint32_t | 0x0000002F (47) | length of string
+ +0x0240 | 54 68 69 73 20 69 73 20 | char[47] | This is | string literal
+ +0x0248 | 61 20 6C 6F 6E 67 20 73 | | a long s
+ +0x0250 | 74 72 69 6E 67 20 74 6F | | tring to
+ +0x0258 | 20 73 68 6F 77 20 68 6F | | show ho
+ +0x0260 | 77 20 69 74 20 62 72 65 | | w it bre
+ +0x0268 | 61 6B 73 20 75 70 2E | | aks up.
+ +0x026F | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0270 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x0272 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x0274 | 16 00 | uint16_t | 0x0016 (22) | size of referring table
+ +0x0276 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x0278 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x027A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x027C | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x0272 | offset to vtable
+ +0x0280 | 65 20 71 49 | float | 0x49712065 (987654) | table field `b` (Float)
+ +0x0284 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0298 | offset to field `c` (table)
+ +0x0288 | C9 76 BE 9F 0C 24 FE 40 | double | 0x40FE240C9FBE76C9 (123457) | table field `a` (Double)
+ +0x0290 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Baz):
+ +0x0292 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x0294 | 08 00 | uint16_t | 0x0008 (8) | size of referring table
+ +0x0296 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `meal` (id: 0)
+
+table (AnnotatedBinary.Baz):
+ +0x0298 | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: +0x0292 | offset to vtable
+ +0x029C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x029F | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
diff --git a/tests/annotated_binary/tests/invalid_union_type_value.bin b/tests/annotated_binary/tests/invalid_union_type_value.bin
new file mode 100644
index 0000000..22f2dd5
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_union_type_value.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_vector_length_cut_short.afb b/tests/annotated_binary/tests/invalid_vector_length_cut_short.afb
new file mode 100644
index 0000000..7d11d2b
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vector_length_cut_short.afb
@@ -0,0 +1,140 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_vector_length_cut_short.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x0008 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x000A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x000C | 68 00 | uint16_t | 0x0068 (104) | size of referring table
+ +0x000E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x0010 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x0012 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x0014 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x0016 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x0018 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x001A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `name` (id: 6)
+ +0x001C | 34 00 | VOffset16 | 0x0034 (52) | offset to field `bars` (id: 7)
+ +0x001E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x0020 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `bar_baz` (id: 9)
+ +0x0022 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `accounts` (id: 10)
+ +0x0024 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `bob` (id: 11)
+ +0x0026 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `alice` (id: 12)
+ +0x0028 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x002A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x002C | 48 00 | VOffset16 | 0x0048 (72) | offset to field `just_i32` (id: 15)
+ +0x002E | 4C 00 | VOffset16 | 0x004C (76) | offset to field `names` (id: 16)
+ +0x0030 | 50 00 | VOffset16 | 0x0050 (80) | offset to field `points_of_interest` (id: 17)
+ +0x0032 | 54 00 | VOffset16 | 0x0054 (84) | offset to field `foobars_type` (id: 18)
+ +0x0034 | 58 00 | VOffset16 | 0x0058 (88) | offset to field `foobars` (id: 19)
+ +0x0036 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x0038 | 5C 00 | VOffset16 | 0x005C (92) | offset to field `measurement` (id: 21)
+ +0x003A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x003C | 60 00 | VOffset16 | 0x0060 (96) | offset to field `anything` (id: 23)
+ +0x003E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x0040 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x0042 | 64 00 | VOffset16 | 0x0064 (100) | offset to field `charlie` (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x0044 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x000A | offset to vtable
+ +0x0048 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x004B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x004C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x004D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x004E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x004F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x0050 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x0054 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x027C | ERROR: offset to field `bar`. Invalid offset, points outside the binary.
+ +0x0058 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x005C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x0060 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x0064 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values`[0] (Int)
+ +0x0068 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | array field `AnnotatedBinary.Dimension.values`[1] (Int)
+ +0x006C | 14 00 00 00 | uint32_t | 0x00000014 (20) | array field `AnnotatedBinary.Dimension.values`[2] (Int)
+ +0x0070 | 01 | uint8_t | 0x01 (1) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0071 | 02 | uint8_t | 0x02 (2) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0072 | 03 | uint8_t | 0x03 (3) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0073 | 00 | uint8_t[1] | . | padding
+ +0x0074 | C8 01 00 00 | UOffset32 | 0x000001C8 (456) Loc: +0x023C | ERROR: offset to field `name`. Invalid offset, points outside the binary.
+ +0x0078 | 5C 01 00 00 | UOffset32 | 0x0000015C (348) Loc: +0x01D4 | ERROR: offset to field `bars`. Invalid offset, points outside the binary.
+ +0x007C | 50 01 00 00 | UOffset32 | 0x00000150 (336) Loc: +0x01CC | ERROR: offset to field `bar_baz`. Invalid offset, points outside the binary.
+ +0x0080 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x01B4 | ERROR: offset to field `accounts`. Invalid offset, points outside the binary.
+ +0x0084 | 24 01 00 00 | UOffset32 | 0x00000124 (292) Loc: +0x01A8 | ERROR: offset to field `bob`. Invalid offset, points outside the binary.
+ +0x0088 | 14 01 00 00 | UOffset32 | 0x00000114 (276) Loc: +0x019C | ERROR: offset to field `alice`. Invalid offset, points outside the binary.
+ +0x008C | 0D 00 00 00 | uint32_t | 0x0000000D (13) | table field `just_i32` (Int)
+ +0x0090 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x016C | ERROR: offset to field `names`. Invalid offset, points outside the binary.
+ +0x0094 | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x0134 | offset to field `points_of_interest` (vector)
+ +0x0098 | 94 00 00 00 | UOffset32 | 0x00000094 (148) Loc: +0x012C | offset to field `foobars_type` (vector)
+ +0x009C | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x00D4 | offset to field `foobars` (vector)
+ +0x00A0 | 33 00 00 00 | UOffset32 | 0x00000033 (51) Loc: +0x00D3 | offset to field `measurement` (union of type `Tolerance`)
+ +0x00A4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x00C0 | offset to field `anything` (union of type `Bar`)
+ +0x00A8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00AC | offset to field `charlie` (string)
+
+string (AnnotatedBinary.Foo.charlie):
+ +0x00AC | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x00B0 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x00B5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x00B6 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x00B8 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+ +0x00BA | 13 00 | uint16_t | 0x0013 (19) | size of referring table
+ +0x00BC | 08 00 | VOffset16 | 0x0008 (8) | offset to field `a` (id: 0)
+ +0x00BE | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+
+table (AnnotatedBinary.Bar):
+ +0x00C0 | 08 00 00 00 | SOffset32 | 0x00000008 (8) Loc: +0x00B8 | offset to vtable
+ +0x00C4 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00C8 | 00 00 00 00 00 10 74 40 | double | 0x4074100000000000 (321) | table field `a` (Double)
+ +0x00D0 | 00 00 00 | uint8_t[3] | ... | padding
+
+union (AnnotatedBinary.Tolerance.measurement):
+ +0x00D3 | 05 | uint8_t | 0x05 (5) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+
+vector (AnnotatedBinary.Foo.foobars):
+ +0x00D4 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x00D8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x010C | offset to union[0] (`Bar`)
+ +0x00DC | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0108 | offset to union[1] (`Baz`)
+ +0x00E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00E4 | offset to union[2] (`Bar`)
+
+table (AnnotatedBinary.Bar):
+ +0x00E4 | D2 FE FF FF | SOffset32 | 0xFFFFFED2 (-302) Loc: +0x0212 | ERROR: offset to vtable. Invalid offset, points outside the binary.
+
+unknown (no known references):
+ +0x00E8 | 00 80 23 44 10 00 00 00 | ?uint8_t[28] | ..#D.... | WARN: nothing refers to this section.
+ +0x00F0 | 00 00 00 00 00 D8 8E 40 | | .......@
+ +0x00F8 | 00 00 00 00 6A FE FF FF | | ....j...
+ +0x0100 | 00 00 00 03 | | ....
+
+vtable (AnnotatedBinary.Baz):
+ +0x0104 | 04 00 | uint16_t | 0x0004 (4) | size of this vtable
+ +0x0106 | 04 00 | uint16_t | 0x0004 (4) | size of referring table
+
+table (AnnotatedBinary.Baz):
+ +0x0108 | 04 00 00 00 | SOffset32 | 0x00000004 (4) Loc: +0x0104 | offset to vtable
+
+table (AnnotatedBinary.Bar):
+ +0x010C | FA FE FF FF | SOffset32 | 0xFFFFFEFA (-262) Loc: +0x0212 | ERROR: offset to vtable. Invalid offset, points outside the binary.
+
+unknown (no known references):
+ +0x0110 | 00 00 E4 43 10 00 00 00 | ?uint8_t[28] | ...C.... | WARN: nothing refers to this section.
+ +0x0118 | 00 00 00 00 00 C0 5E 40 | | ......^@
+ +0x0120 | 00 00 00 00 92 FE FF FF | | ........
+ +0x0128 | 00 00 00 01 | | ....
+
+vector (AnnotatedBinary.Foo.foobars_type):
+ +0x012C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0130 | 01 | UType8 | 0x01 (1) | value[0]
+ +0x0131 | 02 | UType8 | 0x02 (2) | value[1]
+ +0x0132 | 01 | UType8 | 0x01 (1) | value[2]
+
+vector (AnnotatedBinary.Foo.points_of_interest):
+ +0x0134 | 03 00 | ?uint8_t[2] | .. | ERROR: length of vector (# items). Incomplete binary, expected to read 4 bytes.
diff --git a/tests/annotated_binary/tests/invalid_vector_length_cut_short.bin b/tests/annotated_binary/tests/invalid_vector_length_cut_short.bin
new file mode 100644
index 0000000..2d622da
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vector_length_cut_short.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_vector_scalars_cut_short.afb b/tests/annotated_binary/tests/invalid_vector_scalars_cut_short.afb
new file mode 100644
index 0000000..c61987a
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vector_scalars_cut_short.afb
@@ -0,0 +1,190 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_vector_scalars_cut_short.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x0008 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x000A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x000C | 68 00 | uint16_t | 0x0068 (104) | size of referring table
+ +0x000E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x0010 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x0012 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x0014 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x0016 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x0018 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x001A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `name` (id: 6)
+ +0x001C | 34 00 | VOffset16 | 0x0034 (52) | offset to field `bars` (id: 7)
+ +0x001E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x0020 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `bar_baz` (id: 9)
+ +0x0022 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `accounts` (id: 10)
+ +0x0024 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `bob` (id: 11)
+ +0x0026 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `alice` (id: 12)
+ +0x0028 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x002A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x002C | 48 00 | VOffset16 | 0x0048 (72) | offset to field `just_i32` (id: 15)
+ +0x002E | 4C 00 | VOffset16 | 0x004C (76) | offset to field `names` (id: 16)
+ +0x0030 | 50 00 | VOffset16 | 0x0050 (80) | offset to field `points_of_interest` (id: 17)
+ +0x0032 | 54 00 | VOffset16 | 0x0054 (84) | offset to field `foobars_type` (id: 18)
+ +0x0034 | 58 00 | VOffset16 | 0x0058 (88) | offset to field `foobars` (id: 19)
+ +0x0036 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x0038 | 5C 00 | VOffset16 | 0x005C (92) | offset to field `measurement` (id: 21)
+ +0x003A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x003C | 60 00 | VOffset16 | 0x0060 (96) | offset to field `anything` (id: 23)
+ +0x003E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x0040 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x0042 | 64 00 | VOffset16 | 0x0064 (100) | offset to field `charlie` (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x0044 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x000A | offset to vtable
+ +0x0048 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x004B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x004C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x004D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x004E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x004F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x0050 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x0054 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x027C | ERROR: offset to field `bar`. Invalid offset, points outside the binary.
+ +0x0058 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x005C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x0060 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x0064 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values`[0] (Int)
+ +0x0068 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | array field `AnnotatedBinary.Dimension.values`[1] (Int)
+ +0x006C | 14 00 00 00 | uint32_t | 0x00000014 (20) | array field `AnnotatedBinary.Dimension.values`[2] (Int)
+ +0x0070 | 01 | uint8_t | 0x01 (1) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0071 | 02 | uint8_t | 0x02 (2) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0072 | 03 | uint8_t | 0x03 (3) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0073 | 00 | uint8_t[1] | . | padding
+ +0x0074 | C8 01 00 00 | UOffset32 | 0x000001C8 (456) Loc: +0x023C | ERROR: offset to field `name`. Invalid offset, points outside the binary.
+ +0x0078 | 5C 01 00 00 | UOffset32 | 0x0000015C (348) Loc: +0x01D4 | ERROR: offset to field `bars`. Invalid offset, points outside the binary.
+ +0x007C | 50 01 00 00 | UOffset32 | 0x00000150 (336) Loc: +0x01CC | ERROR: offset to field `bar_baz`. Invalid offset, points outside the binary.
+ +0x0080 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x01B4 | offset to field `accounts` (vector)
+ +0x0084 | 24 01 00 00 | UOffset32 | 0x00000124 (292) Loc: +0x01A8 | offset to field `bob` (string)
+ +0x0088 | 14 01 00 00 | UOffset32 | 0x00000114 (276) Loc: +0x019C | offset to field `alice` (string)
+ +0x008C | 0D 00 00 00 | uint32_t | 0x0000000D (13) | table field `just_i32` (Int)
+ +0x0090 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x016C | offset to field `names` (vector)
+ +0x0094 | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x0134 | offset to field `points_of_interest` (vector)
+ +0x0098 | 94 00 00 00 | UOffset32 | 0x00000094 (148) Loc: +0x012C | offset to field `foobars_type` (vector)
+ +0x009C | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x00D4 | offset to field `foobars` (vector)
+ +0x00A0 | 33 00 00 00 | UOffset32 | 0x00000033 (51) Loc: +0x00D3 | offset to field `measurement` (union of type `Tolerance`)
+ +0x00A4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x00C0 | offset to field `anything` (union of type `Bar`)
+ +0x00A8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00AC | offset to field `charlie` (string)
+
+string (AnnotatedBinary.Foo.charlie):
+ +0x00AC | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x00B0 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x00B5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x00B6 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x00B8 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+ +0x00BA | 13 00 | uint16_t | 0x0013 (19) | size of referring table
+ +0x00BC | 08 00 | VOffset16 | 0x0008 (8) | offset to field `a` (id: 0)
+ +0x00BE | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+
+table (AnnotatedBinary.Bar):
+ +0x00C0 | 08 00 00 00 | SOffset32 | 0x00000008 (8) Loc: +0x00B8 | offset to vtable
+ +0x00C4 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00C8 | 00 00 00 00 00 10 74 40 | double | 0x4074100000000000 (321) | table field `a` (Double)
+ +0x00D0 | 00 00 00 | uint8_t[3] | ... | padding
+
+union (AnnotatedBinary.Tolerance.measurement):
+ +0x00D3 | 05 | uint8_t | 0x05 (5) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+
+vector (AnnotatedBinary.Foo.foobars):
+ +0x00D4 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x00D8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x010C | offset to union[0] (`Bar`)
+ +0x00DC | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0108 | offset to union[1] (`Baz`)
+ +0x00E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00E4 | offset to union[2] (`Bar`)
+
+table (AnnotatedBinary.Bar):
+ +0x00E4 | D2 FE FF FF | SOffset32 | 0xFFFFFED2 (-302) Loc: +0x0212 | ERROR: offset to vtable. Invalid offset, points outside the binary.
+
+unknown (no known references):
+ +0x00E8 | 00 80 23 44 10 00 00 00 | ?uint8_t[28] | ..#D.... | WARN: nothing refers to this section.
+ +0x00F0 | 00 00 00 00 00 D8 8E 40 | | .......@
+ +0x00F8 | 00 00 00 00 6A FE FF FF | | ....j...
+ +0x0100 | 00 00 00 03 | | ....
+
+vtable (AnnotatedBinary.Baz):
+ +0x0104 | 04 00 | uint16_t | 0x0004 (4) | size of this vtable
+ +0x0106 | 04 00 | uint16_t | 0x0004 (4) | size of referring table
+
+table (AnnotatedBinary.Baz):
+ +0x0108 | 04 00 00 00 | SOffset32 | 0x00000004 (4) Loc: +0x0104 | offset to vtable
+
+table (AnnotatedBinary.Bar):
+ +0x010C | FA FE FF FF | SOffset32 | 0xFFFFFEFA (-262) Loc: +0x0212 | ERROR: offset to vtable. Invalid offset, points outside the binary.
+
+unknown (no known references):
+ +0x0110 | 00 00 E4 43 10 00 00 00 | ?uint8_t[28] | ...C.... | WARN: nothing refers to this section.
+ +0x0118 | 00 00 00 00 00 C0 5E 40 | | ......^@
+ +0x0120 | 00 00 00 00 92 FE FF FF | | ........
+ +0x0128 | 00 00 00 01 | | ....
+
+vector (AnnotatedBinary.Foo.foobars_type):
+ +0x012C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0130 | 01 | UType8 | 0x01 (1) | value[0]
+ +0x0131 | 02 | UType8 | 0x02 (2) | value[1]
+ +0x0132 | 01 | UType8 | 0x01 (1) | value[2]
+
+vector (AnnotatedBinary.Foo.points_of_interest):
+ +0x0134 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0138 | 33 33 33 33 33 A3 45 40 | double | 0x4045A33333333333 (43.275) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0140 | 7E 57 04 FF 5B 87 53 C0 | double | 0xC053875BFF04577E (-78.115) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0148 | 8D F0 F6 20 04 B6 42 40 | double | 0x4042B60420F6F08D (37.422) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0150 | 9F 77 63 41 61 85 5E C0 | double | 0xC05E85614163779F (-122.084) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0158 | 8F 35 23 83 DC 35 4B C0 | double | 0xC04B35DC8323358F (-54.4208) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0160 | F6 97 DD 93 87 C5 0A 40 | double | 0x400AC58793DD97F6 (3.34645) | struct field `AnnotatedBinary.Location.longitude` (Double)
+
+padding:
+ +0x0168 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (AnnotatedBinary.Foo.names):
+ +0x016C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0170 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0190 | offset to string[0]
+ +0x0174 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0188 | offset to string[1]
+ +0x0178 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x017C | offset to string[2]
+
+string (AnnotatedBinary.Foo.names):
+ +0x017C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x0180 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x0187 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0188 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x018C | 62 6F 62 | char[3] | bob | string literal
+ +0x018F | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0190 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x0194 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x0199 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x019A | 00 00 | uint8_t[2] | .. | padding
+
+string (AnnotatedBinary.Foo.alice):
+ +0x019C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01A0 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01A7 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.bob):
+ +0x01A8 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01AC | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01B3 | 00 | char | 0x00 (0) | string terminator
+
+vector (AnnotatedBinary.Foo.accounts):
+ +0x01B4 | 09 00 00 00 | uint32_t | 0x00000009 (9) | ERROR: length of vector (# items). Longer than the binary.
+
+unknown (no known references):
+ +0x01B8 | 09 00 08 00 07 00 01 00 | ?uint8_t[9] | ........ | WARN: nothing refers to this section.
+ +0x01C0 | 02 | | .
diff --git a/tests/annotated_binary/tests/invalid_vector_scalars_cut_short.bin b/tests/annotated_binary/tests/invalid_vector_scalars_cut_short.bin
new file mode 100644
index 0000000..79dc796
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vector_scalars_cut_short.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_vector_strings_cut_short.afb b/tests/annotated_binary/tests/invalid_vector_strings_cut_short.afb
new file mode 100644
index 0000000..8f17f4e
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vector_strings_cut_short.afb
@@ -0,0 +1,155 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_vector_strings_cut_short.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x0008 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x000A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x000C | 68 00 | uint16_t | 0x0068 (104) | size of referring table
+ +0x000E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x0010 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x0012 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x0014 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x0016 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x0018 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x001A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `name` (id: 6)
+ +0x001C | 34 00 | VOffset16 | 0x0034 (52) | offset to field `bars` (id: 7)
+ +0x001E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x0020 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `bar_baz` (id: 9)
+ +0x0022 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `accounts` (id: 10)
+ +0x0024 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `bob` (id: 11)
+ +0x0026 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `alice` (id: 12)
+ +0x0028 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x002A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x002C | 48 00 | VOffset16 | 0x0048 (72) | offset to field `just_i32` (id: 15)
+ +0x002E | 4C 00 | VOffset16 | 0x004C (76) | offset to field `names` (id: 16)
+ +0x0030 | 50 00 | VOffset16 | 0x0050 (80) | offset to field `points_of_interest` (id: 17)
+ +0x0032 | 54 00 | VOffset16 | 0x0054 (84) | offset to field `foobars_type` (id: 18)
+ +0x0034 | 58 00 | VOffset16 | 0x0058 (88) | offset to field `foobars` (id: 19)
+ +0x0036 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x0038 | 5C 00 | VOffset16 | 0x005C (92) | offset to field `measurement` (id: 21)
+ +0x003A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x003C | 60 00 | VOffset16 | 0x0060 (96) | offset to field `anything` (id: 23)
+ +0x003E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x0040 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x0042 | 64 00 | VOffset16 | 0x0064 (100) | offset to field `charlie` (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x0044 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x000A | offset to vtable
+ +0x0048 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x004B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x004C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x004D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x004E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x004F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x0050 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x0054 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x027C | ERROR: offset to field `bar`. Invalid offset, points outside the binary.
+ +0x0058 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x005C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x0060 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x0064 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values`[0] (Int)
+ +0x0068 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | array field `AnnotatedBinary.Dimension.values`[1] (Int)
+ +0x006C | 14 00 00 00 | uint32_t | 0x00000014 (20) | array field `AnnotatedBinary.Dimension.values`[2] (Int)
+ +0x0070 | 01 | uint8_t | 0x01 (1) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0071 | 02 | uint8_t | 0x02 (2) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0072 | 03 | uint8_t | 0x03 (3) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0073 | 00 | uint8_t[1] | . | padding
+ +0x0074 | C8 01 00 00 | UOffset32 | 0x000001C8 (456) Loc: +0x023C | ERROR: offset to field `name`. Invalid offset, points outside the binary.
+ +0x0078 | 5C 01 00 00 | UOffset32 | 0x0000015C (348) Loc: +0x01D4 | ERROR: offset to field `bars`. Invalid offset, points outside the binary.
+ +0x007C | 50 01 00 00 | UOffset32 | 0x00000150 (336) Loc: +0x01CC | ERROR: offset to field `bar_baz`. Invalid offset, points outside the binary.
+ +0x0080 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x01B4 | ERROR: offset to field `accounts`. Invalid offset, points outside the binary.
+ +0x0084 | 24 01 00 00 | UOffset32 | 0x00000124 (292) Loc: +0x01A8 | ERROR: offset to field `bob`. Invalid offset, points outside the binary.
+ +0x0088 | 14 01 00 00 | UOffset32 | 0x00000114 (276) Loc: +0x019C | ERROR: offset to field `alice`. Invalid offset, points outside the binary.
+ +0x008C | 0D 00 00 00 | uint32_t | 0x0000000D (13) | table field `just_i32` (Int)
+ +0x0090 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x016C | offset to field `names` (vector)
+ +0x0094 | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x0134 | offset to field `points_of_interest` (vector)
+ +0x0098 | 94 00 00 00 | UOffset32 | 0x00000094 (148) Loc: +0x012C | offset to field `foobars_type` (vector)
+ +0x009C | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x00D4 | offset to field `foobars` (vector)
+ +0x00A0 | 33 00 00 00 | UOffset32 | 0x00000033 (51) Loc: +0x00D3 | offset to field `measurement` (union of type `Tolerance`)
+ +0x00A4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x00C0 | offset to field `anything` (union of type `Bar`)
+ +0x00A8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00AC | offset to field `charlie` (string)
+
+string (AnnotatedBinary.Foo.charlie):
+ +0x00AC | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x00B0 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x00B5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x00B6 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x00B8 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+ +0x00BA | 13 00 | uint16_t | 0x0013 (19) | size of referring table
+ +0x00BC | 08 00 | VOffset16 | 0x0008 (8) | offset to field `a` (id: 0)
+ +0x00BE | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+
+table (AnnotatedBinary.Bar):
+ +0x00C0 | 08 00 00 00 | SOffset32 | 0x00000008 (8) Loc: +0x00B8 | offset to vtable
+ +0x00C4 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00C8 | 00 00 00 00 00 10 74 40 | double | 0x4074100000000000 (321) | table field `a` (Double)
+ +0x00D0 | 00 00 00 | uint8_t[3] | ... | padding
+
+union (AnnotatedBinary.Tolerance.measurement):
+ +0x00D3 | 05 | uint8_t | 0x05 (5) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+
+vector (AnnotatedBinary.Foo.foobars):
+ +0x00D4 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x00D8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x010C | offset to union[0] (`Bar`)
+ +0x00DC | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0108 | offset to union[1] (`Baz`)
+ +0x00E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00E4 | offset to union[2] (`Bar`)
+
+table (AnnotatedBinary.Bar):
+ +0x00E4 | D2 FE FF FF | SOffset32 | 0xFFFFFED2 (-302) Loc: +0x0212 | ERROR: offset to vtable. Invalid offset, points outside the binary.
+
+unknown (no known references):
+ +0x00E8 | 00 80 23 44 10 00 00 00 | ?uint8_t[28] | ..#D.... | WARN: nothing refers to this section.
+ +0x00F0 | 00 00 00 00 00 D8 8E 40 | | .......@
+ +0x00F8 | 00 00 00 00 6A FE FF FF | | ....j...
+ +0x0100 | 00 00 00 03 | | ....
+
+vtable (AnnotatedBinary.Baz):
+ +0x0104 | 04 00 | uint16_t | 0x0004 (4) | size of this vtable
+ +0x0106 | 04 00 | uint16_t | 0x0004 (4) | size of referring table
+
+table (AnnotatedBinary.Baz):
+ +0x0108 | 04 00 00 00 | SOffset32 | 0x00000004 (4) Loc: +0x0104 | offset to vtable
+
+table (AnnotatedBinary.Bar):
+ +0x010C | FA FE FF FF | SOffset32 | 0xFFFFFEFA (-262) Loc: +0x0212 | ERROR: offset to vtable. Invalid offset, points outside the binary.
+
+unknown (no known references):
+ +0x0110 | 00 00 E4 43 10 00 00 00 | ?uint8_t[28] | ...C.... | WARN: nothing refers to this section.
+ +0x0118 | 00 00 00 00 00 C0 5E 40 | | ......^@
+ +0x0120 | 00 00 00 00 92 FE FF FF | | ........
+ +0x0128 | 00 00 00 01 | | ....
+
+vector (AnnotatedBinary.Foo.foobars_type):
+ +0x012C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0130 | 01 | UType8 | 0x01 (1) | value[0]
+ +0x0131 | 02 | UType8 | 0x02 (2) | value[1]
+ +0x0132 | 01 | UType8 | 0x01 (1) | value[2]
+
+vector (AnnotatedBinary.Foo.points_of_interest):
+ +0x0134 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0138 | 33 33 33 33 33 A3 45 40 | double | 0x4045A33333333333 (43.275) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0140 | 7E 57 04 FF 5B 87 53 C0 | double | 0xC053875BFF04577E (-78.115) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0148 | 8D F0 F6 20 04 B6 42 40 | double | 0x4042B60420F6F08D (37.422) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0150 | 9F 77 63 41 61 85 5E C0 | double | 0xC05E85614163779F (-122.084) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0158 | 8F 35 23 83 DC 35 4B C0 | double | 0xC04B35DC8323358F (-54.4208) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0160 | F6 97 DD 93 87 C5 0A 40 | double | 0x400AC58793DD97F6 (3.34645) | struct field `AnnotatedBinary.Location.longitude` (Double)
+
+padding:
+ +0x0168 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (AnnotatedBinary.Foo.names):
+ +0x016C | 03 00 00 00 | uint32_t | 0x00000003 (3) | ERROR: length of vector (# items). Longer than the binary.
+
+unknown (no known references):
+ +0x0170 | 20 00 00 00 14 00 | ?uint8_t[6] | ..... | WARN: could be corrupted padding region.
diff --git a/tests/annotated_binary/tests/invalid_vector_strings_cut_short.bin b/tests/annotated_binary/tests/invalid_vector_strings_cut_short.bin
new file mode 100644
index 0000000..434aba1
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vector_strings_cut_short.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_vector_structs_cut_short.afb b/tests/annotated_binary/tests/invalid_vector_structs_cut_short.afb
new file mode 100644
index 0000000..b62c4db
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vector_structs_cut_short.afb
@@ -0,0 +1,146 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_vector_structs_cut_short.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x0008 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x000A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x000C | 68 00 | uint16_t | 0x0068 (104) | size of referring table
+ +0x000E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x0010 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x0012 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x0014 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x0016 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x0018 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x001A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `name` (id: 6)
+ +0x001C | 34 00 | VOffset16 | 0x0034 (52) | offset to field `bars` (id: 7)
+ +0x001E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x0020 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `bar_baz` (id: 9)
+ +0x0022 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `accounts` (id: 10)
+ +0x0024 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `bob` (id: 11)
+ +0x0026 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `alice` (id: 12)
+ +0x0028 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x002A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x002C | 48 00 | VOffset16 | 0x0048 (72) | offset to field `just_i32` (id: 15)
+ +0x002E | 4C 00 | VOffset16 | 0x004C (76) | offset to field `names` (id: 16)
+ +0x0030 | 50 00 | VOffset16 | 0x0050 (80) | offset to field `points_of_interest` (id: 17)
+ +0x0032 | 54 00 | VOffset16 | 0x0054 (84) | offset to field `foobars_type` (id: 18)
+ +0x0034 | 58 00 | VOffset16 | 0x0058 (88) | offset to field `foobars` (id: 19)
+ +0x0036 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x0038 | 5C 00 | VOffset16 | 0x005C (92) | offset to field `measurement` (id: 21)
+ +0x003A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x003C | 60 00 | VOffset16 | 0x0060 (96) | offset to field `anything` (id: 23)
+ +0x003E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x0040 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x0042 | 64 00 | VOffset16 | 0x0064 (100) | offset to field `charlie` (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x0044 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x000A | offset to vtable
+ +0x0048 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x004B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x004C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x004D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x004E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x004F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x0050 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x0054 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x027C | ERROR: offset to field `bar`. Invalid offset, points outside the binary.
+ +0x0058 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x005C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x0060 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x0064 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values`[0] (Int)
+ +0x0068 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | array field `AnnotatedBinary.Dimension.values`[1] (Int)
+ +0x006C | 14 00 00 00 | uint32_t | 0x00000014 (20) | array field `AnnotatedBinary.Dimension.values`[2] (Int)
+ +0x0070 | 01 | uint8_t | 0x01 (1) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0071 | 02 | uint8_t | 0x02 (2) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0072 | 03 | uint8_t | 0x03 (3) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0073 | 00 | uint8_t[1] | . | padding
+ +0x0074 | C8 01 00 00 | UOffset32 | 0x000001C8 (456) Loc: +0x023C | ERROR: offset to field `name`. Invalid offset, points outside the binary.
+ +0x0078 | 5C 01 00 00 | UOffset32 | 0x0000015C (348) Loc: +0x01D4 | ERROR: offset to field `bars`. Invalid offset, points outside the binary.
+ +0x007C | 50 01 00 00 | UOffset32 | 0x00000150 (336) Loc: +0x01CC | ERROR: offset to field `bar_baz`. Invalid offset, points outside the binary.
+ +0x0080 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x01B4 | ERROR: offset to field `accounts`. Invalid offset, points outside the binary.
+ +0x0084 | 24 01 00 00 | UOffset32 | 0x00000124 (292) Loc: +0x01A8 | ERROR: offset to field `bob`. Invalid offset, points outside the binary.
+ +0x0088 | 14 01 00 00 | UOffset32 | 0x00000114 (276) Loc: +0x019C | ERROR: offset to field `alice`. Invalid offset, points outside the binary.
+ +0x008C | 0D 00 00 00 | uint32_t | 0x0000000D (13) | table field `just_i32` (Int)
+ +0x0090 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x016C | ERROR: offset to field `names`. Invalid offset, points outside the binary.
+ +0x0094 | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x0134 | offset to field `points_of_interest` (vector)
+ +0x0098 | 94 00 00 00 | UOffset32 | 0x00000094 (148) Loc: +0x012C | offset to field `foobars_type` (vector)
+ +0x009C | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x00D4 | offset to field `foobars` (vector)
+ +0x00A0 | 33 00 00 00 | UOffset32 | 0x00000033 (51) Loc: +0x00D3 | offset to field `measurement` (union of type `Tolerance`)
+ +0x00A4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x00C0 | offset to field `anything` (union of type `Bar`)
+ +0x00A8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00AC | offset to field `charlie` (string)
+
+string (AnnotatedBinary.Foo.charlie):
+ +0x00AC | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x00B0 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x00B5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x00B6 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x00B8 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+ +0x00BA | 13 00 | uint16_t | 0x0013 (19) | size of referring table
+ +0x00BC | 08 00 | VOffset16 | 0x0008 (8) | offset to field `a` (id: 0)
+ +0x00BE | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+
+table (AnnotatedBinary.Bar):
+ +0x00C0 | 08 00 00 00 | SOffset32 | 0x00000008 (8) Loc: +0x00B8 | offset to vtable
+ +0x00C4 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00C8 | 00 00 00 00 00 10 74 40 | double | 0x4074100000000000 (321) | table field `a` (Double)
+ +0x00D0 | 00 00 00 | uint8_t[3] | ... | padding
+
+union (AnnotatedBinary.Tolerance.measurement):
+ +0x00D3 | 05 | uint8_t | 0x05 (5) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+
+vector (AnnotatedBinary.Foo.foobars):
+ +0x00D4 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x00D8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x010C | offset to union[0] (`Bar`)
+ +0x00DC | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0108 | offset to union[1] (`Baz`)
+ +0x00E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00E4 | offset to union[2] (`Bar`)
+
+table (AnnotatedBinary.Bar):
+ +0x00E4 | D2 FE FF FF | SOffset32 | 0xFFFFFED2 (-302) Loc: +0x0212 | ERROR: offset to vtable. Invalid offset, points outside the binary.
+
+unknown (no known references):
+ +0x00E8 | 00 80 23 44 10 00 00 00 | ?uint8_t[28] | ..#D.... | WARN: nothing refers to this section.
+ +0x00F0 | 00 00 00 00 00 D8 8E 40 | | .......@
+ +0x00F8 | 00 00 00 00 6A FE FF FF | | ....j...
+ +0x0100 | 00 00 00 03 | | ....
+
+vtable (AnnotatedBinary.Baz):
+ +0x0104 | 04 00 | uint16_t | 0x0004 (4) | size of this vtable
+ +0x0106 | 04 00 | uint16_t | 0x0004 (4) | size of referring table
+
+table (AnnotatedBinary.Baz):
+ +0x0108 | 04 00 00 00 | SOffset32 | 0x00000004 (4) Loc: +0x0104 | offset to vtable
+
+table (AnnotatedBinary.Bar):
+ +0x010C | FA FE FF FF | SOffset32 | 0xFFFFFEFA (-262) Loc: +0x0212 | ERROR: offset to vtable. Invalid offset, points outside the binary.
+
+unknown (no known references):
+ +0x0110 | 00 00 E4 43 10 00 00 00 | ?uint8_t[28] | ...C.... | WARN: nothing refers to this section.
+ +0x0118 | 00 00 00 00 00 C0 5E 40 | | ......^@
+ +0x0120 | 00 00 00 00 92 FE FF FF | | ........
+ +0x0128 | 00 00 00 01 | | ....
+
+vector (AnnotatedBinary.Foo.foobars_type):
+ +0x012C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0130 | 01 | UType8 | 0x01 (1) | value[0]
+ +0x0131 | 02 | UType8 | 0x02 (2) | value[1]
+ +0x0132 | 01 | UType8 | 0x01 (1) | value[2]
+
+vector (AnnotatedBinary.Foo.points_of_interest):
+ +0x0134 | 03 00 00 00 | uint32_t | 0x00000003 (3) | ERROR: length of vector (# items). Longer than the binary.
+
+unknown (no known references):
+ +0x0138 | 33 33 33 33 33 A3 45 40 | ?uint8_t[28] | 33333.E@ | WARN: nothing refers to this section.
+ +0x0140 | 7E 57 04 FF 5B 87 53 C0 | | ~W..[.S.
+ +0x0148 | 8D F0 F6 20 04 B6 42 40 | | ... ..B@
+ +0x0150 | 9F 77 63 41 | | .wcA
diff --git a/tests/annotated_binary/tests/invalid_vector_structs_cut_short.bin b/tests/annotated_binary/tests/invalid_vector_structs_cut_short.bin
new file mode 100644
index 0000000..44da408
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vector_structs_cut_short.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_vector_tables_cut_short.afb b/tests/annotated_binary/tests/invalid_vector_tables_cut_short.afb
new file mode 100644
index 0000000..fa8b18f
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vector_tables_cut_short.afb
@@ -0,0 +1,210 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_vector_tables_cut_short.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x0008 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x000A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x000C | 68 00 | uint16_t | 0x0068 (104) | size of referring table
+ +0x000E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x0010 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x0012 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x0014 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x0016 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x0018 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x001A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `name` (id: 6)
+ +0x001C | 34 00 | VOffset16 | 0x0034 (52) | offset to field `bars` (id: 7)
+ +0x001E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x0020 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `bar_baz` (id: 9)
+ +0x0022 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `accounts` (id: 10)
+ +0x0024 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `bob` (id: 11)
+ +0x0026 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `alice` (id: 12)
+ +0x0028 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x002A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x002C | 48 00 | VOffset16 | 0x0048 (72) | offset to field `just_i32` (id: 15)
+ +0x002E | 4C 00 | VOffset16 | 0x004C (76) | offset to field `names` (id: 16)
+ +0x0030 | 50 00 | VOffset16 | 0x0050 (80) | offset to field `points_of_interest` (id: 17)
+ +0x0032 | 54 00 | VOffset16 | 0x0054 (84) | offset to field `foobars_type` (id: 18)
+ +0x0034 | 58 00 | VOffset16 | 0x0058 (88) | offset to field `foobars` (id: 19)
+ +0x0036 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x0038 | 5C 00 | VOffset16 | 0x005C (92) | offset to field `measurement` (id: 21)
+ +0x003A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x003C | 60 00 | VOffset16 | 0x0060 (96) | offset to field `anything` (id: 23)
+ +0x003E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x0040 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x0042 | 64 00 | VOffset16 | 0x0064 (100) | offset to field `charlie` (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x0044 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x000A | offset to vtable
+ +0x0048 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x004B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x004C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x004D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x004E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x004F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x0050 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x0054 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x027C | ERROR: offset to field `bar`. Invalid offset, points outside the binary.
+ +0x0058 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x005C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x0060 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x0064 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values`[0] (Int)
+ +0x0068 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | array field `AnnotatedBinary.Dimension.values`[1] (Int)
+ +0x006C | 14 00 00 00 | uint32_t | 0x00000014 (20) | array field `AnnotatedBinary.Dimension.values`[2] (Int)
+ +0x0070 | 01 | uint8_t | 0x01 (1) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0071 | 02 | uint8_t | 0x02 (2) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0072 | 03 | uint8_t | 0x03 (3) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0073 | 00 | uint8_t[1] | . | padding
+ +0x0074 | C8 01 00 00 | UOffset32 | 0x000001C8 (456) Loc: +0x023C | ERROR: offset to field `name`. Invalid offset, points outside the binary.
+ +0x0078 | 5C 01 00 00 | UOffset32 | 0x0000015C (348) Loc: +0x01D4 | offset to field `bars` (vector)
+ +0x007C | 50 01 00 00 | UOffset32 | 0x00000150 (336) Loc: +0x01CC | offset to field `bar_baz` (union of type `Baz`)
+ +0x0080 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x01B4 | offset to field `accounts` (vector)
+ +0x0084 | 24 01 00 00 | UOffset32 | 0x00000124 (292) Loc: +0x01A8 | offset to field `bob` (string)
+ +0x0088 | 14 01 00 00 | UOffset32 | 0x00000114 (276) Loc: +0x019C | offset to field `alice` (string)
+ +0x008C | 0D 00 00 00 | uint32_t | 0x0000000D (13) | table field `just_i32` (Int)
+ +0x0090 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x016C | offset to field `names` (vector)
+ +0x0094 | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x0134 | offset to field `points_of_interest` (vector)
+ +0x0098 | 94 00 00 00 | UOffset32 | 0x00000094 (148) Loc: +0x012C | offset to field `foobars_type` (vector)
+ +0x009C | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x00D4 | offset to field `foobars` (vector)
+ +0x00A0 | 33 00 00 00 | UOffset32 | 0x00000033 (51) Loc: +0x00D3 | offset to field `measurement` (union of type `Tolerance`)
+ +0x00A4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x00C0 | offset to field `anything` (union of type `Bar`)
+ +0x00A8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00AC | offset to field `charlie` (string)
+
+string (AnnotatedBinary.Foo.charlie):
+ +0x00AC | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x00B0 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x00B5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x00B6 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x00B8 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+ +0x00BA | 13 00 | uint16_t | 0x0013 (19) | size of referring table
+ +0x00BC | 08 00 | VOffset16 | 0x0008 (8) | offset to field `a` (id: 0)
+ +0x00BE | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+
+table (AnnotatedBinary.Bar):
+ +0x00C0 | 08 00 00 00 | SOffset32 | 0x00000008 (8) Loc: +0x00B8 | offset to vtable
+ +0x00C4 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00C8 | 00 00 00 00 00 10 74 40 | double | 0x4074100000000000 (321) | table field `a` (Double)
+ +0x00D0 | 00 00 00 | uint8_t[3] | ... | padding
+
+union (AnnotatedBinary.Tolerance.measurement):
+ +0x00D3 | 05 | uint8_t | 0x05 (5) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+
+vector (AnnotatedBinary.Foo.foobars):
+ +0x00D4 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x00D8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x010C | offset to union[0] (`Bar`)
+ +0x00DC | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0108 | offset to union[1] (`Baz`)
+ +0x00E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00E4 | offset to union[2] (`Bar`)
+
+table (AnnotatedBinary.Bar):
+ +0x00E4 | D2 FE FF FF | SOffset32 | 0xFFFFFED2 (-302) Loc: +0x0212 | ERROR: offset to vtable. Invalid offset, points outside the binary.
+
+unknown (no known references):
+ +0x00E8 | 00 80 23 44 10 00 00 00 | ?uint8_t[28] | ..#D.... | WARN: nothing refers to this section.
+ +0x00F0 | 00 00 00 00 00 D8 8E 40 | | .......@
+ +0x00F8 | 00 00 00 00 6A FE FF FF | | ....j...
+ +0x0100 | 00 00 00 03 | | ....
+
+vtable (AnnotatedBinary.Baz):
+ +0x0104 | 04 00 | uint16_t | 0x0004 (4) | size of this vtable
+ +0x0106 | 04 00 | uint16_t | 0x0004 (4) | size of referring table
+
+table (AnnotatedBinary.Baz):
+ +0x0108 | 04 00 00 00 | SOffset32 | 0x00000004 (4) Loc: +0x0104 | offset to vtable
+
+table (AnnotatedBinary.Bar):
+ +0x010C | FA FE FF FF | SOffset32 | 0xFFFFFEFA (-262) Loc: +0x0212 | ERROR: offset to vtable. Invalid offset, points outside the binary.
+
+unknown (no known references):
+ +0x0110 | 00 00 E4 43 10 00 00 00 | ?uint8_t[28] | ...C.... | WARN: nothing refers to this section.
+ +0x0118 | 00 00 00 00 00 C0 5E 40 | | ......^@
+ +0x0120 | 00 00 00 00 92 FE FF FF | | ........
+ +0x0128 | 00 00 00 01 | | ....
+
+vector (AnnotatedBinary.Foo.foobars_type):
+ +0x012C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0130 | 01 | UType8 | 0x01 (1) | value[0]
+ +0x0131 | 02 | UType8 | 0x02 (2) | value[1]
+ +0x0132 | 01 | UType8 | 0x01 (1) | value[2]
+
+vector (AnnotatedBinary.Foo.points_of_interest):
+ +0x0134 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0138 | 33 33 33 33 33 A3 45 40 | double | 0x4045A33333333333 (43.275) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0140 | 7E 57 04 FF 5B 87 53 C0 | double | 0xC053875BFF04577E (-78.115) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0148 | 8D F0 F6 20 04 B6 42 40 | double | 0x4042B60420F6F08D (37.422) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0150 | 9F 77 63 41 61 85 5E C0 | double | 0xC05E85614163779F (-122.084) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0158 | 8F 35 23 83 DC 35 4B C0 | double | 0xC04B35DC8323358F (-54.4208) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0160 | F6 97 DD 93 87 C5 0A 40 | double | 0x400AC58793DD97F6 (3.34645) | struct field `AnnotatedBinary.Location.longitude` (Double)
+
+padding:
+ +0x0168 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (AnnotatedBinary.Foo.names):
+ +0x016C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0170 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0190 | offset to string[0]
+ +0x0174 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0188 | offset to string[1]
+ +0x0178 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x017C | offset to string[2]
+
+string (AnnotatedBinary.Foo.names):
+ +0x017C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x0180 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x0187 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0188 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x018C | 62 6F 62 | char[3] | bob | string literal
+ +0x018F | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0190 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x0194 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x0199 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x019A | 00 00 | uint8_t[2] | .. | padding
+
+string (AnnotatedBinary.Foo.alice):
+ +0x019C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01A0 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01A7 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.bob):
+ +0x01A8 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01AC | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01B3 | 00 | char | 0x00 (0) | string terminator
+
+vector (AnnotatedBinary.Foo.accounts):
+ +0x01B4 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of vector (# items)
+ +0x01B8 | 09 00 | uint16_t | 0x0009 (9) | value[0]
+ +0x01BA | 08 00 | uint16_t | 0x0008 (8) | value[1]
+ +0x01BC | 07 00 | uint16_t | 0x0007 (7) | value[2]
+ +0x01BE | 01 00 | uint16_t | 0x0001 (1) | value[3]
+ +0x01C0 | 02 00 | uint16_t | 0x0002 (2) | value[4]
+ +0x01C2 | 03 00 | uint16_t | 0x0003 (3) | value[5]
+ +0x01C4 | 06 00 | uint16_t | 0x0006 (6) | value[6]
+ +0x01C6 | 05 00 | uint16_t | 0x0005 (5) | value[7]
+ +0x01C8 | 04 00 | uint16_t | 0x0004 (4) | value[8]
+
+padding:
+ +0x01CA | 00 00 | uint8_t[2] | .. | padding
+
+table (AnnotatedBinary.Baz):
+ +0x01CC | 3A FF FF FF | SOffset32 | 0xFFFFFF3A (-198) Loc: +0x0292 | ERROR: offset to vtable. Invalid offset, points outside the binary.
+
+unknown (no known references):
+ +0x01D0 | 00 00 00 03 | ?uint8_t[4] | .... | WARN: could be corrupted padding region.
+
+vector (AnnotatedBinary.Foo.bars):
+ +0x01D4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | ERROR: length of vector (# items). Longer than the binary.
+
+unknown (no known references):
+ +0x01D8 | 44 00 00 00 10 00 | ?uint8_t[6] | D..... | WARN: could be corrupted padding region.
diff --git a/tests/annotated_binary/tests/invalid_vector_tables_cut_short.bin b/tests/annotated_binary/tests/invalid_vector_tables_cut_short.bin
new file mode 100644
index 0000000..2823d83
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vector_tables_cut_short.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_vector_union_type_value.afb b/tests/annotated_binary/tests/invalid_vector_union_type_value.afb
new file mode 100644
index 0000000..ffa6728
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vector_union_type_value.afb
@@ -0,0 +1,293 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_vector_union_type_value.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x0008 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x000A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x000C | 68 00 | uint16_t | 0x0068 (104) | size of referring table
+ +0x000E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x0010 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x0012 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x0014 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x0016 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x0018 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x001A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `name` (id: 6)
+ +0x001C | 34 00 | VOffset16 | 0x0034 (52) | offset to field `bars` (id: 7)
+ +0x001E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x0020 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `bar_baz` (id: 9)
+ +0x0022 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `accounts` (id: 10)
+ +0x0024 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `bob` (id: 11)
+ +0x0026 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `alice` (id: 12)
+ +0x0028 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x002A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x002C | 48 00 | VOffset16 | 0x0048 (72) | offset to field `just_i32` (id: 15)
+ +0x002E | 4C 00 | VOffset16 | 0x004C (76) | offset to field `names` (id: 16)
+ +0x0030 | 50 00 | VOffset16 | 0x0050 (80) | offset to field `points_of_interest` (id: 17)
+ +0x0032 | 54 00 | VOffset16 | 0x0054 (84) | offset to field `foobars_type` (id: 18)
+ +0x0034 | 58 00 | VOffset16 | 0x0058 (88) | offset to field `foobars` (id: 19)
+ +0x0036 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x0038 | 5C 00 | VOffset16 | 0x005C (92) | offset to field `measurement` (id: 21)
+ +0x003A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x003C | 60 00 | VOffset16 | 0x0060 (96) | offset to field `anything` (id: 23)
+ +0x003E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x0040 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x0042 | 64 00 | VOffset16 | 0x0064 (100) | offset to field `charlie` (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x0044 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x000A | offset to vtable
+ +0x0048 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x004B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x004C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x004D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x004E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x004F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x0050 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x0054 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x027C | offset to field `bar` (table)
+ +0x0058 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x005C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x0060 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x0064 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values`[0] (Int)
+ +0x0068 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | array field `AnnotatedBinary.Dimension.values`[1] (Int)
+ +0x006C | 14 00 00 00 | uint32_t | 0x00000014 (20) | array field `AnnotatedBinary.Dimension.values`[2] (Int)
+ +0x0070 | 01 | uint8_t | 0x01 (1) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0071 | 02 | uint8_t | 0x02 (2) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0072 | 03 | uint8_t | 0x03 (3) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0073 | 00 | uint8_t[1] | . | padding
+ +0x0074 | C8 01 00 00 | UOffset32 | 0x000001C8 (456) Loc: +0x023C | offset to field `name` (string)
+ +0x0078 | 5C 01 00 00 | UOffset32 | 0x0000015C (348) Loc: +0x01D4 | offset to field `bars` (vector)
+ +0x007C | 50 01 00 00 | UOffset32 | 0x00000150 (336) Loc: +0x01CC | offset to field `bar_baz` (union of type `Baz`)
+ +0x0080 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x01B4 | offset to field `accounts` (vector)
+ +0x0084 | 24 01 00 00 | UOffset32 | 0x00000124 (292) Loc: +0x01A8 | offset to field `bob` (string)
+ +0x0088 | 14 01 00 00 | UOffset32 | 0x00000114 (276) Loc: +0x019C | offset to field `alice` (string)
+ +0x008C | 0D 00 00 00 | uint32_t | 0x0000000D (13) | table field `just_i32` (Int)
+ +0x0090 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x016C | offset to field `names` (vector)
+ +0x0094 | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x0134 | offset to field `points_of_interest` (vector)
+ +0x0098 | 94 00 00 00 | UOffset32 | 0x00000094 (148) Loc: +0x012C | offset to field `foobars_type` (vector)
+ +0x009C | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x00D4 | offset to field `foobars` (vector)
+ +0x00A0 | 33 00 00 00 | UOffset32 | 0x00000033 (51) Loc: +0x00D3 | offset to field `measurement` (union of type `Tolerance`)
+ +0x00A4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x00C0 | offset to field `anything` (union of type `Bar`)
+ +0x00A8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00AC | offset to field `charlie` (string)
+
+string (AnnotatedBinary.Foo.charlie):
+ +0x00AC | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x00B0 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x00B5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x00B6 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x00B8 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+ +0x00BA | 13 00 | uint16_t | 0x0013 (19) | size of referring table
+ +0x00BC | 08 00 | VOffset16 | 0x0008 (8) | offset to field `a` (id: 0)
+ +0x00BE | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+
+table (AnnotatedBinary.Bar):
+ +0x00C0 | 08 00 00 00 | SOffset32 | 0x00000008 (8) Loc: +0x00B8 | offset to vtable
+ +0x00C4 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00C8 | 00 00 00 00 00 10 74 40 | double | 0x4074100000000000 (321) | table field `a` (Double)
+ +0x00D0 | 00 00 00 | uint8_t[3] | ... | padding
+
+union (AnnotatedBinary.Tolerance.measurement):
+ +0x00D3 | 05 | uint8_t | 0x05 (5) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+
+vector (AnnotatedBinary.Foo.foobars):
+ +0x00D4 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x00D8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x010C | offset to union[0] (`Bar`)
+ +0x00DC | 2C 00 00 00 | ?uint8_t[4] | ,... | WARN: nothing refers to this section.
+ +0x00E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00E4 | offset to union[2] (`Bar`)
+
+table (AnnotatedBinary.Bar):
+ +0x00E4 | D2 FE FF FF | SOffset32 | 0xFFFFFED2 (-302) Loc: +0x0212 | offset to vtable
+ +0x00E8 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00EC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x00FC | offset to field `c` (table)
+ +0x00F0 | 00 00 00 00 00 D8 8E 40 | double | 0x408ED80000000000 (987) | table field `a` (Double)
+ +0x00F8 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x00FC | 6A FE FF FF | SOffset32 | 0xFFFFFE6A (-406) Loc: +0x0292 | offset to vtable
+ +0x0100 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0103 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+unknown (no known references):
+ +0x0104 | 04 00 04 00 04 00 00 00 | ?uint8_t[8] | ........ | WARN: nothing refers to this section.
+
+table (AnnotatedBinary.Bar):
+ +0x010C | FA FE FF FF | SOffset32 | 0xFFFFFEFA (-262) Loc: +0x0212 | offset to vtable
+ +0x0110 | 00 00 E4 43 | float | 0x43E40000 (456) | table field `b` (Float)
+ +0x0114 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0124 | offset to field `c` (table)
+ +0x0118 | 00 00 00 00 00 C0 5E 40 | double | 0x405EC00000000000 (123) | table field `a` (Double)
+ +0x0120 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x0124 | 92 FE FF FF | SOffset32 | 0xFFFFFE92 (-366) Loc: +0x0292 | offset to vtable
+ +0x0128 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x012B | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
+
+vector (AnnotatedBinary.Foo.foobars_type):
+ +0x012C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0130 | 01 | UType8 | 0x01 (1) | value[0]
+ +0x0131 | FF | UType8 | 0xFF (255) | ERROR: value[1]. Invalid union type value.
+ +0x0132 | 01 | UType8 | 0x01 (1) | value[2]
+
+vector (AnnotatedBinary.Foo.points_of_interest):
+ +0x0134 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0138 | 33 33 33 33 33 A3 45 40 | double | 0x4045A33333333333 (43.275) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0140 | 7E 57 04 FF 5B 87 53 C0 | double | 0xC053875BFF04577E (-78.115) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0148 | 8D F0 F6 20 04 B6 42 40 | double | 0x4042B60420F6F08D (37.422) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0150 | 9F 77 63 41 61 85 5E C0 | double | 0xC05E85614163779F (-122.084) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0158 | 8F 35 23 83 DC 35 4B C0 | double | 0xC04B35DC8323358F (-54.4208) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0160 | F6 97 DD 93 87 C5 0A 40 | double | 0x400AC58793DD97F6 (3.34645) | struct field `AnnotatedBinary.Location.longitude` (Double)
+
+padding:
+ +0x0168 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (AnnotatedBinary.Foo.names):
+ +0x016C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0170 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0190 | offset to string[0]
+ +0x0174 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0188 | offset to string[1]
+ +0x0178 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x017C | offset to string[2]
+
+string (AnnotatedBinary.Foo.names):
+ +0x017C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x0180 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x0187 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0188 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x018C | 62 6F 62 | char[3] | bob | string literal
+ +0x018F | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0190 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x0194 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x0199 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x019A | 00 00 | uint8_t[2] | .. | padding
+
+string (AnnotatedBinary.Foo.alice):
+ +0x019C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01A0 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01A7 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.bob):
+ +0x01A8 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01AC | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01B3 | 00 | char | 0x00 (0) | string terminator
+
+vector (AnnotatedBinary.Foo.accounts):
+ +0x01B4 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of vector (# items)
+ +0x01B8 | 09 00 | uint16_t | 0x0009 (9) | value[0]
+ +0x01BA | 08 00 | uint16_t | 0x0008 (8) | value[1]
+ +0x01BC | 07 00 | uint16_t | 0x0007 (7) | value[2]
+ +0x01BE | 01 00 | uint16_t | 0x0001 (1) | value[3]
+ +0x01C0 | 02 00 | uint16_t | 0x0002 (2) | value[4]
+ +0x01C2 | 03 00 | uint16_t | 0x0003 (3) | value[5]
+ +0x01C4 | 06 00 | uint16_t | 0x0006 (6) | value[6]
+ +0x01C6 | 05 00 | uint16_t | 0x0005 (5) | value[7]
+ +0x01C8 | 04 00 | uint16_t | 0x0004 (4) | value[8]
+
+padding:
+ +0x01CA | 00 00 | uint8_t[2] | .. | padding
+
+table (AnnotatedBinary.Baz):
+ +0x01CC | 3A FF FF FF | SOffset32 | 0xFFFFFF3A (-198) Loc: +0x0292 | offset to vtable
+ +0x01D0 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x01D3 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vector (AnnotatedBinary.Foo.bars):
+ +0x01D4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x01D8 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x021C | offset to table[0]
+ +0x01DC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x01EC | offset to table[1]
+
+padding:
+ +0x01E0 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x01E2 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x01E4 | 1A 00 | uint16_t | 0x001A (26) | size of referring table
+ +0x01E6 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x01E8 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x01EA | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x01EC | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x01E2 | offset to vtable
+ +0x01F0 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x01F4 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x020C | offset to field `c` (table)
+ +0x01F8 | 00 00 00 00 00 D8 8E 40 | double | 0x408ED80000000000 (987) | table field `a` (Double)
+ +0x0200 | 00 00 00 00 00 00 | uint8_t[6] | ...... | padding
+
+vtable (AnnotatedBinary.Baz):
+ +0x0206 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x0208 | 06 00 | uint16_t | 0x0006 (6) | size of referring table
+ +0x020A | 05 00 | VOffset16 | 0x0005 (5) | offset to field `meal` (id: 0)
+
+table (AnnotatedBinary.Baz):
+ +0x020C | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: +0x0206 | offset to vtable
+ +0x0210 | 00 | uint8_t[1] | . | padding
+ +0x0211 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vtable (AnnotatedBinary.Bar):
+ +0x0212 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x0214 | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x0216 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x0218 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x021A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x021C | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x0212 | offset to vtable
+ +0x0220 | 00 00 E4 43 | float | 0x43E40000 (456) | table field `b` (Float)
+ +0x0224 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0234 | offset to field `c` (table)
+ +0x0228 | 00 00 00 00 00 C0 5E 40 | double | 0x405EC00000000000 (123) | table field `a` (Double)
+ +0x0230 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x0234 | A2 FF FF FF | SOffset32 | 0xFFFFFFA2 (-94) Loc: +0x0292 | offset to vtable
+ +0x0238 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x023B | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
+
+string (AnnotatedBinary.Foo.name):
+ +0x023C | 2F 00 00 00 | uint32_t | 0x0000002F (47) | length of string
+ +0x0240 | 54 68 69 73 20 69 73 20 | char[47] | This is | string literal
+ +0x0248 | 61 20 6C 6F 6E 67 20 73 | | a long s
+ +0x0250 | 74 72 69 6E 67 20 74 6F | | tring to
+ +0x0258 | 20 73 68 6F 77 20 68 6F | | show ho
+ +0x0260 | 77 20 69 74 20 62 72 65 | | w it bre
+ +0x0268 | 61 6B 73 20 75 70 2E | | aks up.
+ +0x026F | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0270 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x0272 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x0274 | 16 00 | uint16_t | 0x0016 (22) | size of referring table
+ +0x0276 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x0278 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x027A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x027C | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x0272 | offset to vtable
+ +0x0280 | 65 20 71 49 | float | 0x49712065 (987654) | table field `b` (Float)
+ +0x0284 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0298 | offset to field `c` (table)
+ +0x0288 | C9 76 BE 9F 0C 24 FE 40 | double | 0x40FE240C9FBE76C9 (123457) | table field `a` (Double)
+ +0x0290 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Baz):
+ +0x0292 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x0294 | 08 00 | uint16_t | 0x0008 (8) | size of referring table
+ +0x0296 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `meal` (id: 0)
+
+table (AnnotatedBinary.Baz):
+ +0x0298 | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: +0x0292 | offset to vtable
+ +0x029C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x029F | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
diff --git a/tests/annotated_binary/tests/invalid_vector_union_type_value.bin b/tests/annotated_binary/tests/invalid_vector_union_type_value.bin
new file mode 100644
index 0000000..8725971
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vector_union_type_value.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_vector_unions_cut_short.afb b/tests/annotated_binary/tests/invalid_vector_unions_cut_short.afb
new file mode 100644
index 0000000..7267c76
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vector_unions_cut_short.afb
@@ -0,0 +1,210 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_vector_unions_cut_short.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x0008 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x000A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x000C | 68 00 | uint16_t | 0x0068 (104) | size of referring table
+ +0x000E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x0010 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x0012 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x0014 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x0016 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x0018 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x001A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `name` (id: 6)
+ +0x001C | 34 00 | VOffset16 | 0x0034 (52) | offset to field `bars` (id: 7)
+ +0x001E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x0020 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `bar_baz` (id: 9)
+ +0x0022 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `accounts` (id: 10)
+ +0x0024 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `bob` (id: 11)
+ +0x0026 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `alice` (id: 12)
+ +0x0028 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x002A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x002C | 48 00 | VOffset16 | 0x0048 (72) | offset to field `just_i32` (id: 15)
+ +0x002E | 4C 00 | VOffset16 | 0x004C (76) | offset to field `names` (id: 16)
+ +0x0030 | 50 00 | VOffset16 | 0x0050 (80) | offset to field `points_of_interest` (id: 17)
+ +0x0032 | 54 00 | VOffset16 | 0x0054 (84) | offset to field `foobars_type` (id: 18)
+ +0x0034 | 58 00 | VOffset16 | 0x0058 (88) | offset to field `foobars` (id: 19)
+ +0x0036 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x0038 | 5C 00 | VOffset16 | 0x005C (92) | offset to field `measurement` (id: 21)
+ +0x003A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x003C | 60 00 | VOffset16 | 0x0060 (96) | offset to field `anything` (id: 23)
+ +0x003E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x0040 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x0042 | 64 00 | VOffset16 | 0x0064 (100) | offset to field `charlie` (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x0044 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x000A | offset to vtable
+ +0x0048 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x004B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x004C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x004D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x004E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x004F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x0050 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x0054 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x027C | ERROR: offset to field `bar`. Invalid offset, points outside the binary.
+ +0x0058 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x005C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x0060 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x0064 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values`[0] (Int)
+ +0x0068 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | array field `AnnotatedBinary.Dimension.values`[1] (Int)
+ +0x006C | 14 00 00 00 | uint32_t | 0x00000014 (20) | array field `AnnotatedBinary.Dimension.values`[2] (Int)
+ +0x0070 | 01 | uint8_t | 0x01 (1) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0071 | 02 | uint8_t | 0x02 (2) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0072 | 03 | uint8_t | 0x03 (3) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0073 | 00 | uint8_t[1] | . | padding
+ +0x0074 | C8 01 00 00 | UOffset32 | 0x000001C8 (456) Loc: +0x023C | ERROR: offset to field `name`. Invalid offset, points outside the binary.
+ +0x0078 | 5C 01 00 00 | UOffset32 | 0x0000015C (348) Loc: +0x01D4 | offset to field `bars` (vector)
+ +0x007C | 50 01 00 00 | UOffset32 | 0x00000150 (336) Loc: +0x01CC | offset to field `bar_baz` (union of type `Baz`)
+ +0x0080 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x01B4 | offset to field `accounts` (vector)
+ +0x0084 | 24 01 00 00 | UOffset32 | 0x00000124 (292) Loc: +0x01A8 | offset to field `bob` (string)
+ +0x0088 | 14 01 00 00 | UOffset32 | 0x00000114 (276) Loc: +0x019C | offset to field `alice` (string)
+ +0x008C | 0D 00 00 00 | uint32_t | 0x0000000D (13) | table field `just_i32` (Int)
+ +0x0090 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x016C | offset to field `names` (vector)
+ +0x0094 | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x0134 | offset to field `points_of_interest` (vector)
+ +0x0098 | 94 00 00 00 | UOffset32 | 0x00000094 (148) Loc: +0x012C | offset to field `foobars_type` (vector)
+ +0x009C | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x00D4 | offset to field `foobars` (vector)
+ +0x00A0 | 33 00 00 00 | UOffset32 | 0x00000033 (51) Loc: +0x00D3 | offset to field `measurement` (union of type `Tolerance`)
+ +0x00A4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x00C0 | offset to field `anything` (union of type `Bar`)
+ +0x00A8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00AC | offset to field `charlie` (string)
+
+string (AnnotatedBinary.Foo.charlie):
+ +0x00AC | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x00B0 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x00B5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x00B6 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x00B8 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+ +0x00BA | 13 00 | uint16_t | 0x0013 (19) | size of referring table
+ +0x00BC | 08 00 | VOffset16 | 0x0008 (8) | offset to field `a` (id: 0)
+ +0x00BE | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+
+table (AnnotatedBinary.Bar):
+ +0x00C0 | 08 00 00 00 | SOffset32 | 0x00000008 (8) Loc: +0x00B8 | offset to vtable
+ +0x00C4 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00C8 | 00 00 00 00 00 10 74 40 | double | 0x4074100000000000 (321) | table field `a` (Double)
+ +0x00D0 | 00 00 00 | uint8_t[3] | ... | padding
+
+union (AnnotatedBinary.Tolerance.measurement):
+ +0x00D3 | 05 | uint8_t | 0x05 (5) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+
+vector (AnnotatedBinary.Foo.foobars):
+ +0x00D4 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x00D8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x010C | offset to union[0] (`Bar`)
+ +0x00DC | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0108 | offset to union[1] (`Baz`)
+ +0x00E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00E4 | offset to union[2] (`Bar`)
+
+table (AnnotatedBinary.Bar):
+ +0x00E4 | D2 FE FF FF | SOffset32 | 0xFFFFFED2 (-302) Loc: +0x0212 | ERROR: offset to vtable. Invalid offset, points outside the binary.
+
+unknown (no known references):
+ +0x00E8 | 00 80 23 44 10 00 00 00 | ?uint8_t[28] | ..#D.... | WARN: nothing refers to this section.
+ +0x00F0 | 00 00 00 00 00 D8 8E 40 | | .......@
+ +0x00F8 | 00 00 00 00 6A FE FF FF | | ....j...
+ +0x0100 | 00 00 00 03 | | ....
+
+vtable (AnnotatedBinary.Baz):
+ +0x0104 | 04 00 | uint16_t | 0x0004 (4) | size of this vtable
+ +0x0106 | 04 00 | uint16_t | 0x0004 (4) | size of referring table
+
+table (AnnotatedBinary.Baz):
+ +0x0108 | 04 00 00 00 | SOffset32 | 0x00000004 (4) Loc: +0x0104 | offset to vtable
+
+table (AnnotatedBinary.Bar):
+ +0x010C | FA FE FF FF | SOffset32 | 0xFFFFFEFA (-262) Loc: +0x0212 | ERROR: offset to vtable. Invalid offset, points outside the binary.
+
+unknown (no known references):
+ +0x0110 | 00 00 E4 43 10 00 00 00 | ?uint8_t[28] | ...C.... | WARN: nothing refers to this section.
+ +0x0118 | 00 00 00 00 00 C0 5E 40 | | ......^@
+ +0x0120 | 00 00 00 00 92 FE FF FF | | ........
+ +0x0128 | 00 00 00 01 | | ....
+
+vector (AnnotatedBinary.Foo.foobars_type):
+ +0x012C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0130 | 01 | UType8 | 0x01 (1) | value[0]
+ +0x0131 | 02 | UType8 | 0x02 (2) | value[1]
+ +0x0132 | 01 | UType8 | 0x01 (1) | value[2]
+
+vector (AnnotatedBinary.Foo.points_of_interest):
+ +0x0134 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0138 | 33 33 33 33 33 A3 45 40 | double | 0x4045A33333333333 (43.275) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0140 | 7E 57 04 FF 5B 87 53 C0 | double | 0xC053875BFF04577E (-78.115) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0148 | 8D F0 F6 20 04 B6 42 40 | double | 0x4042B60420F6F08D (37.422) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0150 | 9F 77 63 41 61 85 5E C0 | double | 0xC05E85614163779F (-122.084) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0158 | 8F 35 23 83 DC 35 4B C0 | double | 0xC04B35DC8323358F (-54.4208) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0160 | F6 97 DD 93 87 C5 0A 40 | double | 0x400AC58793DD97F6 (3.34645) | struct field `AnnotatedBinary.Location.longitude` (Double)
+
+padding:
+ +0x0168 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (AnnotatedBinary.Foo.names):
+ +0x016C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0170 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0190 | offset to string[0]
+ +0x0174 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0188 | offset to string[1]
+ +0x0178 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x017C | offset to string[2]
+
+string (AnnotatedBinary.Foo.names):
+ +0x017C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x0180 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x0187 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0188 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x018C | 62 6F 62 | char[3] | bob | string literal
+ +0x018F | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0190 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x0194 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x0199 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x019A | 00 00 | uint8_t[2] | .. | padding
+
+string (AnnotatedBinary.Foo.alice):
+ +0x019C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01A0 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01A7 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.bob):
+ +0x01A8 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01AC | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01B3 | 00 | char | 0x00 (0) | string terminator
+
+vector (AnnotatedBinary.Foo.accounts):
+ +0x01B4 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of vector (# items)
+ +0x01B8 | 09 00 | uint16_t | 0x0009 (9) | value[0]
+ +0x01BA | 08 00 | uint16_t | 0x0008 (8) | value[1]
+ +0x01BC | 07 00 | uint16_t | 0x0007 (7) | value[2]
+ +0x01BE | 01 00 | uint16_t | 0x0001 (1) | value[3]
+ +0x01C0 | 02 00 | uint16_t | 0x0002 (2) | value[4]
+ +0x01C2 | 03 00 | uint16_t | 0x0003 (3) | value[5]
+ +0x01C4 | 06 00 | uint16_t | 0x0006 (6) | value[6]
+ +0x01C6 | 05 00 | uint16_t | 0x0005 (5) | value[7]
+ +0x01C8 | 04 00 | uint16_t | 0x0004 (4) | value[8]
+
+padding:
+ +0x01CA | 00 00 | uint8_t[2] | .. | padding
+
+table (AnnotatedBinary.Baz):
+ +0x01CC | 3A FF FF FF | SOffset32 | 0xFFFFFF3A (-198) Loc: +0x0292 | ERROR: offset to vtable. Invalid offset, points outside the binary.
+
+unknown (no known references):
+ +0x01D0 | 00 00 00 03 | ?uint8_t[4] | .... | WARN: could be corrupted padding region.
+
+vector (AnnotatedBinary.Foo.bars):
+ +0x01D4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | ERROR: length of vector (# items). Longer than the binary.
+
+unknown (no known references):
+ +0x01D8 | 44 00 00 00 10 00 | ?uint8_t[6] | D..... | WARN: could be corrupted padding region.
diff --git a/tests/annotated_binary/tests/invalid_vector_unions_cut_short.bin b/tests/annotated_binary/tests/invalid_vector_unions_cut_short.bin
new file mode 100644
index 0000000..2823d83
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vector_unions_cut_short.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_vtable_field_offset.afb b/tests/annotated_binary/tests/invalid_vtable_field_offset.afb
new file mode 100644
index 0000000..8b786be
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vtable_field_offset.afb
@@ -0,0 +1,286 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_vtable_field_offset.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x0008 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x000A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x000C | 68 00 | uint16_t | 0x0068 (104) | size of referring table
+ +0x000E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x0010 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x0012 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x0014 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x0016 | FF FF | VOffset16 | 0xFFFF (65535) | ERROR: offset to field `bar` (id: 4). Invalid offset, points outside the binary.
+ +0x0018 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x001A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `name` (id: 6)
+ +0x001C | 34 00 | VOffset16 | 0x0034 (52) | offset to field `bars` (id: 7)
+ +0x001E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x0020 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `bar_baz` (id: 9)
+ +0x0022 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `accounts` (id: 10)
+ +0x0024 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `bob` (id: 11)
+ +0x0026 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `alice` (id: 12)
+ +0x0028 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x002A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x002C | 48 00 | VOffset16 | 0x0048 (72) | offset to field `just_i32` (id: 15)
+ +0x002E | 4C 00 | VOffset16 | 0x004C (76) | offset to field `names` (id: 16)
+ +0x0030 | 50 00 | VOffset16 | 0x0050 (80) | offset to field `points_of_interest` (id: 17)
+ +0x0032 | 54 00 | VOffset16 | 0x0054 (84) | offset to field `foobars_type` (id: 18)
+ +0x0034 | 58 00 | VOffset16 | 0x0058 (88) | offset to field `foobars` (id: 19)
+ +0x0036 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x0038 | 5C 00 | VOffset16 | 0x005C (92) | offset to field `measurement` (id: 21)
+ +0x003A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x003C | 60 00 | VOffset16 | 0x0060 (96) | offset to field `anything` (id: 23)
+ +0x003E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x0040 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x0042 | 64 00 | VOffset16 | 0x0064 (100) | offset to field `charlie` (id: 26)
+ +0x0042 | 64 00 | VOffset16 | 0x0064 (100) | offset to unknown field (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x0044 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x000A | offset to vtable
+ +0x0048 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x004B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x004C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x004D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x004E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x004F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x0050 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x0054 | 28 02 00 00 | ?uint8_t[4] | (... | WARN: nothing refers to this section.
+ +0x0058 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x005C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x0060 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x0064 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values`[0] (Int)
+ +0x0068 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | array field `AnnotatedBinary.Dimension.values`[1] (Int)
+ +0x006C | 14 00 00 00 | uint32_t | 0x00000014 (20) | array field `AnnotatedBinary.Dimension.values`[2] (Int)
+ +0x0070 | 01 | uint8_t | 0x01 (1) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0071 | 02 | uint8_t | 0x02 (2) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0072 | 03 | uint8_t | 0x03 (3) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0073 | 00 | uint8_t[1] | . | padding
+ +0x0074 | C8 01 00 00 | UOffset32 | 0x000001C8 (456) Loc: +0x023C | offset to field `name` (string)
+ +0x0078 | 5C 01 00 00 | UOffset32 | 0x0000015C (348) Loc: +0x01D4 | offset to field `bars` (vector)
+ +0x007C | 50 01 00 00 | UOffset32 | 0x00000150 (336) Loc: +0x01CC | offset to field `bar_baz` (union of type `Baz`)
+ +0x0080 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x01B4 | offset to field `accounts` (vector)
+ +0x0084 | 24 01 00 00 | UOffset32 | 0x00000124 (292) Loc: +0x01A8 | offset to field `bob` (string)
+ +0x0088 | 14 01 00 00 | UOffset32 | 0x00000114 (276) Loc: +0x019C | offset to field `alice` (string)
+ +0x008C | 0D 00 00 00 | uint32_t | 0x0000000D (13) | table field `just_i32` (Int)
+ +0x0090 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x016C | offset to field `names` (vector)
+ +0x0094 | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x0134 | offset to field `points_of_interest` (vector)
+ +0x0098 | 94 00 00 00 | UOffset32 | 0x00000094 (148) Loc: +0x012C | offset to field `foobars_type` (vector)
+ +0x009C | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x00D4 | offset to field `foobars` (vector)
+ +0x00A0 | 33 00 00 00 | UOffset32 | 0x00000033 (51) Loc: +0x00D3 | offset to field `measurement` (union of type `Tolerance`)
+ +0x00A4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x00C0 | offset to field `anything` (union of type `Bar`)
+ +0x00A8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00AC | offset to field `charlie` (string)
+
+string (AnnotatedBinary.Foo.charlie):
+ +0x00AC | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x00B0 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x00B5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x00B6 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x00B8 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+ +0x00BA | 13 00 | uint16_t | 0x0013 (19) | size of referring table
+ +0x00BC | 08 00 | VOffset16 | 0x0008 (8) | offset to field `a` (id: 0)
+ +0x00BE | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+
+table (AnnotatedBinary.Bar):
+ +0x00C0 | 08 00 00 00 | SOffset32 | 0x00000008 (8) Loc: +0x00B8 | offset to vtable
+ +0x00C4 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00C8 | 00 00 00 00 00 10 74 40 | double | 0x4074100000000000 (321) | table field `a` (Double)
+ +0x00D0 | 00 00 00 | uint8_t[3] | ... | padding
+
+union (AnnotatedBinary.Tolerance.measurement):
+ +0x00D3 | 05 | uint8_t | 0x05 (5) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+
+vector (AnnotatedBinary.Foo.foobars):
+ +0x00D4 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x00D8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x010C | offset to union[0] (`Bar`)
+ +0x00DC | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0108 | offset to union[1] (`Baz`)
+ +0x00E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00E4 | offset to union[2] (`Bar`)
+
+table (AnnotatedBinary.Bar):
+ +0x00E4 | D2 FE FF FF | SOffset32 | 0xFFFFFED2 (-302) Loc: +0x0212 | offset to vtable
+ +0x00E8 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00EC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x00FC | offset to field `c` (table)
+ +0x00F0 | 00 00 00 00 00 D8 8E 40 | double | 0x408ED80000000000 (987) | table field `a` (Double)
+ +0x00F8 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x00FC | 6A FE FF FF | SOffset32 | 0xFFFFFE6A (-406) Loc: +0x0292 | offset to vtable
+ +0x0100 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0103 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vtable (AnnotatedBinary.Baz):
+ +0x0104 | 04 00 | uint16_t | 0x0004 (4) | size of this vtable
+ +0x0106 | 04 00 | uint16_t | 0x0004 (4) | size of referring table
+
+table (AnnotatedBinary.Baz):
+ +0x0108 | 04 00 00 00 | SOffset32 | 0x00000004 (4) Loc: +0x0104 | offset to vtable
+
+table (AnnotatedBinary.Bar):
+ +0x010C | FA FE FF FF | SOffset32 | 0xFFFFFEFA (-262) Loc: +0x0212 | offset to vtable
+ +0x0110 | 00 00 E4 43 | float | 0x43E40000 (456) | table field `b` (Float)
+ +0x0114 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0124 | offset to field `c` (table)
+ +0x0118 | 00 00 00 00 00 C0 5E 40 | double | 0x405EC00000000000 (123) | table field `a` (Double)
+ +0x0120 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x0124 | 92 FE FF FF | SOffset32 | 0xFFFFFE92 (-366) Loc: +0x0292 | offset to vtable
+ +0x0128 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x012B | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
+
+vector (AnnotatedBinary.Foo.foobars_type):
+ +0x012C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0130 | 01 | UType8 | 0x01 (1) | value[0]
+ +0x0131 | 02 | UType8 | 0x02 (2) | value[1]
+ +0x0132 | 01 | UType8 | 0x01 (1) | value[2]
+
+vector (AnnotatedBinary.Foo.points_of_interest):
+ +0x0134 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0138 | 33 33 33 33 33 A3 45 40 | double | 0x4045A33333333333 (43.275) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0140 | 7E 57 04 FF 5B 87 53 C0 | double | 0xC053875BFF04577E (-78.115) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0148 | 8D F0 F6 20 04 B6 42 40 | double | 0x4042B60420F6F08D (37.422) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0150 | 9F 77 63 41 61 85 5E C0 | double | 0xC05E85614163779F (-122.084) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0158 | 8F 35 23 83 DC 35 4B C0 | double | 0xC04B35DC8323358F (-54.4208) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0160 | F6 97 DD 93 87 C5 0A 40 | double | 0x400AC58793DD97F6 (3.34645) | struct field `AnnotatedBinary.Location.longitude` (Double)
+
+padding:
+ +0x0168 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (AnnotatedBinary.Foo.names):
+ +0x016C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0170 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0190 | offset to string[0]
+ +0x0174 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0188 | offset to string[1]
+ +0x0178 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x017C | offset to string[2]
+
+string (AnnotatedBinary.Foo.names):
+ +0x017C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x0180 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x0187 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0188 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x018C | 62 6F 62 | char[3] | bob | string literal
+ +0x018F | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0190 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x0194 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x0199 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x019A | 00 00 | uint8_t[2] | .. | padding
+
+string (AnnotatedBinary.Foo.alice):
+ +0x019C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01A0 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01A7 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.bob):
+ +0x01A8 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01AC | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01B3 | 00 | char | 0x00 (0) | string terminator
+
+vector (AnnotatedBinary.Foo.accounts):
+ +0x01B4 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of vector (# items)
+ +0x01B8 | 09 00 | uint16_t | 0x0009 (9) | value[0]
+ +0x01BA | 08 00 | uint16_t | 0x0008 (8) | value[1]
+ +0x01BC | 07 00 | uint16_t | 0x0007 (7) | value[2]
+ +0x01BE | 01 00 | uint16_t | 0x0001 (1) | value[3]
+ +0x01C0 | 02 00 | uint16_t | 0x0002 (2) | value[4]
+ +0x01C2 | 03 00 | uint16_t | 0x0003 (3) | value[5]
+ +0x01C4 | 06 00 | uint16_t | 0x0006 (6) | value[6]
+ +0x01C6 | 05 00 | uint16_t | 0x0005 (5) | value[7]
+ +0x01C8 | 04 00 | uint16_t | 0x0004 (4) | value[8]
+
+padding:
+ +0x01CA | 00 00 | uint8_t[2] | .. | padding
+
+table (AnnotatedBinary.Baz):
+ +0x01CC | 3A FF FF FF | SOffset32 | 0xFFFFFF3A (-198) Loc: +0x0292 | offset to vtable
+ +0x01D0 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x01D3 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vector (AnnotatedBinary.Foo.bars):
+ +0x01D4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x01D8 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x021C | offset to table[0]
+ +0x01DC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x01EC | offset to table[1]
+
+padding:
+ +0x01E0 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x01E2 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x01E4 | 1A 00 | uint16_t | 0x001A (26) | size of referring table
+ +0x01E6 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x01E8 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x01EA | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x01EC | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x01E2 | offset to vtable
+ +0x01F0 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x01F4 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x020C | offset to field `c` (table)
+ +0x01F8 | 00 00 00 00 00 D8 8E 40 | double | 0x408ED80000000000 (987) | table field `a` (Double)
+ +0x0200 | 00 00 00 00 00 00 | uint8_t[6] | ...... | padding
+
+vtable (AnnotatedBinary.Baz):
+ +0x0206 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x0208 | 06 00 | uint16_t | 0x0006 (6) | size of referring table
+ +0x020A | 05 00 | VOffset16 | 0x0005 (5) | offset to field `meal` (id: 0)
+
+table (AnnotatedBinary.Baz):
+ +0x020C | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: +0x0206 | offset to vtable
+ +0x0210 | 00 | uint8_t[1] | . | padding
+ +0x0211 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vtable (AnnotatedBinary.Bar):
+ +0x0212 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x0214 | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x0216 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x0218 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x021A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x021C | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x0212 | offset to vtable
+ +0x0220 | 00 00 E4 43 | float | 0x43E40000 (456) | table field `b` (Float)
+ +0x0224 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0234 | offset to field `c` (table)
+ +0x0228 | 00 00 00 00 00 C0 5E 40 | double | 0x405EC00000000000 (123) | table field `a` (Double)
+ +0x0230 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x0234 | A2 FF FF FF | SOffset32 | 0xFFFFFFA2 (-94) Loc: +0x0292 | offset to vtable
+ +0x0238 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x023B | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
+
+string (AnnotatedBinary.Foo.name):
+ +0x023C | 2F 00 00 00 | uint32_t | 0x0000002F (47) | length of string
+ +0x0240 | 54 68 69 73 20 69 73 20 | char[47] | This is | string literal
+ +0x0248 | 61 20 6C 6F 6E 67 20 73 | | a long s
+ +0x0250 | 74 72 69 6E 67 20 74 6F | | tring to
+ +0x0258 | 20 73 68 6F 77 20 68 6F | | show ho
+ +0x0260 | 77 20 69 74 20 62 72 65 | | w it bre
+ +0x0268 | 61 6B 73 20 75 70 2E | | aks up.
+ +0x026F | 00 | char | 0x00 (0) | string terminator
+
+unknown (no known references):
+ +0x0270 | 00 00 0A 00 16 00 0C 00 | ?uint8_t[34] | ........ | WARN: nothing refers to this section.
+ +0x0278 | 04 00 08 00 0A 00 00 00 | | ........
+ +0x0280 | 65 20 71 49 14 00 00 00 | | e qI....
+ +0x0288 | C9 76 BE 9F 0C 24 FE 40 | | .v...$.@
+ +0x0290 | 00 00 | | ..
+
+vtable (AnnotatedBinary.Baz):
+ +0x0292 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x0294 | 08 00 | uint16_t | 0x0008 (8) | size of referring table
+ +0x0296 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `meal` (id: 0)
+
+unknown (no known references):
+ +0x0298 | 06 00 00 00 00 00 00 01 | ?uint8_t[8] | ........ | WARN: nothing refers to this section.
diff --git a/tests/annotated_binary/tests/invalid_vtable_field_offset.bin b/tests/annotated_binary/tests/invalid_vtable_field_offset.bin
new file mode 100644
index 0000000..e32ce5b
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vtable_field_offset.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_vtable_ref_table_size.afb b/tests/annotated_binary/tests/invalid_vtable_ref_table_size.afb
new file mode 100644
index 0000000..5238e9d
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vtable_ref_table_size.afb
@@ -0,0 +1,360 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_vtable_ref_table_size.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x0008 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x000A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x000C | FF FF | uint16_t | 0xFFFF (65535) | ERROR: size of referring table. Longer than the binary.
+ +0x000E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x0010 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x0012 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x0014 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x0016 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x0018 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x001A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `name` (id: 6)
+ +0x001C | 34 00 | VOffset16 | 0x0034 (52) | offset to field `bars` (id: 7)
+ +0x001E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x0020 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `bar_baz` (id: 9)
+ +0x0022 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `accounts` (id: 10)
+ +0x0024 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `bob` (id: 11)
+ +0x0026 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `alice` (id: 12)
+ +0x0028 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x002A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x002C | 48 00 | VOffset16 | 0x0048 (72) | offset to field `just_i32` (id: 15)
+ +0x002E | 4C 00 | VOffset16 | 0x004C (76) | offset to field `names` (id: 16)
+ +0x0030 | 50 00 | VOffset16 | 0x0050 (80) | offset to field `points_of_interest` (id: 17)
+ +0x0032 | 54 00 | VOffset16 | 0x0054 (84) | offset to field `foobars_type` (id: 18)
+ +0x0034 | 58 00 | VOffset16 | 0x0058 (88) | offset to field `foobars` (id: 19)
+ +0x0036 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x0038 | 5C 00 | VOffset16 | 0x005C (92) | offset to field `measurement` (id: 21)
+ +0x003A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x003C | 60 00 | VOffset16 | 0x0060 (96) | offset to field `anything` (id: 23)
+ +0x003E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x0040 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x0042 | 64 00 | VOffset16 | 0x0064 (100) | offset to field `charlie` (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x0044 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x000A | offset to vtable
+ +0x0048 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x004B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x004C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x004D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x004E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x004F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x0050 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x0054 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x027C | offset to field `bar` (table)
+ +0x0058 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x005C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x0060 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x0064 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values`[0] (Int)
+ +0x0068 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | array field `AnnotatedBinary.Dimension.values`[1] (Int)
+ +0x006C | 14 00 00 00 | uint32_t | 0x00000014 (20) | array field `AnnotatedBinary.Dimension.values`[2] (Int)
+ +0x0070 | 01 | uint8_t | 0x01 (1) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0071 | 02 | uint8_t | 0x02 (2) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0072 | 03 | uint8_t | 0x03 (3) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0073 | 00 | uint8_t[1] | . | padding
+ +0x0074 | C8 01 00 00 | UOffset32 | 0x000001C8 (456) Loc: +0x023C | offset to field `name` (string)
+ +0x0078 | 5C 01 00 00 | UOffset32 | 0x0000015C (348) Loc: +0x01D4 | offset to field `bars` (vector)
+ +0x007C | 50 01 00 00 | UOffset32 | 0x00000150 (336) Loc: +0x01CC | offset to field `bar_baz` (union of type `Baz`)
+ +0x0080 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x01B4 | offset to field `accounts` (vector)
+ +0x0084 | 24 01 00 00 | UOffset32 | 0x00000124 (292) Loc: +0x01A8 | offset to field `bob` (string)
+ +0x0088 | 14 01 00 00 | UOffset32 | 0x00000114 (276) Loc: +0x019C | offset to field `alice` (string)
+ +0x008C | 0D 00 00 00 | uint32_t | 0x0000000D (13) | table field `just_i32` (Int)
+ +0x0090 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x016C | offset to field `names` (vector)
+ +0x0094 | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x0134 | offset to field `points_of_interest` (vector)
+ +0x0098 | 94 00 00 00 | UOffset32 | 0x00000094 (148) Loc: +0x012C | offset to field `foobars_type` (vector)
+ +0x009C | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x00D4 | offset to field `foobars` (vector)
+ +0x00A0 | 33 00 00 00 | UOffset32 | 0x00000033 (51) Loc: +0x00D3 | offset to field `measurement` (union of type `Tolerance`)
+ +0x00A4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x00C0 | offset to field `anything` (union of type `Bar`)
+ +0x00A8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00AC | offset to field `charlie` (string)
+ +0x00AC | 05 00 00 00 61 6C 69 63 | uint8_t[500] | ....alic | padding
+ +0x00B4 | 65 00 00 00 08 00 13 00 | | e.......
+ +0x00BC | 08 00 04 00 08 00 00 00 | | ........
+ +0x00C4 | 00 80 23 44 00 00 00 00 | | ..#D....
+ +0x00CC | 00 10 74 40 00 00 00 05 | | ..t@....
+ +0x00D4 | 03 00 00 00 34 00 00 00 | | ....4...
+ +0x00DC | 2C 00 00 00 04 00 00 00 | | ,.......
+ +0x00E4 | D2 FE FF FF 00 80 23 44 | | ......#D
+ +0x00EC | 10 00 00 00 00 00 00 00 | | ........
+ +0x00F4 | 00 D8 8E 40 00 00 00 00 | | ...@....
+ +0x00FC | 6A FE FF FF 00 00 00 03 | | j.......
+ +0x0104 | 04 00 04 00 04 00 00 00 | | ........
+ +0x010C | FA FE FF FF 00 00 E4 43 | | .......C
+ +0x0114 | 10 00 00 00 00 00 00 00 | | ........
+ +0x011C | 00 C0 5E 40 00 00 00 00 | | ..^@....
+ +0x0124 | 92 FE FF FF 00 00 00 01 | | ........
+ +0x012C | 03 00 00 00 01 02 01 00 | | ........
+ +0x0134 | 03 00 00 00 33 33 33 33 | | ....3333
+ +0x013C | 33 A3 45 40 7E 57 04 FF | | 3.E@~W..
+ +0x0144 | 5B 87 53 C0 8D F0 F6 20 | | [.S....
+ +0x014C | 04 B6 42 40 9F 77 63 41 | | ..B@.wcA
+ +0x0154 | 61 85 5E C0 8F 35 23 83 | | a.^..5#.
+ +0x015C | DC 35 4B C0 F6 97 DD 93 | | .5K.....
+ +0x0164 | 87 C5 0A 40 00 00 00 00 | | ...@....
+ +0x016C | 03 00 00 00 20 00 00 00 | | .... ...
+ +0x0174 | 14 00 00 00 04 00 00 00 | | ........
+ +0x017C | 07 00 00 00 63 68 61 72 | | ....char
+ +0x0184 | 6C 69 65 00 03 00 00 00 | | lie.....
+ +0x018C | 62 6F 62 00 05 00 00 00 | | bob.....
+ +0x0194 | 61 6C 69 63 65 00 00 00 | | alice...
+ +0x019C | 07 00 00 00 63 68 61 72 | | ....char
+ +0x01A4 | 6C 69 65 00 07 00 00 00 | | lie.....
+ +0x01AC | 63 68 61 72 6C 69 65 00 | | charlie.
+ +0x01B4 | 09 00 00 00 09 00 08 00 | | ........
+ +0x01BC | 07 00 01 00 02 00 03 00 | | ........
+ +0x01C4 | 06 00 05 00 04 00 00 00 | | ........
+ +0x01CC | 3A FF FF FF 00 00 00 03 | | :.......
+ +0x01D4 | 02 00 00 00 44 00 00 00 | | ....D...
+ +0x01DC | 10 00 00 00 00 00 0A 00 | | ........
+ +0x01E4 | 1A 00 0C 00 04 00 08 00 | | ........
+ +0x01EC | 0A 00 00 00 00 80 23 44 | | ......#D
+ +0x01F4 | 18 00 00 00 00 00 00 00 | | ........
+ +0x01FC | 00 D8 8E 40 00 00 00 00 | | ...@....
+ +0x0204 | 00 00 06 00 06 00 05 00 | | ........
+ +0x020C | 06 00 00 00 00 03 0A 00 | | ........
+ +0x0214 | 18 00 0C 00 04 00 08 00 | | ........
+ +0x021C | 0A 00 00 00 00 00 E4 43 | | .......C
+ +0x0224 | 10 00 00 00 00 00 00 00 | | ........
+ +0x022C | 00 C0 5E 40 00 00 00 00 | | ..^@....
+ +0x0234 | A2 FF FF FF 00 00 00 01 | | ........
+ +0x023C | 2F 00 00 00 54 68 69 73 | | /...This
+ +0x0244 | 20 69 73 20 61 20 6C 6F | | is a lo
+ +0x024C | 6E 67 20 73 74 72 69 6E | | ng strin
+ +0x0254 | 67 20 74 6F 20 73 68 6F | | g to sho
+ +0x025C | 77 20 68 6F 77 20 69 74 | | w how it
+ +0x0264 | 20 62 72 65 61 6B 73 20 | | breaks
+ +0x026C | 75 70 2E 00 00 00 0A 00 | | up......
+ +0x0274 | 16 00 0C 00 04 00 08 00 | | ........
+ +0x027C | 0A 00 00 00 65 20 71 49 | | ....e qI
+ +0x0284 | 14 00 00 00 C9 76 BE 9F | | .....v..
+ +0x028C | 0C 24 FE 40 00 00 06 00 | | .$.@....
+ +0x0294 | 08 00 07 00 06 00 00 00 | | ........
+ +0x029C | 00 00 00 01 | | ....
+
+string (AnnotatedBinary.Foo.charlie):
+ +0x00AC | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x00B0 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x00B5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x00B6 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x00B8 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+ +0x00BA | 13 00 | uint16_t | 0x0013 (19) | size of referring table
+ +0x00BC | 08 00 | VOffset16 | 0x0008 (8) | offset to field `a` (id: 0)
+ +0x00BE | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+
+table (AnnotatedBinary.Bar):
+ +0x00C0 | 08 00 00 00 | SOffset32 | 0x00000008 (8) Loc: +0x00B8 | offset to vtable
+ +0x00C4 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00C8 | 00 00 00 00 00 10 74 40 | double | 0x4074100000000000 (321) | table field `a` (Double)
+ +0x00D0 | 00 00 00 | uint8_t[3] | ... | padding
+
+union (AnnotatedBinary.Tolerance.measurement):
+ +0x00D3 | 05 | uint8_t | 0x05 (5) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+
+vector (AnnotatedBinary.Foo.foobars):
+ +0x00D4 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x00D8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x010C | offset to union[0] (`Bar`)
+ +0x00DC | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0108 | offset to union[1] (`Baz`)
+ +0x00E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00E4 | offset to union[2] (`Bar`)
+
+table (AnnotatedBinary.Bar):
+ +0x00E4 | D2 FE FF FF | SOffset32 | 0xFFFFFED2 (-302) Loc: +0x0212 | offset to vtable
+ +0x00E8 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00EC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x00FC | offset to field `c` (table)
+ +0x00F0 | 00 00 00 00 00 D8 8E 40 | double | 0x408ED80000000000 (987) | table field `a` (Double)
+ +0x00F8 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x00FC | 6A FE FF FF | SOffset32 | 0xFFFFFE6A (-406) Loc: +0x0292 | offset to vtable
+ +0x0100 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0103 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vtable (AnnotatedBinary.Baz):
+ +0x0104 | 04 00 | uint16_t | 0x0004 (4) | size of this vtable
+ +0x0106 | 04 00 | uint16_t | 0x0004 (4) | size of referring table
+
+table (AnnotatedBinary.Baz):
+ +0x0108 | 04 00 00 00 | SOffset32 | 0x00000004 (4) Loc: +0x0104 | offset to vtable
+
+table (AnnotatedBinary.Bar):
+ +0x010C | FA FE FF FF | SOffset32 | 0xFFFFFEFA (-262) Loc: +0x0212 | offset to vtable
+ +0x0110 | 00 00 E4 43 | float | 0x43E40000 (456) | table field `b` (Float)
+ +0x0114 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0124 | offset to field `c` (table)
+ +0x0118 | 00 00 00 00 00 C0 5E 40 | double | 0x405EC00000000000 (123) | table field `a` (Double)
+ +0x0120 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x0124 | 92 FE FF FF | SOffset32 | 0xFFFFFE92 (-366) Loc: +0x0292 | offset to vtable
+ +0x0128 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x012B | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
+
+vector (AnnotatedBinary.Foo.foobars_type):
+ +0x012C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0130 | 01 | UType8 | 0x01 (1) | value[0]
+ +0x0131 | 02 | UType8 | 0x02 (2) | value[1]
+ +0x0132 | 01 | UType8 | 0x01 (1) | value[2]
+
+vector (AnnotatedBinary.Foo.points_of_interest):
+ +0x0134 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0138 | 33 33 33 33 33 A3 45 40 | double | 0x4045A33333333333 (43.275) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0140 | 7E 57 04 FF 5B 87 53 C0 | double | 0xC053875BFF04577E (-78.115) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0148 | 8D F0 F6 20 04 B6 42 40 | double | 0x4042B60420F6F08D (37.422) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0150 | 9F 77 63 41 61 85 5E C0 | double | 0xC05E85614163779F (-122.084) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0158 | 8F 35 23 83 DC 35 4B C0 | double | 0xC04B35DC8323358F (-54.4208) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0160 | F6 97 DD 93 87 C5 0A 40 | double | 0x400AC58793DD97F6 (3.34645) | struct field `AnnotatedBinary.Location.longitude` (Double)
+
+padding:
+ +0x0168 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (AnnotatedBinary.Foo.names):
+ +0x016C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0170 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0190 | offset to string[0]
+ +0x0174 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0188 | offset to string[1]
+ +0x0178 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x017C | offset to string[2]
+
+string (AnnotatedBinary.Foo.names):
+ +0x017C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x0180 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x0187 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0188 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x018C | 62 6F 62 | char[3] | bob | string literal
+ +0x018F | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0190 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x0194 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x0199 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x019A | 00 00 | uint8_t[2] | .. | padding
+
+string (AnnotatedBinary.Foo.alice):
+ +0x019C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01A0 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01A7 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.bob):
+ +0x01A8 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01AC | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01B3 | 00 | char | 0x00 (0) | string terminator
+
+vector (AnnotatedBinary.Foo.accounts):
+ +0x01B4 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of vector (# items)
+ +0x01B8 | 09 00 | uint16_t | 0x0009 (9) | value[0]
+ +0x01BA | 08 00 | uint16_t | 0x0008 (8) | value[1]
+ +0x01BC | 07 00 | uint16_t | 0x0007 (7) | value[2]
+ +0x01BE | 01 00 | uint16_t | 0x0001 (1) | value[3]
+ +0x01C0 | 02 00 | uint16_t | 0x0002 (2) | value[4]
+ +0x01C2 | 03 00 | uint16_t | 0x0003 (3) | value[5]
+ +0x01C4 | 06 00 | uint16_t | 0x0006 (6) | value[6]
+ +0x01C6 | 05 00 | uint16_t | 0x0005 (5) | value[7]
+ +0x01C8 | 04 00 | uint16_t | 0x0004 (4) | value[8]
+
+padding:
+ +0x01CA | 00 00 | uint8_t[2] | .. | padding
+
+table (AnnotatedBinary.Baz):
+ +0x01CC | 3A FF FF FF | SOffset32 | 0xFFFFFF3A (-198) Loc: +0x0292 | offset to vtable
+ +0x01D0 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x01D3 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vector (AnnotatedBinary.Foo.bars):
+ +0x01D4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x01D8 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x021C | offset to table[0]
+ +0x01DC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x01EC | offset to table[1]
+
+padding:
+ +0x01E0 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x01E2 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x01E4 | 1A 00 | uint16_t | 0x001A (26) | size of referring table
+ +0x01E6 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x01E8 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x01EA | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x01EC | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x01E2 | offset to vtable
+ +0x01F0 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x01F4 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x020C | offset to field `c` (table)
+ +0x01F8 | 00 00 00 00 00 D8 8E 40 | double | 0x408ED80000000000 (987) | table field `a` (Double)
+ +0x0200 | 00 00 00 00 00 00 | uint8_t[6] | ...... | padding
+
+vtable (AnnotatedBinary.Baz):
+ +0x0206 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x0208 | 06 00 | uint16_t | 0x0006 (6) | size of referring table
+ +0x020A | 05 00 | VOffset16 | 0x0005 (5) | offset to field `meal` (id: 0)
+
+table (AnnotatedBinary.Baz):
+ +0x020C | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: +0x0206 | offset to vtable
+ +0x0210 | 00 | uint8_t[1] | . | padding
+ +0x0211 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vtable (AnnotatedBinary.Bar):
+ +0x0212 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x0214 | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x0216 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x0218 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x021A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x021C | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x0212 | offset to vtable
+ +0x0220 | 00 00 E4 43 | float | 0x43E40000 (456) | table field `b` (Float)
+ +0x0224 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0234 | offset to field `c` (table)
+ +0x0228 | 00 00 00 00 00 C0 5E 40 | double | 0x405EC00000000000 (123) | table field `a` (Double)
+ +0x0230 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x0234 | A2 FF FF FF | SOffset32 | 0xFFFFFFA2 (-94) Loc: +0x0292 | offset to vtable
+ +0x0238 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x023B | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
+
+string (AnnotatedBinary.Foo.name):
+ +0x023C | 2F 00 00 00 | uint32_t | 0x0000002F (47) | length of string
+ +0x0240 | 54 68 69 73 20 69 73 20 | char[47] | This is | string literal
+ +0x0248 | 61 20 6C 6F 6E 67 20 73 | | a long s
+ +0x0250 | 74 72 69 6E 67 20 74 6F | | tring to
+ +0x0258 | 20 73 68 6F 77 20 68 6F | | show ho
+ +0x0260 | 77 20 69 74 20 62 72 65 | | w it bre
+ +0x0268 | 61 6B 73 20 75 70 2E | | aks up.
+ +0x026F | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0270 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x0272 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x0274 | 16 00 | uint16_t | 0x0016 (22) | size of referring table
+ +0x0276 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x0278 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x027A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x027C | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x0272 | offset to vtable
+ +0x0280 | 65 20 71 49 | float | 0x49712065 (987654) | table field `b` (Float)
+ +0x0284 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0298 | offset to field `c` (table)
+ +0x0288 | C9 76 BE 9F 0C 24 FE 40 | double | 0x40FE240C9FBE76C9 (123457) | table field `a` (Double)
+ +0x0290 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Baz):
+ +0x0292 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x0294 | 08 00 | uint16_t | 0x0008 (8) | size of referring table
+ +0x0296 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `meal` (id: 0)
+
+table (AnnotatedBinary.Baz):
+ +0x0298 | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: +0x0292 | offset to vtable
+ +0x029C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x029F | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
diff --git a/tests/annotated_binary/tests/invalid_vtable_ref_table_size.bin b/tests/annotated_binary/tests/invalid_vtable_ref_table_size.bin
new file mode 100644
index 0000000..6b50242
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vtable_ref_table_size.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_vtable_ref_table_size_short.afb b/tests/annotated_binary/tests/invalid_vtable_ref_table_size_short.afb
new file mode 100644
index 0000000..35eb6a8
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vtable_ref_table_size_short.afb
@@ -0,0 +1,297 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_vtable_ref_table_size_short.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x0008 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x000A | 3A 00 | uint16_t | 0x003A (58) | size of this vtable
+ +0x000C | 01 00 | uint16_t | 0x0001 (1) | ERROR: size of referring table. Shorter than the minimum length:
+ +0x000E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `counter` (id: 0)
+ +0x0010 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `healthy` (id: 1)
+ +0x0012 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `level` (id: 2) <defaults to 99> (Long)
+ +0x0014 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `meal` (id: 3)
+ +0x0016 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `bar` (id: 4)
+ +0x0018 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `home` (id: 5)
+ +0x001A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `name` (id: 6)
+ +0x001C | 34 00 | VOffset16 | 0x0034 (52) | offset to field `bars` (id: 7)
+ +0x001E | 09 00 | VOffset16 | 0x0009 (9) | offset to field `bar_baz_type` (id: 8)
+ +0x0020 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `bar_baz` (id: 9)
+ +0x0022 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `accounts` (id: 10)
+ +0x0024 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `bob` (id: 11)
+ +0x0026 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `alice` (id: 12)
+ +0x0028 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `maybe_i32` (id: 13) <defaults to 0> (Int)
+ +0x002A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_i32` (id: 14) <defaults to 42> (Int)
+ +0x002C | 48 00 | VOffset16 | 0x0048 (72) | offset to field `just_i32` (id: 15)
+ +0x002E | 4C 00 | VOffset16 | 0x004C (76) | offset to field `names` (id: 16)
+ +0x0030 | 50 00 | VOffset16 | 0x0050 (80) | offset to field `points_of_interest` (id: 17)
+ +0x0032 | 54 00 | VOffset16 | 0x0054 (84) | offset to field `foobars_type` (id: 18)
+ +0x0034 | 58 00 | VOffset16 | 0x0058 (88) | offset to field `foobars` (id: 19)
+ +0x0036 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `measurement_type` (id: 20)
+ +0x0038 | 5C 00 | VOffset16 | 0x005C (92) | offset to field `measurement` (id: 21)
+ +0x003A | 0B 00 | VOffset16 | 0x000B (11) | offset to field `anything_type` (id: 22)
+ +0x003C | 60 00 | VOffset16 | 0x0060 (96) | offset to field `anything` (id: 23)
+ +0x003E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `temperature` (id: 24) <defaults to 98.600000> (Float)
+ +0x0040 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `teetotaler` (id: 25) <null> (Obj)
+ +0x0042 | 64 00 | VOffset16 | 0x0064 (100) | offset to field `charlie` (id: 26)
+
+root_table (AnnotatedBinary.Foo):
+ +0x0044 | 3A 00 00 00 | SOffset32 | 0x0000003A (58) Loc: +0x000A | offset to vtable
+ +0x0048 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x004B | 01 | uint8_t | 0x01 (1) | table field `healthy` (Bool)
+ +0x004C | 02 | uint8_t | 0x02 (2) | table field `meal` (Byte)
+ +0x004D | 02 | UType8 | 0x02 (2) | table field `bar_baz_type` (UType)
+ +0x004E | 01 | UType8 | 0x01 (1) | table field `measurement_type` (UType)
+ +0x004F | 01 | UType8 | 0x01 (1) | table field `anything_type` (UType)
+ +0x0050 | D2 04 00 00 | uint32_t | 0x000004D2 (1234) | table field `counter` (Int)
+ +0x0054 | 28 02 00 00 | UOffset32 | 0x00000228 (552) Loc: +0x027C | offset to field `bar` (table)
+ +0x0058 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `AnnotatedBinary.Building.floors` (Int)
+ +0x005C | 02 00 00 00 | uint32_t | 0x00000002 (2) | struct field `AnnotatedBinary.Building.doors` (Int)
+ +0x0060 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `AnnotatedBinary.Building.windows` (Int)
+ +0x0064 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | array field `AnnotatedBinary.Dimension.values`[0] (Int)
+ +0x0068 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | array field `AnnotatedBinary.Dimension.values`[1] (Int)
+ +0x006C | 14 00 00 00 | uint32_t | 0x00000014 (20) | array field `AnnotatedBinary.Dimension.values`[2] (Int)
+ +0x0070 | 01 | uint8_t | 0x01 (1) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0071 | 02 | uint8_t | 0x02 (2) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0072 | 03 | uint8_t | 0x03 (3) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+ +0x0073 | 00 | uint8_t[1] | . | padding
+ +0x0074 | C8 01 00 00 | UOffset32 | 0x000001C8 (456) Loc: +0x023C | offset to field `name` (string)
+ +0x0078 | 5C 01 00 00 | UOffset32 | 0x0000015C (348) Loc: +0x01D4 | offset to field `bars` (vector)
+ +0x007C | 50 01 00 00 | UOffset32 | 0x00000150 (336) Loc: +0x01CC | offset to field `bar_baz` (union of type `Baz`)
+ +0x0080 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x01B4 | offset to field `accounts` (vector)
+ +0x0084 | 24 01 00 00 | UOffset32 | 0x00000124 (292) Loc: +0x01A8 | offset to field `bob` (string)
+ +0x0088 | 14 01 00 00 | UOffset32 | 0x00000114 (276) Loc: +0x019C | offset to field `alice` (string)
+ +0x008C | 0D 00 00 00 | uint32_t | 0x0000000D (13) | table field `just_i32` (Int)
+ +0x0090 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x016C | offset to field `names` (vector)
+ +0x0094 | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x0134 | offset to field `points_of_interest` (vector)
+ +0x0098 | 94 00 00 00 | UOffset32 | 0x00000094 (148) Loc: +0x012C | offset to field `foobars_type` (vector)
+ +0x009C | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x00D4 | offset to field `foobars` (vector)
+ +0x00A0 | 33 00 00 00 | UOffset32 | 0x00000033 (51) Loc: +0x00D3 | offset to field `measurement` (union of type `Tolerance`)
+ +0x00A4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x00C0 | offset to field `anything` (union of type `Bar`)
+ +0x00A8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00AC | offset to field `charlie` (string)
+
+string (AnnotatedBinary.Foo.charlie):
+ +0x00AC | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x00B0 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x00B5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x00B6 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x00B8 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+ +0x00BA | 13 00 | uint16_t | 0x0013 (19) | size of referring table
+ +0x00BC | 08 00 | VOffset16 | 0x0008 (8) | offset to field `a` (id: 0)
+ +0x00BE | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+
+table (AnnotatedBinary.Bar):
+ +0x00C0 | 08 00 00 00 | SOffset32 | 0x00000008 (8) Loc: +0x00B8 | offset to vtable
+ +0x00C4 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00C8 | 00 00 00 00 00 10 74 40 | double | 0x4074100000000000 (321) | table field `a` (Double)
+ +0x00D0 | 00 00 00 | uint8_t[3] | ... | padding
+
+union (AnnotatedBinary.Tolerance.measurement):
+ +0x00D3 | 05 | uint8_t | 0x05 (5) | struct field `AnnotatedBinary.Tolerance.width` (UByte)
+
+vector (AnnotatedBinary.Foo.foobars):
+ +0x00D4 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x00D8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x010C | offset to union[0] (`Bar`)
+ +0x00DC | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0108 | offset to union[1] (`Baz`)
+ +0x00E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00E4 | offset to union[2] (`Bar`)
+
+table (AnnotatedBinary.Bar):
+ +0x00E4 | D2 FE FF FF | SOffset32 | 0xFFFFFED2 (-302) Loc: +0x0212 | offset to vtable
+ +0x00E8 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x00EC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x00FC | offset to field `c` (table)
+ +0x00F0 | 00 00 00 00 00 D8 8E 40 | double | 0x408ED80000000000 (987) | table field `a` (Double)
+ +0x00F8 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x00FC | 6A FE FF FF | SOffset32 | 0xFFFFFE6A (-406) Loc: +0x0292 | offset to vtable
+ +0x0100 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0103 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vtable (AnnotatedBinary.Baz):
+ +0x0104 | 04 00 | uint16_t | 0x0004 (4) | size of this vtable
+ +0x0106 | 04 00 | uint16_t | 0x0004 (4) | size of referring table
+
+table (AnnotatedBinary.Baz):
+ +0x0108 | 04 00 00 00 | SOffset32 | 0x00000004 (4) Loc: +0x0104 | offset to vtable
+
+table (AnnotatedBinary.Bar):
+ +0x010C | FA FE FF FF | SOffset32 | 0xFFFFFEFA (-262) Loc: +0x0212 | offset to vtable
+ +0x0110 | 00 00 E4 43 | float | 0x43E40000 (456) | table field `b` (Float)
+ +0x0114 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0124 | offset to field `c` (table)
+ +0x0118 | 00 00 00 00 00 C0 5E 40 | double | 0x405EC00000000000 (123) | table field `a` (Double)
+ +0x0120 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x0124 | 92 FE FF FF | SOffset32 | 0xFFFFFE92 (-366) Loc: +0x0292 | offset to vtable
+ +0x0128 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x012B | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
+
+vector (AnnotatedBinary.Foo.foobars_type):
+ +0x012C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0130 | 01 | UType8 | 0x01 (1) | value[0]
+ +0x0131 | 02 | UType8 | 0x02 (2) | value[1]
+ +0x0132 | 01 | UType8 | 0x01 (1) | value[2]
+
+vector (AnnotatedBinary.Foo.points_of_interest):
+ +0x0134 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0138 | 33 33 33 33 33 A3 45 40 | double | 0x4045A33333333333 (43.275) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0140 | 7E 57 04 FF 5B 87 53 C0 | double | 0xC053875BFF04577E (-78.115) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0148 | 8D F0 F6 20 04 B6 42 40 | double | 0x4042B60420F6F08D (37.422) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0150 | 9F 77 63 41 61 85 5E C0 | double | 0xC05E85614163779F (-122.084) | struct field `AnnotatedBinary.Location.longitude` (Double)
+ +0x0158 | 8F 35 23 83 DC 35 4B C0 | double | 0xC04B35DC8323358F (-54.4208) | struct field `AnnotatedBinary.Location.latitude` (Double)
+ +0x0160 | F6 97 DD 93 87 C5 0A 40 | double | 0x400AC58793DD97F6 (3.34645) | struct field `AnnotatedBinary.Location.longitude` (Double)
+
+padding:
+ +0x0168 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (AnnotatedBinary.Foo.names):
+ +0x016C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0170 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0190 | offset to string[0]
+ +0x0174 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0188 | offset to string[1]
+ +0x0178 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x017C | offset to string[2]
+
+string (AnnotatedBinary.Foo.names):
+ +0x017C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x0180 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x0187 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0188 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x018C | 62 6F 62 | char[3] | bob | string literal
+ +0x018F | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.names):
+ +0x0190 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x0194 | 61 6C 69 63 65 | char[5] | alice | string literal
+ +0x0199 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x019A | 00 00 | uint8_t[2] | .. | padding
+
+string (AnnotatedBinary.Foo.alice):
+ +0x019C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01A0 | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01A7 | 00 | char | 0x00 (0) | string terminator
+
+string (AnnotatedBinary.Foo.bob):
+ +0x01A8 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x01AC | 63 68 61 72 6C 69 65 | char[7] | charlie | string literal
+ +0x01B3 | 00 | char | 0x00 (0) | string terminator
+
+vector (AnnotatedBinary.Foo.accounts):
+ +0x01B4 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of vector (# items)
+ +0x01B8 | 09 00 | uint16_t | 0x0009 (9) | value[0]
+ +0x01BA | 08 00 | uint16_t | 0x0008 (8) | value[1]
+ +0x01BC | 07 00 | uint16_t | 0x0007 (7) | value[2]
+ +0x01BE | 01 00 | uint16_t | 0x0001 (1) | value[3]
+ +0x01C0 | 02 00 | uint16_t | 0x0002 (2) | value[4]
+ +0x01C2 | 03 00 | uint16_t | 0x0003 (3) | value[5]
+ +0x01C4 | 06 00 | uint16_t | 0x0006 (6) | value[6]
+ +0x01C6 | 05 00 | uint16_t | 0x0005 (5) | value[7]
+ +0x01C8 | 04 00 | uint16_t | 0x0004 (4) | value[8]
+
+padding:
+ +0x01CA | 00 00 | uint8_t[2] | .. | padding
+
+table (AnnotatedBinary.Baz):
+ +0x01CC | 3A FF FF FF | SOffset32 | 0xFFFFFF3A (-198) Loc: +0x0292 | offset to vtable
+ +0x01D0 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x01D3 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vector (AnnotatedBinary.Foo.bars):
+ +0x01D4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x01D8 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x021C | offset to table[0]
+ +0x01DC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x01EC | offset to table[1]
+
+padding:
+ +0x01E0 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x01E2 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x01E4 | 1A 00 | uint16_t | 0x001A (26) | size of referring table
+ +0x01E6 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x01E8 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x01EA | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x01EC | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x01E2 | offset to vtable
+ +0x01F0 | 00 80 23 44 | float | 0x44238000 (654) | table field `b` (Float)
+ +0x01F4 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x020C | offset to field `c` (table)
+ +0x01F8 | 00 00 00 00 00 D8 8E 40 | double | 0x408ED80000000000 (987) | table field `a` (Double)
+ +0x0200 | 00 00 00 00 00 00 | uint8_t[6] | ...... | padding
+
+vtable (AnnotatedBinary.Baz):
+ +0x0206 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x0208 | 06 00 | uint16_t | 0x0006 (6) | size of referring table
+ +0x020A | 05 00 | VOffset16 | 0x0005 (5) | offset to field `meal` (id: 0)
+
+table (AnnotatedBinary.Baz):
+ +0x020C | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: +0x0206 | offset to vtable
+ +0x0210 | 00 | uint8_t[1] | . | padding
+ +0x0211 | 03 | uint8_t | 0x03 (3) | table field `meal` (Byte)
+
+vtable (AnnotatedBinary.Bar):
+ +0x0212 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x0214 | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x0216 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x0218 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x021A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x021C | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x0212 | offset to vtable
+ +0x0220 | 00 00 E4 43 | float | 0x43E40000 (456) | table field `b` (Float)
+ +0x0224 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0234 | offset to field `c` (table)
+ +0x0228 | 00 00 00 00 00 C0 5E 40 | double | 0x405EC00000000000 (123) | table field `a` (Double)
+ +0x0230 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+table (AnnotatedBinary.Baz):
+ +0x0234 | A2 FF FF FF | SOffset32 | 0xFFFFFFA2 (-94) Loc: +0x0292 | offset to vtable
+ +0x0238 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x023B | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
+
+string (AnnotatedBinary.Foo.name):
+ +0x023C | 2F 00 00 00 | uint32_t | 0x0000002F (47) | length of string
+ +0x0240 | 54 68 69 73 20 69 73 20 | char[47] | This is | string literal
+ +0x0248 | 61 20 6C 6F 6E 67 20 73 | | a long s
+ +0x0250 | 74 72 69 6E 67 20 74 6F | | tring to
+ +0x0258 | 20 73 68 6F 77 20 68 6F | | show ho
+ +0x0260 | 77 20 69 74 20 62 72 65 | | w it bre
+ +0x0268 | 61 6B 73 20 75 70 2E | | aks up.
+ +0x026F | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0270 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Bar):
+ +0x0272 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x0274 | 16 00 | uint16_t | 0x0016 (22) | size of referring table
+ +0x0276 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `a` (id: 0)
+ +0x0278 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `b` (id: 1)
+ +0x027A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `c` (id: 2)
+
+table (AnnotatedBinary.Bar):
+ +0x027C | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x0272 | offset to vtable
+ +0x0280 | 65 20 71 49 | float | 0x49712065 (987654) | table field `b` (Float)
+ +0x0284 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0298 | offset to field `c` (table)
+ +0x0288 | C9 76 BE 9F 0C 24 FE 40 | double | 0x40FE240C9FBE76C9 (123457) | table field `a` (Double)
+ +0x0290 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Baz):
+ +0x0292 | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x0294 | 08 00 | uint16_t | 0x0008 (8) | size of referring table
+ +0x0296 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `meal` (id: 0)
+
+table (AnnotatedBinary.Baz):
+ +0x0298 | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: +0x0292 | offset to vtable
+ +0x029C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x029F | 01 | uint8_t | 0x01 (1) | table field `meal` (Byte)
diff --git a/tests/annotated_binary/tests/invalid_vtable_ref_table_size_short.bin b/tests/annotated_binary/tests/invalid_vtable_ref_table_size_short.bin
new file mode 100644
index 0000000..e1db9b7
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vtable_ref_table_size_short.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_vtable_size.afb b/tests/annotated_binary/tests/invalid_vtable_size.afb
new file mode 100644
index 0000000..43d14d5
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vtable_size.afb
@@ -0,0 +1,99 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_vtable_size.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x0008 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x000A | FF FF | uint16_t | 0xFFFF (65535) | ERROR: size of this vtable. Longer than the binary.
+
+unknown (no known references):
+ +0x000C | 68 00 0C 00 07 00 00 00 | ?uint8_t[660] | h....... | WARN: nothing refers to this section.
+ +0x0014 | 08 00 10 00 14 00 30 00 | | ......0.
+ +0x001C | 34 00 09 00 38 00 3C 00 | | 4...8.<.
+ +0x0024 | 40 00 44 00 00 00 00 00 | | @.D.....
+ +0x002C | 48 00 4C 00 50 00 54 00 | | H.L.P.T.
+ +0x0034 | 58 00 0A 00 5C 00 0B 00 | | X...\...
+ +0x003C | 60 00 00 00 00 00 64 00 | | `.....d.
+ +0x0044 | 3A 00 00 00 00 00 00 01 | | :.......
+ +0x004C | 02 02 01 01 D2 04 00 00 | | ........
+ +0x0054 | 28 02 00 00 01 00 00 00 | | (.......
+ +0x005C | 02 00 00 00 0C 00 00 00 | | ........
+ +0x0064 | 0A 00 00 00 0C 00 00 00 | | ........
+ +0x006C | 14 00 00 00 01 02 03 00 | | ........
+ +0x0074 | C8 01 00 00 5C 01 00 00 | | ....\...
+ +0x007C | 50 01 00 00 34 01 00 00 | | P...4...
+ +0x0084 | 24 01 00 00 14 01 00 00 | | $.......
+ +0x008C | 0D 00 00 00 DC 00 00 00 | | ........
+ +0x0094 | A0 00 00 00 94 00 00 00 | | ........
+ +0x009C | 38 00 00 00 33 00 00 00 | | 8...3...
+ +0x00A4 | 1C 00 00 00 04 00 00 00 | | ........
+ +0x00AC | 05 00 00 00 61 6C 69 63 | | ....alic
+ +0x00B4 | 65 00 00 00 08 00 13 00 | | e.......
+ +0x00BC | 08 00 04 00 08 00 00 00 | | ........
+ +0x00C4 | 00 80 23 44 00 00 00 00 | | ..#D....
+ +0x00CC | 00 10 74 40 00 00 00 05 | | ..t@....
+ +0x00D4 | 03 00 00 00 34 00 00 00 | | ....4...
+ +0x00DC | 2C 00 00 00 04 00 00 00 | | ,.......
+ +0x00E4 | D2 FE FF FF 00 80 23 44 | | ......#D
+ +0x00EC | 10 00 00 00 00 00 00 00 | | ........
+ +0x00F4 | 00 D8 8E 40 00 00 00 00 | | ...@....
+ +0x00FC | 6A FE FF FF 00 00 00 03 | | j.......
+ +0x0104 | 04 00 04 00 04 00 00 00 | | ........
+ +0x010C | FA FE FF FF 00 00 E4 43 | | .......C
+ +0x0114 | 10 00 00 00 00 00 00 00 | | ........
+ +0x011C | 00 C0 5E 40 00 00 00 00 | | ..^@....
+ +0x0124 | 92 FE FF FF 00 00 00 01 | | ........
+ +0x012C | 03 00 00 00 01 02 01 00 | | ........
+ +0x0134 | 03 00 00 00 33 33 33 33 | | ....3333
+ +0x013C | 33 A3 45 40 7E 57 04 FF | | 3.E@~W..
+ +0x0144 | 5B 87 53 C0 8D F0 F6 20 | | [.S....
+ +0x014C | 04 B6 42 40 9F 77 63 41 | | ..B@.wcA
+ +0x0154 | 61 85 5E C0 8F 35 23 83 | | a.^..5#.
+ +0x015C | DC 35 4B C0 F6 97 DD 93 | | .5K.....
+ +0x0164 | 87 C5 0A 40 00 00 00 00 | | ...@....
+ +0x016C | 03 00 00 00 20 00 00 00 | | .... ...
+ +0x0174 | 14 00 00 00 04 00 00 00 | | ........
+ +0x017C | 07 00 00 00 63 68 61 72 | | ....char
+ +0x0184 | 6C 69 65 00 03 00 00 00 | | lie.....
+ +0x018C | 62 6F 62 00 05 00 00 00 | | bob.....
+ +0x0194 | 61 6C 69 63 65 00 00 00 | | alice...
+ +0x019C | 07 00 00 00 63 68 61 72 | | ....char
+ +0x01A4 | 6C 69 65 00 07 00 00 00 | | lie.....
+ +0x01AC | 63 68 61 72 6C 69 65 00 | | charlie.
+ +0x01B4 | 09 00 00 00 09 00 08 00 | | ........
+ +0x01BC | 07 00 01 00 02 00 03 00 | | ........
+ +0x01C4 | 06 00 05 00 04 00 00 00 | | ........
+ +0x01CC | 3A FF FF FF 00 00 00 03 | | :.......
+ +0x01D4 | 02 00 00 00 44 00 00 00 | | ....D...
+ +0x01DC | 10 00 00 00 00 00 0A 00 | | ........
+ +0x01E4 | 1A 00 0C 00 04 00 08 00 | | ........
+ +0x01EC | 0A 00 00 00 00 80 23 44 | | ......#D
+ +0x01F4 | 18 00 00 00 00 00 00 00 | | ........
+ +0x01FC | 00 D8 8E 40 00 00 00 00 | | ...@....
+ +0x0204 | 00 00 06 00 06 00 05 00 | | ........
+ +0x020C | 06 00 00 00 00 03 0A 00 | | ........
+ +0x0214 | 18 00 0C 00 04 00 08 00 | | ........
+ +0x021C | 0A 00 00 00 00 00 E4 43 | | .......C
+ +0x0224 | 10 00 00 00 00 00 00 00 | | ........
+ +0x022C | 00 C0 5E 40 00 00 00 00 | | ..^@....
+ +0x0234 | A2 FF FF FF 00 00 00 01 | | ........
+ +0x023C | 2F 00 00 00 54 68 69 73 | | /...This
+ +0x0244 | 20 69 73 20 61 20 6C 6F | | is a lo
+ +0x024C | 6E 67 20 73 74 72 69 6E | | ng strin
+ +0x0254 | 67 20 74 6F 20 73 68 6F | | g to sho
+ +0x025C | 77 20 68 6F 77 20 69 74 | | w how it
+ +0x0264 | 20 62 72 65 61 6B 73 20 | | breaks
+ +0x026C | 75 70 2E 00 00 00 0A 00 | | up......
+ +0x0274 | 16 00 0C 00 04 00 08 00 | | ........
+ +0x027C | 0A 00 00 00 65 20 71 49 | | ....e qI
+ +0x0284 | 14 00 00 00 C9 76 BE 9F | | .....v..
+ +0x028C | 0C 24 FE 40 00 00 06 00 | | .$.@....
+ +0x0294 | 08 00 07 00 06 00 00 00 | | ........
+ +0x029C | 00 00 00 01 | | ....
diff --git a/tests/annotated_binary/tests/invalid_vtable_size.bin b/tests/annotated_binary/tests/invalid_vtable_size.bin
new file mode 100644
index 0000000..fdc7e98
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vtable_size.bin
Binary files differ
diff --git a/tests/annotated_binary/tests/invalid_vtable_size_short.afb b/tests/annotated_binary/tests/invalid_vtable_size_short.afb
new file mode 100644
index 0000000..4ba65f3
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vtable_size_short.afb
@@ -0,0 +1,99 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: annotated_binary.fbs
+// Binary file: tests/invalid_vtable_size_short.bin
+
+header:
+ +0x0000 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x0044 | offset to root table `AnnotatedBinary.Foo`
+ +0x0004 | 41 4E 4E 4F | char[4] | ANNO | File Identifier
+
+padding:
+ +0x0008 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (AnnotatedBinary.Foo):
+ +0x000A | 01 00 | uint16_t | 0x0001 (1) | ERROR: size of this vtable. Shorter than the minimum length:
+
+unknown (no known references):
+ +0x000C | 68 00 0C 00 07 00 00 00 | ?uint8_t[660] | h....... | WARN: nothing refers to this section.
+ +0x0014 | 08 00 10 00 14 00 30 00 | | ......0.
+ +0x001C | 34 00 09 00 38 00 3C 00 | | 4...8.<.
+ +0x0024 | 40 00 44 00 00 00 00 00 | | @.D.....
+ +0x002C | 48 00 4C 00 50 00 54 00 | | H.L.P.T.
+ +0x0034 | 58 00 0A 00 5C 00 0B 00 | | X...\...
+ +0x003C | 60 00 00 00 00 00 64 00 | | `.....d.
+ +0x0044 | 3A 00 00 00 00 00 00 01 | | :.......
+ +0x004C | 02 02 01 01 D2 04 00 00 | | ........
+ +0x0054 | 28 02 00 00 01 00 00 00 | | (.......
+ +0x005C | 02 00 00 00 0C 00 00 00 | | ........
+ +0x0064 | 0A 00 00 00 0C 00 00 00 | | ........
+ +0x006C | 14 00 00 00 01 02 03 00 | | ........
+ +0x0074 | C8 01 00 00 5C 01 00 00 | | ....\...
+ +0x007C | 50 01 00 00 34 01 00 00 | | P...4...
+ +0x0084 | 24 01 00 00 14 01 00 00 | | $.......
+ +0x008C | 0D 00 00 00 DC 00 00 00 | | ........
+ +0x0094 | A0 00 00 00 94 00 00 00 | | ........
+ +0x009C | 38 00 00 00 33 00 00 00 | | 8...3...
+ +0x00A4 | 1C 00 00 00 04 00 00 00 | | ........
+ +0x00AC | 05 00 00 00 61 6C 69 63 | | ....alic
+ +0x00B4 | 65 00 00 00 08 00 13 00 | | e.......
+ +0x00BC | 08 00 04 00 08 00 00 00 | | ........
+ +0x00C4 | 00 80 23 44 00 00 00 00 | | ..#D....
+ +0x00CC | 00 10 74 40 00 00 00 05 | | ..t@....
+ +0x00D4 | 03 00 00 00 34 00 00 00 | | ....4...
+ +0x00DC | 2C 00 00 00 04 00 00 00 | | ,.......
+ +0x00E4 | D2 FE FF FF 00 80 23 44 | | ......#D
+ +0x00EC | 10 00 00 00 00 00 00 00 | | ........
+ +0x00F4 | 00 D8 8E 40 00 00 00 00 | | ...@....
+ +0x00FC | 6A FE FF FF 00 00 00 03 | | j.......
+ +0x0104 | 04 00 04 00 04 00 00 00 | | ........
+ +0x010C | FA FE FF FF 00 00 E4 43 | | .......C
+ +0x0114 | 10 00 00 00 00 00 00 00 | | ........
+ +0x011C | 00 C0 5E 40 00 00 00 00 | | ..^@....
+ +0x0124 | 92 FE FF FF 00 00 00 01 | | ........
+ +0x012C | 03 00 00 00 01 02 01 00 | | ........
+ +0x0134 | 03 00 00 00 33 33 33 33 | | ....3333
+ +0x013C | 33 A3 45 40 7E 57 04 FF | | 3.E@~W..
+ +0x0144 | 5B 87 53 C0 8D F0 F6 20 | | [.S....
+ +0x014C | 04 B6 42 40 9F 77 63 41 | | ..B@.wcA
+ +0x0154 | 61 85 5E C0 8F 35 23 83 | | a.^..5#.
+ +0x015C | DC 35 4B C0 F6 97 DD 93 | | .5K.....
+ +0x0164 | 87 C5 0A 40 00 00 00 00 | | ...@....
+ +0x016C | 03 00 00 00 20 00 00 00 | | .... ...
+ +0x0174 | 14 00 00 00 04 00 00 00 | | ........
+ +0x017C | 07 00 00 00 63 68 61 72 | | ....char
+ +0x0184 | 6C 69 65 00 03 00 00 00 | | lie.....
+ +0x018C | 62 6F 62 00 05 00 00 00 | | bob.....
+ +0x0194 | 61 6C 69 63 65 00 00 00 | | alice...
+ +0x019C | 07 00 00 00 63 68 61 72 | | ....char
+ +0x01A4 | 6C 69 65 00 07 00 00 00 | | lie.....
+ +0x01AC | 63 68 61 72 6C 69 65 00 | | charlie.
+ +0x01B4 | 09 00 00 00 09 00 08 00 | | ........
+ +0x01BC | 07 00 01 00 02 00 03 00 | | ........
+ +0x01C4 | 06 00 05 00 04 00 00 00 | | ........
+ +0x01CC | 3A FF FF FF 00 00 00 03 | | :.......
+ +0x01D4 | 02 00 00 00 44 00 00 00 | | ....D...
+ +0x01DC | 10 00 00 00 00 00 0A 00 | | ........
+ +0x01E4 | 1A 00 0C 00 04 00 08 00 | | ........
+ +0x01EC | 0A 00 00 00 00 80 23 44 | | ......#D
+ +0x01F4 | 18 00 00 00 00 00 00 00 | | ........
+ +0x01FC | 00 D8 8E 40 00 00 00 00 | | ...@....
+ +0x0204 | 00 00 06 00 06 00 05 00 | | ........
+ +0x020C | 06 00 00 00 00 03 0A 00 | | ........
+ +0x0214 | 18 00 0C 00 04 00 08 00 | | ........
+ +0x021C | 0A 00 00 00 00 00 E4 43 | | .......C
+ +0x0224 | 10 00 00 00 00 00 00 00 | | ........
+ +0x022C | 00 C0 5E 40 00 00 00 00 | | ..^@....
+ +0x0234 | A2 FF FF FF 00 00 00 01 | | ........
+ +0x023C | 2F 00 00 00 54 68 69 73 | | /...This
+ +0x0244 | 20 69 73 20 61 20 6C 6F | | is a lo
+ +0x024C | 6E 67 20 73 74 72 69 6E | | ng strin
+ +0x0254 | 67 20 74 6F 20 73 68 6F | | g to sho
+ +0x025C | 77 20 68 6F 77 20 69 74 | | w how it
+ +0x0264 | 20 62 72 65 61 6B 73 20 | | breaks
+ +0x026C | 75 70 2E 00 00 00 0A 00 | | up......
+ +0x0274 | 16 00 0C 00 04 00 08 00 | | ........
+ +0x027C | 0A 00 00 00 65 20 71 49 | | ....e qI
+ +0x0284 | 14 00 00 00 C9 76 BE 9F | | .....v..
+ +0x028C | 0C 24 FE 40 00 00 06 00 | | .$.@....
+ +0x0294 | 08 00 07 00 06 00 00 00 | | ........
+ +0x029C | 00 00 00 01 | | ....
diff --git a/tests/annotated_binary/tests/invalid_vtable_size_short.bin b/tests/annotated_binary/tests/invalid_vtable_size_short.bin
new file mode 100644
index 0000000..435bd74
--- /dev/null
+++ b/tests/annotated_binary/tests/invalid_vtable_size_short.bin
Binary files differ
diff --git a/tests/arrays_test/mod.rs b/tests/arrays_test/mod.rs
index 83782dc..5a649d5 100644
--- a/tests/arrays_test/mod.rs
+++ b/tests/arrays_test/mod.rs
@@ -1,4 +1,5 @@
// Automatically generated by the Flatbuffers compiler. Do not modify.
+// @generated
pub mod my_game {
use super::*;
pub mod example {
diff --git a/tests/arrays_test/my_game/example/array_struct_generated.rs b/tests/arrays_test/my_game/example/array_struct_generated.rs
index dea3655..bf41696 100644
--- a/tests/arrays_test/my_game/example/array_struct_generated.rs
+++ b/tests/arrays_test/my_game/example/array_struct_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct ArrayStruct, aligned to 8
@@ -13,8 +18,8 @@
Self([0; 160])
}
}
-impl std::fmt::Debug for ArrayStruct {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for ArrayStruct {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("ArrayStruct")
.field("a", &self.a())
.field("b", &self.b())
@@ -47,7 +52,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(self as *const ArrayStruct as *const u8, Self::size())
+ ::core::slice::from_raw_parts(self as *const ArrayStruct as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -58,7 +63,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(*self as *const ArrayStruct as *const u8, Self::size())
+ ::core::slice::from_raw_parts(*self as *const ArrayStruct as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -158,7 +163,7 @@
pub fn set_d(&mut self, x: &[NestedStruct; 2]) {
unsafe {
- std::ptr::copy(
+ core::ptr::copy(
x.as_ptr() as *const u8,
self.0.as_mut_ptr().add(72),
64,
diff --git a/tests/arrays_test/my_game/example/array_table_generated.rs b/tests/arrays_test/my_game/example/array_table_generated.rs
index f46ac74..bc78fc1 100644
--- a/tests/arrays_test/my_game/example/array_table_generated.rs
+++ b/tests/arrays_test/my_game/example/array_table_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum ArrayTableOffset {}
@@ -103,8 +108,8 @@
}
}
-impl std::fmt::Debug for ArrayTable<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for ArrayTable<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("ArrayTable");
ds.field("a", &self.a());
ds.finish()
diff --git a/tests/arrays_test/my_game/example/nested_struct_generated.rs b/tests/arrays_test/my_game/example/nested_struct_generated.rs
index 48a6b91..337affc 100644
--- a/tests/arrays_test/my_game/example/nested_struct_generated.rs
+++ b/tests/arrays_test/my_game/example/nested_struct_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct NestedStruct, aligned to 8
@@ -13,8 +18,8 @@
Self([0; 32])
}
}
-impl std::fmt::Debug for NestedStruct {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for NestedStruct {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("NestedStruct")
.field("a", &self.a())
.field("b", &self.b())
@@ -45,7 +50,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(self as *const NestedStruct as *const u8, Self::size())
+ ::core::slice::from_raw_parts(self as *const NestedStruct as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -56,7 +61,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(*self as *const NestedStruct as *const u8, Self::size())
+ ::core::slice::from_raw_parts(*self as *const NestedStruct as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -129,7 +134,7 @@
pub fn set_c(&mut self, x: &[TestEnum; 2]) {
unsafe {
- std::ptr::copy(
+ core::ptr::copy(
x.as_ptr() as *const u8,
self.0.as_mut_ptr().add(9),
2,
diff --git a/tests/arrays_test/my_game/example/test_enum_generated.rs b/tests/arrays_test/my_game/example/test_enum_generated.rs
index 6dcc1cb..5252133 100644
--- a/tests/arrays_test/my_game/example/test_enum_generated.rs
+++ b/tests/arrays_test/my_game/example/test_enum_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
@@ -42,8 +47,8 @@
}
}
}
-impl std::fmt::Debug for TestEnum {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for TestEnum {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
diff --git a/tests/arrays_test_generated.h b/tests/arrays_test_generated.h
index 1300b92..090f464 100644
--- a/tests/arrays_test_generated.h
+++ b/tests/arrays_test_generated.h
@@ -6,6 +6,13 @@
#include "flatbuffers/flatbuffers.h"
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
+
namespace MyGame {
namespace Example {
@@ -364,7 +371,7 @@
(void)_rehasher;
(void)_o;
struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ArrayTableT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
- auto _a = _o->a ? _o->a.get() : 0;
+ auto _a = _o->a ? _o->a.get() : nullptr;
return MyGame::Example::CreateArrayTable(
_fbb,
_a);
diff --git a/tests/cpp17/generated_cpp17/monster_test_generated.h b/tests/cpp17/generated_cpp17/monster_test_generated.h
index 442ba50..be27b45 100644
--- a/tests/cpp17/generated_cpp17/monster_test_generated.h
+++ b/tests/cpp17/generated_cpp17/monster_test_generated.h
@@ -6,6 +6,14 @@
#include "flatbuffers/flatbuffers.h"
#include "flatbuffers/flexbuffers.h"
+#include "flatbuffers/flex_flat_util.h"
+
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
namespace MyGame {
@@ -35,6 +43,8 @@
struct StructOfStructs;
+struct StructOfStructsOfStructs;
+
struct Stat;
struct StatBuilder;
struct StatT;
@@ -73,6 +83,8 @@
inline const flatbuffers::TypeTable *StructOfStructsTypeTable();
+inline const flatbuffers::TypeTable *StructOfStructsOfStructsTypeTable();
+
inline const flatbuffers::TypeTable *StatTypeTable();
inline const flatbuffers::TypeTable *ReferrableTypeTable();
@@ -815,6 +827,47 @@
using FieldType = decltype(std::declval<type>().get_field<Index>());
};
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructOfStructsOfStructs FLATBUFFERS_FINAL_CLASS {
+ private:
+ MyGame::Example::StructOfStructs a_;
+
+ public:
+ struct Traits;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return StructOfStructsOfStructsTypeTable();
+ }
+ StructOfStructsOfStructs()
+ : a_() {
+ }
+ StructOfStructsOfStructs(const MyGame::Example::StructOfStructs &_a)
+ : a_(_a) {
+ }
+ const MyGame::Example::StructOfStructs &a() const {
+ return a_;
+ }
+ MyGame::Example::StructOfStructs &mutable_a() {
+ return a_;
+ }
+ template<size_t Index>
+ auto get_field() const {
+ if constexpr (Index == 0) return a();
+ else static_assert(Index != Index, "Invalid Field Index");
+ }
+};
+FLATBUFFERS_STRUCT_END(StructOfStructsOfStructs, 20);
+
+struct StructOfStructsOfStructs::Traits {
+ using type = StructOfStructsOfStructs;
+ static constexpr auto name = "StructOfStructsOfStructs";
+ static constexpr auto fully_qualified_name = "MyGame.Example.StructOfStructsOfStructs";
+ static constexpr size_t fields_number = 1;
+ static constexpr std::array<const char *, fields_number> field_names = {
+ "a"
+ };
+ template<size_t Index>
+ using FieldType = decltype(std::declval<type>().get_field<Index>());
+};
+
} // namespace Example
struct InParentNamespaceT : public flatbuffers::NativeTable {
@@ -2912,55 +2965,48 @@
{ auto _e = color(); _o->color = _e; }
{ auto _e = test_type(); _o->test.type = _e; }
{ auto _e = test(); if (_e) _o->test.value = MyGame::Example::AnyUnion::UnPack(_e, test_type(), _resolver); }
- { auto _e = test4(); if (_e) { _o->test4.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test4[_i] = *_e->Get(_i); } } }
- { auto _e = testarrayofstring(); if (_e) { _o->testarrayofstring.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring[_i] = _e->Get(_i)->str(); } } }
- { auto _e = testarrayoftables(); if (_e) { _o->testarrayoftables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->testarrayoftables[_i]) { _e->Get(_i)->UnPackTo(_o->testarrayoftables[_i].get(), _resolver); } else { _o->testarrayoftables[_i] = std::unique_ptr<MyGame::Example::MonsterT>(_e->Get(_i)->UnPack(_resolver)); }; } } }
- { auto _e = enemy(); if (_e) { if(_o->enemy) { _e->UnPackTo(_o->enemy.get(), _resolver); } else { _o->enemy = std::unique_ptr<MyGame::Example::MonsterT>(_e->UnPack(_resolver)); } } }
+ { auto _e = test4(); if (_e) { _o->test4.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test4[_i] = *_e->Get(_i); } } else { _o->test4.resize(0); } }
+ { auto _e = testarrayofstring(); if (_e) { _o->testarrayofstring.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring[_i] = _e->Get(_i)->str(); } } else { _o->testarrayofstring.resize(0); } }
+ { auto _e = testarrayoftables(); if (_e) { _o->testarrayoftables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->testarrayoftables[_i]) { _e->Get(_i)->UnPackTo(_o->testarrayoftables[_i].get(), _resolver); } else { _o->testarrayoftables[_i] = std::unique_ptr<MyGame::Example::MonsterT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->testarrayoftables.resize(0); } }
+ { auto _e = enemy(); if (_e) { if(_o->enemy) { _e->UnPackTo(_o->enemy.get(), _resolver); } else { _o->enemy = std::unique_ptr<MyGame::Example::MonsterT>(_e->UnPack(_resolver)); } } else if (_o->enemy) { _o->enemy.reset(); } }
{ auto _e = testnestedflatbuffer(); if (_e) { _o->testnestedflatbuffer.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->testnestedflatbuffer.begin()); } }
- { auto _e = testempty(); if (_e) { if(_o->testempty) { _e->UnPackTo(_o->testempty.get(), _resolver); } else { _o->testempty = std::unique_ptr<MyGame::Example::StatT>(_e->UnPack(_resolver)); } } }
+ { auto _e = testempty(); if (_e) { if(_o->testempty) { _e->UnPackTo(_o->testempty.get(), _resolver); } else { _o->testempty = std::unique_ptr<MyGame::Example::StatT>(_e->UnPack(_resolver)); } } else if (_o->testempty) { _o->testempty.reset(); } }
{ auto _e = testbool(); _o->testbool = _e; }
{ auto _e = testhashs32_fnv1(); _o->testhashs32_fnv1 = _e; }
{ auto _e = testhashu32_fnv1(); _o->testhashu32_fnv1 = _e; }
{ auto _e = testhashs64_fnv1(); _o->testhashs64_fnv1 = _e; }
{ auto _e = testhashu64_fnv1(); _o->testhashu64_fnv1 = _e; }
{ auto _e = testhashs32_fnv1a(); _o->testhashs32_fnv1a = _e; }
- { auto _e = testhashu32_fnv1a(); //scalar resolver, naked
-if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->testhashu32_fnv1a), static_cast<flatbuffers::hash_value_t>(_e)); else _o->testhashu32_fnv1a = nullptr; }
+ { auto _e = testhashu32_fnv1a(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->testhashu32_fnv1a), static_cast<flatbuffers::hash_value_t>(_e)); else _o->testhashu32_fnv1a = nullptr; }
{ auto _e = testhashs64_fnv1a(); _o->testhashs64_fnv1a = _e; }
{ auto _e = testhashu64_fnv1a(); _o->testhashu64_fnv1a = _e; }
- { auto _e = testarrayofbools(); if (_e) { _o->testarrayofbools.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofbools[_i] = _e->Get(_i) != 0; } } }
+ { auto _e = testarrayofbools(); if (_e) { _o->testarrayofbools.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofbools[_i] = _e->Get(_i) != 0; } } else { _o->testarrayofbools.resize(0); } }
{ auto _e = testf(); _o->testf = _e; }
{ auto _e = testf2(); _o->testf2 = _e; }
{ auto _e = testf3(); _o->testf3 = _e; }
- { auto _e = testarrayofstring2(); if (_e) { _o->testarrayofstring2.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring2[_i] = _e->Get(_i)->str(); } } }
- { auto _e = testarrayofsortedstruct(); if (_e) { _o->testarrayofsortedstruct.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofsortedstruct[_i] = *_e->Get(_i); } } }
+ { auto _e = testarrayofstring2(); if (_e) { _o->testarrayofstring2.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring2[_i] = _e->Get(_i)->str(); } } else { _o->testarrayofstring2.resize(0); } }
+ { auto _e = testarrayofsortedstruct(); if (_e) { _o->testarrayofsortedstruct.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofsortedstruct[_i] = *_e->Get(_i); } } else { _o->testarrayofsortedstruct.resize(0); } }
{ auto _e = flex(); if (_e) { _o->flex.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->flex.begin()); } }
- { auto _e = test5(); if (_e) { _o->test5.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test5[_i] = *_e->Get(_i); } } }
- { auto _e = vector_of_longs(); if (_e) { _o->vector_of_longs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_longs[_i] = _e->Get(_i); } } }
- { auto _e = vector_of_doubles(); if (_e) { _o->vector_of_doubles.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_doubles[_i] = _e->Get(_i); } } }
- { auto _e = parent_namespace_test(); if (_e) { if(_o->parent_namespace_test) { _e->UnPackTo(_o->parent_namespace_test.get(), _resolver); } else { _o->parent_namespace_test = std::unique_ptr<MyGame::InParentNamespaceT>(_e->UnPack(_resolver)); } } }
- { auto _e = vector_of_referrables(); if (_e) { _o->vector_of_referrables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->vector_of_referrables[_i]) { _e->Get(_i)->UnPackTo(_o->vector_of_referrables[_i].get(), _resolver); } else { _o->vector_of_referrables[_i] = std::unique_ptr<MyGame::Example::ReferrableT>(_e->Get(_i)->UnPack(_resolver)); }; } } }
- { auto _e = single_weak_reference(); //scalar resolver, naked
-if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->single_weak_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->single_weak_reference = nullptr; }
- { auto _e = vector_of_weak_references(); if (_e) { _o->vector_of_weak_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { //vector resolver, naked
-if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_weak_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i))); else _o->vector_of_weak_references[_i] = nullptr; } } }
- { auto _e = vector_of_strong_referrables(); if (_e) { _o->vector_of_strong_referrables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->vector_of_strong_referrables[_i]) { _e->Get(_i)->UnPackTo(_o->vector_of_strong_referrables[_i].get(), _resolver); } else { _o->vector_of_strong_referrables[_i] = std::unique_ptr<MyGame::Example::ReferrableT>(_e->Get(_i)->UnPack(_resolver)); }; } } }
- { auto _e = co_owning_reference(); //scalar resolver, naked
-if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->co_owning_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->co_owning_reference = nullptr; }
- { auto _e = vector_of_co_owning_references(); if (_e) { _o->vector_of_co_owning_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { //vector resolver, default_ptr_type
-if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_co_owning_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i)));/* else do nothing */; } } }
- { auto _e = non_owning_reference(); //scalar resolver, naked
-if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->non_owning_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->non_owning_reference = nullptr; }
- { auto _e = vector_of_non_owning_references(); if (_e) { _o->vector_of_non_owning_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { //vector resolver, naked
-if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_non_owning_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i))); else _o->vector_of_non_owning_references[_i] = nullptr; } } }
+ { auto _e = test5(); if (_e) { _o->test5.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test5[_i] = *_e->Get(_i); } } else { _o->test5.resize(0); } }
+ { auto _e = vector_of_longs(); if (_e) { _o->vector_of_longs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_longs[_i] = _e->Get(_i); } } else { _o->vector_of_longs.resize(0); } }
+ { auto _e = vector_of_doubles(); if (_e) { _o->vector_of_doubles.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_doubles[_i] = _e->Get(_i); } } else { _o->vector_of_doubles.resize(0); } }
+ { auto _e = parent_namespace_test(); if (_e) { if(_o->parent_namespace_test) { _e->UnPackTo(_o->parent_namespace_test.get(), _resolver); } else { _o->parent_namespace_test = std::unique_ptr<MyGame::InParentNamespaceT>(_e->UnPack(_resolver)); } } else if (_o->parent_namespace_test) { _o->parent_namespace_test.reset(); } }
+ { auto _e = vector_of_referrables(); if (_e) { _o->vector_of_referrables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->vector_of_referrables[_i]) { _e->Get(_i)->UnPackTo(_o->vector_of_referrables[_i].get(), _resolver); } else { _o->vector_of_referrables[_i] = std::unique_ptr<MyGame::Example::ReferrableT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->vector_of_referrables.resize(0); } }
+ { auto _e = single_weak_reference(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->single_weak_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->single_weak_reference = nullptr; }
+ { auto _e = vector_of_weak_references(); if (_e) { _o->vector_of_weak_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { /*vector resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_weak_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i))); else _o->vector_of_weak_references[_i] = nullptr; } } else { _o->vector_of_weak_references.resize(0); } }
+ { auto _e = vector_of_strong_referrables(); if (_e) { _o->vector_of_strong_referrables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->vector_of_strong_referrables[_i]) { _e->Get(_i)->UnPackTo(_o->vector_of_strong_referrables[_i].get(), _resolver); } else { _o->vector_of_strong_referrables[_i] = std::unique_ptr<MyGame::Example::ReferrableT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->vector_of_strong_referrables.resize(0); } }
+ { auto _e = co_owning_reference(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->co_owning_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->co_owning_reference = nullptr; }
+ { auto _e = vector_of_co_owning_references(); if (_e) { _o->vector_of_co_owning_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { /*vector resolver, default_ptr_type*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_co_owning_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i)));/* else do nothing */; } } else { _o->vector_of_co_owning_references.resize(0); } }
+ { auto _e = non_owning_reference(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->non_owning_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->non_owning_reference = nullptr; }
+ { auto _e = vector_of_non_owning_references(); if (_e) { _o->vector_of_non_owning_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { /*vector resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_non_owning_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i))); else _o->vector_of_non_owning_references[_i] = nullptr; } } else { _o->vector_of_non_owning_references.resize(0); } }
{ auto _e = any_unique_type(); _o->any_unique.type = _e; }
{ auto _e = any_unique(); if (_e) _o->any_unique.value = MyGame::Example::AnyUniqueAliasesUnion::UnPack(_e, any_unique_type(), _resolver); }
{ auto _e = any_ambiguous_type(); _o->any_ambiguous.type = _e; }
{ auto _e = any_ambiguous(); if (_e) _o->any_ambiguous.value = MyGame::Example::AnyAmbiguousAliasesUnion::UnPack(_e, any_ambiguous_type(), _resolver); }
- { auto _e = vector_of_enums(); if (_e) { _o->vector_of_enums.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_enums[_i] = static_cast<MyGame::Example::Color>(_e->Get(_i)); } } }
+ { auto _e = vector_of_enums(); if (_e) { _o->vector_of_enums.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_enums[_i] = static_cast<MyGame::Example::Color>(_e->Get(_i)); } } else { _o->vector_of_enums.resize(0); } }
{ auto _e = signed_enum(); _o->signed_enum = _e; }
{ auto _e = testrequirednestedflatbuffer(); if (_e) { _o->testrequirednestedflatbuffer.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->testrequirednestedflatbuffer.begin()); } }
- { auto _e = scalar_key_sorted_tables(); if (_e) { _o->scalar_key_sorted_tables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->scalar_key_sorted_tables[_i]) { _e->Get(_i)->UnPackTo(_o->scalar_key_sorted_tables[_i].get(), _resolver); } else { _o->scalar_key_sorted_tables[_i] = std::unique_ptr<MyGame::Example::StatT>(_e->Get(_i)->UnPack(_resolver)); }; } } }
+ { auto _e = scalar_key_sorted_tables(); if (_e) { _o->scalar_key_sorted_tables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->scalar_key_sorted_tables[_i]) { _e->Get(_i)->UnPackTo(_o->scalar_key_sorted_tables[_i].get(), _resolver); } else { _o->scalar_key_sorted_tables[_i] = std::unique_ptr<MyGame::Example::StatT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->scalar_key_sorted_tables.resize(0); } }
{ auto _e = native_inline(); if (_e) _o->native_inline = *_e; }
{ auto _e = long_enum_non_enum_default(); _o->long_enum_non_enum_default = _e; }
{ auto _e = long_enum_normal_default(); _o->long_enum_normal_default = _e; }
@@ -2974,7 +3020,7 @@
(void)_rehasher;
(void)_o;
struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const MonsterT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
- auto _pos = _o->pos ? _o->pos.get() : 0;
+ auto _pos = _o->pos ? _o->pos.get() : nullptr;
auto _mana = _o->mana;
auto _hp = _o->hp;
auto _name = _fbb.CreateString(_o->name);
@@ -3104,7 +3150,7 @@
{ auto _e = f32(); _o->f32 = _e; }
{ auto _e = f64(); _o->f64 = _e; }
{ auto _e = v8(); if (_e) { _o->v8.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->v8.begin()); } }
- { auto _e = vf64(); if (_e) { _o->vf64.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vf64[_i] = _e->Get(_i); } } }
+ { auto _e = vf64(); if (_e) { _o->vf64.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vf64[_i] = _e->Get(_i); } } else { _o->vf64.resize(0); } }
}
inline flatbuffers::Offset<TypeAliases> TypeAliases::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
@@ -3737,6 +3783,23 @@
return &tt;
}
+inline const flatbuffers::TypeTable *StructOfStructsOfStructsTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::StructOfStructsTypeTable
+ };
+ static const int64_t values[] = { 0, 20 };
+ static const char * const names[] = {
+ "a"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 1, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
inline const flatbuffers::TypeTable *StatTypeTable() {
static const flatbuffers::TypeCode type_codes[] = {
{ flatbuffers::ET_STRING, 0, -1 },
diff --git a/tests/cpp17/generated_cpp17/optional_scalars_generated.h b/tests/cpp17/generated_cpp17/optional_scalars_generated.h
index 24b5ccd..b4b0625 100644
--- a/tests/cpp17/generated_cpp17/optional_scalars_generated.h
+++ b/tests/cpp17/generated_cpp17/optional_scalars_generated.h
@@ -6,6 +6,13 @@
#include "flatbuffers/flatbuffers.h"
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
+
namespace optional_scalars {
struct ScalarStuff;
diff --git a/tests/cpp17/generated_cpp17/union_vector_generated.h b/tests/cpp17/generated_cpp17/union_vector_generated.h
index aa0daf8..5d45644 100644
--- a/tests/cpp17/generated_cpp17/union_vector_generated.h
+++ b/tests/cpp17/generated_cpp17/union_vector_generated.h
@@ -6,6 +6,13 @@
#include "flatbuffers/flatbuffers.h"
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
+
struct Attacker;
struct AttackerBuilder;
struct AttackerT;
@@ -760,8 +767,8 @@
(void)_resolver;
{ auto _e = main_character_type(); _o->main_character.type = _e; }
{ auto _e = main_character(); if (_e) _o->main_character.value = CharacterUnion::UnPack(_e, main_character_type(), _resolver); }
- { auto _e = characters_type(); if (_e) { _o->characters.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->characters[_i].type = static_cast<Character>(_e->Get(_i)); } } }
- { auto _e = characters(); if (_e) { _o->characters.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->characters[_i].value = CharacterUnion::UnPack(_e->Get(_i), characters_type()->GetEnum<Character>(_i), _resolver); } } }
+ { auto _e = characters_type(); if (_e) { _o->characters.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->characters[_i].type = static_cast<Character>(_e->Get(_i)); } } else { _o->characters.resize(0); } }
+ { auto _e = characters(); if (_e) { _o->characters.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->characters[_i].value = CharacterUnion::UnPack(_e->Get(_i), characters_type()->GetEnum<Character>(_i), _resolver); } } else { _o->characters.resize(0); } }
}
inline flatbuffers::Offset<Movie> Movie::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MovieT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
diff --git a/tests/cpp17/test_cpp17.cpp b/tests/cpp17/test_cpp17.cpp
index a17205a..cfba2b6 100644
--- a/tests/cpp17/test_cpp17.cpp
+++ b/tests/cpp17/test_cpp17.cpp
@@ -20,6 +20,7 @@
// This is an experimental feature and could change at any time.
#include "flatbuffers/flatbuffers.h"
+#include "flatbuffers/flex_flat_util.h"
#include "flatbuffers/flexbuffers.h"
#include "flatbuffers/idl.h"
#include "flatbuffers/minireflect.h"
@@ -46,6 +47,7 @@
/*******************************************************************************
** Build some FB objects.
*******************************************************************************/
+namespace {
const Monster *BuildMonster(flatbuffers::FlatBufferBuilder &fbb) {
using ::cpp17::MyGame::Example::Color;
using ::cpp17::MyGame::Example::MonsterBuilder;
@@ -144,6 +146,8 @@
any_unique_type = 0
any_ambiguous_type = 0
signed_enum = -1
+ long_enum_non_enum_default = 0
+ long_enum_normal_default = 2
})";
// Call a generic function that has no specific knowledge of the flatbuffer we
@@ -167,13 +171,13 @@
** Test Traits::FieldType
*******************************************************************************/
using pos_type = Monster::Traits::FieldType<0>;
-static_assert(std::is_same_v<pos_type, const Vec3*>);
+static_assert(std::is_same_v<pos_type, const Vec3 *>);
using mana_type = Monster::Traits::FieldType<1>;
static_assert(std::is_same_v<mana_type, int16_t>);
using name_type = Monster::Traits::FieldType<3>;
-static_assert(std::is_same_v<name_type, const flatbuffers::String*>);
+static_assert(std::is_same_v<name_type, const flatbuffers::String *>);
/*******************************************************************************
** Generic Create Function Test.
@@ -249,6 +253,7 @@
StringifyAnyFlatbuffersTypeTest();
return 0;
}
+} // namespace
int main(int /*argc*/, const char * /*argv*/[]) {
InitTestEngine();
diff --git a/tests/dictionary_lookup.fbs b/tests/dictionary_lookup.fbs
new file mode 100644
index 0000000..45b9dce
--- /dev/null
+++ b/tests/dictionary_lookup.fbs
@@ -0,0 +1,11 @@
+namespace DictionaryLookup;
+
+table LongFloatEntry {
+ key: long (key);
+ value: float;
+}
+
+table LongFloatMap {
+ entries: [LongFloatEntry];
+}
+root_type LongFloatMap;
diff --git a/tests/docker/languages/Dockerfile.testing.swift_5_2 b/tests/docker/languages/Dockerfile.testing.swift_5_2
index b309477..22995d2 100644
--- a/tests/docker/languages/Dockerfile.testing.swift_5_2
+++ b/tests/docker/languages/Dockerfile.testing.swift_5_2
@@ -4,5 +4,5 @@
RUN cp flatc_debian_stretch flatc
WORKDIR /code/tests
RUN swift --version
-WORKDIR /code/tests/FlatBuffers.Test.Swift
+WORKDIR /code/tests/swift/tests/
RUN sh SwiftTest.sh
diff --git a/tests/evolution_test.cpp b/tests/evolution_test.cpp
new file mode 100644
index 0000000..da0fd74
--- /dev/null
+++ b/tests/evolution_test.cpp
@@ -0,0 +1,139 @@
+#include "evolution_test.h"
+
+#include "evolution_test/evolution_v1_generated.h"
+#include "evolution_test/evolution_v2_generated.h"
+#include "flatbuffers/idl.h"
+#include "test_assert.h"
+
+namespace flatbuffers {
+namespace tests {
+
+void EvolutionTest(const std::string &tests_data_path) {
+ // VS10 does not support typed enums, exclude from tests
+#if !defined(_MSC_VER) || _MSC_VER >= 1700
+ const int NUM_VERSIONS = 2;
+ std::string schemas[NUM_VERSIONS];
+ std::string jsonfiles[NUM_VERSIONS];
+ std::vector<uint8_t> binaries[NUM_VERSIONS];
+
+ flatbuffers::IDLOptions idl_opts;
+ idl_opts.lang_to_generate |= flatbuffers::IDLOptions::kBinary;
+ flatbuffers::Parser parser(idl_opts);
+
+ // Load all the schema versions and their associated data.
+ for (int i = 0; i < NUM_VERSIONS; ++i) {
+ std::string schema = tests_data_path + "evolution_test/evolution_v" +
+ flatbuffers::NumToString(i + 1) + ".fbs";
+ TEST_ASSERT(flatbuffers::LoadFile(schema.c_str(), false, &schemas[i]));
+ std::string json = tests_data_path + "evolution_test/evolution_v" +
+ flatbuffers::NumToString(i + 1) + ".json";
+ TEST_ASSERT(flatbuffers::LoadFile(json.c_str(), false, &jsonfiles[i]));
+
+ TEST_ASSERT(parser.Parse(schemas[i].c_str()));
+ TEST_ASSERT(parser.Parse(jsonfiles[i].c_str()));
+
+ auto bufLen = parser.builder_.GetSize();
+ auto buf = parser.builder_.GetBufferPointer();
+ binaries[i].reserve(bufLen);
+ std::copy(buf, buf + bufLen, std::back_inserter(binaries[i]));
+ }
+
+ // Assert that all the verifiers for the different schema versions properly
+ // verify any version data.
+ for (int i = 0; i < NUM_VERSIONS; ++i) {
+ flatbuffers::Verifier verifier(&binaries[i].front(), binaries[i].size());
+ TEST_ASSERT(Evolution::V1::VerifyRootBuffer(verifier));
+ TEST_ASSERT(Evolution::V2::VerifyRootBuffer(verifier));
+ }
+
+ // Test backwards compatibility by reading old data with an evolved schema.
+ auto root_v1_viewed_from_v2 = Evolution::V2::GetRoot(&binaries[0].front());
+ // field 'k' is new in version 2, so it should be null.
+ TEST_ASSERT(nullptr == root_v1_viewed_from_v2->k());
+ // field 'l' is new in version 2 with a default of 56.
+ TEST_EQ(root_v1_viewed_from_v2->l(), 56);
+ // field 'c' of 'TableA' is new in version 2, so it should be null.
+ TEST_ASSERT(nullptr == root_v1_viewed_from_v2->e()->c());
+ // 'TableC' was added to field 'c' union in version 2, so it should be null.
+ TEST_ASSERT(nullptr == root_v1_viewed_from_v2->c_as_TableC());
+ // The field 'c' union should be of type 'TableB' regardless of schema version
+ TEST_ASSERT(root_v1_viewed_from_v2->c_type() == Evolution::V2::Union::TableB);
+ // The field 'f' was renamed to 'ff' in version 2, it should still be
+ // readable.
+ TEST_EQ(root_v1_viewed_from_v2->ff()->a(), 16);
+
+ // Test forwards compatibility by reading new data with an old schema.
+ auto root_v2_viewed_from_v1 = Evolution::V1::GetRoot(&binaries[1].front());
+ // The field 'c' union in version 2 is a new table (index = 3) and should
+ // still be accessible, but not interpretable.
+ TEST_EQ(static_cast<uint8_t>(root_v2_viewed_from_v1->c_type()), 3);
+ TEST_NOTNULL(root_v2_viewed_from_v1->c());
+ // The field 'd' enum in verison 2 has new members and should still be
+ // accessible, but not interpretable.
+ TEST_EQ(static_cast<int8_t>(root_v2_viewed_from_v1->d()), 3);
+ // The field 'a' in version 2 is deprecated and should return the default
+ // value (0) instead of the value stored in the in the buffer (42).
+ TEST_EQ(root_v2_viewed_from_v1->a(), 0);
+ // The field 'ff' was originally named 'f' in version 1, it should still be
+ // readable.
+ TEST_EQ(root_v2_viewed_from_v1->f()->a(), 35);
+#endif
+}
+
+void ConformTest() {
+ flatbuffers::Parser parser;
+ TEST_EQ(parser.Parse("table T { A:int; } enum E:byte { A }"), true);
+
+ auto test_conform = [](flatbuffers::Parser &parser1, const char *test,
+ const char *expected_err) {
+ flatbuffers::Parser parser2;
+ TEST_EQ(parser2.Parse(test), true);
+ auto err = parser2.ConformTo(parser1);
+ TEST_NOTNULL(strstr(err.c_str(), expected_err));
+ };
+
+ test_conform(parser, "table T { A:byte; }", "types differ for field");
+ test_conform(parser, "table T { B:int; A:int; }", "offsets differ for field");
+ test_conform(parser, "table T { A:int = 1; }", "defaults differ for field");
+ test_conform(parser, "table T { B:float; }",
+ "field renamed to different type");
+ test_conform(parser, "enum E:byte { B, A }", "values differ for enum");
+}
+
+void UnionDeprecationTest(const std::string& tests_data_path) {
+ const int NUM_VERSIONS = 2;
+ std::string schemas[NUM_VERSIONS];
+ std::string jsonfiles[NUM_VERSIONS];
+ std::vector<uint8_t> binaries[NUM_VERSIONS];
+
+ flatbuffers::IDLOptions idl_opts;
+ idl_opts.lang_to_generate |= flatbuffers::IDLOptions::kBinary;
+ flatbuffers::Parser parser(idl_opts);
+
+ // Load all the schema versions and their associated data.
+ for (int i = 0; i < NUM_VERSIONS; ++i) {
+ std::string schema = tests_data_path + "evolution_test/evolution_v" +
+ flatbuffers::NumToString(i + 1) + ".fbs";
+ TEST_ASSERT(flatbuffers::LoadFile(schema.c_str(), false, &schemas[i]));
+ std::string json = tests_data_path + "evolution_test/evolution_v" +
+ flatbuffers::NumToString(i + 1) + ".json";
+ TEST_ASSERT(flatbuffers::LoadFile(json.c_str(), false, &jsonfiles[i]));
+
+ TEST_ASSERT(parser.Parse(schemas[i].c_str()));
+ TEST_ASSERT(parser.Parse(jsonfiles[i].c_str()));
+
+ auto bufLen = parser.builder_.GetSize();
+ auto buf = parser.builder_.GetBufferPointer();
+ binaries[i].reserve(bufLen);
+ std::copy(buf, buf + bufLen, std::back_inserter(binaries[i]));
+ }
+
+ auto v2 = parser.LookupStruct("Evolution.V2.Root");
+ TEST_NOTNULL(v2);
+ auto j_type_field = v2->fields.Lookup("j_type");
+ TEST_NOTNULL(j_type_field);
+ TEST_ASSERT(j_type_field->deprecated);
+}
+
+} // namespace tests
+} // namespace flatbuffers
\ No newline at end of file
diff --git a/tests/evolution_test.h b/tests/evolution_test.h
new file mode 100644
index 0000000..3933c3b
--- /dev/null
+++ b/tests/evolution_test.h
@@ -0,0 +1,16 @@
+#ifndef TESTS_EVOLUTION_TEST_H
+#define TESTS_EVOLUTION_TEST_H
+
+#include <string>
+
+namespace flatbuffers {
+namespace tests {
+
+void EvolutionTest(const std::string &tests_data_path);
+void ConformTest();
+void UnionDeprecationTest(const std::string &tests_data_path);
+
+} // namespace tests
+} // namespace flatbuffers
+
+#endif
diff --git a/tests/evolution_test/evolution_v1_generated.h b/tests/evolution_test/evolution_v1_generated.h
index d5ddf8f..31370d8 100644
--- a/tests/evolution_test/evolution_v1_generated.h
+++ b/tests/evolution_test/evolution_v1_generated.h
@@ -6,6 +6,13 @@
#include "flatbuffers/flatbuffers.h"
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
+
namespace Evolution {
namespace V1 {
diff --git a/tests/evolution_test/evolution_v2_generated.h b/tests/evolution_test/evolution_v2_generated.h
index 2a0efcb..20d019c 100644
--- a/tests/evolution_test/evolution_v2_generated.h
+++ b/tests/evolution_test/evolution_v2_generated.h
@@ -6,6 +6,13 @@
#include "flatbuffers/flatbuffers.h"
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
+
namespace Evolution {
namespace V2 {
diff --git a/tests/flatc/bar/bar.fbs b/tests/flatc/bar/bar.fbs
new file mode 100644
index 0000000..afd4be9
--- /dev/null
+++ b/tests/flatc/bar/bar.fbs
@@ -0,0 +1,5 @@
+include "baz/baz.fbs";
+
+table Bar {
+ baz:Baz;
+}
\ No newline at end of file
diff --git a/tests/flatc/bar/bar_with_foo.fbs b/tests/flatc/bar/bar_with_foo.fbs
new file mode 100644
index 0000000..d5c0f9c
--- /dev/null
+++ b/tests/flatc/bar/bar_with_foo.fbs
@@ -0,0 +1,6 @@
+include "foo.fbs";
+include "baz/baz.fbs";
+
+table BarWithFoo {
+ foo:Foo;
+}
\ No newline at end of file
diff --git a/tests/flatc/bar/bar_with_ns.fbs b/tests/flatc/bar/bar_with_ns.fbs
new file mode 100644
index 0000000..f5a800d
--- /dev/null
+++ b/tests/flatc/bar/bar_with_ns.fbs
@@ -0,0 +1,14 @@
+include "baz/baz_with_ns.fbs";
+include "baz/baz.fbs";
+
+namespace bar;
+
+table Bar {
+ baz:baz.Baz;
+ baz2:Baz;
+ foo:Foo;
+}
+
+table Foo {
+ a:int;
+}
\ No newline at end of file
diff --git a/tests/flatc/bar/baz/baz.fbs b/tests/flatc/bar/baz/baz.fbs
new file mode 100644
index 0000000..254e980
--- /dev/null
+++ b/tests/flatc/bar/baz/baz.fbs
@@ -0,0 +1,6 @@
+enum Baz : short {
+ None = 0,
+ Red,
+ Green,
+ Blue,
+}
\ No newline at end of file
diff --git a/tests/flatc/bar/baz/baz_with_ns.fbs b/tests/flatc/bar/baz/baz_with_ns.fbs
new file mode 100644
index 0000000..d258413
--- /dev/null
+++ b/tests/flatc/bar/baz/baz_with_ns.fbs
@@ -0,0 +1,8 @@
+namespace baz;
+
+enum Baz : short {
+ None = 0,
+ Red,
+ Green,
+ Blue,
+}
\ No newline at end of file
diff --git a/tests/flatc/flatc_cpp_tests.py b/tests/flatc/flatc_cpp_tests.py
new file mode 100755
index 0000000..72b2e9d
--- /dev/null
+++ b/tests/flatc/flatc_cpp_tests.py
@@ -0,0 +1,254 @@
+# Copyright 2022 Google Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from flatc_test import *
+
+
+class CppTests:
+ def Flatten(self):
+ # Generate just foo with a "flatten" import of bar.
+ flatc(["--cpp", "foo.fbs"])
+
+ # Foo should be generated in place and include bar flatten
+ assert_file_and_contents("foo_generated.h", '#include "bar_generated.h"')
+
+ def FlattenAbsolutePath(self):
+ # Generate just foo with a "flatten" import of bar.
+ flatc(["--cpp", make_absolute("foo.fbs")])
+
+ # Foo should be generated in place and include bar flatten
+ assert_file_and_contents("foo_generated.h", '#include "bar_generated.h"')
+
+ def FlattenSubDirectory(self):
+ # Generate just foo with a "flatten" import of bar.
+ flatc(["--cpp", "bar/bar.fbs"])
+
+ # Bar should be generated in place and include baz
+ assert_file_and_contents("bar_generated.h", '#include "baz_generated.h"')
+
+ def FlattenOutPath(self):
+ # Generate just foo with a "flatten" import of bar.
+ flatc(["--cpp", "-o", ".tmp", "foo.fbs"])
+
+ # Foo should be generated in the out path and include bar flatten to the out path.
+ assert_file_and_contents(".tmp/foo_generated.h", '#include "bar_generated.h"')
+
+ def FlattenOutPathSuperDirectory(self):
+ # Generate just foo with a "flatten" import of bar.
+ flatc(["--cpp", "-o", "../.tmp", "foo.fbs"])
+
+ # Foo should be generated in the out path and include bar flatten to the out path.
+ assert_file_and_contents(
+ "../.tmp/foo_generated.h", '#include "bar_generated.h"'
+ )
+
+ def FlattenOutPathSubDirectory(self):
+ # Generate just foo with a "flatten" import of bar.
+ flatc(["--cpp", "-o", ".tmp", "bar/bar.fbs"])
+
+ # Bar should be generated in the out path and include baz flatten to the out path.
+ assert_file_and_contents(".tmp/bar_generated.h", '#include "baz_generated.h"')
+
+ def KeepPrefix(self):
+ # Generate just foo with the import of bar keeping the prefix of where it is located.
+ flatc(["--cpp", "--keep-prefix", "foo.fbs"])
+
+ assert_file_and_contents("foo_generated.h", '#include "bar/bar_generated.h"')
+
+ def KeepPrefixAbsolutePath(self):
+ # Generate just foo with the import of bar keeping the prefix of where it is located.
+ flatc(["--cpp", "--keep-prefix", make_absolute("foo.fbs")])
+
+ assert_file_and_contents("foo_generated.h", '#include "bar/bar_generated.h"')
+
+ def KeepPrefixSubDirectory(self):
+ # Generate with the import of bar keeping the prefix of where it is located.
+ flatc(["--cpp", "--keep-prefix", "bar/bar.fbs"])
+
+ assert_file_and_contents("bar_generated.h", '#include "baz/baz_generated.h"')
+
+ def KeepPrefixOutPath(self):
+ # Generate just foo with the import of bar keeping the prefix of where it is located.
+ flatc(["--cpp", "--keep-prefix", "-o", ".tmp", "foo.fbs"])
+
+ assert_file_and_contents(
+ ".tmp/foo_generated.h",
+ '#include "bar/bar_generated.h"',
+ )
+
+ def KeepPrefixOutPathSubDirectory(self):
+ # Generate with the import of bar keeping the prefix of where it is located.
+ flatc(["--cpp", "--keep-prefix", "-o", ".tmp", "bar/bar.fbs"])
+
+ assert_file_and_contents(
+ ".tmp/bar_generated.h", '#include "baz/baz_generated.h"'
+ )
+
+ def IncludePrefix(self):
+ # Generate just foo with the import of bar keeping the prefix of where it is located.
+ flatc(["--cpp", "--include-prefix", "test", "foo.fbs"])
+
+ assert_file_and_contents("foo_generated.h", '#include "test/bar_generated.h"')
+
+ def IncludePrefixAbolutePath(self):
+ # Generate just foo with the import of bar keeping the prefix of where it is located.
+ flatc(["--cpp", "--include-prefix", "test", make_absolute("foo.fbs")])
+
+ assert_file_and_contents("foo_generated.h", '#include "test/bar_generated.h"')
+
+ def IncludePrefixSubDirectory(self):
+ # Generate just foo with the import of bar keeping the prefix of where it is located.
+ flatc(["--cpp", "--include-prefix", "test", "bar/bar.fbs"])
+
+ assert_file_and_contents("bar_generated.h", '#include "test/baz_generated.h"')
+
+ def IncludePrefixOutPath(self):
+ # Generate just foo with the import of bar keeping the prefix of where it is located.
+ flatc(["--cpp", "--include-prefix", "test", "-o", ".tmp", "foo.fbs"])
+
+ assert_file_and_contents(
+ ".tmp/foo_generated.h", '#include "test/bar_generated.h"'
+ )
+
+ def IncludePrefixOutPathSubDirectory(self):
+ # Generate just foo with the import of bar keeping the prefix of where it is located.
+ flatc(["--cpp", "--include-prefix", "test", "-o", ".tmp", "bar/bar.fbs"])
+
+ assert_file_and_contents(
+ ".tmp/bar_generated.h", '#include "test/baz_generated.h"'
+ )
+
+ def KeepPrefixIncludePrefix(self):
+ # Generate just foo with the import of bar keeping the prefix of where it is located.
+ flatc(["--cpp", "--keep-prefix", "--include-prefix", "test", "foo.fbs"])
+
+ # The include prefix should come first, with the kept prefix next.
+ assert_file_and_contents(
+ "foo_generated.h", '#include "test/bar/bar_generated.h"'
+ )
+
+ def KeepPrefixIncludePrefixAbsolutePath(self):
+ # Generate just foo with the import of bar keeping the prefix of where it is located.
+ flatc(
+ [
+ "--cpp",
+ "--keep-prefix",
+ "--include-prefix",
+ "test",
+ make_absolute("foo.fbs"),
+ ]
+ )
+
+ # The include prefix should come first, with the kept prefix next.
+ assert_file_and_contents(
+ "foo_generated.h", '#include "test/bar/bar_generated.h"'
+ )
+
+ def KeepPrefixIncludePrefixSubDirectory(self):
+ # Generate just foo with the import of bar keeping the prefix of where it is located.
+ flatc(["--cpp", "--keep-prefix", "--include-prefix", "test", "bar/bar.fbs"])
+
+ # The include prefix should come first, with the kept prefix next.
+ assert_file_and_contents(
+ "bar_generated.h", '#include "test/baz/baz_generated.h"'
+ )
+
+ def KeepPrefixIncludePrefixOutPathSubDirectory(self):
+ # Generate just foo with the import of bar keeping the prefix of where it is located.
+ flatc(
+ [
+ "--cpp",
+ "--keep-prefix",
+ "--include-prefix",
+ "test",
+ "-o",
+ ".tmp",
+ "bar/bar.fbs",
+ ]
+ )
+
+ # The include prefix should come first, with the kept prefix next.
+ assert_file_and_contents(
+ ".tmp/bar_generated.h", '#include "test/baz/baz_generated.h"'
+ )
+
+ def KeepPrefixIncludePrefixOutPathSuperDirectory(self):
+ # Generate just foo with the import of bar keeping the prefix of where it is located.
+ flatc(
+ [
+ "--cpp",
+ "--keep-prefix",
+ "--include-prefix",
+ "test",
+ "-o",
+ "../.tmp",
+ "bar/bar.fbs",
+ ]
+ )
+
+ # The include prefix should come first, with the kept prefix next.
+ assert_file_and_contents(
+ "../.tmp/bar_generated.h", '#include "test/baz/baz_generated.h"'
+ )
+
+ def KeepPrefixIncludePrefixoutPathAbsoluePaths_SuperDirectoryReference(self):
+ # Generate bar_with_foo that references a type in a super directory.
+ flatc(
+ [
+ "--cpp",
+ "--keep-prefix",
+ "--include-prefix",
+ "generated",
+ "-I",
+ str(script_path.absolute()),
+ "-o",
+ str(Path(script_path, ".tmp").absolute()),
+ str(Path(script_path, "bar/bar_with_foo.fbs").absolute()),
+ ]
+ )
+
+ # The include prefix should come first, with the kept prefix next.
+ assert_file_and_contents(
+ ".tmp/bar_with_foo_generated.h",
+ [
+ '#include "generated/baz/baz_generated.h"',
+ '#include "generated/foo_generated.h"',
+ ],
+ )
+
+ def KeepPrefixIncludePrefixoutPath_SuperDirectoryReference(self):
+ # Generate bar_with_foo that references a type in a super directory.
+ flatc(
+ [
+ "--cpp",
+ "--keep-prefix",
+ "--include-prefix",
+ "generated",
+ "-I",
+ "./",
+ "-o",
+ ".tmp",
+ "bar/bar_with_foo.fbs",
+ ]
+ )
+
+ # The include prefix should come first, with the kept prefix next.
+ assert_file_and_contents(
+ ".tmp/bar_with_foo_generated.h",
+ [
+ '#include "generated/baz/baz_generated.h"',
+ '#include "generated/foo_generated.h"',
+ ],
+ unlink=False,
+ )
diff --git a/tests/flatc/flatc_test.py b/tests/flatc/flatc_test.py
new file mode 100755
index 0000000..fcc32c6
--- /dev/null
+++ b/tests/flatc/flatc_test.py
@@ -0,0 +1,127 @@
+# Copyright 2022 Google Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import argparse
+import platform
+import subprocess
+from pathlib import Path
+
+parser = argparse.ArgumentParser()
+parser.add_argument(
+ "--flatc", help="path of the Flat C compiler relative to the root directory"
+)
+
+args = parser.parse_args()
+
+# Get the path where this script is located so we can invoke the script from
+# any directory and have the paths work correctly.
+script_path = Path(__file__).parent.resolve()
+
+# Get the root path as an absolute path, so all derived paths are absolute.
+root_path = script_path.parent.parent.absolute()
+
+# Get the location of the flatc executable, reading from the first command line
+# argument or defaulting to default names.
+flatc_exe = Path(
+ ("flatc" if not platform.system() == "Windows" else "flatc.exe")
+ if not args.flatc
+ else args.flatc
+)
+
+# Find and assert flatc compiler is present.
+if root_path in flatc_exe.parents:
+ flatc_exe = flatc_exe.relative_to(root_path)
+flatc_path = Path(root_path, flatc_exe)
+assert flatc_path.exists(), "Cannot find the flatc compiler " + str(flatc_path)
+
+# Execute the flatc compiler with the specified parameters
+def flatc(options, cwd=script_path):
+ cmd = [str(flatc_path)] + options
+ subprocess.check_call(cmd, cwd=str(cwd))
+
+
+def make_absolute(filename, path=script_path):
+ return str(Path(path, filename).absolute())
+
+
+def assert_file_exists(filename, path=script_path):
+ file = Path(path, filename)
+ assert file.exists(), "could not find file: " + filename
+ return file
+
+
+def assert_file_doesnt_exists(filename, path=script_path):
+ file = Path(path, filename)
+ assert not file.exists(), "file exists but shouldn't: " + filename
+ return file
+
+
+def assert_file_contains(file, needles):
+ with open(file) as file:
+ contents = file.read()
+ for needle in [needles] if isinstance(needles, str) else needles:
+ assert needle in contents, (
+ "coudn't find '" + needle + "' in file: " + str(file)
+ )
+ return file
+
+
+def assert_file_doesnt_contains(file, needles):
+ with open(file) as file:
+ contents = file.read()
+ for needle in [needles] if isinstance(needles, str) else needles:
+ assert needle not in contents, (
+ "Found unexpected '" + needle + "' in file: " + str(file)
+ )
+ return file
+
+
+def assert_file_and_contents(
+ file, needle, doesnt_contain=None, path=script_path, unlink=True
+):
+ assert_file_contains(assert_file_exists(file, path), needle)
+ if doesnt_contain:
+ assert_file_doesnt_contains(assert_file_exists(file, path), doesnt_contain)
+ if unlink:
+ Path(path, file).unlink()
+
+
+def run_all(*modules):
+ failing = 0
+ passing = 0
+ for module in modules:
+ methods = [
+ func
+ for func in dir(module)
+ if callable(getattr(module, func)) and not func.startswith("__")
+ ]
+ module_failing = 0
+ module_passing = 0
+ for method in methods:
+ try:
+ print("{0}.{1}".format(module.__name__, method))
+ getattr(module, method)(module)
+ print(" [PASSED]")
+ module_passing = module_passing + 1
+ except Exception as e:
+ print(" [FAILED]: " + str(e))
+ module_failing = module_failing + 1
+ print(
+ "{0}: {1} of {2} passsed".format(
+ module.__name__, module_passing, module_passing + module_failing
+ )
+ )
+ passing = passing + module_passing
+ failing = failing + module_failing
+ return passing, failing
diff --git a/tests/flatc/flatc_ts_tests.py b/tests/flatc/flatc_ts_tests.py
new file mode 100755
index 0000000..6e444bc
--- /dev/null
+++ b/tests/flatc/flatc_ts_tests.py
@@ -0,0 +1,242 @@
+# Copyright 2022 Google Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from flatc_test import *
+
+
+class TsTests():
+
+ def Base(self):
+ # Generate just foo with no extra arguments
+ flatc(["--ts", "foo.fbs"])
+
+ # Should generate the module that exports both foo and its direct
+ # include, bar.
+ assert_file_and_contents(
+ "foo_generated.ts",
+ [
+ "export { Bar } from './bar.js';",
+ "export { Foo } from './foo.js';",
+ ],
+ )
+
+ # Foo should be generated in place and exports the Foo table.
+ assert_file_and_contents("foo.ts", "export class Foo {")
+
+ # Included files, like bar, should not be generated.
+ assert_file_doesnt_exists("bar.ts")
+
+ def BaseMultipleFiles(self):
+ # Generate both foo and bar with no extra arguments
+ flatc(["--ts", "foo.fbs", "bar/bar.fbs"])
+
+ # Should generate the module that exports both foo and its direct
+ # include, bar.
+ assert_file_and_contents(
+ "foo_generated.ts",
+ [
+ "export { Bar } from './bar.js';",
+ "export { Foo } from './foo.js';",
+ ],
+ )
+
+ # Foo should be generated in place and exports the Foo table.
+ assert_file_and_contents("foo.ts", "export class Foo {")
+
+ # Bar should also be generatd in place and exports the Bar table.
+ assert_file_and_contents("bar.ts", "export class Bar {")
+
+ def BaseWithNamespace(self):
+ # Generate foo with namespacing, with no extra arguments
+ flatc(["--ts", "foo_with_ns.fbs"])
+
+ # Should generate the module that exports both foo in its namespace
+ # directory and its direct include, bar.
+ assert_file_and_contents(
+ "foo_with_ns_generated.ts",
+ [
+ "export { Bar } from './bar/bar.js';",
+ "export { Foo } from './something/foo.js';",
+ ],
+ )
+
+ # Foo should be placed in the namespaced directory. It should export
+ # Foo, and the import of Bar should be relative to its location.
+ assert_file_and_contents(
+ "something/foo.ts",
+ [
+ "export class Foo {",
+ "import { Bar } from '../bar/bar.js';",
+ ],
+ )
+
+ # Included files, like bar, should not be generated.
+ assert_file_doesnt_exists("bar.ts")
+
+ def GenAll(self):
+ # Generate foo with generate all options
+ flatc(["--ts", "--gen-all", "foo.fbs"])
+
+ # Should generate a single file that exports all the generated types.
+ assert_file_and_contents(
+ "foo_generated.ts",
+ [
+ "export { Bar } from './bar.js'",
+ "export { Baz } from './baz.js'",
+ "export { Foo } from './foo.js'",
+ ],
+ )
+
+ # Foo should be generated with an import to Bar and an export of itself.
+ assert_file_and_contents(
+ "foo.ts",
+ [
+ "import { Bar } from './bar.js';",
+ "export class Foo {",
+ ],
+ )
+
+ # Bar should be generated with an import to Baz and an export of itself.
+ assert_file_and_contents(
+ "bar.ts",
+ [
+ "import { Baz } from './baz.js';",
+ "export class Bar {",
+ ],
+ )
+
+ # Baz should be generated with an export of itself.
+ assert_file_and_contents(
+ "baz.ts",
+ [
+ "export enum Baz {",
+ ],
+ )
+
+
+ def FlatFiles(self):
+ # Generate just foo with the flat files option
+ flatc(["--ts", "--ts-flat-files", "foo.fbs"])
+
+ # Should generate a single file that imports bar as a single file, and
+ # exports the Foo table.
+ assert_file_and_contents(
+ "foo_generated.ts",
+ [
+ "import {Bar as Bar} from './bar_generated.js';",
+ "export class Foo {",
+ ],
+ )
+
+ # The root type Foo should not be generated in its own file.
+ assert_file_doesnt_exists("foo.ts")
+
+ def FlatFilesWithNamespace(self):
+ # Generate just foo with the flat files option
+ flatc(["--ts", "--ts-flat-files", "foo_with_ns.fbs"])
+
+ # Should generate a single file that imports bar as a single file, and
+ # exports the Foo table.
+ assert_file_and_contents(
+ "foo_with_ns_generated.ts",
+ [
+ "import {Bar as Bar} from './bar_with_ns_generated.js';",
+ "export class Foo {",
+ ],
+ )
+
+ # The root type Foo should not be generated in its own file.
+ assert_file_doesnt_exists("foo.ts")
+
+ def FlatFilesMultipleFiles(self):
+ # Generate both foo and bar with the flat files option
+ flatc(["--ts", "--ts-flat-files", "foo.fbs", "bar/bar.fbs"])
+
+ # Should generate a single foo file that imports bar as a single file,
+ # and exports the Foo table.
+ assert_file_and_contents(
+ "foo_generated.ts",
+ [
+ "import {Bar as Bar} from './bar_generated.js';",
+ "export class Foo {",
+ ],
+ )
+
+ # Should generate a single bar file that imports bar as a single file,
+ # and exports the Bar table.
+ assert_file_and_contents(
+ "bar_generated.ts",
+ [
+ "import {Baz as Baz} from './baz_generated.js';",
+ "export class Bar {",
+ ],
+ )
+
+ # The types Foo and Bar should not be generated in their own files
+ assert_file_doesnt_exists("foo.ts")
+ assert_file_doesnt_exists("bar.ts")
+
+ def FlatFilesGenAll(self):
+ # Generate foo with all of its dependents with the flat files option
+ flatc(["--ts", "--ts-flat-files", "--gen-all", "foo.fbs"])
+
+ # Should generate a single foo file
+ assert_file_and_contents(
+ "foo_generated.ts",
+ # Should export each of the types within the single file
+ [
+ "export class Foo {",
+ "export class Bar {",
+ "export enum Baz {",
+ ],
+ # No includes for the dependent types should be present.
+ doesnt_contain=[
+ "import {Bar as Bar}",
+ "import {Baz as Baz}",
+ ],
+ )
+
+ # The types Foo, Bar and Baz should not be generated in their own files.
+ assert_file_doesnt_exists("foo.ts")
+ assert_file_doesnt_exists("bar.ts")
+ assert_file_doesnt_exists("baz.ts")
+
+
+ def ZFlatFilesGenAllWithNamespacing(self):
+ # Generate foo with all of its dependents with the flat files option
+ flatc(["--ts", "--ts-flat-files", "--gen-all", "foo_with_ns.fbs"])
+
+ # Should generate a single foo file
+ assert_file_and_contents(
+ "foo_with_ns_generated.ts",
+ # Should export each of the types within the single file
+ [
+ "export class bar_Bar {",
+ "export class bar_Foo {",
+ "export enum Baz {",
+ "export enum baz_Baz {",
+ "export class something_Foo {"
+ ],
+ # No includes for the dependent types should be present.
+ doesnt_contain=[
+ "import {Bar as Bar}",
+ "import {Baz as Baz}",
+ ],
+ )
+
+ # The types Foo, Bar and Baz should not be generated in their own files.
+ assert_file_doesnt_exists("foo.ts")
+ assert_file_doesnt_exists("bar.ts")
+ assert_file_doesnt_exists("baz.ts")
+
diff --git a/tests/flatc/foo.fbs b/tests/flatc/foo.fbs
new file mode 100644
index 0000000..a2f27aa
--- /dev/null
+++ b/tests/flatc/foo.fbs
@@ -0,0 +1,9 @@
+include "bar/bar.fbs";
+include "bar/bar_with_ns.fbs";
+
+table Foo {
+ bar:Bar;
+ bar2:bar.Bar;
+}
+
+root_type Foo;
\ No newline at end of file
diff --git a/tests/flatc/foo_with_ns.fbs b/tests/flatc/foo_with_ns.fbs
new file mode 100644
index 0000000..c348d9b
--- /dev/null
+++ b/tests/flatc/foo_with_ns.fbs
@@ -0,0 +1,9 @@
+include "bar/bar_with_ns.fbs";
+
+namespace something;
+
+table Foo {
+ bar:bar.Bar;
+}
+
+root_type Foo;
\ No newline at end of file
diff --git a/tests/flatc/main.py b/tests/flatc/main.py
new file mode 100755
index 0000000..1b6bee9
--- /dev/null
+++ b/tests/flatc/main.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+#
+# Copyright 2022 Google Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+
+from flatc_test import run_all
+from flatc_cpp_tests import CppTests
+from flatc_ts_tests import TsTests
+
+passing, failing = run_all(CppTests, TsTests)
+
+print("")
+print("{0} of {1} tests passed".format(passing, passing + failing))
+
+if failing > 0:
+ sys.exit(1)
diff --git a/tests/flexbuffers_test.cpp b/tests/flexbuffers_test.cpp
new file mode 100644
index 0000000..1b34f85
--- /dev/null
+++ b/tests/flexbuffers_test.cpp
@@ -0,0 +1,292 @@
+#include "flexbuffers_test.h"
+
+#include "flatbuffers/flexbuffers.h"
+#include "flatbuffers/idl.h"
+#include "is_quiet_nan.h"
+#include "test_assert.h"
+
+namespace flatbuffers {
+namespace tests {
+
+// Shortcuts for the infinity.
+static const auto infinity_d = std::numeric_limits<double>::infinity();
+
+void FlexBuffersTest() {
+ flexbuffers::Builder slb(512,
+ flexbuffers::BUILDER_FLAG_SHARE_KEYS_AND_STRINGS);
+
+ // Write the equivalent of:
+ // { vec: [ -100, "Fred", 4.0, false ], bar: [ 1, 2, 3 ], bar3: [ 1, 2, 3 ],
+ // foo: 100, bool: true, mymap: { foo: "Fred" } }
+
+ // It's possible to do this without std::function support as well.
+ slb.Map([&]() {
+ slb.Vector("vec", [&]() {
+ slb += -100; // Equivalent to slb.Add(-100) or slb.Int(-100);
+ slb += "Fred";
+ slb.IndirectFloat(4.0f);
+ auto i_f = slb.LastValue();
+ uint8_t blob[] = { 77 };
+ slb.Blob(blob, 1);
+ slb += false;
+ slb.ReuseValue(i_f);
+ });
+ int ints[] = { 1, 2, 3 };
+ slb.Vector("bar", ints, 3);
+ slb.FixedTypedVector("bar3", ints, 3);
+ bool bools[] = { true, false, true, false };
+ slb.Vector("bools", bools, 4);
+ slb.Bool("bool", true);
+ slb.Double("foo", 100);
+ slb.Map("mymap", [&]() {
+ slb.String("foo", "Fred"); // Testing key and string reuse.
+ });
+ });
+ slb.Finish();
+
+ // clang-format off
+ #ifdef FLATBUFFERS_TEST_VERBOSE
+ for (size_t i = 0; i < slb.GetBuffer().size(); i++)
+ printf("%d ", slb.GetBuffer().data()[i]);
+ printf("\n");
+ #endif
+ // clang-format on
+
+ std::vector<uint8_t> reuse_tracker;
+ TEST_EQ(flexbuffers::VerifyBuffer(slb.GetBuffer().data(),
+ slb.GetBuffer().size(), &reuse_tracker),
+ true);
+
+ auto map = flexbuffers::GetRoot(slb.GetBuffer()).AsMap();
+ TEST_EQ(map.size(), 7);
+ auto vec = map["vec"].AsVector();
+ TEST_EQ(vec.size(), 6);
+ TEST_EQ(vec[0].AsInt64(), -100);
+ TEST_EQ_STR(vec[1].AsString().c_str(), "Fred");
+ TEST_EQ(vec[1].AsInt64(), 0); // Number parsing failed.
+ TEST_EQ(vec[2].AsDouble(), 4.0);
+ TEST_EQ(vec[2].AsString().IsTheEmptyString(), true); // Wrong Type.
+ TEST_EQ_STR(vec[2].AsString().c_str(), ""); // This still works though.
+ TEST_EQ_STR(vec[2].ToString().c_str(), "4.0"); // Or have it converted.
+ // Few tests for templated version of As.
+ TEST_EQ(vec[0].As<int64_t>(), -100);
+ TEST_EQ_STR(vec[1].As<std::string>().c_str(), "Fred");
+ TEST_EQ(vec[1].As<int64_t>(), 0); // Number parsing failed.
+ TEST_EQ(vec[2].As<double>(), 4.0);
+ // Test that the blob can be accessed.
+ TEST_EQ(vec[3].IsBlob(), true);
+ auto blob = vec[3].AsBlob();
+ TEST_EQ(blob.size(), 1);
+ TEST_EQ(blob.data()[0], 77);
+ TEST_EQ(vec[4].IsBool(), true); // Check if type is a bool
+ TEST_EQ(vec[4].AsBool(), false); // Check if value is false
+ TEST_EQ(vec[5].AsDouble(), 4.0); // This is shared with vec[2] !
+ auto tvec = map["bar"].AsTypedVector();
+ TEST_EQ(tvec.size(), 3);
+ TEST_EQ(tvec[2].AsInt8(), 3);
+ auto tvec3 = map["bar3"].AsFixedTypedVector();
+ TEST_EQ(tvec3.size(), 3);
+ TEST_EQ(tvec3[2].AsInt8(), 3);
+ TEST_EQ(map["bool"].AsBool(), true);
+ auto tvecb = map["bools"].AsTypedVector();
+ TEST_EQ(tvecb.ElementType(), flexbuffers::FBT_BOOL);
+ TEST_EQ(map["foo"].AsUInt8(), 100);
+ TEST_EQ(map["unknown"].IsNull(), true);
+ auto mymap = map["mymap"].AsMap();
+ // These should be equal by pointer equality, since key and value are shared.
+ TEST_EQ(mymap.Keys()[0].AsKey(), map.Keys()[4].AsKey());
+ TEST_EQ(mymap.Values()[0].AsString().c_str(), vec[1].AsString().c_str());
+ // We can mutate values in the buffer.
+ TEST_EQ(vec[0].MutateInt(-99), true);
+ TEST_EQ(vec[0].AsInt64(), -99);
+ TEST_EQ(vec[1].MutateString("John"), true); // Size must match.
+ TEST_EQ_STR(vec[1].AsString().c_str(), "John");
+ TEST_EQ(vec[1].MutateString("Alfred"), false); // Too long.
+ TEST_EQ(vec[2].MutateFloat(2.0f), true);
+ TEST_EQ(vec[2].AsFloat(), 2.0f);
+ TEST_EQ(vec[2].MutateFloat(3.14159), false); // Double does not fit in float.
+ TEST_EQ(vec[4].AsBool(), false); // Is false before change
+ TEST_EQ(vec[4].MutateBool(true), true); // Can change a bool
+ TEST_EQ(vec[4].AsBool(), true); // Changed bool is now true
+
+ // Parse from JSON:
+ flatbuffers::Parser parser;
+ slb.Clear();
+ auto jsontest = "{ a: [ 123, 456.0 ], b: \"hello\", c: true, d: false }";
+ TEST_EQ(parser.ParseFlexBuffer(jsontest, nullptr, &slb), true);
+ TEST_EQ(flexbuffers::VerifyBuffer(slb.GetBuffer().data(),
+ slb.GetBuffer().size(), &reuse_tracker),
+ true);
+ auto jroot = flexbuffers::GetRoot(slb.GetBuffer());
+ auto jmap = jroot.AsMap();
+ auto jvec = jmap["a"].AsVector();
+ TEST_EQ(jvec[0].AsInt64(), 123);
+ TEST_EQ(jvec[1].AsDouble(), 456.0);
+ TEST_EQ_STR(jmap["b"].AsString().c_str(), "hello");
+ TEST_EQ(jmap["c"].IsBool(), true); // Parsed correctly to a bool
+ TEST_EQ(jmap["c"].AsBool(), true); // Parsed correctly to true
+ TEST_EQ(jmap["d"].IsBool(), true); // Parsed correctly to a bool
+ TEST_EQ(jmap["d"].AsBool(), false); // Parsed correctly to false
+ // And from FlexBuffer back to JSON:
+ auto jsonback = jroot.ToString();
+ TEST_EQ_STR(jsontest, jsonback.c_str());
+
+ slb.Clear();
+ slb.Vector([&]() {
+ for (int i = 0; i < 130; ++i) slb.Add(static_cast<uint8_t>(255));
+ slb.Vector([&]() {
+ for (int i = 0; i < 130; ++i) slb.Add(static_cast<uint8_t>(255));
+ slb.Vector([] {});
+ });
+ });
+ slb.Finish();
+ TEST_EQ(slb.GetSize(), 664);
+}
+
+void FlexBuffersReuseBugTest() {
+ flexbuffers::Builder slb;
+ slb.Map([&]() {
+ slb.Vector("vec", [&]() {});
+ slb.Bool("bool", true);
+ });
+ slb.Finish();
+ std::vector<uint8_t> reuse_tracker;
+ // This would fail before, since the reuse_tracker would use the address of
+ // the vector reference to check for reuse, but in this case we have an empty
+ // vector, and since the size field is before the pointer, its address is the
+ // same as thing after it, the key "bool".
+ // We fix this by using the address of the size field for tracking reuse.
+ TEST_EQ(flexbuffers::VerifyBuffer(slb.GetBuffer().data(),
+ slb.GetBuffer().size(), &reuse_tracker),
+ true);
+}
+
+void FlexBuffersFloatingPointTest() {
+#if defined(FLATBUFFERS_HAS_NEW_STRTOD) && (FLATBUFFERS_HAS_NEW_STRTOD > 0)
+ flexbuffers::Builder slb(512,
+ flexbuffers::BUILDER_FLAG_SHARE_KEYS_AND_STRINGS);
+ // Parse floating-point values from JSON:
+ flatbuffers::Parser parser;
+ slb.Clear();
+ auto jsontest =
+ "{ a: [1.0, nan, inf, infinity, -inf, +inf, -infinity, 8.0] }";
+ TEST_EQ(parser.ParseFlexBuffer(jsontest, nullptr, &slb), true);
+ auto jroot = flexbuffers::GetRoot(slb.GetBuffer());
+ TEST_EQ(flexbuffers::VerifyBuffer(slb.GetBuffer().data(),
+ slb.GetBuffer().size(), nullptr),
+ true);
+ auto jmap = jroot.AsMap();
+ auto jvec = jmap["a"].AsVector();
+ TEST_EQ(8, jvec.size());
+ TEST_EQ(1.0, jvec[0].AsDouble());
+ TEST_ASSERT(is_quiet_nan(jvec[1].AsDouble()));
+ TEST_EQ(infinity_d, jvec[2].AsDouble());
+ TEST_EQ(infinity_d, jvec[3].AsDouble());
+ TEST_EQ(-infinity_d, jvec[4].AsDouble());
+ TEST_EQ(+infinity_d, jvec[5].AsDouble());
+ TEST_EQ(-infinity_d, jvec[6].AsDouble());
+ TEST_EQ(8.0, jvec[7].AsDouble());
+#endif
+}
+
+void FlexBuffersDeprecatedTest() {
+ // FlexBuffers as originally designed had a flaw involving the
+ // FBT_VECTOR_STRING datatype, and this test documents/tests the fix for it.
+ // Discussion: https://github.com/google/flatbuffers/issues/5627
+ flexbuffers::Builder slb;
+ // FBT_VECTOR_* are "typed vectors" where all elements are of the same type.
+ // Problem is, when storing FBT_STRING elements, it relies on that type to
+ // get the bit-width for the size field of the string, which in this case
+ // isn't present, and instead defaults to 8-bit. This means that any strings
+ // stored inside such a vector, when accessed thru the old API that returns
+ // a String reference, will appear to be truncated if the string stored is
+ // actually >=256 bytes.
+ std::string test_data(300, 'A');
+ auto start = slb.StartVector();
+ // This one will have a 16-bit size field.
+ slb.String(test_data);
+ // This one will have an 8-bit size field.
+ slb.String("hello");
+ // We're asking this to be serialized as a typed vector (true), but not
+ // fixed size (false). The type will be FBT_VECTOR_STRING with a bit-width
+ // of whatever the offsets in the vector need, the bit-widths of the strings
+ // are not stored(!) <- the actual design flaw.
+ // Note that even in the fixed code, we continue to serialize the elements of
+ // FBT_VECTOR_STRING as FBT_STRING, since there may be old code out there
+ // reading new data that we want to continue to function.
+ // Thus, FBT_VECTOR_STRING, while deprecated, will always be represented the
+ // same way, the fix lies on the reading side.
+ slb.EndVector(start, true, false);
+ slb.Finish();
+ // Verify because why not.
+ TEST_EQ(flexbuffers::VerifyBuffer(slb.GetBuffer().data(),
+ slb.GetBuffer().size(), nullptr),
+ true);
+ // So now lets read this data back.
+ // For existing data, since we have no way of knowing what the actual
+ // bit-width of the size field of the string is, we are going to ignore this
+ // field, and instead treat these strings as FBT_KEY (null-terminated), so we
+ // can deal with strings of arbitrary length. This of course truncates strings
+ // with embedded nulls, but we think that that is preferrable over truncating
+ // strings >= 256 bytes.
+ auto vec = flexbuffers::GetRoot(slb.GetBuffer()).AsTypedVector();
+ // Even though this was serialized as FBT_VECTOR_STRING, it is read as
+ // FBT_VECTOR_KEY:
+ TEST_EQ(vec.ElementType(), flexbuffers::FBT_KEY);
+ // Access the long string. Previously, this would return a string of size 1,
+ // since it would read the high-byte of the 16-bit length.
+ // This should now correctly test the full 300 bytes, using AsKey():
+ TEST_EQ_STR(vec[0].AsKey(), test_data.c_str());
+ // Old code that called AsString will continue to work, as the String
+ // accessor objects now use a cached size that can come from a key as well.
+ TEST_EQ_STR(vec[0].AsString().c_str(), test_data.c_str());
+ // Short strings work as before:
+ TEST_EQ_STR(vec[1].AsKey(), "hello");
+ TEST_EQ_STR(vec[1].AsString().c_str(), "hello");
+ // So, while existing code and data mostly "just work" with the fixes applied
+ // to AsTypedVector and AsString, what do you do going forward?
+ // Code accessing existing data doesn't necessarily need to change, though
+ // you could consider using AsKey instead of AsString for a) documenting
+ // that you are accessing keys, or b) a speedup if you don't actually use
+ // the string size.
+ // For new data, or data that doesn't need to be backwards compatible,
+ // instead serialize as FBT_VECTOR (call EndVector with typed = false, then
+ // read elements with AsString), or, for maximum compactness, use
+ // FBT_VECTOR_KEY (call slb.Key above instead, read with AsKey or AsString).
+}
+
+void ParseFlexbuffersFromJsonWithNullTest() {
+ // Test nulls are handled appropriately through flexbuffers to exercise other
+ // code paths of ParseSingleValue in the optional scalars change.
+ // TODO(cneo): Json -> Flatbuffers test once some language can generate code
+ // with optional scalars.
+ {
+ char json[] = "{\"opt_field\": 123 }";
+ flatbuffers::Parser parser;
+ flexbuffers::Builder flexbuild;
+ parser.ParseFlexBuffer(json, nullptr, &flexbuild);
+ auto root = flexbuffers::GetRoot(flexbuild.GetBuffer());
+ TEST_EQ(root.AsMap()["opt_field"].AsInt64(), 123);
+ }
+ {
+ char json[] = "{\"opt_field\": 123.4 }";
+ flatbuffers::Parser parser;
+ flexbuffers::Builder flexbuild;
+ parser.ParseFlexBuffer(json, nullptr, &flexbuild);
+ auto root = flexbuffers::GetRoot(flexbuild.GetBuffer());
+ TEST_EQ(root.AsMap()["opt_field"].AsDouble(), 123.4);
+ }
+ {
+ char json[] = "{\"opt_field\": null }";
+ flatbuffers::Parser parser;
+ flexbuffers::Builder flexbuild;
+ parser.ParseFlexBuffer(json, nullptr, &flexbuild);
+ auto root = flexbuffers::GetRoot(flexbuild.GetBuffer());
+ TEST_ASSERT(!root.AsMap().IsTheEmptyMap());
+ TEST_ASSERT(root.AsMap()["opt_field"].IsNull());
+ TEST_EQ(root.ToString(), std::string("{ opt_field: null }"));
+ }
+}
+
+} // namespace tests
+} // namespace flatbuffers
\ No newline at end of file
diff --git a/tests/flexbuffers_test.h b/tests/flexbuffers_test.h
new file mode 100644
index 0000000..02a10b6
--- /dev/null
+++ b/tests/flexbuffers_test.h
@@ -0,0 +1,16 @@
+#ifndef TESTS_FLEXBUFFERS_TEST_H
+#define TESTS_FLEXBUFFERS_TEST_H
+
+namespace flatbuffers {
+namespace tests {
+
+void FlexBuffersTest();
+void FlexBuffersReuseBugTest();
+void FlexBuffersFloatingPointTest();
+void FlexBuffersDeprecatedTest();
+void ParseFlexbuffersFromJsonWithNullTest();
+
+} // namespace tests
+} // namespace flatbuffers
+
+#endif // TESTS_FLEXBUFFERS_TEST_H
\ No newline at end of file
diff --git a/tests/fuzz_test.cpp b/tests/fuzz_test.cpp
new file mode 100644
index 0000000..66883fa
--- /dev/null
+++ b/tests/fuzz_test.cpp
@@ -0,0 +1,305 @@
+#include "fuzz_test.h"
+
+#include "flatbuffers/flatbuffers.h"
+#include "flatbuffers/idl.h"
+#include "test_assert.h"
+
+namespace flatbuffers {
+namespace tests {
+namespace {
+
+// Include simple random number generator to ensure results will be the
+// same cross platform.
+// http://en.wikipedia.org/wiki/Park%E2%80%93Miller_random_number_generator
+uint32_t lcg_seed = 48271;
+uint32_t lcg_rand() {
+ return lcg_seed =
+ (static_cast<uint64_t>(lcg_seed) * 279470273UL) % 4294967291UL;
+}
+void lcg_reset() { lcg_seed = 48271; }
+
+template<typename T>
+static void CompareTableFieldValue(flatbuffers::Table *table,
+ flatbuffers::voffset_t voffset, T val) {
+ T read = table->GetField(voffset, static_cast<T>(0));
+ TEST_EQ(read, val);
+}
+
+} // namespace
+
+// Low level stress/fuzz test: serialize/deserialize a variety of
+// different kinds of data in different combinations
+void FuzzTest1() {
+ // Values we're testing against: chosen to ensure no bits get chopped
+ // off anywhere, and also be different from eachother.
+ const uint8_t bool_val = true;
+ const int8_t char_val = -127; // 0x81
+ const uint8_t uchar_val = 0xFF;
+ const int16_t short_val = -32222; // 0x8222;
+ const uint16_t ushort_val = 0xFEEE;
+ const int32_t int_val = 0x83333333;
+ const uint32_t uint_val = 0xFDDDDDDD;
+ const int64_t long_val = 0x8444444444444444LL;
+ const uint64_t ulong_val = 0xFCCCCCCCCCCCCCCCULL;
+ const float float_val = 3.14159f;
+ const double double_val = 3.14159265359;
+
+ const int test_values_max = 11;
+ const flatbuffers::voffset_t fields_per_object = 4;
+ const int num_fuzz_objects = 10000; // The higher, the more thorough :)
+
+ flatbuffers::FlatBufferBuilder builder;
+
+ lcg_reset(); // Keep it deterministic.
+
+ flatbuffers::uoffset_t objects[num_fuzz_objects];
+
+ // Generate num_fuzz_objects random objects each consisting of
+ // fields_per_object fields, each of a random type.
+ for (int i = 0; i < num_fuzz_objects; i++) {
+ auto start = builder.StartTable();
+ for (flatbuffers::voffset_t f = 0; f < fields_per_object; f++) {
+ int choice = lcg_rand() % test_values_max;
+ auto off = flatbuffers::FieldIndexToOffset(f);
+ switch (choice) {
+ case 0: builder.AddElement<uint8_t>(off, bool_val, 0); break;
+ case 1: builder.AddElement<int8_t>(off, char_val, 0); break;
+ case 2: builder.AddElement<uint8_t>(off, uchar_val, 0); break;
+ case 3: builder.AddElement<int16_t>(off, short_val, 0); break;
+ case 4: builder.AddElement<uint16_t>(off, ushort_val, 0); break;
+ case 5: builder.AddElement<int32_t>(off, int_val, 0); break;
+ case 6: builder.AddElement<uint32_t>(off, uint_val, 0); break;
+ case 7: builder.AddElement<int64_t>(off, long_val, 0); break;
+ case 8: builder.AddElement<uint64_t>(off, ulong_val, 0); break;
+ case 9: builder.AddElement<float>(off, float_val, 0); break;
+ case 10: builder.AddElement<double>(off, double_val, 0); break;
+ }
+ }
+ objects[i] = builder.EndTable(start);
+ }
+ builder.PreAlign<flatbuffers::largest_scalar_t>(0); // Align whole buffer.
+
+ lcg_reset(); // Reset.
+
+ uint8_t *eob = builder.GetCurrentBufferPointer() + builder.GetSize();
+
+ // Test that all objects we generated are readable and return the
+ // expected values. We generate random objects in the same order
+ // so this is deterministic.
+ for (int i = 0; i < num_fuzz_objects; i++) {
+ auto table = reinterpret_cast<flatbuffers::Table *>(eob - objects[i]);
+ for (flatbuffers::voffset_t f = 0; f < fields_per_object; f++) {
+ int choice = lcg_rand() % test_values_max;
+ flatbuffers::voffset_t off = flatbuffers::FieldIndexToOffset(f);
+ switch (choice) {
+ case 0: CompareTableFieldValue(table, off, bool_val); break;
+ case 1: CompareTableFieldValue(table, off, char_val); break;
+ case 2: CompareTableFieldValue(table, off, uchar_val); break;
+ case 3: CompareTableFieldValue(table, off, short_val); break;
+ case 4: CompareTableFieldValue(table, off, ushort_val); break;
+ case 5: CompareTableFieldValue(table, off, int_val); break;
+ case 6: CompareTableFieldValue(table, off, uint_val); break;
+ case 7: CompareTableFieldValue(table, off, long_val); break;
+ case 8: CompareTableFieldValue(table, off, ulong_val); break;
+ case 9: CompareTableFieldValue(table, off, float_val); break;
+ case 10: CompareTableFieldValue(table, off, double_val); break;
+ }
+ }
+ }
+}
+
+// High level stress/fuzz test: generate a big schema and
+// matching json data in random combinations, then parse both,
+// generate json back from the binary, and compare with the original.
+void FuzzTest2() {
+ lcg_reset(); // Keep it deterministic.
+
+ const int num_definitions = 30;
+ const int num_struct_definitions = 5; // Subset of num_definitions.
+ const int fields_per_definition = 15;
+ const int instances_per_definition = 5;
+ const int deprecation_rate = 10; // 1 in deprecation_rate fields will
+ // be deprecated.
+
+ std::string schema = "namespace test;\n\n";
+
+ struct RndDef {
+ std::string instances[instances_per_definition];
+
+ // Since we're generating schema and corresponding data in tandem,
+ // this convenience function adds strings to both at once.
+ static void Add(RndDef (&definitions_l)[num_definitions],
+ std::string &schema_l, const int instances_per_definition_l,
+ const char *schema_add, const char *instance_add,
+ int definition) {
+ schema_l += schema_add;
+ for (int i = 0; i < instances_per_definition_l; i++)
+ definitions_l[definition].instances[i] += instance_add;
+ }
+ };
+
+ // clang-format off
+ #define AddToSchemaAndInstances(schema_add, instance_add) \
+ RndDef::Add(definitions, schema, instances_per_definition, \
+ schema_add, instance_add, definition)
+
+ #define Dummy() \
+ RndDef::Add(definitions, schema, instances_per_definition, \
+ "byte", "1", definition)
+ // clang-format on
+
+ RndDef definitions[num_definitions];
+
+ // We are going to generate num_definitions, the first
+ // num_struct_definitions will be structs, the rest tables. For each
+ // generate random fields, some of which may be struct/table types
+ // referring to previously generated structs/tables.
+ // Simultanenously, we generate instances_per_definition JSON data
+ // definitions, which will have identical structure to the schema
+ // being generated. We generate multiple instances such that when creating
+ // hierarchy, we get some variety by picking one randomly.
+ for (int definition = 0; definition < num_definitions; definition++) {
+ std::string definition_name = "D" + flatbuffers::NumToString(definition);
+
+ bool is_struct = definition < num_struct_definitions;
+
+ AddToSchemaAndInstances(
+ ((is_struct ? "struct " : "table ") + definition_name + " {\n").c_str(),
+ "{\n");
+
+ for (int field = 0; field < fields_per_definition; field++) {
+ const bool is_last_field = field == fields_per_definition - 1;
+
+ // Deprecate 1 in deprecation_rate fields. Only table fields can be
+ // deprecated.
+ // Don't deprecate the last field to avoid dangling commas in JSON.
+ const bool deprecated =
+ !is_struct && !is_last_field && (lcg_rand() % deprecation_rate == 0);
+
+ std::string field_name = "f" + flatbuffers::NumToString(field);
+ AddToSchemaAndInstances((" " + field_name + ":").c_str(),
+ deprecated ? "" : (field_name + ": ").c_str());
+ // Pick random type:
+ auto base_type = static_cast<flatbuffers::BaseType>(
+ lcg_rand() % (flatbuffers::BASE_TYPE_UNION + 1));
+ switch (base_type) {
+ case flatbuffers::BASE_TYPE_STRING:
+ if (is_struct) {
+ Dummy(); // No strings in structs.
+ } else {
+ AddToSchemaAndInstances("string", deprecated ? "" : "\"hi\"");
+ }
+ break;
+ case flatbuffers::BASE_TYPE_VECTOR:
+ if (is_struct) {
+ Dummy(); // No vectors in structs.
+ } else {
+ AddToSchemaAndInstances("[ubyte]",
+ deprecated ? "" : "[\n0,\n1,\n255\n]");
+ }
+ break;
+ case flatbuffers::BASE_TYPE_NONE:
+ case flatbuffers::BASE_TYPE_UTYPE:
+ case flatbuffers::BASE_TYPE_STRUCT:
+ case flatbuffers::BASE_TYPE_UNION:
+ if (definition) {
+ // Pick a random previous definition and random data instance of
+ // that definition.
+ int defref = lcg_rand() % definition;
+ int instance = lcg_rand() % instances_per_definition;
+ AddToSchemaAndInstances(
+ ("D" + flatbuffers::NumToString(defref)).c_str(),
+ deprecated ? ""
+ : definitions[defref].instances[instance].c_str());
+ } else {
+ // If this is the first definition, we have no definition we can
+ // refer to.
+ Dummy();
+ }
+ break;
+ case flatbuffers::BASE_TYPE_BOOL:
+ AddToSchemaAndInstances(
+ "bool", deprecated ? "" : (lcg_rand() % 2 ? "true" : "false"));
+ break;
+ case flatbuffers::BASE_TYPE_ARRAY:
+ if (!is_struct) {
+ AddToSchemaAndInstances(
+ "ubyte",
+ deprecated ? "" : "255"); // No fixed-length arrays in tables.
+ } else {
+ AddToSchemaAndInstances("[int:3]", deprecated ? "" : "[\n,\n,\n]");
+ }
+ break;
+ default:
+ // All the scalar types.
+ schema += flatbuffers::kTypeNames[base_type];
+
+ if (!deprecated) {
+ // We want each instance to use its own random value.
+ for (int inst = 0; inst < instances_per_definition; inst++)
+ definitions[definition].instances[inst] +=
+ flatbuffers::IsFloat(base_type)
+ ? flatbuffers::NumToString<double>(lcg_rand() % 128)
+ .c_str()
+ : flatbuffers::NumToString<int>(lcg_rand() % 128).c_str();
+ }
+ }
+ AddToSchemaAndInstances(deprecated ? "(deprecated);\n" : ";\n",
+ deprecated ? ""
+ : is_last_field ? "\n"
+ : ",\n");
+ }
+ AddToSchemaAndInstances("}\n\n", "}");
+ }
+
+ schema += "root_type D" + flatbuffers::NumToString(num_definitions - 1);
+ schema += ";\n";
+
+ flatbuffers::Parser parser;
+
+ // Will not compare against the original if we don't write defaults
+ parser.builder_.ForceDefaults(true);
+
+ // Parse the schema, parse the generated data, then generate text back
+ // from the binary and compare against the original.
+ TEST_EQ(parser.Parse(schema.c_str()), true);
+
+ const std::string &json =
+ definitions[num_definitions - 1].instances[0] + "\n";
+
+ TEST_EQ(parser.Parse(json.c_str()), true);
+
+ std::string jsongen;
+ parser.opts.indent_step = 0;
+ auto result =
+ GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen);
+ TEST_EQ(result, true);
+
+ if (jsongen != json) {
+ // These strings are larger than a megabyte, so we show the bytes around
+ // the first bytes that are different rather than the whole string.
+ size_t len = std::min(json.length(), jsongen.length());
+ for (size_t i = 0; i < len; i++) {
+ if (json[i] != jsongen[i]) {
+ i -= std::min(static_cast<size_t>(10), i); // show some context;
+ size_t end = std::min(len, i + 20);
+ for (; i < end; i++)
+ TEST_OUTPUT_LINE("at %d: found \"%c\", expected \"%c\"\n",
+ static_cast<int>(i), jsongen[i], json[i]);
+ break;
+ }
+ }
+ TEST_NOTNULL(nullptr); //-V501 (this comment suppresses CWE-570 warning)
+ }
+
+ // clang-format off
+ #ifdef FLATBUFFERS_TEST_VERBOSE
+ TEST_OUTPUT_LINE("%dk schema tested with %dk of json\n",
+ static_cast<int>(schema.length() / 1024),
+ static_cast<int>(json.length() / 1024));
+ #endif
+ // clang-format on
+}
+
+} // namespace tests
+} // namespace flatbuffers
\ No newline at end of file
diff --git a/tests/fuzz_test.h b/tests/fuzz_test.h
new file mode 100644
index 0000000..3708128
--- /dev/null
+++ b/tests/fuzz_test.h
@@ -0,0 +1,13 @@
+#ifndef TESTS_FUZZ_TEST_H
+#define TESTS_FUZZ_TEST_H
+
+namespace flatbuffers {
+namespace tests {
+
+void FuzzTest1();
+void FuzzTest2();
+
+} // namespace tests
+} // namespace flatbuffers
+
+#endif
diff --git a/tests/fuzzer/.gitignore b/tests/fuzzer/.gitignore
new file mode 100644
index 0000000..2e4d1d1
--- /dev/null
+++ b/tests/fuzzer/.gitignore
@@ -0,0 +1,18 @@
+# The generated fuzzers
+*_fuzzer
+
+# Findings from the fuzzers
+oom-*
+slow-unit-*
+crash-*
+
+# Individual fuzzer logs if job=N
+fuzz-*.log
+
+.clangd/
+
+# These are copied from tests/annotated_binary/ and should use the latest ones.
+annotated_binary.bfbs
+annotated_binary.bin
+
+monster_test.bfbs
\ No newline at end of file
diff --git a/tests/fuzzer/CMakeLists.txt b/tests/fuzzer/CMakeLists.txt
index 9cc5a5f..63bda68 100644
--- a/tests/fuzzer/CMakeLists.txt
+++ b/tests/fuzzer/CMakeLists.txt
@@ -95,6 +95,7 @@
${FLATBUFFERS_DIR}/include/flatbuffers/flatbuffer_builder.h
${FLATBUFFERS_DIR}/include/flatbuffers/flatbuffers.h
${FLATBUFFERS_DIR}/include/flatbuffers/flexbuffers.h
+ ${FLATBUFFERS_DIR}/include/flatbuffers/flex_flat_util.h
${FLATBUFFERS_DIR}/include/flatbuffers/hash.h
${FLATBUFFERS_DIR}/include/flatbuffers/idl.h
${FLATBUFFERS_DIR}/include/flatbuffers/minireflect.h
@@ -112,12 +113,15 @@
${FLATBUFFERS_DIR}/src/idl_parser.cpp
${FLATBUFFERS_DIR}/src/idl_gen_text.cpp
${FLATBUFFERS_DIR}/src/reflection.cpp
+ ${FLATBUFFERS_DIR}/src/binary_annotator.h
+ ${FLATBUFFERS_DIR}/src/binary_annotator.cpp
${FLATBUFFERS_DIR}/src/util.cpp
${FLATBUFFERS_DIR}/tests/test_assert.cpp
)
include_directories(${FLATBUFFERS_DIR}/include)
include_directories(${FLATBUFFERS_DIR}/tests)
+include_directories(${FLATBUFFERS_DIR}/src)
add_library(flatbuffers_fuzzed STATIC ${FlatBuffers_Library_SRCS})
# Use PUBLIC to force 'fuzzer_config' for all dependent targets
@@ -156,7 +160,20 @@
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/../monster_test.bfbs
${CMAKE_CURRENT_BINARY_DIR}/monster_test.bfbs)
-
+
+add_executable(annotator_fuzzer flatbuffers_annotator_fuzzer.cc)
+target_link_libraries(annotator_fuzzer PRIVATE flatbuffers_fuzzed)
+add_custom_command(
+ TARGET annotator_fuzzer PRE_BUILD
+
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_SOURCE_DIR}/../annotated_binary/annotated_binary.bfbs
+ ${CMAKE_CURRENT_BINARY_DIR}/annotated_binary.bfbs
+
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_SOURCE_DIR}/../annotated_binary/annotated_binary.bin
+ ${CMAKE_CURRENT_BINARY_DIR}/seed_annotator/annotated_binary.bin
+)
# Build debugger for weird cases found with fuzzer.
if(BUILD_DEBUGGER)
diff --git a/tests/fuzzer/flatbuffers_annotator_fuzzer.cc b/tests/fuzzer/flatbuffers_annotator_fuzzer.cc
new file mode 100644
index 0000000..7ff4313
--- /dev/null
+++ b/tests/fuzzer/flatbuffers_annotator_fuzzer.cc
@@ -0,0 +1,53 @@
+
+#include <filesystem>
+#include <string>
+
+#include "binary_annotator.h"
+#include "test_init.h"
+
+static std::filesystem::path exe_path_;
+static const uint8_t *schema_bfbs_;
+static size_t schema_bfbs_length_;
+
+bool TestFileExists(std::filesystem::path file_path) {
+ if (file_path.has_filename() && std::filesystem::exists(file_path))
+ return true;
+
+ TEST_OUTPUT_LINE("@DEBUG: file '%s' not found", file_path.string().c_str());
+ for (const auto &entry :
+ std::filesystem::directory_iterator(file_path.parent_path())) {
+ TEST_OUTPUT_LINE("@DEBUG: parent path entry: '%s'",
+ entry.path().string().c_str());
+ }
+ return false;
+}
+
+std::string LoadBinarySchema(const char *file_name) {
+ const auto file_path = exe_path_.parent_path() / file_name;
+ TEST_EQ(true, TestFileExists(file_path));
+ std::string schemafile;
+ TEST_EQ(true,
+ flatbuffers::LoadFile(file_path.string().c_str(), true, &schemafile));
+
+ flatbuffers::Verifier verifier(
+ reinterpret_cast<const uint8_t *>(schemafile.c_str()), schemafile.size());
+ TEST_EQ(true, reflection::VerifySchemaBuffer(verifier));
+ return schemafile;
+}
+
+extern "C" int LLVMFuzzerInitialize(int *, char ***argv) {
+ exe_path_ = (*argv)[0];
+ static const std::string schema_file =
+ LoadBinarySchema("annotated_binary.bfbs");
+ schema_bfbs_ = reinterpret_cast<const uint8_t *>(schema_file.c_str());
+ schema_bfbs_length_ = schema_file.size();
+ return 0;
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+ flatbuffers::BinaryAnnotator annotator(schema_bfbs_, schema_bfbs_length_,
+ data, size);
+
+ annotator.Annotate();
+ return 0;
+}
\ No newline at end of file
diff --git a/tests/fuzzer/flatbuffers_monster_fuzzer.cc b/tests/fuzzer/flatbuffers_monster_fuzzer.cc
index 8981c2f..4b8b790 100644
--- a/tests/fuzzer/flatbuffers_monster_fuzzer.cc
+++ b/tests/fuzzer/flatbuffers_monster_fuzzer.cc
@@ -23,6 +23,7 @@
#include "cpp17/generated_cpp17/monster_test_generated.h"
#include "flatbuffers/idl.h"
+#include "test_assert.h"
#include "test_init.h"
namespace fs = std::filesystem;
@@ -32,6 +33,8 @@
// The current executable path (see LLVMFuzzerInitialize).
static fs::path exe_path_;
+static flatbuffers::Parser parser_;
+
namespace {
static constexpr size_t kMinInputLength = 1;
@@ -46,7 +49,8 @@
TEST_OUTPUT_LINE("@DEBUG: file '%s' not found", file_path.string().c_str());
for (const auto &entry : fs::directory_iterator(file_path.parent_path())) {
- TEST_OUTPUT_LINE("@DEBUG: parent path entry: '%s'", entry.path().string().c_str());
+ TEST_OUTPUT_LINE("@DEBUG: parent path entry: '%s'",
+ entry.path().string().c_str());
}
return false;
}
@@ -55,7 +59,8 @@
const auto file_path = exe_path_.parent_path() / file_name;
TEST_EQ(true, TestFileExists(file_path));
std::string schemafile;
- TEST_EQ(true, flatbuffers::LoadFile(file_path.string().c_str(), true, &schemafile));
+ TEST_EQ(true,
+ flatbuffers::LoadFile(file_path.string().c_str(), true, &schemafile));
flatbuffers::Verifier verifier(
reinterpret_cast<const uint8_t *>(schemafile.c_str()), schemafile.size());
@@ -65,26 +70,19 @@
std::string do_test(const flatbuffers::IDLOptions &opts,
const std::string input_json, const bool check_parser) {
- // once loaded from disk
- static const std::string schemafile = LoadBinarySchema("monster_test.bfbs");
- // parse schema first, so we can use it to parse the data after
- flatbuffers::Parser parser;
- TEST_EQ(true, parser.Deserialize(
- reinterpret_cast<const uint8_t *>(schemafile.c_str()),
- schemafile.size()));
// (re)define parser options
- parser.opts = opts;
+ parser_.opts = opts;
std::string jsongen;
- if (parser.ParseJson(input_json.c_str())) {
- flatbuffers::Verifier verifier(parser.builder_.GetBufferPointer(),
- parser.builder_.GetSize());
+ if (parser_.ParseJson(input_json.c_str())) {
+ flatbuffers::Verifier verifier(parser_.builder_.GetBufferPointer(),
+ parser_.builder_.GetSize());
TEST_EQ(true, MyGame::Example::VerifyMonsterBuffer(verifier));
TEST_ASSERT(
- GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen));
+ GenerateText(parser_, parser_.builder_.GetBufferPointer(), &jsongen));
} else if (check_parser) {
TEST_OUTPUT_LINE("parser failed with JSON:\n%s", input_json.c_str());
- TEST_EQ_STR("", parser.error_.c_str());
+ TEST_EQ_STR("", parser_.error_.c_str());
TEST_ASSERT(false);
}
return jsongen;
@@ -100,6 +98,11 @@
extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) {
(void)argc;
exe_path_ = (*argv)[0];
+
+ static const std::string schemafile = LoadBinarySchema("monster_test.bfbs");
+ // parse schema first, so we can use it to parse the data after
+ parser_.Deserialize(reinterpret_cast<const uint8_t *>(schemafile.c_str()),
+ schemafile.size());
return 0;
}
@@ -122,10 +125,20 @@
(flags & flags_skip_unexpected_fields_in_json);
opts.allow_non_utf8 = (flags & flags_allow_non_utf8);
- const std::string jsongen_1 = do_test(opts, input, false);
- if (!jsongen_1.empty()) {
- const std::string jsongen_2 = do_test(opts, jsongen_1, true);
- TEST_EQ(jsongen_1, jsongen_2);
- }
+ do {
+ const std::string jsongen_1 = do_test(opts, input, false);
+ if (!jsongen_1.empty()) {
+ const std::string jsongen_2 = do_test(opts, jsongen_1, true);
+ if (jsongen_1 != jsongen_2 && !opts.output_default_scalars_in_json) {
+ // This gets tricky when the jsongen_1 includes a default-value, as the
+ // generated jsongen_2 doesn't emit default-values. So enable default
+ // scalars and re-run it.
+ opts.output_default_scalars_in_json = true;
+ continue;
+ }
+ TEST_EQ(jsongen_1, jsongen_2);
+ }
+ } while (0);
+
return 0;
}
diff --git a/tests/fuzzer/readme.md b/tests/fuzzer/readme.md
index 1d0b392..c451301 100644
--- a/tests/fuzzer/readme.md
+++ b/tests/fuzzer/readme.md
@@ -11,6 +11,7 @@
To build and run these tests LLVM compiler (with clang frontend) and CMake should be installed before.
The fuzzer section include four tests:
+- `annotator_fuzzer` checks that inputs given to the flatc --annotate are always parsable;
- `verifier_fuzzer` checks stability of deserialization engine for `Monster` schema;
- `parser_fuzzer` checks stability of schema and json parser under various inputs;
- `scalar_parser` focused on validation of the parser while parse numeric scalars in schema and/or json files;
diff --git a/tests/fuzzer/test_init.h b/tests/fuzzer/test_init.h
index 6c9113d..6cb58d3 100644
--- a/tests/fuzzer/test_init.h
+++ b/tests/fuzzer/test_init.h
@@ -11,7 +11,7 @@
// This hook terminate program both in Debug and Release.
static bool TestFailListener(const char *expval, const char *val,
const char *exp, const char *file, int line,
- const char *func = 0) {
+ const char *func = nullptr) {
(void)expval;
(void)val;
(void)exp;
diff --git a/tests/go_test.go b/tests/go_test.go
index 11b3f0a..8cb7b97 100644
--- a/tests/go_test.go
+++ b/tests/go_test.go
@@ -17,14 +17,14 @@
package main
import (
- mygame "MyGame" // refers to generated code
- example "MyGame/Example" // refers to generated code
+ mygame "MyGame" // refers to generated code
+ example "MyGame/Example" // refers to generated code
+ "encoding/json"
optional_scalars "optional_scalars" // refers to generated code
"bytes"
"flag"
"fmt"
- "io/ioutil"
"os"
"reflect"
"sort"
@@ -69,6 +69,35 @@
os.Exit(m.Run())
}
+// TestTextParsing test if text parsing works with object API.
+func TestTextParsing(t *testing.T) {
+ expectedMonster := example.MonsterT{
+ Mana: 42,
+ Name: "foo",
+ LongEnumNormalDefault: example.LongEnumLongTwo,
+ }
+
+ buf := new(bytes.Buffer)
+ if err := json.NewEncoder(buf).Encode(expectedMonster); err != nil {
+ t.Fatal(err)
+ }
+
+ var monster example.MonsterT
+ if err := json.NewDecoder(buf).Decode(&monster); err != nil {
+ t.Fatal(err)
+ }
+
+ if monster.Mana != expectedMonster.Mana {
+ t.Fatal("wrong mana:", monster.Mana)
+ }
+ if monster.Name != expectedMonster.Name {
+ t.Fatal("wrong name:", monster.Name)
+ }
+ if monster.LongEnumNormalDefault != expectedMonster.LongEnumNormalDefault {
+ t.Fatal("wrong enum:", monster.LongEnumNormalDefault)
+ }
+}
+
// TestAll runs all checks, failing if any errors occur.
func TestAll(t *testing.T) {
// Verify that the Go FlatBuffers runtime library generates the
@@ -101,7 +130,7 @@
// Verify that the buffer generated by C++ code is readable by the
// generated Go code:
- monsterDataCpp, err := ioutil.ReadFile(cppData)
+ monsterDataCpp, err := os.ReadFile(cppData)
if err != nil {
t.Fatal(err)
}
@@ -141,7 +170,7 @@
// is given, check that Go code can read it, and that Go code
// generates an identical buffer when used to create the example data:
if javaData != "" {
- monsterDataJava, err := ioutil.ReadFile(javaData)
+ monsterDataJava, err := os.ReadFile(javaData)
if err != nil {
t.Fatal(err)
}
@@ -155,7 +184,7 @@
}
// Write the generated buffer out to a file:
- err = ioutil.WriteFile(outData, generated[off:], os.FileMode(0644))
+ err = os.WriteFile(outData, generated[off:], os.FileMode(0644))
if err != nil {
t.Fatal(err)
}
@@ -1685,7 +1714,7 @@
CheckObjectAPI(generated, off, true, fail)
// Write generated bfufer out to a file
- if err := ioutil.WriteFile(outData+".sp", generated[off:], os.FileMode(0644)); err != nil {
+ if err := os.WriteFile(outData+".sp", generated[off:], os.FileMode(0644)); err != nil {
fail("failed to write file: %s", err)
}
}
diff --git a/tests/include_test1/mod.rs b/tests/include_test1/mod.rs
index 3a6afa9..ca4894d 100644
--- a/tests/include_test1/mod.rs
+++ b/tests/include_test1/mod.rs
@@ -1,4 +1,5 @@
// Automatically generated by the Flatbuffers compiler. Do not modify.
+// @generated
pub mod my_game {
use super::*;
pub mod other_name_space {
diff --git a/tests/include_test1/my_game/other_name_space/from_include_generated.rs b/tests/include_test1/my_game/other_name_space/from_include_generated.rs
index 048bafd..3c5165d 100644
--- a/tests/include_test1/my_game/other_name_space/from_include_generated.rs
+++ b/tests/include_test1/my_game/other_name_space/from_include_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
@@ -34,8 +39,8 @@
}
}
}
-impl std::fmt::Debug for FromInclude {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for FromInclude {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
diff --git a/tests/include_test1/my_game/other_name_space/table_b_generated.rs b/tests/include_test1/my_game/other_name_space/table_b_generated.rs
index 46a99cb..da7b937 100644
--- a/tests/include_test1/my_game/other_name_space/table_b_generated.rs
+++ b/tests/include_test1/my_game/other_name_space/table_b_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TableBOffset {}
@@ -103,8 +108,8 @@
}
}
-impl std::fmt::Debug for TableB<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for TableB<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TableB");
ds.field("a", &self.a());
ds.finish()
diff --git a/tests/include_test1/my_game/other_name_space/unused_generated.rs b/tests/include_test1/my_game/other_name_space/unused_generated.rs
index 1dc5913..1e4ad9c 100644
--- a/tests/include_test1/my_game/other_name_space/unused_generated.rs
+++ b/tests/include_test1/my_game/other_name_space/unused_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct Unused, aligned to 4
@@ -13,8 +18,8 @@
Self([0; 4])
}
}
-impl std::fmt::Debug for Unused {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for Unused {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Unused")
.field("a", &self.a())
.finish()
@@ -42,7 +47,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(self as *const Unused as *const u8, Self::size())
+ ::core::slice::from_raw_parts(self as *const Unused as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -53,7 +58,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(*self as *const Unused as *const u8, Self::size())
+ ::core::slice::from_raw_parts(*self as *const Unused as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
diff --git a/tests/include_test1/table_a_generated.rs b/tests/include_test1/table_a_generated.rs
index 9188b29..0e6a78d 100644
--- a/tests/include_test1/table_a_generated.rs
+++ b/tests/include_test1/table_a_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TableAOffset {}
@@ -103,8 +108,8 @@
}
}
-impl std::fmt::Debug for TableA<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for TableA<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TableA");
ds.field("b", &self.b());
ds.finish()
diff --git a/tests/include_test2/mod.rs b/tests/include_test2/mod.rs
index 3a6afa9..ca4894d 100644
--- a/tests/include_test2/mod.rs
+++ b/tests/include_test2/mod.rs
@@ -1,4 +1,5 @@
// Automatically generated by the Flatbuffers compiler. Do not modify.
+// @generated
pub mod my_game {
use super::*;
pub mod other_name_space {
diff --git a/tests/include_test2/my_game/other_name_space/from_include_generated.rs b/tests/include_test2/my_game/other_name_space/from_include_generated.rs
index 048bafd..3c5165d 100644
--- a/tests/include_test2/my_game/other_name_space/from_include_generated.rs
+++ b/tests/include_test2/my_game/other_name_space/from_include_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
@@ -34,8 +39,8 @@
}
}
}
-impl std::fmt::Debug for FromInclude {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for FromInclude {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
diff --git a/tests/include_test2/my_game/other_name_space/table_b_generated.rs b/tests/include_test2/my_game/other_name_space/table_b_generated.rs
index 46a99cb..da7b937 100644
--- a/tests/include_test2/my_game/other_name_space/table_b_generated.rs
+++ b/tests/include_test2/my_game/other_name_space/table_b_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TableBOffset {}
@@ -103,8 +108,8 @@
}
}
-impl std::fmt::Debug for TableB<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for TableB<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TableB");
ds.field("a", &self.a());
ds.finish()
diff --git a/tests/include_test2/my_game/other_name_space/unused_generated.rs b/tests/include_test2/my_game/other_name_space/unused_generated.rs
index 1dc5913..1e4ad9c 100644
--- a/tests/include_test2/my_game/other_name_space/unused_generated.rs
+++ b/tests/include_test2/my_game/other_name_space/unused_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct Unused, aligned to 4
@@ -13,8 +18,8 @@
Self([0; 4])
}
}
-impl std::fmt::Debug for Unused {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for Unused {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Unused")
.field("a", &self.a())
.finish()
@@ -42,7 +47,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(self as *const Unused as *const u8, Self::size())
+ ::core::slice::from_raw_parts(self as *const Unused as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -53,7 +58,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(*self as *const Unused as *const u8, Self::size())
+ ::core::slice::from_raw_parts(*self as *const Unused as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
diff --git a/tests/include_test2/table_a_generated.rs b/tests/include_test2/table_a_generated.rs
index 9188b29..0e6a78d 100644
--- a/tests/include_test2/table_a_generated.rs
+++ b/tests/include_test2/table_a_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TableAOffset {}
@@ -103,8 +108,8 @@
}
}
-impl std::fmt::Debug for TableA<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for TableA<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TableA");
ds.field("b", &self.b());
ds.finish()
diff --git a/tests/is_quiet_nan.h b/tests/is_quiet_nan.h
new file mode 100644
index 0000000..6d31c3d
--- /dev/null
+++ b/tests/is_quiet_nan.h
@@ -0,0 +1,41 @@
+#ifndef TESTS_IS_QUIET_NAN_H
+#define TESTS_IS_QUIET_NAN_H
+
+namespace flatbuffers {
+namespace tests {
+
+#if defined(FLATBUFFERS_HAS_NEW_STRTOD) && (FLATBUFFERS_HAS_NEW_STRTOD > 0)
+// The IEEE-754 quiet_NaN is not simple binary constant.
+// All binary NaN bit strings have all the bits of the biased exponent field E
+// set to 1. A quiet NaN bit string should be encoded with the first bit d[1]
+// of the trailing significand field T being 1 (d[0] is implicit bit).
+// It is assumed that endianness of floating-point is same as integer.
+template<typename T, typename U, U qnan_base> bool is_quiet_nan_impl(T v) {
+ static_assert(sizeof(T) == sizeof(U), "unexpected");
+ U b = 0;
+ std::memcpy(&b, &v, sizeof(T));
+ return ((b & qnan_base) == qnan_base);
+}
+# if defined(__mips__) || defined(__hppa__)
+inline bool is_quiet_nan(float v) {
+ return is_quiet_nan_impl<float, uint32_t, 0x7FC00000u>(v) ||
+ is_quiet_nan_impl<float, uint32_t, 0x7FBFFFFFu>(v);
+}
+inline bool is_quiet_nan(double v) {
+ return is_quiet_nan_impl<double, uint64_t, 0x7FF8000000000000ul>(v) ||
+ is_quiet_nan_impl<double, uint64_t, 0x7FF7FFFFFFFFFFFFu>(v);
+}
+# else
+inline bool is_quiet_nan(float v) {
+ return is_quiet_nan_impl<float, uint32_t, 0x7FC00000u>(v);
+}
+inline bool is_quiet_nan(double v) {
+ return is_quiet_nan_impl<double, uint64_t, 0x7FF8000000000000ul>(v);
+}
+# endif
+#endif
+
+} // namespace tests
+} // namespace flatbuffers
+
+#endif // TESTS_IS_QUIET_NAN_H
diff --git a/tests/json_test.cpp b/tests/json_test.cpp
new file mode 100644
index 0000000..6d4064f
--- /dev/null
+++ b/tests/json_test.cpp
@@ -0,0 +1,174 @@
+#include "json_test.h"
+
+#include "flatbuffers/flatbuffers.h"
+#include "flatbuffers/idl.h"
+#include "monster_test_generated.h"
+#include "monster_test_bfbs_generated.h"
+#include "optional_scalars_generated.h"
+#include "test_assert.h"
+
+namespace flatbuffers {
+namespace tests {
+
+using namespace MyGame::Example;
+
+// Check stringify of an default enum value to json
+void JsonDefaultTest(const std::string& tests_data_path) {
+ // load FlatBuffer schema (.fbs) from disk
+ std::string schemafile;
+ TEST_EQ(flatbuffers::LoadFile((tests_data_path + "monster_test.fbs").c_str(),
+ false, &schemafile),
+ true);
+ // parse schema first, so we can use it to parse the data after
+ flatbuffers::Parser parser;
+ auto include_test_path =
+ flatbuffers::ConCatPathFileName(tests_data_path, "include_test");
+ const char *include_directories[] = { tests_data_path.c_str(),
+ include_test_path.c_str(), nullptr };
+
+ TEST_EQ(parser.Parse(schemafile.c_str(), include_directories), true);
+ // create incomplete monster and store to json
+ parser.opts.output_default_scalars_in_json = true;
+ parser.opts.output_enum_identifiers = true;
+ flatbuffers::FlatBufferBuilder builder;
+ auto name = builder.CreateString("default_enum");
+ MonsterBuilder color_monster(builder);
+ color_monster.add_name(name);
+ FinishMonsterBuffer(builder, color_monster.Finish());
+ std::string jsongen;
+ auto result = GenerateText(parser, builder.GetBufferPointer(), &jsongen);
+ TEST_EQ(result, true);
+ // default value of the "color" field is Blue
+ TEST_EQ(std::string::npos != jsongen.find("color: \"Blue\""), true);
+ // default value of the "testf" field is 3.14159
+ TEST_EQ(std::string::npos != jsongen.find("testf: 3.14159"), true);
+}
+
+void JsonEnumsTest(const std::string& tests_data_path) {
+ // load FlatBuffer schema (.fbs) from disk
+ std::string schemafile;
+ TEST_EQ(flatbuffers::LoadFile((tests_data_path + "monster_test.fbs").c_str(),
+ false, &schemafile),
+ true);
+ // parse schema first, so we can use it to parse the data after
+ flatbuffers::Parser parser;
+ auto include_test_path =
+ flatbuffers::ConCatPathFileName(tests_data_path, "include_test");
+ const char *include_directories[] = { tests_data_path.c_str(),
+ include_test_path.c_str(), nullptr };
+ parser.opts.output_enum_identifiers = true;
+ TEST_EQ(parser.Parse(schemafile.c_str(), include_directories), true);
+ flatbuffers::FlatBufferBuilder builder;
+ auto name = builder.CreateString("bitflag_enum");
+ MonsterBuilder color_monster(builder);
+ color_monster.add_name(name);
+ color_monster.add_color(Color(Color_Blue | Color_Red));
+ FinishMonsterBuffer(builder, color_monster.Finish());
+ std::string jsongen;
+ auto result = GenerateText(parser, builder.GetBufferPointer(), &jsongen);
+ TEST_EQ(result, true);
+ TEST_EQ(std::string::npos != jsongen.find("color: \"Red Blue\""), true);
+ // Test forward compatibility with 'output_enum_identifiers = true'.
+ // Current Color doesn't have '(1u << 2)' field, let's add it.
+ builder.Clear();
+ std::string future_json;
+ auto future_name = builder.CreateString("future bitflag_enum");
+ MonsterBuilder future_color(builder);
+ future_color.add_name(future_name);
+ future_color.add_color(
+ static_cast<Color>((1u << 2) | Color_Blue | Color_Red));
+ FinishMonsterBuffer(builder, future_color.Finish());
+ result = GenerateText(parser, builder.GetBufferPointer(), &future_json);
+ TEST_EQ(result, true);
+ TEST_EQ(std::string::npos != future_json.find("color: 13"), true);
+}
+
+void JsonOptionalTest(const std::string& tests_data_path, bool default_scalars) {
+ // load FlatBuffer schema (.fbs) and JSON from disk
+ std::string schemafile;
+ std::string jsonfile;
+ TEST_EQ(
+ flatbuffers::LoadFile((tests_data_path + "optional_scalars.fbs").c_str(),
+ false, &schemafile),
+ true);
+ TEST_EQ(flatbuffers::LoadFile((tests_data_path + "optional_scalars" +
+ (default_scalars ? "_defaults" : "") + ".json")
+ .c_str(),
+ false, &jsonfile),
+ true);
+
+ auto include_test_path =
+ flatbuffers::ConCatPathFileName(tests_data_path, "include_test");
+ const char *include_directories[] = { tests_data_path.c_str(),
+ include_test_path.c_str(), nullptr };
+
+ // parse schema first, so we can use it to parse the data after
+ flatbuffers::Parser parser;
+ parser.opts.output_default_scalars_in_json = default_scalars;
+ TEST_EQ(parser.Parse(schemafile.c_str(), include_directories), true);
+ TEST_EQ(parser.ParseJson(jsonfile.c_str()), true);
+
+ // here, parser.builder_ contains a binary buffer that is the parsed data.
+
+ // First, verify it, just in case:
+ flatbuffers::Verifier verifier(parser.builder_.GetBufferPointer(),
+ parser.builder_.GetSize());
+ TEST_EQ(optional_scalars::VerifyScalarStuffBuffer(verifier), true);
+
+ // to ensure it is correct, we now generate text back from the binary,
+ // and compare the two:
+ std::string jsongen;
+ auto result =
+ GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen);
+ TEST_EQ(result, true);
+ TEST_EQ_STR(jsongen.c_str(), jsonfile.c_str());
+}
+
+void ParseIncorrectMonsterJsonTest(const std::string& tests_data_path) {
+ std::string schemafile;
+ TEST_EQ(flatbuffers::LoadFile((tests_data_path + "monster_test.bfbs").c_str(),
+ true, &schemafile),
+ true);
+ flatbuffers::Parser parser;
+ flatbuffers::Verifier verifier(
+ reinterpret_cast<const uint8_t *>(schemafile.c_str()), schemafile.size());
+ TEST_EQ(reflection::VerifySchemaBuffer(verifier), true);
+ TEST_EQ(
+ parser.Deserialize(reinterpret_cast<const uint8_t *>(schemafile.c_str()),
+ schemafile.size()),
+ true);
+ TEST_EQ(parser.ParseJson("{name:\"monster\"}"), true);
+ TEST_EQ(parser.ParseJson(""), false);
+ TEST_EQ(parser.ParseJson("{name: 1}"), false);
+ TEST_EQ(parser.ParseJson("{name:+1}"), false);
+ TEST_EQ(parser.ParseJson("{name:-1}"), false);
+ TEST_EQ(parser.ParseJson("{name:-f}"), false);
+ TEST_EQ(parser.ParseJson("{name:+f}"), false);
+}
+
+void JsonUnsortedArrayTest() {
+ flatbuffers::Parser parser;
+ TEST_EQ(parser.Deserialize(MyGame::Example::MonsterBinarySchema::data(),
+ MyGame::Example::MonsterBinarySchema::size()),
+ true);
+ auto jsonStr = R"(
+ {
+ "name": "lookupTest",
+ "testarrayoftables": [
+ { "name": "aaa" },
+ { "name": "ccc" },
+ { "name": "bbb" }
+ ]
+ }
+ )";
+ TEST_EQ(parser.ParseJson(jsonStr), true);
+ auto monster = flatbuffers::GetRoot<MyGame::Example::Monster>(
+ parser.builder_.GetBufferPointer());
+
+ TEST_NOTNULL(monster->testarrayoftables()->LookupByKey("aaa"));
+ TEST_NOTNULL(monster->testarrayoftables()->LookupByKey("bbb"));
+ TEST_NOTNULL(monster->testarrayoftables()->LookupByKey("ccc"));
+}
+
+} // namespace tests
+} // namespace flatbuffers
\ No newline at end of file
diff --git a/tests/json_test.h b/tests/json_test.h
new file mode 100644
index 0000000..fe6efd4
--- /dev/null
+++ b/tests/json_test.h
@@ -0,0 +1,18 @@
+#ifndef TESTS_JSON_TEST_H
+#define TESTS_JSON_TEST_H
+
+#include <string>
+
+namespace flatbuffers {
+namespace tests {
+
+void JsonDefaultTest(const std::string& tests_data_path);
+void JsonEnumsTest(const std::string& tests_data_path);
+void JsonOptionalTest(const std::string& tests_data_path, bool default_scalars);
+void ParseIncorrectMonsterJsonTest(const std::string& tests_data_path);
+void JsonUnsortedArrayTest();
+
+} // namespace tests
+} // namespace flatbuffers
+
+#endif
\ No newline at end of file
diff --git a/tests/keyword_test.fbs b/tests/keyword_test.fbs
index 4ca761b..77fc42b 100644
--- a/tests/keyword_test.fbs
+++ b/tests/keyword_test.fbs
@@ -8,6 +8,7 @@
is: ABC = void;
private: public;
type: int;
+ default: bool = false;
}
union KeywordsInUnion {
diff --git a/tests/keyword_test/keyword_test/abc_generated.rs b/tests/keyword_test/keyword_test/abc_generated.rs
index 99b43e4..823b883 100644
--- a/tests/keyword_test/keyword_test/abc_generated.rs
+++ b/tests/keyword_test/keyword_test/abc_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
@@ -42,8 +47,8 @@
}
}
}
-impl std::fmt::Debug for ABC {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for ABC {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
diff --git a/tests/keyword_test/keyword_test/keywords_in_table_generated.rs b/tests/keyword_test/keyword_test/keywords_in_table_generated.rs
index 6a16f05..74ddfba 100644
--- a/tests/keyword_test/keyword_test/keywords_in_table_generated.rs
+++ b/tests/keyword_test/keyword_test/keywords_in_table_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum KeywordsInTableOffset {}
@@ -23,6 +28,7 @@
pub const VT_IS: flatbuffers::VOffsetT = 4;
pub const VT_PRIVATE: flatbuffers::VOffsetT = 6;
pub const VT_TYPE_: flatbuffers::VOffsetT = 8;
+ pub const VT_DEFAULT: flatbuffers::VOffsetT = 10;
pub const fn get_fully_qualified_name() -> &'static str {
"KeywordTest.KeywordsInTable"
@@ -41,6 +47,7 @@
builder.add_type_(args.type_);
builder.add_private(args.private);
builder.add_is(args.is);
+ builder.add_default(args.default);
builder.finish()
}
@@ -48,10 +55,12 @@
let is = self.is();
let private = self.private();
let type_ = self.type_();
+ let default = self.default();
KeywordsInTableT {
is,
private,
type_,
+ default,
}
}
@@ -67,6 +76,10 @@
pub fn type_(&self) -> i32 {
self._tab.get::<i32>(KeywordsInTable::VT_TYPE_, Some(0)).unwrap()
}
+ #[inline]
+ pub fn default(&self) -> bool {
+ self._tab.get::<bool>(KeywordsInTable::VT_DEFAULT, Some(false)).unwrap()
+ }
}
impl flatbuffers::Verifiable for KeywordsInTable<'_> {
@@ -79,6 +92,7 @@
.visit_field::<ABC>("is", Self::VT_IS, false)?
.visit_field::<public>("private", Self::VT_PRIVATE, false)?
.visit_field::<i32>("type_", Self::VT_TYPE_, false)?
+ .visit_field::<bool>("default", Self::VT_DEFAULT, false)?
.finish();
Ok(())
}
@@ -87,6 +101,7 @@
pub is: ABC,
pub private: public,
pub type_: i32,
+ pub default: bool,
}
impl<'a> Default for KeywordsInTableArgs {
#[inline]
@@ -95,6 +110,7 @@
is: ABC::void,
private: public::NONE,
type_: 0,
+ default: false,
}
}
}
@@ -117,6 +133,10 @@
self.fbb_.push_slot::<i32>(KeywordsInTable::VT_TYPE_, type_, 0);
}
#[inline]
+ pub fn add_default(&mut self, default: bool) {
+ self.fbb_.push_slot::<bool>(KeywordsInTable::VT_DEFAULT, default, false);
+ }
+ #[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> KeywordsInTableBuilder<'a, 'b> {
let start = _fbb.start_table();
KeywordsInTableBuilder {
@@ -131,12 +151,13 @@
}
}
-impl std::fmt::Debug for KeywordsInTable<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for KeywordsInTable<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("KeywordsInTable");
ds.field("is", &self.is());
ds.field("private", &self.private());
ds.field("type_", &self.type_());
+ ds.field("default", &self.default());
ds.finish()
}
}
@@ -146,6 +167,7 @@
pub is: ABC,
pub private: public,
pub type_: i32,
+ pub default: bool,
}
impl Default for KeywordsInTableT {
fn default() -> Self {
@@ -153,6 +175,7 @@
is: ABC::void,
private: public::NONE,
type_: 0,
+ default: false,
}
}
}
@@ -164,10 +187,12 @@
let is = self.is;
let private = self.private;
let type_ = self.type_;
+ let default = self.default;
KeywordsInTable::create(_fbb, &KeywordsInTableArgs{
is,
private,
type_,
+ default,
})
}
}
diff --git a/tests/keyword_test/keyword_test/keywords_in_union_generated.rs b/tests/keyword_test/keyword_test/keywords_in_union_generated.rs
index cf03797..78d8cd7 100644
--- a/tests/keyword_test/keyword_test/keywords_in_union_generated.rs
+++ b/tests/keyword_test/keyword_test/keywords_in_union_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
@@ -42,8 +47,8 @@
}
}
}
-impl std::fmt::Debug for KeywordsInUnion {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for KeywordsInUnion {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -128,7 +133,7 @@
/// If the union variant matches, return the owned KeywordsInTableT, setting the union to NONE.
pub fn take_static_(&mut self) -> Option<Box<KeywordsInTableT>> {
if let Self::Static_(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::Static_(w) = v {
Some(w)
} else {
@@ -149,7 +154,7 @@
/// If the union variant matches, return the owned KeywordsInTableT, setting the union to NONE.
pub fn take_internal(&mut self) -> Option<Box<KeywordsInTableT>> {
if let Self::Internal(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::Internal(w) = v {
Some(w)
} else {
diff --git a/tests/keyword_test/keyword_test/public_generated.rs b/tests/keyword_test/keyword_test/public_generated.rs
index 2de4c0b..76c6ed0 100644
--- a/tests/keyword_test/keyword_test/public_generated.rs
+++ b/tests/keyword_test/keyword_test/public_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
@@ -34,8 +39,8 @@
}
}
}
-impl std::fmt::Debug for public {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for public {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
diff --git a/tests/keyword_test/mod.rs b/tests/keyword_test/mod.rs
index 94ce650..d87e5d1 100644
--- a/tests/keyword_test/mod.rs
+++ b/tests/keyword_test/mod.rs
@@ -1,4 +1,5 @@
// Automatically generated by the Flatbuffers compiler. Do not modify.
+// @generated
pub mod keyword_test {
use super::*;
mod abc_generated;
diff --git a/tests/monster_extra_generated.h b/tests/monster_extra_generated.h
index b27e092..b224677 100644
--- a/tests/monster_extra_generated.h
+++ b/tests/monster_extra_generated.h
@@ -6,6 +6,13 @@
#include "flatbuffers/flatbuffers.h"
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
+
namespace MyGame {
struct MonsterExtra;
@@ -268,8 +275,8 @@
{ auto _e = f1(); _o->f1 = _e; }
{ auto _e = f2(); _o->f2 = _e; }
{ auto _e = f3(); _o->f3 = _e; }
- { auto _e = dvec(); if (_e) { _o->dvec.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->dvec[_i] = _e->Get(_i); } } }
- { auto _e = fvec(); if (_e) { _o->fvec.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->fvec[_i] = _e->Get(_i); } } }
+ { auto _e = dvec(); if (_e) { _o->dvec.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->dvec[_i] = _e->Get(_i); } } else { _o->dvec.resize(0); } }
+ { auto _e = fvec(); if (_e) { _o->fvec.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->fvec[_i] = _e->Get(_i); } } else { _o->fvec.resize(0); } }
}
inline flatbuffers::Offset<MonsterExtra> MonsterExtra::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterExtraT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
diff --git a/tests/monster_extra_my_game_generated.dart b/tests/monster_extra_my_game_generated.dart
index 238ab8f..26310be 100644
--- a/tests/monster_extra_my_game_generated.dart
+++ b/tests/monster_extra_my_game_generated.dart
@@ -32,7 +32,7 @@
@override
String toString() {
- return 'MonsterExtra{d0: $d0, d1: $d1, d2: $d2, d3: $d3, f0: $f0, f1: $f1, f2: $f2, f3: $f3, dvec: $dvec, fvec: $fvec}';
+ return 'MonsterExtra{d0: ${d0}, d1: ${d1}, d2: ${d2}, d3: ${d3}, f0: ${f0}, f1: ${f1}, f2: ${f2}, f3: ${f3}, dvec: ${dvec}, fvec: ${fvec}}';
}
MonsterExtraT unpack() => MonsterExtraT(
@@ -99,7 +99,7 @@
@override
String toString() {
- return 'MonsterExtraT{d0: $d0, d1: $d1, d2: $d2, d3: $d3, f0: $f0, f1: $f1, f2: $f2, f3: $f3, dvec: $dvec, fvec: $fvec}';
+ return 'MonsterExtraT{d0: ${d0}, d1: ${d1}, d2: ${d2}, d3: ${d3}, f0: ${f0}, f1: ${f1}, f2: ${f2}, f3: ${f3}, dvec: ${dvec}, fvec: ${fvec}}';
}
}
diff --git a/tests/monster_test.afb b/tests/monster_test.afb
new file mode 100644
index 0000000..b98933a
--- /dev/null
+++ b/tests/monster_test.afb
@@ -0,0 +1,6647 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: ../reflection/reflection.fbs
+// Binary file: monster_test.bfbs
+
+header:
+ +0x0000 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x001C | offset to root table `reflection.Schema`
+ +0x0004 | 42 46 42 53 | char[4] | BFBS | File Identifier
+
+vtable (reflection.Schema):
+ +0x0008 | 14 00 | uint16_t | 0x0014 (20) | size of this vtable
+ +0x000A | 20 00 | uint16_t | 0x0020 (32) | size of referring table
+ +0x000C | 04 00 | VOffset16 | 0x0004 (4) | offset to field `objects` (id: 0)
+ +0x000E | 08 00 | VOffset16 | 0x0008 (8) | offset to field `enums` (id: 1)
+ +0x0010 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `file_ident` (id: 2)
+ +0x0012 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `file_ext` (id: 3)
+ +0x0014 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `root_table` (id: 4)
+ +0x0016 | 18 00 | VOffset16 | 0x0018 (24) | offset to field `services` (id: 5)
+ +0x0018 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `advanced_features` (id: 6) <defaults to 0> (ULong)
+ +0x001A | 1C 00 | VOffset16 | 0x001C (28) | offset to field `fbs_files` (id: 7)
+
+root_table (reflection.Schema):
+ +0x001C | 14 00 00 00 | SOffset32 | 0x00000014 (20) Loc: +0x0008 | offset to vtable
+ +0x0020 | 58 00 00 00 | UOffset32 | 0x00000058 (88) Loc: +0x0078 | offset to field `objects` (vector)
+ +0x0024 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x0058 | offset to field `enums` (vector)
+ +0x0028 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x004C | offset to field `file_ident` (string)
+ +0x002C | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x0044 | offset to field `file_ext` (string)
+ +0x0030 | A0 0E 00 00 | UOffset32 | 0x00000EA0 (3744) Loc: +0x0ED0 | offset to field `root_table` (table)
+ +0x0034 | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x003C | offset to field `services` (vector)
+ +0x0038 | 80 00 00 00 | UOffset32 | 0x00000080 (128) Loc: +0x00B8 | offset to field `fbs_files` (vector)
+
+vector (reflection.Schema.services):
+ +0x003C | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x0040 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x011C | offset to table[0]
+
+string (reflection.Schema.file_ext):
+ +0x0044 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x0048 | 6D 6F 6E | char[3] | mon | string literal
+ +0x004B | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.Schema.file_ident):
+ +0x004C | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x0050 | 4D 4F 4E 53 | char[4] | MONS | string literal
+ +0x0054 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0055 | 00 00 00 | uint8_t[3] | ... | padding
+
+vector (reflection.Schema.enums):
+ +0x0058 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of vector (# items)
+ +0x005C | 4C 05 00 00 | UOffset32 | 0x0000054C (1356) Loc: +0x05A8 | offset to table[0]
+ +0x0060 | B8 02 00 00 | UOffset32 | 0x000002B8 (696) Loc: +0x0318 | offset to table[1]
+ +0x0064 | F8 03 00 00 | UOffset32 | 0x000003F8 (1016) Loc: +0x045C | offset to table[2]
+ +0x0068 | 04 09 00 00 | UOffset32 | 0x00000904 (2308) Loc: +0x096C | offset to table[3]
+ +0x006C | 90 06 00 00 | UOffset32 | 0x00000690 (1680) Loc: +0x06FC | offset to table[4]
+ +0x0070 | BC 07 00 00 | UOffset32 | 0x000007BC (1980) Loc: +0x082C | offset to table[5]
+ +0x0074 | EC 0A 00 00 | UOffset32 | 0x00000AEC (2796) Loc: +0x0B60 | offset to table[6]
+
+vector (reflection.Schema.objects):
+ +0x0078 | 0F 00 00 00 | uint32_t | 0x0000000F (15) | length of vector (# items)
+ +0x007C | 9C 31 00 00 | UOffset32 | 0x0000319C (12700) Loc: +0x3218 | offset to table[0]
+ +0x0080 | 50 0E 00 00 | UOffset32 | 0x00000E50 (3664) Loc: +0x0ED0 | offset to table[1]
+ +0x0084 | E8 2D 00 00 | UOffset32 | 0x00002DE8 (11752) Loc: +0x2E6C | offset to table[2]
+ +0x0088 | C4 2E 00 00 | UOffset32 | 0x00002EC4 (11972) Loc: +0x2F4C | offset to table[3]
+ +0x008C | 64 30 00 00 | UOffset32 | 0x00003064 (12388) Loc: +0x30F0 | offset to table[4]
+ +0x0090 | D8 2F 00 00 | UOffset32 | 0x00002FD8 (12248) Loc: +0x3068 | offset to table[5]
+ +0x0094 | A0 35 00 00 | UOffset32 | 0x000035A0 (13728) Loc: +0x3634 | offset to table[6]
+ +0x0098 | 80 34 00 00 | UOffset32 | 0x00003480 (13440) Loc: +0x3518 | offset to table[7]
+ +0x009C | 70 0B 00 00 | UOffset32 | 0x00000B70 (2928) Loc: +0x0C0C | offset to table[8]
+ +0x00A0 | 78 32 00 00 | UOffset32 | 0x00003278 (12920) Loc: +0x3318 | offset to table[9]
+ +0x00A4 | 68 36 00 00 | UOffset32 | 0x00003668 (13928) Loc: +0x370C | offset to table[10]
+ +0x00A8 | A0 36 00 00 | UOffset32 | 0x000036A0 (13984) Loc: +0x3748 | offset to table[11]
+ +0x00AC | 90 37 00 00 | UOffset32 | 0x00003790 (14224) Loc: +0x383C | offset to table[12]
+ +0x00B0 | 44 38 00 00 | UOffset32 | 0x00003844 (14404) Loc: +0x38F4 | offset to table[13]
+ +0x00B4 | EC 36 00 00 | UOffset32 | 0x000036EC (14060) Loc: +0x37A0 | offset to table[14]
+
+vector (reflection.Schema.fbs_files):
+ +0x00B8 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x00BC | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x00F4 | offset to table[0]
+ +0x00C0 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x00DC | offset to table[1]
+ +0x00C4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00C8 | offset to table[2]
+
+table (reflection.SchemaFile):
+ +0x00C8 | 64 CB FF FF | SOffset32 | 0xFFFFCB64 (-13468) Loc: +0x3564 | offset to vtable
+ +0x00CC | 94 36 00 00 | UOffset32 | 0x00003694 (13972) Loc: +0x3760 | offset to field `key` (string)
+ +0x00D0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00D4 | offset to field `value` (string)
+
+string (reflection.SchemaFile.value):
+ +0x00D4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x00D8 | E0 | char[1] | à | string literal
+ +0x00D9 | 36 | char | 0x36 (54) | string terminator
+
+padding:
+ +0x00DA | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.SchemaFile):
+ +0x00DC | 78 CB FF FF | SOffset32 | 0xFFFFCB78 (-13448) Loc: +0x3564 | offset to vtable
+ +0x00E0 | 34 38 00 00 | UOffset32 | 0x00003834 (14388) Loc: +0x3914 | offset to field `key` (string)
+ +0x00E4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x00E8 | offset to field `value` (string)
+
+string (reflection.SchemaFile.value):
+ +0x00E8 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x00EC | CC 36 | char[2] | Ì6 | string literal
+ +0x00EE | 00 | char | 0x00 (0) | string terminator
+
+unknown (no known references):
+ +0x00EF | 00 24 38 00 00 | ?uint8_t[5] | .$8.. | WARN: could be corrupted padding region.
+
+table (reflection.SchemaFile):
+ +0x00F4 | 90 CB FF FF | SOffset32 | 0xFFFFCB90 (-13424) Loc: +0x3564 | offset to vtable
+ +0x00F8 | C0 36 00 00 | UOffset32 | 0x000036C0 (14016) Loc: +0x37B8 | offset to field `key` (string)
+ +0x00FC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0100 | offset to field `value` (string)
+
+string (reflection.SchemaFile.value):
+ +0x0100 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x0104 | B4 36 | char[2] | ´6 | string literal
+ +0x0106 | 00 | char | 0x00 (0) | string terminator
+
+unknown (no known references):
+ +0x0107 | 00 0C 38 00 00 00 00 | ?uint8_t[7] | ..8.... | WARN: could be corrupted padding region.
+
+vtable (reflection.Service):
+ +0x010E | 0E 00 | uint16_t | 0x000E (14) | size of this vtable
+ +0x0110 | 14 00 | uint16_t | 0x0014 (20) | size of referring table
+ +0x0112 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `name` (id: 0)
+ +0x0114 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `calls` (id: 1)
+ +0x0116 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `attributes` (id: 2) <null> (Vector)
+ +0x0118 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `documentation` (id: 3)
+ +0x011A | 10 00 | VOffset16 | 0x0010 (16) | offset to field `declaration_file` (id: 4)
+
+table (reflection.Service):
+ +0x011C | 0E 00 00 00 | SOffset32 | 0x0000000E (14) Loc: +0x010E | offset to vtable
+ +0x0120 | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x0148 | offset to field `name` (string)
+ +0x0124 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0134 | offset to field `calls` (vector)
+ +0x0128 | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x0130 | offset to field `documentation` (vector)
+ +0x012C | 34 36 00 00 | UOffset32 | 0x00003634 (13876) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Service.documentation):
+ +0x0130 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Service.calls):
+ +0x0134 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of vector (# items)
+ +0x0138 | 88 01 00 00 | UOffset32 | 0x00000188 (392) Loc: +0x02C0 | offset to table[0]
+ +0x013C | F4 00 00 00 | UOffset32 | 0x000000F4 (244) Loc: +0x0230 | offset to table[1]
+ +0x0140 | 90 00 00 00 | UOffset32 | 0x00000090 (144) Loc: +0x01D0 | offset to table[2]
+ +0x0144 | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x016C | offset to table[3]
+
+string (reflection.Service.name):
+ +0x0148 | 1D 00 00 00 | uint32_t | 0x0000001D (29) | length of string
+ +0x014C | 4D 79 47 61 6D 65 2E 45 | char[29] | MyGame.E | string literal
+ +0x0154 | 78 61 6D 70 6C 65 2E 4D | | xample.M
+ +0x015C | 6F 6E 73 74 65 72 53 74 | | onsterSt
+ +0x0164 | 6F 72 61 67 65 | | orage
+ +0x0169 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x016A | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.RPCCall):
+ +0x016C | BA FE FF FF | SOffset32 | 0xFFFFFEBA (-326) Loc: +0x02B2 | offset to vtable
+ +0x0170 | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x01B8 | offset to field `name` (string)
+ +0x0174 | 5C 0D 00 00 | UOffset32 | 0x00000D5C (3420) Loc: +0x0ED0 | offset to field `request` (table)
+ +0x0178 | D4 2D 00 00 | UOffset32 | 0x00002DD4 (11732) Loc: +0x2F4C | offset to field `response` (table)
+ +0x017C | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0188 | offset to field `attributes` (vector)
+ +0x0180 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0184 | offset to field `documentation` (vector)
+
+vector (reflection.RPCCall.documentation):
+ +0x0184 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.RPCCall.attributes):
+ +0x0188 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x018C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0190 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x0190 | 2C CC FF FF | SOffset32 | 0xFFFFCC2C (-13268) Loc: +0x3564 | offset to vtable
+ +0x0194 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x01A8 | offset to field `key` (string)
+ +0x0198 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x019C | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x019C | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x01A0 | 62 69 64 69 | char[4] | bidi | string literal
+ +0x01A4 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x01A5 | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x01A8 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of string
+ +0x01AC | 73 74 72 65 61 6D 69 6E | char[9] | streamin | string literal
+ +0x01B4 | 67 | | g
+ +0x01B5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x01B6 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.RPCCall.name):
+ +0x01B8 | 12 00 00 00 | uint32_t | 0x00000012 (18) | length of string
+ +0x01BC | 47 65 74 4D 69 6E 4D 61 | char[18] | GetMinMa | string literal
+ +0x01C4 | 78 48 69 74 50 6F 69 6E | | xHitPoin
+ +0x01CC | 74 73 | | ts
+ +0x01CE | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.RPCCall):
+ +0x01D0 | 1E FF FF FF | SOffset32 | 0xFFFFFF1E (-226) Loc: +0x02B2 | offset to vtable
+ +0x01D4 | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x021C | offset to field `name` (string)
+ +0x01D8 | F8 0C 00 00 | UOffset32 | 0x00000CF8 (3320) Loc: +0x0ED0 | offset to field `request` (table)
+ +0x01DC | 70 2D 00 00 | UOffset32 | 0x00002D70 (11632) Loc: +0x2F4C | offset to field `response` (table)
+ +0x01E0 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x01EC | offset to field `attributes` (vector)
+ +0x01E4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x01E8 | offset to field `documentation` (vector)
+
+vector (reflection.RPCCall.documentation):
+ +0x01E8 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.RPCCall.attributes):
+ +0x01EC | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x01F0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x01F4 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x01F4 | 90 CC FF FF | SOffset32 | 0xFFFFCC90 (-13168) Loc: +0x3564 | offset to vtable
+ +0x01F8 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x020C | offset to field `key` (string)
+ +0x01FC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0200 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x0200 | 06 00 00 00 | uint32_t | 0x00000006 (6) | length of string
+ +0x0204 | 63 6C 69 65 6E 74 | char[6] | client | string literal
+ +0x020A | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x020C | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of string
+ +0x0210 | 73 74 72 65 61 6D 69 6E | char[9] | streamin | string literal
+ +0x0218 | 67 | | g
+ +0x0219 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x021A | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.RPCCall.name):
+ +0x021C | 0E 00 00 00 | uint32_t | 0x0000000E (14) | length of string
+ +0x0220 | 47 65 74 4D 61 78 48 69 | char[14] | GetMaxHi | string literal
+ +0x0228 | 74 50 6F 69 6E 74 | | tPoint
+ +0x022E | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.RPCCall):
+ +0x0230 | 7E FF FF FF | SOffset32 | 0xFFFFFF7E (-130) Loc: +0x02B2 | offset to vtable
+ +0x0234 | 70 00 00 00 | UOffset32 | 0x00000070 (112) Loc: +0x02A4 | offset to field `name` (string)
+ +0x0238 | 14 2D 00 00 | UOffset32 | 0x00002D14 (11540) Loc: +0x2F4C | offset to field `request` (table)
+ +0x023C | 94 0C 00 00 | UOffset32 | 0x00000C94 (3220) Loc: +0x0ED0 | offset to field `response` (table)
+ +0x0240 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x024C | offset to field `attributes` (vector)
+ +0x0244 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0248 | offset to field `documentation` (vector)
+
+vector (reflection.RPCCall.documentation):
+ +0x0248 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.RPCCall.attributes):
+ +0x024C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x0250 | 30 00 00 00 | UOffset32 | 0x00000030 (48) Loc: +0x0280 | offset to table[0]
+ +0x0254 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0258 | offset to table[1]
+
+table (reflection.KeyValue):
+ +0x0258 | F4 CC FF FF | SOffset32 | 0xFFFFCCF4 (-13068) Loc: +0x3564 | offset to vtable
+ +0x025C | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0270 | offset to field `key` (string)
+ +0x0260 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0264 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x0264 | 06 00 00 00 | uint32_t | 0x00000006 (6) | length of string
+ +0x0268 | 73 65 72 76 65 72 | char[6] | server | string literal
+ +0x026E | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x0270 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of string
+ +0x0274 | 73 74 72 65 61 6D 69 6E | char[9] | streamin | string literal
+ +0x027C | 67 | | g
+ +0x027D | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x027E | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.KeyValue):
+ +0x0280 | 1C CD FF FF | SOffset32 | 0xFFFFCD1C (-13028) Loc: +0x3564 | offset to vtable
+ +0x0284 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0294 | offset to field `key` (string)
+ +0x0288 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x028C | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x028C | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x0290 | 30 | char[1] | 0 | string literal
+ +0x0291 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0292 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x0294 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | length of string
+ +0x0298 | 69 64 65 6D 70 6F 74 65 | char[10] | idempote | string literal
+ +0x02A0 | 6E 74 | | nt
+ +0x02A2 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.RPCCall.name):
+ +0x02A4 | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x02A8 | 52 65 74 72 69 65 76 65 | char[8] | Retrieve | string literal
+ +0x02B0 | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.RPCCall):
+ +0x02B2 | 0E 00 | uint16_t | 0x000E (14) | size of this vtable
+ +0x02B4 | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x02B6 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `name` (id: 0)
+ +0x02B8 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `request` (id: 1)
+ +0x02BA | 0C 00 | VOffset16 | 0x000C (12) | offset to field `response` (id: 2)
+ +0x02BC | 10 00 | VOffset16 | 0x0010 (16) | offset to field `attributes` (id: 3)
+ +0x02BE | 14 00 | VOffset16 | 0x0014 (20) | offset to field `documentation` (id: 4)
+
+table (reflection.RPCCall):
+ +0x02C0 | 0E 00 00 00 | SOffset32 | 0x0000000E (14) Loc: +0x02B2 | offset to vtable
+ +0x02C4 | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x030C | offset to field `name` (string)
+ +0x02C8 | 08 0C 00 00 | UOffset32 | 0x00000C08 (3080) Loc: +0x0ED0 | offset to field `request` (table)
+ +0x02CC | 80 2C 00 00 | UOffset32 | 0x00002C80 (11392) Loc: +0x2F4C | offset to field `response` (table)
+ +0x02D0 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x02DC | offset to field `attributes` (vector)
+ +0x02D4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x02D8 | offset to field `documentation` (vector)
+
+vector (reflection.RPCCall.documentation):
+ +0x02D8 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.RPCCall.attributes):
+ +0x02DC | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x02E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x02E4 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x02E4 | 80 CD FF FF | SOffset32 | 0xFFFFCD80 (-12928) Loc: +0x3564 | offset to vtable
+ +0x02E8 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x02FC | offset to field `key` (string)
+ +0x02EC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x02F0 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x02F0 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x02F4 | 6E 6F 6E 65 | char[4] | none | string literal
+ +0x02F8 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x02F9 | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x02FC | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of string
+ +0x0300 | 73 74 72 65 61 6D 69 6E | char[9] | streamin | string literal
+ +0x0308 | 67 | | g
+ +0x0309 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x030A | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.RPCCall.name):
+ +0x030C | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x0310 | 53 74 6F 72 65 | char[5] | Store | string literal
+ +0x0315 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0316 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Enum):
+ +0x0318 | 82 FD FF FF | SOffset32 | 0xFFFFFD82 (-638) Loc: +0x0596 | offset to vtable
+ +0x031C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x031F | 01 | uint8_t | 0x01 (1) | table field `is_union` (Bool)
+ +0x0320 | 40 00 00 00 | UOffset32 | 0x00000040 (64) Loc: +0x0360 | offset to field `name` (string)
+ +0x0324 | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x034C | offset to field `values` (vector)
+ +0x0328 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0338 | offset to field `underlying_type` (table)
+ +0x032C | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x0334 | offset to field `documentation` (vector)
+ +0x0330 | 30 34 00 00 | UOffset32 | 0x00003430 (13360) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Enum.documentation):
+ +0x0334 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0338 | 34 CD FF FF | SOffset32 | 0xFFFFCD34 (-13004) Loc: +0x3604 | offset to vtable
+ +0x033C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x033F | 01 | uint8_t | 0x01 (1) | table field `base_type` (Byte)
+ +0x0340 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `index` (Int)
+ +0x0344 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x0348 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+vector (reflection.Enum.values):
+ +0x034C | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of vector (# items)
+ +0x0350 | E0 00 00 00 | UOffset32 | 0x000000E0 (224) Loc: +0x0430 | offset to table[0]
+ +0x0354 | A4 00 00 00 | UOffset32 | 0x000000A4 (164) Loc: +0x03F8 | offset to table[1]
+ +0x0358 | 68 00 00 00 | UOffset32 | 0x00000068 (104) Loc: +0x03C0 | offset to table[2]
+ +0x035C | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0388 | offset to table[3]
+
+string (reflection.Enum.name):
+ +0x0360 | 22 00 00 00 | uint32_t | 0x00000022 (34) | length of string
+ +0x0364 | 4D 79 47 61 6D 65 2E 45 | char[34] | MyGame.E | string literal
+ +0x036C | 78 61 6D 70 6C 65 2E 41 | | xample.A
+ +0x0374 | 6E 79 41 6D 62 69 67 75 | | nyAmbigu
+ +0x037C | 6F 75 73 41 6C 69 61 73 | | ousAlias
+ +0x0384 | 65 73 | | es
+ +0x0386 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.EnumVal):
+ +0x0388 | 7E F8 FF FF | SOffset32 | 0xFFFFF87E (-1922) Loc: +0x0B0A | offset to vtable
+ +0x038C | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x03B8 | offset to field `name` (string)
+ +0x0390 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x03A8 | offset to field `union_type` (table)
+ +0x0394 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x03A4 | offset to field `documentation` (vector)
+ +0x0398 | 03 00 00 00 00 00 00 00 | int64_t | 0x0000000000000003 (3) | table field `value` (Long)
+ +0x03A0 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (reflection.EnumVal.documentation):
+ +0x03A4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x03A8 | F0 CA FF FF | SOffset32 | 0xFFFFCAF0 (-13584) Loc: +0x38B8 | offset to vtable
+ +0x03AC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x03AF | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x03B0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `index` (Int)
+ +0x03B4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x03B8 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x03BC | 4D 33 | char[2] | M3 | string literal
+ +0x03BE | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.EnumVal):
+ +0x03C0 | B6 F8 FF FF | SOffset32 | 0xFFFFF8B6 (-1866) Loc: +0x0B0A | offset to vtable
+ +0x03C4 | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x03F0 | offset to field `name` (string)
+ +0x03C8 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x03E0 | offset to field `union_type` (table)
+ +0x03CC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x03DC | offset to field `documentation` (vector)
+ +0x03D0 | 02 00 00 00 00 00 00 00 | int64_t | 0x0000000000000002 (2) | table field `value` (Long)
+ +0x03D8 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (reflection.EnumVal.documentation):
+ +0x03DC | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x03E0 | 28 CB FF FF | SOffset32 | 0xFFFFCB28 (-13528) Loc: +0x38B8 | offset to vtable
+ +0x03E4 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x03E7 | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x03E8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `index` (Int)
+ +0x03EC | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x03F0 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x03F4 | 4D 32 | char[2] | M2 | string literal
+ +0x03F6 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.EnumVal):
+ +0x03F8 | EE F8 FF FF | SOffset32 | 0xFFFFF8EE (-1810) Loc: +0x0B0A | offset to vtable
+ +0x03FC | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0428 | offset to field `name` (string)
+ +0x0400 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x0418 | offset to field `union_type` (table)
+ +0x0404 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0414 | offset to field `documentation` (vector)
+ +0x0408 | 01 00 00 00 00 00 00 00 | int64_t | 0x0000000000000001 (1) | table field `value` (Long)
+ +0x0410 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (reflection.EnumVal.documentation):
+ +0x0414 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0418 | 60 CB FF FF | SOffset32 | 0xFFFFCB60 (-13472) Loc: +0x38B8 | offset to vtable
+ +0x041C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x041F | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x0420 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `index` (Int)
+ +0x0424 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x0428 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x042C | 4D 31 | char[2] | M1 | string literal
+ +0x042E | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.EnumVal):
+ +0x0430 | 72 F8 FF FF | SOffset32 | 0xFFFFF872 (-1934) Loc: +0x0BBE | offset to vtable
+ +0x0434 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x0450 | offset to field `name` (string)
+ +0x0438 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0444 | offset to field `union_type` (table)
+ +0x043C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0440 | offset to field `documentation` (vector)
+
+vector (reflection.EnumVal.documentation):
+ +0x0440 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0444 | 64 F8 FF FF | SOffset32 | 0xFFFFF864 (-1948) Loc: +0x0BE0 | offset to vtable
+ +0x0448 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x044C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x0450 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x0454 | 4E 4F 4E 45 | char[4] | NONE | string literal
+ +0x0458 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0459 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Enum):
+ +0x045C | C6 FE FF FF | SOffset32 | 0xFFFFFEC6 (-314) Loc: +0x0596 | offset to vtable
+ +0x0460 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0463 | 01 | uint8_t | 0x01 (1) | table field `is_union` (Bool)
+ +0x0464 | 40 00 00 00 | UOffset32 | 0x00000040 (64) Loc: +0x04A4 | offset to field `name` (string)
+ +0x0468 | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x0490 | offset to field `values` (vector)
+ +0x046C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x047C | offset to field `underlying_type` (table)
+ +0x0470 | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x0478 | offset to field `documentation` (vector)
+ +0x0474 | EC 32 00 00 | UOffset32 | 0x000032EC (13036) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Enum.documentation):
+ +0x0478 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x047C | 78 CE FF FF | SOffset32 | 0xFFFFCE78 (-12680) Loc: +0x3604 | offset to vtable
+ +0x0480 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0483 | 01 | uint8_t | 0x01 (1) | table field `base_type` (Byte)
+ +0x0484 | 02 00 00 00 | uint32_t | 0x00000002 (2) | table field `index` (Int)
+ +0x0488 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x048C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+vector (reflection.Enum.values):
+ +0x0490 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of vector (# items)
+ +0x0494 | D8 00 00 00 | UOffset32 | 0x000000D8 (216) Loc: +0x056C | offset to table[0]
+ +0x0498 | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x0538 | offset to table[1]
+ +0x049C | 64 00 00 00 | UOffset32 | 0x00000064 (100) Loc: +0x0500 | offset to table[2]
+ +0x04A0 | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x04C8 | offset to table[3]
+
+string (reflection.Enum.name):
+ +0x04A4 | 1F 00 00 00 | uint32_t | 0x0000001F (31) | length of string
+ +0x04A8 | 4D 79 47 61 6D 65 2E 45 | char[31] | MyGame.E | string literal
+ +0x04B0 | 78 61 6D 70 6C 65 2E 41 | | xample.A
+ +0x04B8 | 6E 79 55 6E 69 71 75 65 | | nyUnique
+ +0x04C0 | 41 6C 69 61 73 65 73 | | Aliases
+ +0x04C7 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.EnumVal):
+ +0x04C8 | BE F9 FF FF | SOffset32 | 0xFFFFF9BE (-1602) Loc: +0x0B0A | offset to vtable
+ +0x04CC | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x04F8 | offset to field `name` (string)
+ +0x04D0 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x04E8 | offset to field `union_type` (table)
+ +0x04D4 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x04E4 | offset to field `documentation` (vector)
+ +0x04D8 | 03 00 00 00 00 00 00 00 | int64_t | 0x0000000000000003 (3) | table field `value` (Long)
+ +0x04E0 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (reflection.EnumVal.documentation):
+ +0x04E4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x04E8 | 30 CC FF FF | SOffset32 | 0xFFFFCC30 (-13264) Loc: +0x38B8 | offset to vtable
+ +0x04EC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x04EF | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x04F0 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | table field `index` (Int)
+ +0x04F4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x04F8 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x04FC | 4D 32 | char[2] | M2 | string literal
+ +0x04FE | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.EnumVal):
+ +0x0500 | F6 F9 FF FF | SOffset32 | 0xFFFFF9F6 (-1546) Loc: +0x0B0A | offset to vtable
+ +0x0504 | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0530 | offset to field `name` (string)
+ +0x0508 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x0520 | offset to field `union_type` (table)
+ +0x050C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x051C | offset to field `documentation` (vector)
+ +0x0510 | 02 00 00 00 00 00 00 00 | int64_t | 0x0000000000000002 (2) | table field `value` (Long)
+ +0x0518 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (reflection.EnumVal.documentation):
+ +0x051C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0520 | 68 CC FF FF | SOffset32 | 0xFFFFCC68 (-13208) Loc: +0x38B8 | offset to vtable
+ +0x0524 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0527 | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x0528 | 07 00 00 00 | uint32_t | 0x00000007 (7) | table field `index` (Int)
+ +0x052C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x0530 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x0534 | 54 53 | char[2] | TS | string literal
+ +0x0536 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.EnumVal):
+ +0x0538 | 1E FC FF FF | SOffset32 | 0xFFFFFC1E (-994) Loc: +0x091A | offset to vtable
+ +0x053C | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x0564 | offset to field `name` (string)
+ +0x0540 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0554 | offset to field `union_type` (table)
+ +0x0544 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0550 | offset to field `documentation` (vector)
+ +0x0548 | 01 00 00 00 00 00 00 00 | int64_t | 0x0000000000000001 (1) | table field `value` (Long)
+
+vector (reflection.EnumVal.documentation):
+ +0x0550 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0554 | 9C CC FF FF | SOffset32 | 0xFFFFCC9C (-13156) Loc: +0x38B8 | offset to vtable
+ +0x0558 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x055B | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x055C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `index` (Int)
+ +0x0560 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x0564 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x0568 | 4D | char[1] | M | string literal
+ +0x0569 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x056A | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.EnumVal):
+ +0x056C | AE F9 FF FF | SOffset32 | 0xFFFFF9AE (-1618) Loc: +0x0BBE | offset to vtable
+ +0x0570 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x058C | offset to field `name` (string)
+ +0x0574 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0580 | offset to field `union_type` (table)
+ +0x0578 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x057C | offset to field `documentation` (vector)
+
+vector (reflection.EnumVal.documentation):
+ +0x057C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0580 | A0 F9 FF FF | SOffset32 | 0xFFFFF9A0 (-1632) Loc: +0x0BE0 | offset to vtable
+ +0x0584 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x0588 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x058C | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x0590 | 4E 4F 4E 45 | char[4] | NONE | string literal
+ +0x0594 | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.Enum):
+ +0x0596 | 12 00 | uint16_t | 0x0012 (18) | size of this vtable
+ +0x0598 | 1C 00 | uint16_t | 0x001C (28) | size of referring table
+ +0x059A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `name` (id: 0)
+ +0x059C | 0C 00 | VOffset16 | 0x000C (12) | offset to field `values` (id: 1)
+ +0x059E | 07 00 | VOffset16 | 0x0007 (7) | offset to field `is_union` (id: 2)
+ +0x05A0 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `underlying_type` (id: 3)
+ +0x05A2 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `attributes` (id: 4) <null> (Vector)
+ +0x05A4 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `documentation` (id: 5)
+ +0x05A6 | 18 00 | VOffset16 | 0x0018 (24) | offset to field `declaration_file` (id: 6)
+
+table (reflection.Enum):
+ +0x05A8 | 12 00 00 00 | SOffset32 | 0x00000012 (18) Loc: +0x0596 | offset to vtable
+ +0x05AC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x05AF | 01 | uint8_t | 0x01 (1) | table field `is_union` (Bool)
+ +0x05B0 | 40 00 00 00 | UOffset32 | 0x00000040 (64) Loc: +0x05F0 | offset to field `name` (string)
+ +0x05B4 | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x05DC | offset to field `values` (vector)
+ +0x05B8 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x05C8 | offset to field `underlying_type` (table)
+ +0x05BC | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x05C4 | offset to field `documentation` (vector)
+ +0x05C0 | A0 31 00 00 | UOffset32 | 0x000031A0 (12704) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Enum.documentation):
+ +0x05C4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x05C8 | C4 CF FF FF | SOffset32 | 0xFFFFCFC4 (-12348) Loc: +0x3604 | offset to vtable
+ +0x05CC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x05CF | 01 | uint8_t | 0x01 (1) | table field `base_type` (Byte)
+ +0x05D0 | 00 00 00 00 | uint32_t | 0x00000000 (0) | table field `index` (Int)
+ +0x05D4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x05D8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+vector (reflection.Enum.values):
+ +0x05DC | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of vector (# items)
+ +0x05E0 | F0 00 00 00 | UOffset32 | 0x000000F0 (240) Loc: +0x06D0 | offset to table[0]
+ +0x05E4 | B4 00 00 00 | UOffset32 | 0x000000B4 (180) Loc: +0x0698 | offset to table[1]
+ +0x05E8 | 68 00 00 00 | UOffset32 | 0x00000068 (104) Loc: +0x0650 | offset to table[2]
+ +0x05EC | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x0608 | offset to table[3]
+
+string (reflection.Enum.name):
+ +0x05F0 | 12 00 00 00 | uint32_t | 0x00000012 (18) | length of string
+ +0x05F4 | 4D 79 47 61 6D 65 2E 45 | char[18] | MyGame.E | string literal
+ +0x05FC | 78 61 6D 70 6C 65 2E 41 | | xample.A
+ +0x0604 | 6E 79 | | ny
+ +0x0606 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.EnumVal):
+ +0x0608 | EE FC FF FF | SOffset32 | 0xFFFFFCEE (-786) Loc: +0x091A | offset to vtable
+ +0x060C | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x0634 | offset to field `name` (string)
+ +0x0610 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0624 | offset to field `union_type` (table)
+ +0x0614 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0620 | offset to field `documentation` (vector)
+ +0x0618 | 03 00 00 00 00 00 00 00 | int64_t | 0x0000000000000003 (3) | table field `value` (Long)
+
+vector (reflection.EnumVal.documentation):
+ +0x0620 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0624 | 6C CD FF FF | SOffset32 | 0xFFFFCD6C (-12948) Loc: +0x38B8 | offset to vtable
+ +0x0628 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x062B | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x062C | 0A 00 00 00 | uint32_t | 0x0000000A (10) | table field `index` (Int)
+ +0x0630 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x0634 | 17 00 00 00 | uint32_t | 0x00000017 (23) | length of string
+ +0x0638 | 4D 79 47 61 6D 65 5F 45 | char[23] | MyGame_E | string literal
+ +0x0640 | 78 61 6D 70 6C 65 32 5F | | xample2_
+ +0x0648 | 4D 6F 6E 73 74 65 72 | | Monster
+ +0x064F | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.EnumVal):
+ +0x0650 | 36 FD FF FF | SOffset32 | 0xFFFFFD36 (-714) Loc: +0x091A | offset to vtable
+ +0x0654 | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x067C | offset to field `name` (string)
+ +0x0658 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x066C | offset to field `union_type` (table)
+ +0x065C | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0668 | offset to field `documentation` (vector)
+ +0x0660 | 02 00 00 00 00 00 00 00 | int64_t | 0x0000000000000002 (2) | table field `value` (Long)
+
+vector (reflection.EnumVal.documentation):
+ +0x0668 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x066C | B4 CD FF FF | SOffset32 | 0xFFFFCDB4 (-12876) Loc: +0x38B8 | offset to vtable
+ +0x0670 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0673 | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x0674 | 07 00 00 00 | uint32_t | 0x00000007 (7) | table field `index` (Int)
+ +0x0678 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x067C | 17 00 00 00 | uint32_t | 0x00000017 (23) | length of string
+ +0x0680 | 54 65 73 74 53 69 6D 70 | char[23] | TestSimp | string literal
+ +0x0688 | 6C 65 54 61 62 6C 65 57 | | leTableW
+ +0x0690 | 69 74 68 45 6E 75 6D | | ithEnum
+ +0x0697 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.EnumVal):
+ +0x0698 | 7E FD FF FF | SOffset32 | 0xFFFFFD7E (-642) Loc: +0x091A | offset to vtable
+ +0x069C | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x06C4 | offset to field `name` (string)
+ +0x06A0 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x06B4 | offset to field `union_type` (table)
+ +0x06A4 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x06B0 | offset to field `documentation` (vector)
+ +0x06A8 | 01 00 00 00 00 00 00 00 | int64_t | 0x0000000000000001 (1) | table field `value` (Long)
+
+vector (reflection.EnumVal.documentation):
+ +0x06B0 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x06B4 | FC CD FF FF | SOffset32 | 0xFFFFCDFC (-12804) Loc: +0x38B8 | offset to vtable
+ +0x06B8 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x06BB | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x06BC | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `index` (Int)
+ +0x06C0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x06C4 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x06C8 | 4D 6F 6E 73 74 65 72 | char[7] | Monster | string literal
+ +0x06CF | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.EnumVal):
+ +0x06D0 | 12 FB FF FF | SOffset32 | 0xFFFFFB12 (-1262) Loc: +0x0BBE | offset to vtable
+ +0x06D4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x06F0 | offset to field `name` (string)
+ +0x06D8 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x06E4 | offset to field `union_type` (table)
+ +0x06DC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x06E0 | offset to field `documentation` (vector)
+
+vector (reflection.EnumVal.documentation):
+ +0x06E0 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x06E4 | 04 FB FF FF | SOffset32 | 0xFFFFFB04 (-1276) Loc: +0x0BE0 | offset to vtable
+ +0x06E8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x06EC | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x06F0 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x06F4 | 4E 4F 4E 45 | char[4] | NONE | string literal
+ +0x06F8 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x06F9 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Enum):
+ +0x06FC | A2 FD FF FF | SOffset32 | 0xFFFFFDA2 (-606) Loc: +0x095A | offset to vtable
+ +0x0700 | 6C 00 00 00 | UOffset32 | 0x0000006C (108) Loc: +0x076C | offset to field `name` (string)
+ +0x0704 | 58 00 00 00 | UOffset32 | 0x00000058 (88) Loc: +0x075C | offset to field `values` (vector)
+ +0x0708 | 40 00 00 00 | UOffset32 | 0x00000040 (64) Loc: +0x0748 | offset to field `underlying_type` (table)
+ +0x070C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x071C | offset to field `attributes` (vector)
+ +0x0710 | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x0718 | offset to field `documentation` (vector)
+ +0x0714 | 4C 30 00 00 | UOffset32 | 0x0000304C (12364) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Enum.documentation):
+ +0x0718 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Enum.attributes):
+ +0x071C | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x0720 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0724 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x0724 | C0 D1 FF FF | SOffset32 | 0xFFFFD1C0 (-11840) Loc: +0x3564 | offset to vtable
+ +0x0728 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0738 | offset to field `key` (string)
+ +0x072C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0730 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x0730 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x0734 | 30 | char[1] | 0 | string literal
+ +0x0735 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0736 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x0738 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of string
+ +0x073C | 62 69 74 5F 66 6C 61 67 | char[9] | bit_flag | string literal
+ +0x0744 | 73 | | s
+ +0x0745 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0746 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Type):
+ +0x0748 | 44 D1 FF FF | SOffset32 | 0xFFFFD144 (-11964) Loc: +0x3604 | offset to vtable
+ +0x074C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x074F | 0A | uint8_t | 0x0A (10) | table field `base_type` (Byte)
+ +0x0750 | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `index` (Int)
+ +0x0754 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x0758 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+vector (reflection.Enum.values):
+ +0x075C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0760 | 98 00 00 00 | UOffset32 | 0x00000098 (152) Loc: +0x07F8 | offset to table[0]
+ +0x0764 | 5C 00 00 00 | UOffset32 | 0x0000005C (92) Loc: +0x07C0 | offset to table[1]
+ +0x0768 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0788 | offset to table[2]
+
+string (reflection.Enum.name):
+ +0x076C | 17 00 00 00 | uint32_t | 0x00000017 (23) | length of string
+ +0x0770 | 4D 79 47 61 6D 65 2E 45 | char[23] | MyGame.E | string literal
+ +0x0778 | 78 61 6D 70 6C 65 2E 4C | | xample.L
+ +0x0780 | 6F 6E 67 45 6E 75 6D | | ongEnum
+ +0x0787 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.EnumVal):
+ +0x0788 | 7E FC FF FF | SOffset32 | 0xFFFFFC7E (-898) Loc: +0x0B0A | offset to vtable
+ +0x078C | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x07B4 | offset to field `name` (string)
+ +0x0790 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x07A8 | offset to field `union_type` (table)
+ +0x0794 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x07A4 | offset to field `documentation` (vector)
+ +0x0798 | 00 00 00 00 00 01 00 00 | int64_t | 0x0000010000000000 (1099511627776) | table field `value` (Long)
+ +0x07A0 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (reflection.EnumVal.documentation):
+ +0x07A4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x07A8 | C8 FB FF FF | SOffset32 | 0xFFFFFBC8 (-1080) Loc: +0x0BE0 | offset to vtable
+ +0x07AC | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x07B0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x07B4 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x07B8 | 4C 6F 6E 67 42 69 67 | char[7] | LongBig | string literal
+ +0x07BF | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.EnumVal):
+ +0x07C0 | B6 FC FF FF | SOffset32 | 0xFFFFFCB6 (-842) Loc: +0x0B0A | offset to vtable
+ +0x07C4 | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x07EC | offset to field `name` (string)
+ +0x07C8 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x07E0 | offset to field `union_type` (table)
+ +0x07CC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x07DC | offset to field `documentation` (vector)
+ +0x07D0 | 04 00 00 00 00 00 00 00 | int64_t | 0x0000000000000004 (4) | table field `value` (Long)
+ +0x07D8 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (reflection.EnumVal.documentation):
+ +0x07DC | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x07E0 | 00 FC FF FF | SOffset32 | 0xFFFFFC00 (-1024) Loc: +0x0BE0 | offset to vtable
+ +0x07E4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x07E8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x07EC | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x07F0 | 4C 6F 6E 67 54 77 6F | char[7] | LongTwo | string literal
+ +0x07F7 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.EnumVal):
+ +0x07F8 | DE FE FF FF | SOffset32 | 0xFFFFFEDE (-290) Loc: +0x091A | offset to vtable
+ +0x07FC | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x0820 | offset to field `name` (string)
+ +0x0800 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0814 | offset to field `union_type` (table)
+ +0x0804 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0810 | offset to field `documentation` (vector)
+ +0x0808 | 02 00 00 00 00 00 00 00 | int64_t | 0x0000000000000002 (2) | table field `value` (Long)
+
+vector (reflection.EnumVal.documentation):
+ +0x0810 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0814 | 34 FC FF FF | SOffset32 | 0xFFFFFC34 (-972) Loc: +0x0BE0 | offset to vtable
+ +0x0818 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x081C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x0820 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x0824 | 4C 6F 6E 67 4F 6E 65 | char[7] | LongOne | string literal
+ +0x082B | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Enum):
+ +0x082C | DE FC FF FF | SOffset32 | 0xFFFFFCDE (-802) Loc: +0x0B4E | offset to vtable
+ +0x0830 | 40 00 00 00 | UOffset32 | 0x00000040 (64) Loc: +0x0870 | offset to field `name` (string)
+ +0x0834 | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x085C | offset to field `values` (vector)
+ +0x0838 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0848 | offset to field `underlying_type` (table)
+ +0x083C | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x0844 | offset to field `documentation` (vector)
+ +0x0840 | 20 2F 00 00 | UOffset32 | 0x00002F20 (12064) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Enum.documentation):
+ +0x0844 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0848 | 44 D2 FF FF | SOffset32 | 0xFFFFD244 (-11708) Loc: +0x3604 | offset to vtable
+ +0x084C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x084F | 03 | uint8_t | 0x03 (3) | table field `base_type` (Byte)
+ +0x0850 | 05 00 00 00 | uint32_t | 0x00000005 (5) | table field `index` (Int)
+ +0x0854 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x0858 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+vector (reflection.Enum.values):
+ +0x085C | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of vector (# items)
+ +0x0860 | C8 00 00 00 | UOffset32 | 0x000000C8 (200) Loc: +0x0928 | offset to table[0]
+ +0x0864 | 8C 00 00 00 | UOffset32 | 0x0000008C (140) Loc: +0x08F0 | offset to table[1]
+ +0x0868 | 50 00 00 00 | UOffset32 | 0x00000050 (80) Loc: +0x08B8 | offset to table[2]
+ +0x086C | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x0888 | offset to table[3]
+
+string (reflection.Enum.name):
+ +0x0870 | 13 00 00 00 | uint32_t | 0x00000013 (19) | length of string
+ +0x0874 | 4D 79 47 61 6D 65 2E 45 | char[19] | MyGame.E | string literal
+ +0x087C | 78 61 6D 70 6C 65 2E 52 | | xample.R
+ +0x0884 | 61 63 65 | | ace
+ +0x0887 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.EnumVal):
+ +0x0888 | 6E FF FF FF | SOffset32 | 0xFFFFFF6E (-146) Loc: +0x091A | offset to vtable
+ +0x088C | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x08B0 | offset to field `name` (string)
+ +0x0890 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x08A4 | offset to field `union_type` (table)
+ +0x0894 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x08A0 | offset to field `documentation` (vector)
+ +0x0898 | 02 00 00 00 00 00 00 00 | int64_t | 0x0000000000000002 (2) | table field `value` (Long)
+
+vector (reflection.EnumVal.documentation):
+ +0x08A0 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x08A4 | C4 FC FF FF | SOffset32 | 0xFFFFFCC4 (-828) Loc: +0x0BE0 | offset to vtable
+ +0x08A8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x08AC | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x08B0 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x08B4 | 45 6C 66 | char[3] | Elf | string literal
+ +0x08B7 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.EnumVal):
+ +0x08B8 | AE FD FF FF | SOffset32 | 0xFFFFFDAE (-594) Loc: +0x0B0A | offset to vtable
+ +0x08BC | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x08E4 | offset to field `name` (string)
+ +0x08C0 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x08D8 | offset to field `union_type` (table)
+ +0x08C4 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x08D4 | offset to field `documentation` (vector)
+ +0x08C8 | 01 00 00 00 00 00 00 00 | int64_t | 0x0000000000000001 (1) | table field `value` (Long)
+ +0x08D0 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (reflection.EnumVal.documentation):
+ +0x08D4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x08D8 | F8 FC FF FF | SOffset32 | 0xFFFFFCF8 (-776) Loc: +0x0BE0 | offset to vtable
+ +0x08DC | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x08E0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x08E4 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x08E8 | 44 77 61 72 66 | char[5] | Dwarf | string literal
+ +0x08ED | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x08EE | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.EnumVal):
+ +0x08F0 | 32 FD FF FF | SOffset32 | 0xFFFFFD32 (-718) Loc: +0x0BBE | offset to vtable
+ +0x08F4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x0910 | offset to field `name` (string)
+ +0x08F8 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0904 | offset to field `union_type` (table)
+ +0x08FC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0900 | offset to field `documentation` (vector)
+
+vector (reflection.EnumVal.documentation):
+ +0x0900 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0904 | 24 FD FF FF | SOffset32 | 0xFFFFFD24 (-732) Loc: +0x0BE0 | offset to vtable
+ +0x0908 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x090C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x0910 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x0914 | 48 75 6D 61 6E | char[5] | Human | string literal
+ +0x0919 | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.EnumVal):
+ +0x091A | 0E 00 | uint16_t | 0x000E (14) | size of this vtable
+ +0x091C | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x091E | 04 00 | VOffset16 | 0x0004 (4) | offset to field `name` (id: 0)
+ +0x0920 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `value` (id: 1)
+ +0x0922 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `object` (id: 2) <null> (Obj)
+ +0x0924 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `union_type` (id: 3)
+ +0x0926 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `documentation` (id: 4)
+
+table (reflection.EnumVal):
+ +0x0928 | 0E 00 00 00 | SOffset32 | 0x0000000E (14) Loc: +0x091A | offset to vtable
+ +0x092C | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x0950 | offset to field `name` (string)
+ +0x0930 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0944 | offset to field `union_type` (table)
+ +0x0934 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0940 | offset to field `documentation` (vector)
+ +0x0938 | FF FF FF FF FF FF FF FF | int64_t | 0xFFFFFFFFFFFFFFFF (-1) | table field `value` (Long)
+
+vector (reflection.EnumVal.documentation):
+ +0x0940 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0944 | 64 FD FF FF | SOffset32 | 0xFFFFFD64 (-668) Loc: +0x0BE0 | offset to vtable
+ +0x0948 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x094C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x0950 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x0954 | 4E 6F 6E 65 | char[4] | None | string literal
+ +0x0958 | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.Enum):
+ +0x095A | 12 00 | uint16_t | 0x0012 (18) | size of this vtable
+ +0x095C | 1C 00 | uint16_t | 0x001C (28) | size of referring table
+ +0x095E | 04 00 | VOffset16 | 0x0004 (4) | offset to field `name` (id: 0)
+ +0x0960 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `values` (id: 1)
+ +0x0962 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `is_union` (id: 2) <defaults to 0> (Bool)
+ +0x0964 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `underlying_type` (id: 3)
+ +0x0966 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `attributes` (id: 4)
+ +0x0968 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `documentation` (id: 5)
+ +0x096A | 18 00 | VOffset16 | 0x0018 (24) | offset to field `declaration_file` (id: 6)
+
+table (reflection.Enum):
+ +0x096C | 12 00 00 00 | SOffset32 | 0x00000012 (18) Loc: +0x095A | offset to vtable
+ +0x0970 | 9C 00 00 00 | UOffset32 | 0x0000009C (156) Loc: +0x0A0C | offset to field `name` (string)
+ +0x0974 | 88 00 00 00 | UOffset32 | 0x00000088 (136) Loc: +0x09FC | offset to field `values` (vector)
+ +0x0978 | 70 00 00 00 | UOffset32 | 0x00000070 (112) Loc: +0x09E8 | offset to field `underlying_type` (table)
+ +0x097C | 40 00 00 00 | UOffset32 | 0x00000040 (64) Loc: +0x09BC | offset to field `attributes` (vector)
+ +0x0980 | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x0988 | offset to field `documentation` (vector)
+ +0x0984 | DC 2D 00 00 | UOffset32 | 0x00002DDC (11740) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Enum.documentation):
+ +0x0988 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x098C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0990 | offset to string[0]
+
+string (reflection.Enum.documentation):
+ +0x0990 | 27 00 00 00 | uint32_t | 0x00000027 (39) | length of string
+ +0x0994 | 20 43 6F 6D 70 6F 73 69 | char[39] | Composi | string literal
+ +0x099C | 74 65 20 63 6F 6D 70 6F | | te compo
+ +0x09A4 | 6E 65 6E 74 73 20 6F 66 | | nents of
+ +0x09AC | 20 4D 6F 6E 73 74 65 72 | | Monster
+ +0x09B4 | 20 63 6F 6C 6F 72 2E | | color.
+ +0x09BB | 00 | char | 0x00 (0) | string terminator
+
+vector (reflection.Enum.attributes):
+ +0x09BC | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x09C0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x09C4 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x09C4 | 60 D4 FF FF | SOffset32 | 0xFFFFD460 (-11168) Loc: +0x3564 | offset to vtable
+ +0x09C8 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x09D8 | offset to field `key` (string)
+ +0x09CC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x09D0 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x09D0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x09D4 | 30 | char[1] | 0 | string literal
+ +0x09D5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x09D6 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x09D8 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of string
+ +0x09DC | 62 69 74 5F 66 6C 61 67 | char[9] | bit_flag | string literal
+ +0x09E4 | 73 | | s
+ +0x09E5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x09E6 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Type):
+ +0x09E8 | E4 D3 FF FF | SOffset32 | 0xFFFFD3E4 (-11292) Loc: +0x3604 | offset to vtable
+ +0x09EC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x09EF | 04 | uint8_t | 0x04 (4) | table field `base_type` (Byte)
+ +0x09F0 | 03 00 00 00 | uint32_t | 0x00000003 (3) | table field `index` (Int)
+ +0x09F4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x09F8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+vector (reflection.Enum.values):
+ +0x09FC | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0A00 | 18 01 00 00 | UOffset32 | 0x00000118 (280) Loc: +0x0B18 | offset to table[0]
+ +0x0A04 | 84 00 00 00 | UOffset32 | 0x00000084 (132) Loc: +0x0A88 | offset to table[1]
+ +0x0A08 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0A28 | offset to table[2]
+
+string (reflection.Enum.name):
+ +0x0A0C | 14 00 00 00 | uint32_t | 0x00000014 (20) | length of string
+ +0x0A10 | 4D 79 47 61 6D 65 2E 45 | char[20] | MyGame.E | string literal
+ +0x0A18 | 78 61 6D 70 6C 65 2E 43 | | xample.C
+ +0x0A20 | 6F 6C 6F 72 | | olor
+ +0x0A24 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0A25 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.EnumVal):
+ +0x0A28 | 1E FF FF FF | SOffset32 | 0xFFFFFF1E (-226) Loc: +0x0B0A | offset to vtable
+ +0x0A2C | 50 00 00 00 | UOffset32 | 0x00000050 (80) Loc: +0x0A7C | offset to field `name` (string)
+ +0x0A30 | 40 00 00 00 | UOffset32 | 0x00000040 (64) Loc: +0x0A70 | offset to field `union_type` (table)
+ +0x0A34 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0A44 | offset to field `documentation` (vector)
+ +0x0A38 | 08 00 00 00 00 00 00 00 | int64_t | 0x0000000000000008 (8) | table field `value` (Long)
+ +0x0A40 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (reflection.EnumVal.documentation):
+ +0x0A44 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x0A48 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0A4C | offset to string[0]
+
+string (reflection.EnumVal.documentation):
+ +0x0A4C | 1C 00 00 00 | uint32_t | 0x0000001C (28) | length of string
+ +0x0A50 | 20 5C 62 72 69 65 66 20 | char[28] | \brief | string literal
+ +0x0A58 | 63 6F 6C 6F 72 20 42 6C | | color Bl
+ +0x0A60 | 75 65 20 28 31 75 20 3C | | ue (1u <
+ +0x0A68 | 3C 20 33 29 | | < 3)
+ +0x0A6C | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0A6D | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x0A70 | 90 FE FF FF | SOffset32 | 0xFFFFFE90 (-368) Loc: +0x0BE0 | offset to vtable
+ +0x0A74 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x0A78 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x0A7C | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x0A80 | 42 6C 75 65 | char[4] | Blue | string literal
+ +0x0A84 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0A85 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.EnumVal):
+ +0x0A88 | 7E FF FF FF | SOffset32 | 0xFFFFFF7E (-130) Loc: +0x0B0A | offset to vtable
+ +0x0A8C | 74 00 00 00 | UOffset32 | 0x00000074 (116) Loc: +0x0B00 | offset to field `name` (string)
+ +0x0A90 | 64 00 00 00 | UOffset32 | 0x00000064 (100) Loc: +0x0AF4 | offset to field `union_type` (table)
+ +0x0A94 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0AA4 | offset to field `documentation` (vector)
+ +0x0A98 | 02 00 00 00 00 00 00 00 | int64_t | 0x0000000000000002 (2) | table field `value` (Long)
+ +0x0AA0 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (reflection.EnumVal.documentation):
+ +0x0AA4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x0AA8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x0ADC | offset to string[0]
+ +0x0AAC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0AB0 | offset to string[1]
+
+string (reflection.EnumVal.documentation):
+ +0x0AB0 | 27 00 00 00 | uint32_t | 0x00000027 (39) | length of string
+ +0x0AB4 | 20 47 72 65 65 6E 20 69 | char[39] | Green i | string literal
+ +0x0ABC | 73 20 62 69 74 5F 66 6C | | s bit_fl
+ +0x0AC4 | 61 67 20 77 69 74 68 20 | | ag with
+ +0x0ACC | 76 61 6C 75 65 20 28 31 | | value (1
+ +0x0AD4 | 75 20 3C 3C 20 31 29 | | u << 1)
+ +0x0ADB | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.EnumVal.documentation):
+ +0x0ADC | 13 00 00 00 | uint32_t | 0x00000013 (19) | length of string
+ +0x0AE0 | 20 5C 62 72 69 65 66 20 | char[19] | \brief | string literal
+ +0x0AE8 | 63 6F 6C 6F 72 20 47 72 | | color Gr
+ +0x0AF0 | 65 65 6E | | een
+ +0x0AF3 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x0AF4 | 14 FF FF FF | SOffset32 | 0xFFFFFF14 (-236) Loc: +0x0BE0 | offset to vtable
+ +0x0AF8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x0AFC | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x0B00 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x0B04 | 47 72 65 65 6E | char[5] | Green | string literal
+ +0x0B09 | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.EnumVal):
+ +0x0B0A | 0E 00 | uint16_t | 0x000E (14) | size of this vtable
+ +0x0B0C | 1C 00 | uint16_t | 0x001C (28) | size of referring table
+ +0x0B0E | 04 00 | VOffset16 | 0x0004 (4) | offset to field `name` (id: 0)
+ +0x0B10 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `value` (id: 1)
+ +0x0B12 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `object` (id: 2) <null> (Obj)
+ +0x0B14 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `union_type` (id: 3)
+ +0x0B16 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `documentation` (id: 4)
+
+table (reflection.EnumVal):
+ +0x0B18 | 0E 00 00 00 | SOffset32 | 0x0000000E (14) Loc: +0x0B0A | offset to vtable
+ +0x0B1C | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x0B44 | offset to field `name` (string)
+ +0x0B20 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x0B38 | offset to field `union_type` (table)
+ +0x0B24 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0B34 | offset to field `documentation` (vector)
+ +0x0B28 | 01 00 00 00 00 00 00 00 | int64_t | 0x0000000000000001 (1) | table field `value` (Long)
+ +0x0B30 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (reflection.EnumVal.documentation):
+ +0x0B34 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0B38 | 58 FF FF FF | SOffset32 | 0xFFFFFF58 (-168) Loc: +0x0BE0 | offset to vtable
+ +0x0B3C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x0B40 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x0B44 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x0B48 | 52 65 64 | char[3] | Red | string literal
+ +0x0B4B | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0B4C | 00 00 | uint8_t[2] | .. | padding
+
+vtable (reflection.Enum):
+ +0x0B4E | 12 00 | uint16_t | 0x0012 (18) | size of this vtable
+ +0x0B50 | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x0B52 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `name` (id: 0)
+ +0x0B54 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `values` (id: 1)
+ +0x0B56 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `is_union` (id: 2) <defaults to 0> (Bool)
+ +0x0B58 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `underlying_type` (id: 3)
+ +0x0B5A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `attributes` (id: 4) <null> (Vector)
+ +0x0B5C | 10 00 | VOffset16 | 0x0010 (16) | offset to field `documentation` (id: 5)
+ +0x0B5E | 14 00 | VOffset16 | 0x0014 (20) | offset to field `declaration_file` (id: 6)
+
+table (reflection.Enum):
+ +0x0B60 | 12 00 00 00 | SOffset32 | 0x00000012 (18) Loc: +0x0B4E | offset to vtable
+ +0x0B64 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x0B98 | offset to field `name` (string)
+ +0x0B68 | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x0B90 | offset to field `values` (vector)
+ +0x0B6C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0B7C | offset to field `underlying_type` (table)
+ +0x0B70 | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x0B78 | offset to field `documentation` (vector)
+ +0x0B74 | A0 2D 00 00 | UOffset32 | 0x00002DA0 (11680) Loc: +0x3914 | offset to field `declaration_file` (string)
+
+vector (reflection.Enum.documentation):
+ +0x0B78 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0B7C | 78 D5 FF FF | SOffset32 | 0xFFFFD578 (-10888) Loc: +0x3604 | offset to vtable
+ +0x0B80 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0B83 | 09 | uint8_t | 0x09 (9) | table field `base_type` (Byte)
+ +0x0B84 | 06 00 00 00 | uint32_t | 0x00000006 (6) | table field `index` (Int)
+ +0x0B88 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x0B8C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+vector (reflection.Enum.values):
+ +0x0B90 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x0B94 | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x0BCC | offset to table[0]
+
+string (reflection.Enum.name):
+ +0x0B98 | 21 00 00 00 | uint32_t | 0x00000021 (33) | length of string
+ +0x0B9C | 4D 79 47 61 6D 65 2E 4F | char[33] | MyGame.O | string literal
+ +0x0BA4 | 74 68 65 72 4E 61 6D 65 | | therName
+ +0x0BAC | 53 70 61 63 65 2E 46 72 | | Space.Fr
+ +0x0BB4 | 6F 6D 49 6E 63 6C 75 64 | | omInclud
+ +0x0BBC | 65 | | e
+ +0x0BBD | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.EnumVal):
+ +0x0BBE | 0E 00 | uint16_t | 0x000E (14) | size of this vtable
+ +0x0BC0 | 10 00 | uint16_t | 0x0010 (16) | size of referring table
+ +0x0BC2 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `name` (id: 0)
+ +0x0BC4 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `value` (id: 1) <defaults to 0> (Long)
+ +0x0BC6 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `object` (id: 2) <null> (Obj)
+ +0x0BC8 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `union_type` (id: 3)
+ +0x0BCA | 0C 00 | VOffset16 | 0x000C (12) | offset to field `documentation` (id: 4)
+
+table (reflection.EnumVal):
+ +0x0BCC | 0E 00 00 00 | SOffset32 | 0x0000000E (14) Loc: +0x0BBE | offset to vtable
+ +0x0BD0 | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x0BFC | offset to field `name` (string)
+ +0x0BD4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x0BF0 | offset to field `union_type` (table)
+ +0x0BD8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0BDC | offset to field `documentation` (vector)
+
+vector (reflection.EnumVal.documentation):
+ +0x0BDC | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vtable (reflection.Type):
+ +0x0BE0 | 10 00 | uint16_t | 0x0010 (16) | size of this vtable
+ +0x0BE2 | 0C 00 | uint16_t | 0x000C (12) | size of referring table
+ +0x0BE4 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `base_type` (id: 0) <defaults to 0> (Byte)
+ +0x0BE6 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `element` (id: 1) <defaults to 0> (Byte)
+ +0x0BE8 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `index` (id: 2) <defaults to -1> (Int)
+ +0x0BEA | 00 00 | VOffset16 | 0x0000 (0) | offset to field `fixed_length` (id: 3) <defaults to 0> (UShort)
+ +0x0BEC | 04 00 | VOffset16 | 0x0004 (4) | offset to field `base_size` (id: 4)
+ +0x0BEE | 08 00 | VOffset16 | 0x0008 (8) | offset to field `element_size` (id: 5)
+
+table (reflection.Type):
+ +0x0BF0 | 10 00 00 00 | SOffset32 | 0x00000010 (16) Loc: +0x0BE0 | offset to vtable
+ +0x0BF4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x0BF8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.EnumVal.name):
+ +0x0BFC | 0A 00 00 00 | uint32_t | 0x0000000A (10) | length of string
+ +0x0C00 | 49 6E 63 6C 75 64 65 56 | char[10] | IncludeV | string literal
+ +0x0C08 | 61 6C | | al
+ +0x0C0A | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Object):
+ +0x0C0C | E4 D3 FF FF | SOffset32 | 0xFFFFD3E4 (-11292) Loc: +0x3828 | offset to vtable
+ +0x0C10 | 4C 00 00 00 | UOffset32 | 0x0000004C (76) Loc: +0x0C5C | offset to field `name` (string)
+ +0x0C14 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x0C28 | offset to field `fields` (vector)
+ +0x0C18 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `minalign` (Int)
+ +0x0C1C | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x0C24 | offset to field `documentation` (vector)
+ +0x0C20 | 40 2B 00 00 | UOffset32 | 0x00002B40 (11072) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Object.documentation):
+ +0x0C24 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Object.fields):
+ +0x0C28 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | length of vector (# items)
+ +0x0C2C | E4 00 00 00 | UOffset32 | 0x000000E4 (228) Loc: +0x0D10 | offset to table[0]
+ +0x0C30 | B0 00 00 00 | UOffset32 | 0x000000B0 (176) Loc: +0x0CE0 | offset to table[1]
+ +0x0C34 | F0 01 00 00 | UOffset32 | 0x000001F0 (496) Loc: +0x0E24 | offset to table[2]
+ +0x0C38 | 90 01 00 00 | UOffset32 | 0x00000190 (400) Loc: +0x0DC8 | offset to table[3]
+ +0x0C3C | 30 01 00 00 | UOffset32 | 0x00000130 (304) Loc: +0x0D6C | offset to table[4]
+ +0x0C40 | 60 02 00 00 | UOffset32 | 0x00000260 (608) Loc: +0x0EA0 | offset to table[5]
+ +0x0C44 | B0 01 00 00 | UOffset32 | 0x000001B0 (432) Loc: +0x0DF4 | offset to table[6]
+ +0x0C48 | 54 01 00 00 | UOffset32 | 0x00000154 (340) Loc: +0x0D9C | offset to table[7]
+ +0x0C4C | F0 00 00 00 | UOffset32 | 0x000000F0 (240) Loc: +0x0D3C | offset to table[8]
+ +0x0C50 | 04 02 00 00 | UOffset32 | 0x00000204 (516) Loc: +0x0E54 | offset to table[9]
+ +0x0C54 | 5C 00 00 00 | UOffset32 | 0x0000005C (92) Loc: +0x0CB0 | offset to table[10]
+ +0x0C58 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x0C7C | offset to table[11]
+
+string (reflection.Object.name):
+ +0x0C5C | 1A 00 00 00 | uint32_t | 0x0000001A (26) | length of string
+ +0x0C60 | 4D 79 47 61 6D 65 2E 45 | char[26] | MyGame.E | string literal
+ +0x0C68 | 78 61 6D 70 6C 65 2E 54 | | xample.T
+ +0x0C70 | 79 70 65 41 6C 69 61 73 | | ypeAlias
+ +0x0C78 | 65 73 | | es
+ +0x0C7A | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x0C7C | 00 DB FF FF | SOffset32 | 0xFFFFDB00 (-9472) Loc: +0x317C | offset to vtable
+ +0x0C80 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0C83 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x0C84 | 0B 00 | uint16_t | 0x000B (11) | table field `id` (UShort)
+ +0x0C86 | 1A 00 | uint16_t | 0x001A (26) | table field `offset` (UShort)
+ +0x0C88 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x0CA4 | offset to field `name` (string)
+ +0x0C8C | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0C98 | offset to field `type` (table)
+ +0x0C90 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0C94 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x0C94 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0C98 | 14 E1 FF FF | SOffset32 | 0xFFFFE114 (-7916) Loc: +0x2B84 | offset to vtable
+ +0x0C9C | 00 00 | uint8_t[2] | .. | padding
+ +0x0C9E | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x0C9F | 0C | uint8_t | 0x0C (12) | table field `element` (Byte)
+ +0x0CA0 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x0CA4 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x0CA8 | 76 66 36 34 | char[4] | vf64 | string literal
+ +0x0CAC | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0CAD | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Field):
+ +0x0CB0 | 34 DB FF FF | SOffset32 | 0xFFFFDB34 (-9420) Loc: +0x317C | offset to vtable
+ +0x0CB4 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0CB7 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x0CB8 | 0A 00 | uint16_t | 0x000A (10) | table field `id` (UShort)
+ +0x0CBA | 18 00 | uint16_t | 0x0018 (24) | table field `offset` (UShort)
+ +0x0CBC | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x0CD8 | offset to field `name` (string)
+ +0x0CC0 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0CCC | offset to field `type` (table)
+ +0x0CC4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0CC8 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x0CC8 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0CCC | 48 E1 FF FF | SOffset32 | 0xFFFFE148 (-7864) Loc: +0x2B84 | offset to vtable
+ +0x0CD0 | 00 00 | uint8_t[2] | .. | padding
+ +0x0CD2 | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x0CD3 | 03 | uint8_t | 0x03 (3) | table field `element` (Byte)
+ +0x0CD4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x0CD8 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x0CDC | 76 38 | char[2] | v8 | string literal
+ +0x0CDE | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x0CE0 | 4A D8 FF FF | SOffset32 | 0xFFFFD84A (-10166) Loc: +0x3496 | offset to vtable
+ +0x0CE4 | 09 00 | uint16_t | 0x0009 (9) | table field `id` (UShort)
+ +0x0CE6 | 16 00 | uint16_t | 0x0016 (22) | table field `offset` (UShort)
+ +0x0CE8 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0D08 | offset to field `name` (string)
+ +0x0CEC | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0CF8 | offset to field `type` (table)
+ +0x0CF0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0CF4 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x0CF4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0CF8 | 14 D6 FF FF | SOffset32 | 0xFFFFD614 (-10732) Loc: +0x36E4 | offset to vtable
+ +0x0CFC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0CFF | 0C | uint8_t | 0x0C (12) | table field `base_type` (Byte)
+ +0x0D00 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x0D04 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x0D08 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x0D0C | 66 36 34 | char[3] | f64 | string literal
+ +0x0D0F | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x0D10 | 7A D8 FF FF | SOffset32 | 0xFFFFD87A (-10118) Loc: +0x3496 | offset to vtable
+ +0x0D14 | 08 00 | uint16_t | 0x0008 (8) | table field `id` (UShort)
+ +0x0D16 | 14 00 | uint16_t | 0x0014 (20) | table field `offset` (UShort)
+ +0x0D18 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x0D34 | offset to field `name` (string)
+ +0x0D1C | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0D28 | offset to field `type` (table)
+ +0x0D20 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0D24 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x0D24 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0D28 | 8C D3 FF FF | SOffset32 | 0xFFFFD38C (-11380) Loc: +0x399C | offset to vtable
+ +0x0D2C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0D2F | 0B | uint8_t | 0x0B (11) | table field `base_type` (Byte)
+ +0x0D30 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x0D34 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x0D38 | 66 33 32 | char[3] | f32 | string literal
+ +0x0D3B | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x0D3C | A6 D8 FF FF | SOffset32 | 0xFFFFD8A6 (-10074) Loc: +0x3496 | offset to vtable
+ +0x0D40 | 07 00 | uint16_t | 0x0007 (7) | table field `id` (UShort)
+ +0x0D42 | 12 00 | uint16_t | 0x0012 (18) | table field `offset` (UShort)
+ +0x0D44 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0D64 | offset to field `name` (string)
+ +0x0D48 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0D54 | offset to field `type` (table)
+ +0x0D4C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0D50 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x0D50 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0D54 | 70 D6 FF FF | SOffset32 | 0xFFFFD670 (-10640) Loc: +0x36E4 | offset to vtable
+ +0x0D58 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0D5B | 0A | uint8_t | 0x0A (10) | table field `base_type` (Byte)
+ +0x0D5C | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x0D60 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x0D64 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x0D68 | 75 36 34 | char[3] | u64 | string literal
+ +0x0D6B | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x0D6C | D6 D8 FF FF | SOffset32 | 0xFFFFD8D6 (-10026) Loc: +0x3496 | offset to vtable
+ +0x0D70 | 06 00 | uint16_t | 0x0006 (6) | table field `id` (UShort)
+ +0x0D72 | 10 00 | uint16_t | 0x0010 (16) | table field `offset` (UShort)
+ +0x0D74 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0D94 | offset to field `name` (string)
+ +0x0D78 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0D84 | offset to field `type` (table)
+ +0x0D7C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0D80 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x0D80 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0D84 | A0 D6 FF FF | SOffset32 | 0xFFFFD6A0 (-10592) Loc: +0x36E4 | offset to vtable
+ +0x0D88 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0D8B | 09 | uint8_t | 0x09 (9) | table field `base_type` (Byte)
+ +0x0D8C | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x0D90 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x0D94 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x0D98 | 69 36 34 | char[3] | i64 | string literal
+ +0x0D9B | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x0D9C | 06 D9 FF FF | SOffset32 | 0xFFFFD906 (-9978) Loc: +0x3496 | offset to vtable
+ +0x0DA0 | 05 00 | uint16_t | 0x0005 (5) | table field `id` (UShort)
+ +0x0DA2 | 0E 00 | uint16_t | 0x000E (14) | table field `offset` (UShort)
+ +0x0DA4 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x0DC0 | offset to field `name` (string)
+ +0x0DA8 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0DB4 | offset to field `type` (table)
+ +0x0DAC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0DB0 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x0DB0 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0DB4 | 18 D4 FF FF | SOffset32 | 0xFFFFD418 (-11240) Loc: +0x399C | offset to vtable
+ +0x0DB8 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0DBB | 08 | uint8_t | 0x08 (8) | table field `base_type` (Byte)
+ +0x0DBC | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x0DC0 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x0DC4 | 75 33 32 | char[3] | u32 | string literal
+ +0x0DC7 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x0DC8 | 32 D9 FF FF | SOffset32 | 0xFFFFD932 (-9934) Loc: +0x3496 | offset to vtable
+ +0x0DCC | 04 00 | uint16_t | 0x0004 (4) | table field `id` (UShort)
+ +0x0DCE | 0C 00 | uint16_t | 0x000C (12) | table field `offset` (UShort)
+ +0x0DD0 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x0DEC | offset to field `name` (string)
+ +0x0DD4 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0DE0 | offset to field `type` (table)
+ +0x0DD8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0DDC | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x0DDC | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0DE0 | 44 D4 FF FF | SOffset32 | 0xFFFFD444 (-11196) Loc: +0x399C | offset to vtable
+ +0x0DE4 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0DE7 | 07 | uint8_t | 0x07 (7) | table field `base_type` (Byte)
+ +0x0DE8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x0DEC | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x0DF0 | 69 33 32 | char[3] | i32 | string literal
+ +0x0DF3 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x0DF4 | 5E D9 FF FF | SOffset32 | 0xFFFFD95E (-9890) Loc: +0x3496 | offset to vtable
+ +0x0DF8 | 03 00 | uint16_t | 0x0003 (3) | table field `id` (UShort)
+ +0x0DFA | 0A 00 | uint16_t | 0x000A (10) | table field `offset` (UShort)
+ +0x0DFC | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0E1C | offset to field `name` (string)
+ +0x0E00 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0E0C | offset to field `type` (table)
+ +0x0E04 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0E08 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x0E08 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0E0C | 28 D7 FF FF | SOffset32 | 0xFFFFD728 (-10456) Loc: +0x36E4 | offset to vtable
+ +0x0E10 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0E13 | 06 | uint8_t | 0x06 (6) | table field `base_type` (Byte)
+ +0x0E14 | 02 00 00 00 | uint32_t | 0x00000002 (2) | table field `base_size` (UInt)
+ +0x0E18 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x0E1C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x0E20 | 75 31 36 | char[3] | u16 | string literal
+ +0x0E23 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x0E24 | 8E D9 FF FF | SOffset32 | 0xFFFFD98E (-9842) Loc: +0x3496 | offset to vtable
+ +0x0E28 | 02 00 | uint16_t | 0x0002 (2) | table field `id` (UShort)
+ +0x0E2A | 08 00 | uint16_t | 0x0008 (8) | table field `offset` (UShort)
+ +0x0E2C | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0E4C | offset to field `name` (string)
+ +0x0E30 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0E3C | offset to field `type` (table)
+ +0x0E34 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0E38 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x0E38 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0E3C | 58 D7 FF FF | SOffset32 | 0xFFFFD758 (-10408) Loc: +0x36E4 | offset to vtable
+ +0x0E40 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0E43 | 05 | uint8_t | 0x05 (5) | table field `base_type` (Byte)
+ +0x0E44 | 02 00 00 00 | uint32_t | 0x00000002 (2) | table field `base_size` (UInt)
+ +0x0E48 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x0E4C | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x0E50 | 69 31 36 | char[3] | i16 | string literal
+ +0x0E53 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x0E54 | BE D9 FF FF | SOffset32 | 0xFFFFD9BE (-9794) Loc: +0x3496 | offset to vtable
+ +0x0E58 | 01 00 | uint16_t | 0x0001 (1) | table field `id` (UShort)
+ +0x0E5A | 06 00 | uint16_t | 0x0006 (6) | table field `offset` (UShort)
+ +0x0E5C | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0E7C | offset to field `name` (string)
+ +0x0E60 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0E6C | offset to field `type` (table)
+ +0x0E64 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0E68 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x0E68 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0E6C | 88 D7 FF FF | SOffset32 | 0xFFFFD788 (-10360) Loc: +0x36E4 | offset to vtable
+ +0x0E70 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0E73 | 04 | uint8_t | 0x04 (4) | table field `base_type` (Byte)
+ +0x0E74 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x0E78 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x0E7C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x0E80 | 75 38 | char[2] | u8 | string literal
+ +0x0E82 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0E83 | 00 00 00 | uint8_t[3] | ... | padding
+
+vtable (reflection.Field):
+ +0x0E86 | 1A 00 | uint16_t | 0x001A (26) | size of this vtable
+ +0x0E88 | 14 00 | uint16_t | 0x0014 (20) | size of referring table
+ +0x0E8A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `name` (id: 0)
+ +0x0E8C | 0C 00 | VOffset16 | 0x000C (12) | offset to field `type` (id: 1)
+ +0x0E8E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `id` (id: 2) <defaults to 0> (UShort)
+ +0x0E90 | 06 00 | VOffset16 | 0x0006 (6) | offset to field `offset` (id: 3)
+ +0x0E92 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x0E94 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x0E96 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x0E98 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x0E9A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `key` (id: 8) <defaults to 0> (Bool)
+ +0x0E9C | 00 00 | VOffset16 | 0x0000 (0) | offset to field `attributes` (id: 9) <null> (Vector)
+ +0x0E9E | 10 00 | VOffset16 | 0x0010 (16) | offset to field `documentation` (id: 10)
+
+table (reflection.Field):
+ +0x0EA0 | 1A 00 00 00 | SOffset32 | 0x0000001A (26) Loc: +0x0E86 | offset to vtable
+ +0x0EA4 | 00 00 | uint8_t[2] | .. | padding
+ +0x0EA6 | 04 00 | uint16_t | 0x0004 (4) | table field `offset` (UShort)
+ +0x0EA8 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x0EC8 | offset to field `name` (string)
+ +0x0EAC | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0EB8 | offset to field `type` (table)
+ +0x0EB0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0EB4 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x0EB4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x0EB8 | D4 D7 FF FF | SOffset32 | 0xFFFFD7D4 (-10284) Loc: +0x36E4 | offset to vtable
+ +0x0EBC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x0EBF | 03 | uint8_t | 0x03 (3) | table field `base_type` (Byte)
+ +0x0EC0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x0EC4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x0EC8 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x0ECC | 69 38 | char[2] | i8 | string literal
+ +0x0ECE | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Object):
+ +0x0ED0 | A8 D6 FF FF | SOffset32 | 0xFFFFD6A8 (-10584) Loc: +0x3828 | offset to vtable
+ +0x0ED4 | 30 01 00 00 | UOffset32 | 0x00000130 (304) Loc: +0x1004 | offset to field `name` (string)
+ +0x0ED8 | 50 00 00 00 | UOffset32 | 0x00000050 (80) Loc: +0x0F28 | offset to field `fields` (vector)
+ +0x0EDC | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `minalign` (Int)
+ +0x0EE0 | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x0EE8 | offset to field `documentation` (vector)
+ +0x0EE4 | 7C 28 00 00 | UOffset32 | 0x0000287C (10364) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Object.documentation):
+ +0x0EE8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x0EEC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0EF0 | offset to string[0]
+
+string (reflection.Object.documentation):
+ +0x0EF0 | 33 00 00 00 | uint32_t | 0x00000033 (51) | length of string
+ +0x0EF4 | 20 61 6E 20 65 78 61 6D | char[51] | an exam | string literal
+ +0x0EFC | 70 6C 65 20 64 6F 63 75 | | ple docu
+ +0x0F04 | 6D 65 6E 74 61 74 69 6F | | mentatio
+ +0x0F0C | 6E 20 63 6F 6D 6D 65 6E | | n commen
+ +0x0F14 | 74 3A 20 22 6D 6F 6E 73 | | t: "mons
+ +0x0F1C | 74 65 72 20 6F 62 6A 65 | | ter obje
+ +0x0F24 | 63 74 22 | | ct"
+ +0x0F27 | 00 | char | 0x00 (0) | string terminator
+
+vector (reflection.Object.fields):
+ +0x0F28 | 36 00 00 00 | uint32_t | 0x00000036 (54) | length of vector (# items)
+ +0x0F2C | 80 04 00 00 | UOffset32 | 0x00000480 (1152) Loc: +0x13AC | offset to table[0]
+ +0x0F30 | E4 04 00 00 | UOffset32 | 0x000004E4 (1252) Loc: +0x1414 | offset to table[1]
+ +0x0F34 | 4C 05 00 00 | UOffset32 | 0x0000054C (1356) Loc: +0x1480 | offset to table[2]
+ +0x0F38 | AC 05 00 00 | UOffset32 | 0x000005AC (1452) Loc: +0x14E4 | offset to table[3]
+ +0x0F3C | A8 09 00 00 | UOffset32 | 0x000009A8 (2472) Loc: +0x18E4 | offset to table[4]
+ +0x0F40 | 78 1B 00 00 | UOffset32 | 0x00001B78 (7032) Loc: +0x2AB8 | offset to table[5]
+ +0x0F44 | 88 18 00 00 | UOffset32 | 0x00001888 (6280) Loc: +0x27CC | offset to table[6]
+ +0x0F48 | 44 0F 00 00 | UOffset32 | 0x00000F44 (3908) Loc: +0x1E8C | offset to table[7]
+ +0x0F4C | 7C 1C 00 00 | UOffset32 | 0x00001C7C (7292) Loc: +0x2BC8 | offset to table[8]
+ +0x0F50 | C0 1D 00 00 | UOffset32 | 0x00001DC0 (7616) Loc: +0x2D10 | offset to table[9]
+ +0x0F54 | EC 1B 00 00 | UOffset32 | 0x00001BEC (7148) Loc: +0x2B40 | offset to table[10]
+ +0x0F58 | 44 01 00 00 | UOffset32 | 0x00000144 (324) Loc: +0x109C | offset to table[11]
+ +0x0F5C | C4 00 00 00 | UOffset32 | 0x000000C4 (196) Loc: +0x1020 | offset to table[12]
+ +0x0F60 | 30 1E 00 00 | UOffset32 | 0x00001E30 (7728) Loc: +0x2D90 | offset to table[13]
+ +0x0F64 | 30 1D 00 00 | UOffset32 | 0x00001D30 (7472) Loc: +0x2C94 | offset to table[14]
+ +0x0F68 | A8 01 00 00 | UOffset32 | 0x000001A8 (424) Loc: +0x1110 | offset to table[15]
+ +0x0F6C | 10 07 00 00 | UOffset32 | 0x00000710 (1808) Loc: +0x167C | offset to table[16]
+ +0x0F70 | 80 0D 00 00 | UOffset32 | 0x00000D80 (3456) Loc: +0x1CF0 | offset to table[17]
+ +0x0F74 | A0 1E 00 00 | UOffset32 | 0x00001EA0 (7840) Loc: +0x2E14 | offset to table[18]
+ +0x0F78 | 2C 02 00 00 | UOffset32 | 0x0000022C (556) Loc: +0x11A4 | offset to table[19]
+ +0x0F7C | 5C 03 00 00 | UOffset32 | 0x0000035C (860) Loc: +0x12D8 | offset to table[20]
+ +0x0F80 | 08 0C 00 00 | UOffset32 | 0x00000C08 (3080) Loc: +0x1B88 | offset to table[21]
+ +0x0F84 | 58 1A 00 00 | UOffset32 | 0x00001A58 (6744) Loc: +0x29DC | offset to table[22]
+ +0x0F88 | E4 19 00 00 | UOffset32 | 0x000019E4 (6628) Loc: +0x296C | offset to table[23]
+ +0x0F8C | A0 0E 00 00 | UOffset32 | 0x00000EA0 (3744) Loc: +0x1E2C | offset to table[24]
+ +0x0F90 | C4 1A 00 00 | UOffset32 | 0x00001AC4 (6852) Loc: +0x2A54 | offset to table[25]
+ +0x0F94 | 90 11 00 00 | UOffset32 | 0x00001190 (4496) Loc: +0x2124 | offset to table[26]
+ +0x0F98 | 78 0F 00 00 | UOffset32 | 0x00000F78 (3960) Loc: +0x1F10 | offset to table[27]
+ +0x0F9C | 68 19 00 00 | UOffset32 | 0x00001968 (6504) Loc: +0x2904 | offset to table[28]
+ +0x0FA0 | E0 0F 00 00 | UOffset32 | 0x00000FE0 (4064) Loc: +0x1F80 | offset to table[29]
+ +0x0FA4 | 88 18 00 00 | UOffset32 | 0x00001888 (6280) Loc: +0x282C | offset to table[30]
+ +0x0FA8 | C0 16 00 00 | UOffset32 | 0x000016C0 (5824) Loc: +0x2668 | offset to table[31]
+ +0x0FAC | 1C 17 00 00 | UOffset32 | 0x0000171C (5916) Loc: +0x26C8 | offset to table[32]
+ +0x0FB0 | 10 11 00 00 | UOffset32 | 0x00001110 (4368) Loc: +0x20C0 | offset to table[33]
+ +0x0FB4 | 8C 10 00 00 | UOffset32 | 0x0000108C (4236) Loc: +0x2040 | offset to table[34]
+ +0x0FB8 | 30 10 00 00 | UOffset32 | 0x00001030 (4144) Loc: +0x1FE8 | offset to table[35]
+ +0x0FBC | 20 16 00 00 | UOffset32 | 0x00001620 (5664) Loc: +0x25DC | offset to table[36]
+ +0x0FC0 | E0 13 00 00 | UOffset32 | 0x000013E0 (5088) Loc: +0x23A0 | offset to table[37]
+ +0x0FC4 | FC 14 00 00 | UOffset32 | 0x000014FC (5372) Loc: +0x24C0 | offset to table[38]
+ +0x0FC8 | 58 12 00 00 | UOffset32 | 0x00001258 (4696) Loc: +0x2220 | offset to table[39]
+ +0x0FCC | 84 15 00 00 | UOffset32 | 0x00001584 (5508) Loc: +0x2550 | offset to table[40]
+ +0x0FD0 | E4 12 00 00 | UOffset32 | 0x000012E4 (4836) Loc: +0x22B4 | offset to table[41]
+ +0x0FD4 | 5C 14 00 00 | UOffset32 | 0x0000145C (5212) Loc: +0x2430 | offset to table[42]
+ +0x0FD8 | B4 11 00 00 | UOffset32 | 0x000011B4 (4532) Loc: +0x218C | offset to table[43]
+ +0x0FDC | 50 17 00 00 | UOffset32 | 0x00001750 (5968) Loc: +0x272C | offset to table[44]
+ +0x0FE0 | 38 02 00 00 | UOffset32 | 0x00000238 (568) Loc: +0x1218 | offset to table[45]
+ +0x0FE4 | C0 07 00 00 | UOffset32 | 0x000007C0 (1984) Loc: +0x17A4 | offset to table[46]
+ +0x0FE8 | 78 0D 00 00 | UOffset32 | 0x00000D78 (3448) Loc: +0x1D60 | offset to table[47]
+ +0x0FEC | 58 03 00 00 | UOffset32 | 0x00000358 (856) Loc: +0x1344 | offset to table[48]
+ +0x0FF0 | D8 0D 00 00 | UOffset32 | 0x00000DD8 (3544) Loc: +0x1DC8 | offset to table[49]
+ +0x0FF4 | 58 05 00 00 | UOffset32 | 0x00000558 (1368) Loc: +0x154C | offset to table[50]
+ +0x0FF8 | 88 0C 00 00 | UOffset32 | 0x00000C88 (3208) Loc: +0x1C80 | offset to table[51]
+ +0x0FFC | DC 09 00 00 | UOffset32 | 0x000009DC (2524) Loc: +0x19D8 | offset to table[52]
+ +0x1000 | 8C 0A 00 00 | UOffset32 | 0x00000A8C (2700) Loc: +0x1A8C | offset to table[53]
+
+string (reflection.Object.name):
+ +0x1004 | 16 00 00 00 | uint32_t | 0x00000016 (22) | length of string
+ +0x1008 | 4D 79 47 61 6D 65 2E 45 | char[22] | MyGame.E | string literal
+ +0x1010 | 78 61 6D 70 6C 65 2E 4D | | xample.M
+ +0x1018 | 6F 6E 73 74 65 72 | | onster
+ +0x101E | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x1020 | 62 FD FF FF | SOffset32 | 0xFFFFFD62 (-670) Loc: +0x12BE | offset to vtable
+ +0x1024 | 35 00 | uint16_t | 0x0035 (53) | table field `id` (UShort)
+ +0x1026 | 6E 00 | uint16_t | 0x006E (110) | table field `offset` (UShort)
+ +0x1028 | 54 00 00 00 | UOffset32 | 0x00000054 (84) Loc: +0x107C | offset to field `name` (string)
+ +0x102C | 3C 00 00 00 | UOffset32 | 0x0000003C (60) Loc: +0x1068 | offset to field `type` (table)
+ +0x1030 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x1044 | offset to field `attributes` (vector)
+ +0x1034 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1040 | offset to field `documentation` (vector)
+ +0x1038 | 02 00 00 00 00 00 00 00 | int64_t | 0x0000000000000002 (2) | table field `default_integer` (Long)
+
+vector (reflection.Field.documentation):
+ +0x1040 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1044 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x1048 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x104C | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x104C | E8 DA FF FF | SOffset32 | 0xFFFFDAE8 (-9496) Loc: +0x3564 | offset to vtable
+ +0x1050 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1060 | offset to field `key` (string)
+ +0x1054 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1058 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1058 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x105C | 35 33 | char[2] | 53 | string literal
+ +0x105E | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1060 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1064 | 69 64 | char[2] | id | string literal
+ +0x1066 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x1068 | 64 DA FF FF | SOffset32 | 0xFFFFDA64 (-9628) Loc: +0x3604 | offset to vtable
+ +0x106C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x106F | 0A | uint8_t | 0x0A (10) | table field `base_type` (Byte)
+ +0x1070 | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `index` (Int)
+ +0x1074 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x1078 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x107C | 18 00 00 00 | uint32_t | 0x00000018 (24) | length of string
+ +0x1080 | 6C 6F 6E 67 5F 65 6E 75 | char[24] | long_enu | string literal
+ +0x1088 | 6D 5F 6E 6F 72 6D 61 6C | | m_normal
+ +0x1090 | 5F 64 65 66 61 75 6C 74 | | _default
+ +0x1098 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1099 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Field):
+ +0x109C | 62 E6 FF FF | SOffset32 | 0xFFFFE662 (-6558) Loc: +0x2A3A | offset to vtable
+ +0x10A0 | 34 00 | uint16_t | 0x0034 (52) | table field `id` (UShort)
+ +0x10A2 | 6C 00 | uint16_t | 0x006C (108) | table field `offset` (UShort)
+ +0x10A4 | 4C 00 00 00 | UOffset32 | 0x0000004C (76) Loc: +0x10F0 | offset to field `name` (string)
+ +0x10A8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x10DC | offset to field `type` (table)
+ +0x10AC | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x10B8 | offset to field `attributes` (vector)
+ +0x10B0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x10B4 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x10B4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x10B8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x10BC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x10C0 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x10C0 | 5C DB FF FF | SOffset32 | 0xFFFFDB5C (-9380) Loc: +0x3564 | offset to vtable
+ +0x10C4 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x10D4 | offset to field `key` (string)
+ +0x10C8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x10CC | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x10CC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x10D0 | 35 32 | char[2] | 52 | string literal
+ +0x10D2 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x10D4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x10D8 | 69 64 | char[2] | id | string literal
+ +0x10DA | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x10DC | D8 DA FF FF | SOffset32 | 0xFFFFDAD8 (-9512) Loc: +0x3604 | offset to vtable
+ +0x10E0 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x10E3 | 0A | uint8_t | 0x0A (10) | table field `base_type` (Byte)
+ +0x10E4 | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `index` (Int)
+ +0x10E8 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x10EC | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x10F0 | 1A 00 00 00 | uint32_t | 0x0000001A (26) | length of string
+ +0x10F4 | 6C 6F 6E 67 5F 65 6E 75 | char[26] | long_enu | string literal
+ +0x10FC | 6D 5F 6E 6F 6E 5F 65 6E | | m_non_en
+ +0x1104 | 75 6D 5F 64 65 66 61 75 | | um_defau
+ +0x110C | 6C 74 | | lt
+ +0x110E | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x1110 | EC E5 FF FF | SOffset32 | 0xFFFFE5EC (-6676) Loc: +0x2B24 | offset to vtable
+ +0x1114 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x1117 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x1118 | 33 00 | uint16_t | 0x0033 (51) | table field `id` (UShort)
+ +0x111A | 6A 00 | uint16_t | 0x006A (106) | table field `offset` (UShort)
+ +0x111C | 74 00 00 00 | UOffset32 | 0x00000074 (116) Loc: +0x1190 | offset to field `name` (string)
+ +0x1120 | 60 00 00 00 | UOffset32 | 0x00000060 (96) Loc: +0x1180 | offset to field `type` (table)
+ +0x1124 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1130 | offset to field `attributes` (vector)
+ +0x1128 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x112C | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x112C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1130 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x1134 | 30 00 00 00 | UOffset32 | 0x00000030 (48) Loc: +0x1164 | offset to table[0]
+ +0x1138 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x113C | offset to table[1]
+
+table (reflection.KeyValue):
+ +0x113C | D8 DB FF FF | SOffset32 | 0xFFFFDBD8 (-9256) Loc: +0x3564 | offset to vtable
+ +0x1140 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1150 | offset to field `key` (string)
+ +0x1144 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1148 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1148 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x114C | 30 | char[1] | 0 | string literal
+ +0x114D | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x114E | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x1150 | 0D 00 00 00 | uint32_t | 0x0000000D (13) | length of string
+ +0x1154 | 6E 61 74 69 76 65 5F 69 | char[13] | native_i | string literal
+ +0x115C | 6E 6C 69 6E 65 | | nline
+ +0x1161 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1162 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.KeyValue):
+ +0x1164 | 00 DC FF FF | SOffset32 | 0xFFFFDC00 (-9216) Loc: +0x3564 | offset to vtable
+ +0x1168 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1178 | offset to field `key` (string)
+ +0x116C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1170 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1170 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1174 | 35 31 | char[2] | 51 | string literal
+ +0x1176 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1178 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x117C | 69 64 | char[2] | id | string literal
+ +0x117E | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x1180 | C8 D8 FF FF | SOffset32 | 0xFFFFD8C8 (-10040) Loc: +0x38B8 | offset to vtable
+ +0x1184 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x1187 | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x1188 | 06 00 00 00 | uint32_t | 0x00000006 (6) | table field `index` (Int)
+ +0x118C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1190 | 0D 00 00 00 | uint32_t | 0x0000000D (13) | length of string
+ +0x1194 | 6E 61 74 69 76 65 5F 69 | char[13] | native_i | string literal
+ +0x119C | 6E 6C 69 6E 65 | | nline
+ +0x11A1 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x11A2 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x11A4 | 80 E6 FF FF | SOffset32 | 0xFFFFE680 (-6528) Loc: +0x2B24 | offset to vtable
+ +0x11A8 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x11AB | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x11AC | 32 00 | uint16_t | 0x0032 (50) | table field `id` (UShort)
+ +0x11AE | 68 00 | uint16_t | 0x0068 (104) | table field `offset` (UShort)
+ +0x11B0 | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x11F8 | offset to field `name` (string)
+ +0x11B4 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x11E8 | offset to field `type` (table)
+ +0x11B8 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x11C4 | offset to field `attributes` (vector)
+ +0x11BC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x11C0 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x11C0 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x11C4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x11C8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x11CC | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x11CC | 68 DC FF FF | SOffset32 | 0xFFFFDC68 (-9112) Loc: +0x3564 | offset to vtable
+ +0x11D0 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x11E0 | offset to field `key` (string)
+ +0x11D4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x11D8 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x11D8 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x11DC | 35 30 | char[2] | 50 | string literal
+ +0x11DE | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x11E0 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x11E4 | 69 64 | char[2] | id | string literal
+ +0x11E6 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x11E8 | 38 E8 FF FF | SOffset32 | 0xFFFFE838 (-6088) Loc: +0x29B0 | offset to vtable
+ +0x11EC | 00 00 | uint8_t[2] | .. | padding
+ +0x11EE | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x11EF | 0F | uint8_t | 0x0F (15) | table field `element` (Byte)
+ +0x11F0 | 03 00 00 00 | uint32_t | 0x00000003 (3) | table field `index` (Int)
+ +0x11F4 | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x11F8 | 18 00 00 00 | uint32_t | 0x00000018 (24) | length of string
+ +0x11FC | 73 63 61 6C 61 72 5F 6B | char[24] | scalar_k | string literal
+ +0x1204 | 65 79 5F 73 6F 72 74 65 | | ey_sorte
+ +0x120C | 64 5F 74 61 62 6C 65 73 | | d_tables
+ +0x1214 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1215 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Field):
+ +0x1218 | F4 E6 FF FF | SOffset32 | 0xFFFFE6F4 (-6412) Loc: +0x2B24 | offset to vtable
+ +0x121C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x121F | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x1220 | 31 00 | uint16_t | 0x0031 (49) | table field `id` (UShort)
+ +0x1222 | 66 00 | uint16_t | 0x0066 (102) | table field `offset` (UShort)
+ +0x1224 | 78 00 00 00 | UOffset32 | 0x00000078 (120) Loc: +0x129C | offset to field `name` (string)
+ +0x1228 | 68 00 00 00 | UOffset32 | 0x00000068 (104) Loc: +0x1290 | offset to field `type` (table)
+ +0x122C | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1238 | offset to field `attributes` (vector)
+ +0x1230 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1234 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x1234 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1238 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x123C | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x1274 | offset to table[0]
+ +0x1240 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1244 | offset to table[1]
+
+table (reflection.KeyValue):
+ +0x1244 | E0 DC FF FF | SOffset32 | 0xFFFFDCE0 (-8992) Loc: +0x3564 | offset to vtable
+ +0x1248 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x125C | offset to field `key` (string)
+ +0x124C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1250 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1250 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x1254 | 4D 6F 6E 73 74 65 72 | char[7] | Monster | string literal
+ +0x125B | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x125C | 11 00 00 00 | uint32_t | 0x00000011 (17) | length of string
+ +0x1260 | 6E 65 73 74 65 64 5F 66 | char[17] | nested_f | string literal
+ +0x1268 | 6C 61 74 62 75 66 66 65 | | latbuffe
+ +0x1270 | 72 | | r
+ +0x1271 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1272 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.KeyValue):
+ +0x1274 | 10 DD FF FF | SOffset32 | 0xFFFFDD10 (-8944) Loc: +0x3564 | offset to vtable
+ +0x1278 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1288 | offset to field `key` (string)
+ +0x127C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1280 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1280 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1284 | 34 39 | char[2] | 49 | string literal
+ +0x1286 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1288 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x128C | 69 64 | char[2] | id | string literal
+ +0x128E | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x1290 | 0C E7 FF FF | SOffset32 | 0xFFFFE70C (-6388) Loc: +0x2B84 | offset to vtable
+ +0x1294 | 00 00 | uint8_t[2] | .. | padding
+ +0x1296 | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x1297 | 04 | uint8_t | 0x04 (4) | table field `element` (Byte)
+ +0x1298 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x129C | 1C 00 00 00 | uint32_t | 0x0000001C (28) | length of string
+ +0x12A0 | 74 65 73 74 72 65 71 75 | char[28] | testrequ | string literal
+ +0x12A8 | 69 72 65 64 6E 65 73 74 | | irednest
+ +0x12B0 | 65 64 66 6C 61 74 62 75 | | edflatbu
+ +0x12B8 | 66 66 65 72 | | ffer
+ +0x12BC | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.Field):
+ +0x12BE | 1A 00 | uint16_t | 0x001A (26) | size of this vtable
+ +0x12C0 | 20 00 | uint16_t | 0x0020 (32) | size of referring table
+ +0x12C2 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `name` (id: 0)
+ +0x12C4 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `type` (id: 1)
+ +0x12C6 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `id` (id: 2)
+ +0x12C8 | 06 00 | VOffset16 | 0x0006 (6) | offset to field `offset` (id: 3)
+ +0x12CA | 18 00 | VOffset16 | 0x0018 (24) | offset to field `default_integer` (id: 4)
+ +0x12CC | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x12CE | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x12D0 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x12D2 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `key` (id: 8) <defaults to 0> (Bool)
+ +0x12D4 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `attributes` (id: 9)
+ +0x12D6 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `documentation` (id: 10)
+
+table (reflection.Field):
+ +0x12D8 | 1A 00 00 00 | SOffset32 | 0x0000001A (26) Loc: +0x12BE | offset to vtable
+ +0x12DC | 30 00 | uint16_t | 0x0030 (48) | table field `id` (UShort)
+ +0x12DE | 64 00 | uint16_t | 0x0064 (100) | table field `offset` (UShort)
+ +0x12E0 | 54 00 00 00 | UOffset32 | 0x00000054 (84) Loc: +0x1334 | offset to field `name` (string)
+ +0x12E4 | 3C 00 00 00 | UOffset32 | 0x0000003C (60) Loc: +0x1320 | offset to field `type` (table)
+ +0x12E8 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x12FC | offset to field `attributes` (vector)
+ +0x12EC | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x12F8 | offset to field `documentation` (vector)
+ +0x12F0 | FF FF FF FF FF FF FF FF | int64_t | 0xFFFFFFFFFFFFFFFF (-1) | table field `default_integer` (Long)
+
+vector (reflection.Field.documentation):
+ +0x12F8 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x12FC | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x1300 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1304 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x1304 | A0 DD FF FF | SOffset32 | 0xFFFFDDA0 (-8800) Loc: +0x3564 | offset to vtable
+ +0x1308 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1318 | offset to field `key` (string)
+ +0x130C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1310 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1310 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1314 | 34 38 | char[2] | 48 | string literal
+ +0x1316 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1318 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x131C | 69 64 | char[2] | id | string literal
+ +0x131E | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x1320 | 1C DD FF FF | SOffset32 | 0xFFFFDD1C (-8932) Loc: +0x3604 | offset to vtable
+ +0x1324 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x1327 | 03 | uint8_t | 0x03 (3) | table field `base_type` (Byte)
+ +0x1328 | 05 00 00 00 | uint32_t | 0x00000005 (5) | table field `index` (Int)
+ +0x132C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x1330 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1334 | 0B 00 00 00 | uint32_t | 0x0000000B (11) | length of string
+ +0x1338 | 73 69 67 6E 65 64 5F 65 | char[11] | signed_e | string literal
+ +0x1340 | 6E 75 6D | | num
+ +0x1343 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x1344 | 20 E8 FF FF | SOffset32 | 0xFFFFE820 (-6112) Loc: +0x2B24 | offset to vtable
+ +0x1348 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x134B | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x134C | 2F 00 | uint16_t | 0x002F (47) | table field `id` (UShort)
+ +0x134E | 62 00 | uint16_t | 0x0062 (98) | table field `offset` (UShort)
+ +0x1350 | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x1398 | offset to field `name` (string)
+ +0x1354 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x1388 | offset to field `type` (table)
+ +0x1358 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1364 | offset to field `attributes` (vector)
+ +0x135C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1360 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x1360 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1364 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x1368 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x136C | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x136C | 08 DE FF FF | SOffset32 | 0xFFFFDE08 (-8696) Loc: +0x3564 | offset to vtable
+ +0x1370 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1380 | offset to field `key` (string)
+ +0x1374 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1378 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1378 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x137C | 34 37 | char[2] | 47 | string literal
+ +0x137E | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1380 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1384 | 69 64 | char[2] | id | string literal
+ +0x1386 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x1388 | D8 E9 FF FF | SOffset32 | 0xFFFFE9D8 (-5672) Loc: +0x29B0 | offset to vtable
+ +0x138C | 00 00 | uint8_t[2] | .. | padding
+ +0x138E | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x138F | 04 | uint8_t | 0x04 (4) | table field `element` (Byte)
+ +0x1390 | 03 00 00 00 | uint32_t | 0x00000003 (3) | table field `index` (Int)
+ +0x1394 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1398 | 0F 00 00 00 | uint32_t | 0x0000000F (15) | length of string
+ +0x139C | 76 65 63 74 6F 72 5F 6F | char[15] | vector_o | string literal
+ +0x13A4 | 66 5F 65 6E 75 6D 73 | | f_enums
+ +0x13AB | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x13AC | 88 E8 FF FF | SOffset32 | 0xFFFFE888 (-6008) Loc: +0x2B24 | offset to vtable
+ +0x13B0 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x13B3 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x13B4 | 2E 00 | uint16_t | 0x002E (46) | table field `id` (UShort)
+ +0x13B6 | 60 00 | uint16_t | 0x0060 (96) | table field `offset` (UShort)
+ +0x13B8 | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x1400 | offset to field `name` (string)
+ +0x13BC | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x13F0 | offset to field `type` (table)
+ +0x13C0 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x13CC | offset to field `attributes` (vector)
+ +0x13C4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x13C8 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x13C8 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x13CC | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x13D0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x13D4 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x13D4 | 70 DE FF FF | SOffset32 | 0xFFFFDE70 (-8592) Loc: +0x3564 | offset to vtable
+ +0x13D8 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x13E8 | offset to field `key` (string)
+ +0x13DC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x13E0 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x13E0 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x13E4 | 34 36 | char[2] | 46 | string literal
+ +0x13E6 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x13E8 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x13EC | 69 64 | char[2] | id | string literal
+ +0x13EE | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x13F0 | 38 DB FF FF | SOffset32 | 0xFFFFDB38 (-9416) Loc: +0x38B8 | offset to vtable
+ +0x13F4 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x13F7 | 10 | uint8_t | 0x10 (16) | table field `base_type` (Byte)
+ +0x13F8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `index` (Int)
+ +0x13FC | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1400 | 0D 00 00 00 | uint32_t | 0x0000000D (13) | length of string
+ +0x1404 | 61 6E 79 5F 61 6D 62 69 | char[13] | any_ambi | string literal
+ +0x140C | 67 75 6F 75 73 | | guous
+ +0x1411 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1412 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x1414 | DA E9 FF FF | SOffset32 | 0xFFFFE9DA (-5670) Loc: +0x2A3A | offset to vtable
+ +0x1418 | 2D 00 | uint16_t | 0x002D (45) | table field `id` (UShort)
+ +0x141A | 5E 00 | uint16_t | 0x005E (94) | table field `offset` (UShort)
+ +0x141C | 4C 00 00 00 | UOffset32 | 0x0000004C (76) Loc: +0x1468 | offset to field `name` (string)
+ +0x1420 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x1454 | offset to field `type` (table)
+ +0x1424 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1430 | offset to field `attributes` (vector)
+ +0x1428 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x142C | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x142C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1430 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x1434 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1438 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x1438 | D4 DE FF FF | SOffset32 | 0xFFFFDED4 (-8492) Loc: +0x3564 | offset to vtable
+ +0x143C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x144C | offset to field `key` (string)
+ +0x1440 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1444 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1444 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1448 | 34 35 | char[2] | 45 | string literal
+ +0x144A | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x144C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1450 | 69 64 | char[2] | id | string literal
+ +0x1452 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x1454 | 50 DE FF FF | SOffset32 | 0xFFFFDE50 (-8624) Loc: +0x3604 | offset to vtable
+ +0x1458 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x145B | 01 | uint8_t | 0x01 (1) | table field `base_type` (Byte)
+ +0x145C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `index` (Int)
+ +0x1460 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x1464 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1468 | 12 00 00 00 | uint32_t | 0x00000012 (18) | length of string
+ +0x146C | 61 6E 79 5F 61 6D 62 69 | char[18] | any_ambi | string literal
+ +0x1474 | 67 75 6F 75 73 5F 74 79 | | guous_ty
+ +0x147C | 70 65 | | pe
+ +0x147E | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x1480 | 5C E9 FF FF | SOffset32 | 0xFFFFE95C (-5796) Loc: +0x2B24 | offset to vtable
+ +0x1484 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x1487 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x1488 | 2C 00 | uint16_t | 0x002C (44) | table field `id` (UShort)
+ +0x148A | 5C 00 | uint16_t | 0x005C (92) | table field `offset` (UShort)
+ +0x148C | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x14D4 | offset to field `name` (string)
+ +0x1490 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x14C4 | offset to field `type` (table)
+ +0x1494 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x14A0 | offset to field `attributes` (vector)
+ +0x1498 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x149C | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x149C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x14A0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x14A4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x14A8 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x14A8 | 44 DF FF FF | SOffset32 | 0xFFFFDF44 (-8380) Loc: +0x3564 | offset to vtable
+ +0x14AC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x14BC | offset to field `key` (string)
+ +0x14B0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x14B4 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x14B4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x14B8 | 34 34 | char[2] | 44 | string literal
+ +0x14BA | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x14BC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x14C0 | 69 64 | char[2] | id | string literal
+ +0x14C2 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x14C4 | 0C DC FF FF | SOffset32 | 0xFFFFDC0C (-9204) Loc: +0x38B8 | offset to vtable
+ +0x14C8 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x14CB | 10 | uint8_t | 0x10 (16) | table field `base_type` (Byte)
+ +0x14CC | 02 00 00 00 | uint32_t | 0x00000002 (2) | table field `index` (Int)
+ +0x14D0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x14D4 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | length of string
+ +0x14D8 | 61 6E 79 5F 75 6E 69 71 | char[10] | any_uniq | string literal
+ +0x14E0 | 75 65 | | ue
+ +0x14E2 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x14E4 | AA EA FF FF | SOffset32 | 0xFFFFEAAA (-5462) Loc: +0x2A3A | offset to vtable
+ +0x14E8 | 2B 00 | uint16_t | 0x002B (43) | table field `id` (UShort)
+ +0x14EA | 5A 00 | uint16_t | 0x005A (90) | table field `offset` (UShort)
+ +0x14EC | 4C 00 00 00 | UOffset32 | 0x0000004C (76) Loc: +0x1538 | offset to field `name` (string)
+ +0x14F0 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x1524 | offset to field `type` (table)
+ +0x14F4 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1500 | offset to field `attributes` (vector)
+ +0x14F8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x14FC | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x14FC | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1500 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x1504 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1508 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x1508 | A4 DF FF FF | SOffset32 | 0xFFFFDFA4 (-8284) Loc: +0x3564 | offset to vtable
+ +0x150C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x151C | offset to field `key` (string)
+ +0x1510 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1514 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1514 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1518 | 34 33 | char[2] | 43 | string literal
+ +0x151A | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x151C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1520 | 69 64 | char[2] | id | string literal
+ +0x1522 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x1524 | 20 DF FF FF | SOffset32 | 0xFFFFDF20 (-8416) Loc: +0x3604 | offset to vtable
+ +0x1528 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x152B | 01 | uint8_t | 0x01 (1) | table field `base_type` (Byte)
+ +0x152C | 02 00 00 00 | uint32_t | 0x00000002 (2) | table field `index` (Int)
+ +0x1530 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x1534 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1538 | 0F 00 00 00 | uint32_t | 0x0000000F (15) | length of string
+ +0x153C | 61 6E 79 5F 75 6E 69 71 | char[15] | any_uniq | string literal
+ +0x1544 | 75 65 5F 74 79 70 65 | | ue_type
+ +0x154B | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x154C | 28 EA FF FF | SOffset32 | 0xFFFFEA28 (-5592) Loc: +0x2B24 | offset to vtable
+ +0x1550 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x1553 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x1554 | 2A 00 | uint16_t | 0x002A (42) | table field `id` (UShort)
+ +0x1556 | 58 00 | uint16_t | 0x0058 (88) | table field `offset` (UShort)
+ +0x1558 | 00 01 00 00 | UOffset32 | 0x00000100 (256) Loc: +0x1658 | offset to field `name` (string)
+ +0x155C | F0 00 00 00 | UOffset32 | 0x000000F0 (240) Loc: +0x164C | offset to field `type` (table)
+ +0x1560 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x156C | offset to field `attributes` (vector)
+ +0x1564 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1568 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x1568 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x156C | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of vector (# items)
+ +0x1570 | B0 00 00 00 | UOffset32 | 0x000000B0 (176) Loc: +0x1620 | offset to table[0]
+ +0x1574 | 80 00 00 00 | UOffset32 | 0x00000080 (128) Loc: +0x15F4 | offset to table[1]
+ +0x1578 | 50 00 00 00 | UOffset32 | 0x00000050 (80) Loc: +0x15C8 | offset to table[2]
+ +0x157C | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x15A0 | offset to table[3]
+ +0x1580 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1584 | offset to table[4]
+
+table (reflection.KeyValue):
+ +0x1584 | 20 E0 FF FF | SOffset32 | 0xFFFFE020 (-8160) Loc: +0x3564 | offset to vtable
+ +0x1588 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1598 | offset to field `key` (string)
+ +0x158C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1590 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1590 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1594 | 34 32 | char[2] | 42 | string literal
+ +0x1596 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1598 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x159C | 69 64 | char[2] | id | string literal
+ +0x159E | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x15A0 | 3C E0 FF FF | SOffset32 | 0xFFFFE03C (-8132) Loc: +0x3564 | offset to vtable
+ +0x15A4 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x15BC | offset to field `key` (string)
+ +0x15A8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x15AC | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x15AC | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x15B0 | 66 6E 76 31 61 5F 36 34 | char[8] | fnv1a_64 | string literal
+ +0x15B8 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x15B9 | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x15BC | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x15C0 | 68 61 73 68 | char[4] | hash | string literal
+ +0x15C4 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x15C5 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x15C8 | 64 E0 FF FF | SOffset32 | 0xFFFFE064 (-8092) Loc: +0x3564 | offset to vtable
+ +0x15CC | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x15E4 | offset to field `key` (string)
+ +0x15D0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x15D4 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x15D4 | 0B 00 00 00 | uint32_t | 0x0000000B (11) | length of string
+ +0x15D8 | 52 65 66 65 72 72 61 62 | char[11] | Referrab | string literal
+ +0x15E0 | 6C 65 54 | | leT
+ +0x15E3 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x15E4 | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x15E8 | 63 70 70 5F 74 79 70 65 | char[8] | cpp_type | string literal
+ +0x15F0 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x15F1 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x15F4 | 90 E0 FF FF | SOffset32 | 0xFFFFE090 (-8048) Loc: +0x3564 | offset to vtable
+ +0x15F8 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1608 | offset to field `key` (string)
+ +0x15FC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1600 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1600 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of string
+ +0x1604 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1605 | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x1608 | 10 00 00 00 | uint32_t | 0x00000010 (16) | length of string
+ +0x160C | 63 70 70 5F 70 74 72 5F | char[16] | cpp_ptr_ | string literal
+ +0x1614 | 74 79 70 65 5F 67 65 74 | | type_get
+ +0x161C | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x161D | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x1620 | BC E0 FF FF | SOffset32 | 0xFFFFE0BC (-8004) Loc: +0x3564 | offset to vtable
+ +0x1624 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x1638 | offset to field `key` (string)
+ +0x1628 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x162C | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x162C | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x1630 | 6E 61 6B 65 64 | char[5] | naked | string literal
+ +0x1635 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1636 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x1638 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | length of string
+ +0x163C | 63 70 70 5F 70 74 72 5F | char[12] | cpp_ptr_ | string literal
+ +0x1644 | 74 79 70 65 | | type
+ +0x1648 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1649 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x164C | C8 EA FF FF | SOffset32 | 0xFFFFEAC8 (-5432) Loc: +0x2B84 | offset to vtable
+ +0x1650 | 00 00 | uint8_t[2] | .. | padding
+ +0x1652 | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x1653 | 0A | uint8_t | 0x0A (10) | table field `element` (Byte)
+ +0x1654 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1658 | 1F 00 00 00 | uint32_t | 0x0000001F (31) | length of string
+ +0x165C | 76 65 63 74 6F 72 5F 6F | char[31] | vector_o | string literal
+ +0x1664 | 66 5F 6E 6F 6E 5F 6F 77 | | f_non_ow
+ +0x166C | 6E 69 6E 67 5F 72 65 66 | | ning_ref
+ +0x1674 | 65 72 65 6E 63 65 73 | | erences
+ +0x167B | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x167C | 42 EC FF FF | SOffset32 | 0xFFFFEC42 (-5054) Loc: +0x2A3A | offset to vtable
+ +0x1680 | 29 00 | uint16_t | 0x0029 (41) | table field `id` (UShort)
+ +0x1682 | 56 00 | uint16_t | 0x0056 (86) | table field `offset` (UShort)
+ +0x1684 | 04 01 00 00 | UOffset32 | 0x00000104 (260) Loc: +0x1788 | offset to field `name` (string)
+ +0x1688 | F0 00 00 00 | UOffset32 | 0x000000F0 (240) Loc: +0x1778 | offset to field `type` (table)
+ +0x168C | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1698 | offset to field `attributes` (vector)
+ +0x1690 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1694 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x1694 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1698 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of vector (# items)
+ +0x169C | B0 00 00 00 | UOffset32 | 0x000000B0 (176) Loc: +0x174C | offset to table[0]
+ +0x16A0 | 80 00 00 00 | UOffset32 | 0x00000080 (128) Loc: +0x1720 | offset to table[1]
+ +0x16A4 | 50 00 00 00 | UOffset32 | 0x00000050 (80) Loc: +0x16F4 | offset to table[2]
+ +0x16A8 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x16CC | offset to table[3]
+ +0x16AC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x16B0 | offset to table[4]
+
+table (reflection.KeyValue):
+ +0x16B0 | 4C E1 FF FF | SOffset32 | 0xFFFFE14C (-7860) Loc: +0x3564 | offset to vtable
+ +0x16B4 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x16C4 | offset to field `key` (string)
+ +0x16B8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x16BC | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x16BC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x16C0 | 34 31 | char[2] | 41 | string literal
+ +0x16C2 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x16C4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x16C8 | 69 64 | char[2] | id | string literal
+ +0x16CA | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x16CC | 68 E1 FF FF | SOffset32 | 0xFFFFE168 (-7832) Loc: +0x3564 | offset to vtable
+ +0x16D0 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x16E8 | offset to field `key` (string)
+ +0x16D4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x16D8 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x16D8 | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x16DC | 66 6E 76 31 61 5F 36 34 | char[8] | fnv1a_64 | string literal
+ +0x16E4 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x16E5 | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x16E8 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x16EC | 68 61 73 68 | char[4] | hash | string literal
+ +0x16F0 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x16F1 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x16F4 | 90 E1 FF FF | SOffset32 | 0xFFFFE190 (-7792) Loc: +0x3564 | offset to vtable
+ +0x16F8 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x1710 | offset to field `key` (string)
+ +0x16FC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1700 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1700 | 0B 00 00 00 | uint32_t | 0x0000000B (11) | length of string
+ +0x1704 | 52 65 66 65 72 72 61 62 | char[11] | Referrab | string literal
+ +0x170C | 6C 65 54 | | leT
+ +0x170F | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1710 | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x1714 | 63 70 70 5F 74 79 70 65 | char[8] | cpp_type | string literal
+ +0x171C | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x171D | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x1720 | BC E1 FF FF | SOffset32 | 0xFFFFE1BC (-7748) Loc: +0x3564 | offset to vtable
+ +0x1724 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1734 | offset to field `key` (string)
+ +0x1728 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x172C | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x172C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of string
+ +0x1730 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1731 | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x1734 | 10 00 00 00 | uint32_t | 0x00000010 (16) | length of string
+ +0x1738 | 63 70 70 5F 70 74 72 5F | char[16] | cpp_ptr_ | string literal
+ +0x1740 | 74 79 70 65 5F 67 65 74 | | type_get
+ +0x1748 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1749 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x174C | E8 E1 FF FF | SOffset32 | 0xFFFFE1E8 (-7704) Loc: +0x3564 | offset to vtable
+ +0x1750 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x1764 | offset to field `key` (string)
+ +0x1754 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1758 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1758 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x175C | 6E 61 6B 65 64 | char[5] | naked | string literal
+ +0x1761 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1762 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x1764 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | length of string
+ +0x1768 | 63 70 70 5F 70 74 72 5F | char[12] | cpp_ptr_ | string literal
+ +0x1770 | 74 79 70 65 | | type
+ +0x1774 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1775 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x1778 | 94 E0 FF FF | SOffset32 | 0xFFFFE094 (-8044) Loc: +0x36E4 | offset to vtable
+ +0x177C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x177F | 0A | uint8_t | 0x0A (10) | table field `base_type` (Byte)
+ +0x1780 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x1784 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1788 | 14 00 00 00 | uint32_t | 0x00000014 (20) | length of string
+ +0x178C | 6E 6F 6E 5F 6F 77 6E 69 | char[20] | non_owni | string literal
+ +0x1794 | 6E 67 5F 72 65 66 65 72 | | ng_refer
+ +0x179C | 65 6E 63 65 | | ence
+ +0x17A0 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x17A1 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Field):
+ +0x17A4 | 80 EC FF FF | SOffset32 | 0xFFFFEC80 (-4992) Loc: +0x2B24 | offset to vtable
+ +0x17A8 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x17AB | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x17AC | 28 00 | uint16_t | 0x0028 (40) | table field `id` (UShort)
+ +0x17AE | 54 00 | uint16_t | 0x0054 (84) | table field `offset` (UShort)
+ +0x17B0 | 10 01 00 00 | UOffset32 | 0x00000110 (272) Loc: +0x18C0 | offset to field `name` (string)
+ +0x17B4 | 00 01 00 00 | UOffset32 | 0x00000100 (256) Loc: +0x18B4 | offset to field `type` (table)
+ +0x17B8 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x17C4 | offset to field `attributes` (vector)
+ +0x17BC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x17C0 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x17C0 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x17C4 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of vector (# items)
+ +0x17C8 | B4 00 00 00 | UOffset32 | 0x000000B4 (180) Loc: +0x187C | offset to table[0]
+ +0x17CC | 80 00 00 00 | UOffset32 | 0x00000080 (128) Loc: +0x184C | offset to table[1]
+ +0x17D0 | 50 00 00 00 | UOffset32 | 0x00000050 (80) Loc: +0x1820 | offset to table[2]
+ +0x17D4 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x17F8 | offset to table[3]
+ +0x17D8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x17DC | offset to table[4]
+
+table (reflection.KeyValue):
+ +0x17DC | 78 E2 FF FF | SOffset32 | 0xFFFFE278 (-7560) Loc: +0x3564 | offset to vtable
+ +0x17E0 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x17F0 | offset to field `key` (string)
+ +0x17E4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x17E8 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x17E8 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x17EC | 34 30 | char[2] | 40 | string literal
+ +0x17EE | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x17F0 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x17F4 | 69 64 | char[2] | id | string literal
+ +0x17F6 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x17F8 | 94 E2 FF FF | SOffset32 | 0xFFFFE294 (-7532) Loc: +0x3564 | offset to vtable
+ +0x17FC | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x1814 | offset to field `key` (string)
+ +0x1800 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1804 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1804 | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x1808 | 66 6E 76 31 61 5F 36 34 | char[8] | fnv1a_64 | string literal
+ +0x1810 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1811 | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x1814 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x1818 | 68 61 73 68 | char[4] | hash | string literal
+ +0x181C | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x181D | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x1820 | BC E2 FF FF | SOffset32 | 0xFFFFE2BC (-7492) Loc: +0x3564 | offset to vtable
+ +0x1824 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x183C | offset to field `key` (string)
+ +0x1828 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x182C | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x182C | 0B 00 00 00 | uint32_t | 0x0000000B (11) | length of string
+ +0x1830 | 52 65 66 65 72 72 61 62 | char[11] | Referrab | string literal
+ +0x1838 | 6C 65 54 | | leT
+ +0x183B | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x183C | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x1840 | 63 70 70 5F 74 79 70 65 | char[8] | cpp_type | string literal
+ +0x1848 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1849 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x184C | E8 E2 FF FF | SOffset32 | 0xFFFFE2E8 (-7448) Loc: +0x3564 | offset to vtable
+ +0x1850 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x1864 | offset to field `key` (string)
+ +0x1854 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1858 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1858 | 06 00 00 00 | uint32_t | 0x00000006 (6) | length of string
+ +0x185C | 2E 67 65 74 28 29 | char[6] | .get() | string literal
+ +0x1862 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1864 | 10 00 00 00 | uint32_t | 0x00000010 (16) | length of string
+ +0x1868 | 63 70 70 5F 70 74 72 5F | char[16] | cpp_ptr_ | string literal
+ +0x1870 | 74 79 70 65 5F 67 65 74 | | type_get
+ +0x1878 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1879 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x187C | 18 E3 FF FF | SOffset32 | 0xFFFFE318 (-7400) Loc: +0x3564 | offset to vtable
+ +0x1880 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x18A0 | offset to field `key` (string)
+ +0x1884 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1888 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1888 | 10 00 00 00 | uint32_t | 0x00000010 (16) | length of string
+ +0x188C | 64 65 66 61 75 6C 74 5F | char[16] | default_ | string literal
+ +0x1894 | 70 74 72 5F 74 79 70 65 | | ptr_type
+ +0x189C | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x189D | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x18A0 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | length of string
+ +0x18A4 | 63 70 70 5F 70 74 72 5F | char[12] | cpp_ptr_ | string literal
+ +0x18AC | 74 79 70 65 | | type
+ +0x18B0 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x18B1 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x18B4 | 30 ED FF FF | SOffset32 | 0xFFFFED30 (-4816) Loc: +0x2B84 | offset to vtable
+ +0x18B8 | 00 00 | uint8_t[2] | .. | padding
+ +0x18BA | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x18BB | 0A | uint8_t | 0x0A (10) | table field `element` (Byte)
+ +0x18BC | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x18C0 | 1E 00 00 00 | uint32_t | 0x0000001E (30) | length of string
+ +0x18C4 | 76 65 63 74 6F 72 5F 6F | char[30] | vector_o | string literal
+ +0x18CC | 66 5F 63 6F 5F 6F 77 6E | | f_co_own
+ +0x18D4 | 69 6E 67 5F 72 65 66 65 | | ing_refe
+ +0x18DC | 72 65 6E 63 65 73 | | rences
+ +0x18E2 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x18E4 | AA EE FF FF | SOffset32 | 0xFFFFEEAA (-4438) Loc: +0x2A3A | offset to vtable
+ +0x18E8 | 27 00 | uint16_t | 0x0027 (39) | table field `id` (UShort)
+ +0x18EA | 52 00 | uint16_t | 0x0052 (82) | table field `offset` (UShort)
+ +0x18EC | D4 00 00 00 | UOffset32 | 0x000000D4 (212) Loc: +0x19C0 | offset to field `name` (string)
+ +0x18F0 | C0 00 00 00 | UOffset32 | 0x000000C0 (192) Loc: +0x19B0 | offset to field `type` (table)
+ +0x18F4 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1900 | offset to field `attributes` (vector)
+ +0x18F8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x18FC | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x18FC | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1900 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of vector (# items)
+ +0x1904 | 80 00 00 00 | UOffset32 | 0x00000080 (128) Loc: +0x1984 | offset to table[0]
+ +0x1908 | 50 00 00 00 | UOffset32 | 0x00000050 (80) Loc: +0x1958 | offset to table[1]
+ +0x190C | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x1930 | offset to table[2]
+ +0x1910 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1914 | offset to table[3]
+
+table (reflection.KeyValue):
+ +0x1914 | B0 E3 FF FF | SOffset32 | 0xFFFFE3B0 (-7248) Loc: +0x3564 | offset to vtable
+ +0x1918 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1928 | offset to field `key` (string)
+ +0x191C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1920 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1920 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1924 | 33 39 | char[2] | 39 | string literal
+ +0x1926 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1928 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x192C | 69 64 | char[2] | id | string literal
+ +0x192E | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x1930 | CC E3 FF FF | SOffset32 | 0xFFFFE3CC (-7220) Loc: +0x3564 | offset to vtable
+ +0x1934 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x194C | offset to field `key` (string)
+ +0x1938 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x193C | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x193C | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x1940 | 66 6E 76 31 61 5F 36 34 | char[8] | fnv1a_64 | string literal
+ +0x1948 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1949 | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x194C | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x1950 | 68 61 73 68 | char[4] | hash | string literal
+ +0x1954 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1955 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x1958 | F4 E3 FF FF | SOffset32 | 0xFFFFE3F4 (-7180) Loc: +0x3564 | offset to vtable
+ +0x195C | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x1974 | offset to field `key` (string)
+ +0x1960 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1964 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1964 | 0B 00 00 00 | uint32_t | 0x0000000B (11) | length of string
+ +0x1968 | 52 65 66 65 72 72 61 62 | char[11] | Referrab | string literal
+ +0x1970 | 6C 65 54 | | leT
+ +0x1973 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1974 | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x1978 | 63 70 70 5F 74 79 70 65 | char[8] | cpp_type | string literal
+ +0x1980 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1981 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x1984 | 20 E4 FF FF | SOffset32 | 0xFFFFE420 (-7136) Loc: +0x3564 | offset to vtable
+ +0x1988 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x199C | offset to field `key` (string)
+ +0x198C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1990 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1990 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x1994 | 6E 61 6B 65 64 | char[5] | naked | string literal
+ +0x1999 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x199A | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x199C | 0C 00 00 00 | uint32_t | 0x0000000C (12) | length of string
+ +0x19A0 | 63 70 70 5F 70 74 72 5F | char[12] | cpp_ptr_ | string literal
+ +0x19A8 | 74 79 70 65 | | type
+ +0x19AC | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x19AD | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x19B0 | CC E2 FF FF | SOffset32 | 0xFFFFE2CC (-7476) Loc: +0x36E4 | offset to vtable
+ +0x19B4 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x19B7 | 0A | uint8_t | 0x0A (10) | table field `base_type` (Byte)
+ +0x19B8 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x19BC | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x19C0 | 13 00 00 00 | uint32_t | 0x00000013 (19) | length of string
+ +0x19C4 | 63 6F 5F 6F 77 6E 69 6E | char[19] | co_ownin | string literal
+ +0x19CC | 67 5F 72 65 66 65 72 65 | | g_refere
+ +0x19D4 | 6E 63 65 | | nce
+ +0x19D7 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x19D8 | B4 EE FF FF | SOffset32 | 0xFFFFEEB4 (-4428) Loc: +0x2B24 | offset to vtable
+ +0x19DC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x19DF | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x19E0 | 26 00 | uint16_t | 0x0026 (38) | table field `id` (UShort)
+ +0x19E2 | 50 00 | uint16_t | 0x0050 (80) | table field `offset` (UShort)
+ +0x19E4 | 84 00 00 00 | UOffset32 | 0x00000084 (132) Loc: +0x1A68 | offset to field `name` (string)
+ +0x19E8 | 70 00 00 00 | UOffset32 | 0x00000070 (112) Loc: +0x1A58 | offset to field `type` (table)
+ +0x19EC | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x19F8 | offset to field `attributes` (vector)
+ +0x19F0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x19F4 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x19F4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x19F8 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x19FC | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x1A20 | offset to table[0]
+ +0x1A00 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1A04 | offset to table[1]
+
+table (reflection.KeyValue):
+ +0x1A04 | A0 E4 FF FF | SOffset32 | 0xFFFFE4A0 (-7008) Loc: +0x3564 | offset to vtable
+ +0x1A08 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1A18 | offset to field `key` (string)
+ +0x1A0C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1A10 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1A10 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1A14 | 33 38 | char[2] | 38 | string literal
+ +0x1A16 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1A18 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1A1C | 69 64 | char[2] | id | string literal
+ +0x1A1E | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x1A20 | BC E4 FF FF | SOffset32 | 0xFFFFE4BC (-6980) Loc: +0x3564 | offset to vtable
+ +0x1A24 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x1A44 | offset to field `key` (string)
+ +0x1A28 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1A2C | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1A2C | 10 00 00 00 | uint32_t | 0x00000010 (16) | length of string
+ +0x1A30 | 64 65 66 61 75 6C 74 5F | char[16] | default_ | string literal
+ +0x1A38 | 70 74 72 5F 74 79 70 65 | | ptr_type
+ +0x1A40 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1A41 | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x1A44 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | length of string
+ +0x1A48 | 63 70 70 5F 70 74 72 5F | char[12] | cpp_ptr_ | string literal
+ +0x1A50 | 74 79 70 65 | | type
+ +0x1A54 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1A55 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x1A58 | A8 F0 FF FF | SOffset32 | 0xFFFFF0A8 (-3928) Loc: +0x29B0 | offset to vtable
+ +0x1A5C | 00 00 | uint8_t[2] | .. | padding
+ +0x1A5E | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x1A5F | 0F | uint8_t | 0x0F (15) | table field `element` (Byte)
+ +0x1A60 | 02 00 00 00 | uint32_t | 0x00000002 (2) | table field `index` (Int)
+ +0x1A64 | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1A68 | 1C 00 00 00 | uint32_t | 0x0000001C (28) | length of string
+ +0x1A6C | 76 65 63 74 6F 72 5F 6F | char[28] | vector_o | string literal
+ +0x1A74 | 66 5F 73 74 72 6F 6E 67 | | f_strong
+ +0x1A7C | 5F 72 65 66 65 72 72 61 | | _referra
+ +0x1A84 | 62 6C 65 73 | | bles
+ +0x1A88 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1A89 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Field):
+ +0x1A8C | 68 EF FF FF | SOffset32 | 0xFFFFEF68 (-4248) Loc: +0x2B24 | offset to vtable
+ +0x1A90 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x1A93 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x1A94 | 25 00 | uint16_t | 0x0025 (37) | table field `id` (UShort)
+ +0x1A96 | 4E 00 | uint16_t | 0x004E (78) | table field `offset` (UShort)
+ +0x1A98 | D0 00 00 00 | UOffset32 | 0x000000D0 (208) Loc: +0x1B68 | offset to field `name` (string)
+ +0x1A9C | C0 00 00 00 | UOffset32 | 0x000000C0 (192) Loc: +0x1B5C | offset to field `type` (table)
+ +0x1AA0 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1AAC | offset to field `attributes` (vector)
+ +0x1AA4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1AA8 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x1AA8 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1AAC | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of vector (# items)
+ +0x1AB0 | 80 00 00 00 | UOffset32 | 0x00000080 (128) Loc: +0x1B30 | offset to table[0]
+ +0x1AB4 | 50 00 00 00 | UOffset32 | 0x00000050 (80) Loc: +0x1B04 | offset to table[1]
+ +0x1AB8 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x1ADC | offset to table[2]
+ +0x1ABC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1AC0 | offset to table[3]
+
+table (reflection.KeyValue):
+ +0x1AC0 | 5C E5 FF FF | SOffset32 | 0xFFFFE55C (-6820) Loc: +0x3564 | offset to vtable
+ +0x1AC4 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1AD4 | offset to field `key` (string)
+ +0x1AC8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1ACC | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1ACC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1AD0 | 33 37 | char[2] | 37 | string literal
+ +0x1AD2 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1AD4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1AD8 | 69 64 | char[2] | id | string literal
+ +0x1ADA | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x1ADC | 78 E5 FF FF | SOffset32 | 0xFFFFE578 (-6792) Loc: +0x3564 | offset to vtable
+ +0x1AE0 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x1AF8 | offset to field `key` (string)
+ +0x1AE4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1AE8 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1AE8 | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x1AEC | 66 6E 76 31 61 5F 36 34 | char[8] | fnv1a_64 | string literal
+ +0x1AF4 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1AF5 | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x1AF8 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x1AFC | 68 61 73 68 | char[4] | hash | string literal
+ +0x1B00 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1B01 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x1B04 | A0 E5 FF FF | SOffset32 | 0xFFFFE5A0 (-6752) Loc: +0x3564 | offset to vtable
+ +0x1B08 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x1B20 | offset to field `key` (string)
+ +0x1B0C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1B10 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1B10 | 0B 00 00 00 | uint32_t | 0x0000000B (11) | length of string
+ +0x1B14 | 52 65 66 65 72 72 61 62 | char[11] | Referrab | string literal
+ +0x1B1C | 6C 65 54 | | leT
+ +0x1B1F | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1B20 | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x1B24 | 63 70 70 5F 74 79 70 65 | char[8] | cpp_type | string literal
+ +0x1B2C | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1B2D | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x1B30 | CC E5 FF FF | SOffset32 | 0xFFFFE5CC (-6708) Loc: +0x3564 | offset to vtable
+ +0x1B34 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x1B48 | offset to field `key` (string)
+ +0x1B38 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1B3C | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1B3C | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x1B40 | 6E 61 6B 65 64 | char[5] | naked | string literal
+ +0x1B45 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1B46 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x1B48 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | length of string
+ +0x1B4C | 63 70 70 5F 70 74 72 5F | char[12] | cpp_ptr_ | string literal
+ +0x1B54 | 74 79 70 65 | | type
+ +0x1B58 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1B59 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x1B5C | D8 EF FF FF | SOffset32 | 0xFFFFEFD8 (-4136) Loc: +0x2B84 | offset to vtable
+ +0x1B60 | 00 00 | uint8_t[2] | .. | padding
+ +0x1B62 | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x1B63 | 0A | uint8_t | 0x0A (10) | table field `element` (Byte)
+ +0x1B64 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1B68 | 19 00 00 00 | uint32_t | 0x00000019 (25) | length of string
+ +0x1B6C | 76 65 63 74 6F 72 5F 6F | char[25] | vector_o | string literal
+ +0x1B74 | 66 5F 77 65 61 6B 5F 72 | | f_weak_r
+ +0x1B7C | 65 66 65 72 65 6E 63 65 | | eference
+ +0x1B84 | 73 | | s
+ +0x1B85 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1B86 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x1B88 | 4E F1 FF FF | SOffset32 | 0xFFFFF14E (-3762) Loc: +0x2A3A | offset to vtable
+ +0x1B8C | 24 00 | uint16_t | 0x0024 (36) | table field `id` (UShort)
+ +0x1B8E | 4C 00 | uint16_t | 0x004C (76) | table field `offset` (UShort)
+ +0x1B90 | D4 00 00 00 | UOffset32 | 0x000000D4 (212) Loc: +0x1C64 | offset to field `name` (string)
+ +0x1B94 | C0 00 00 00 | UOffset32 | 0x000000C0 (192) Loc: +0x1C54 | offset to field `type` (table)
+ +0x1B98 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1BA4 | offset to field `attributes` (vector)
+ +0x1B9C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1BA0 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x1BA0 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1BA4 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of vector (# items)
+ +0x1BA8 | 80 00 00 00 | UOffset32 | 0x00000080 (128) Loc: +0x1C28 | offset to table[0]
+ +0x1BAC | 50 00 00 00 | UOffset32 | 0x00000050 (80) Loc: +0x1BFC | offset to table[1]
+ +0x1BB0 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x1BD4 | offset to table[2]
+ +0x1BB4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1BB8 | offset to table[3]
+
+table (reflection.KeyValue):
+ +0x1BB8 | 54 E6 FF FF | SOffset32 | 0xFFFFE654 (-6572) Loc: +0x3564 | offset to vtable
+ +0x1BBC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1BCC | offset to field `key` (string)
+ +0x1BC0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1BC4 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1BC4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1BC8 | 33 36 | char[2] | 36 | string literal
+ +0x1BCA | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1BCC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1BD0 | 69 64 | char[2] | id | string literal
+ +0x1BD2 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x1BD4 | 70 E6 FF FF | SOffset32 | 0xFFFFE670 (-6544) Loc: +0x3564 | offset to vtable
+ +0x1BD8 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x1BF0 | offset to field `key` (string)
+ +0x1BDC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1BE0 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1BE0 | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x1BE4 | 66 6E 76 31 61 5F 36 34 | char[8] | fnv1a_64 | string literal
+ +0x1BEC | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1BED | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x1BF0 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x1BF4 | 68 61 73 68 | char[4] | hash | string literal
+ +0x1BF8 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1BF9 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x1BFC | 98 E6 FF FF | SOffset32 | 0xFFFFE698 (-6504) Loc: +0x3564 | offset to vtable
+ +0x1C00 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x1C18 | offset to field `key` (string)
+ +0x1C04 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1C08 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1C08 | 0B 00 00 00 | uint32_t | 0x0000000B (11) | length of string
+ +0x1C0C | 52 65 66 65 72 72 61 62 | char[11] | Referrab | string literal
+ +0x1C14 | 6C 65 54 | | leT
+ +0x1C17 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1C18 | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x1C1C | 63 70 70 5F 74 79 70 65 | char[8] | cpp_type | string literal
+ +0x1C24 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1C25 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x1C28 | C4 E6 FF FF | SOffset32 | 0xFFFFE6C4 (-6460) Loc: +0x3564 | offset to vtable
+ +0x1C2C | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x1C40 | offset to field `key` (string)
+ +0x1C30 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1C34 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1C34 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x1C38 | 6E 61 6B 65 64 | char[5] | naked | string literal
+ +0x1C3D | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1C3E | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x1C40 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | length of string
+ +0x1C44 | 63 70 70 5F 70 74 72 5F | char[12] | cpp_ptr_ | string literal
+ +0x1C4C | 74 79 70 65 | | type
+ +0x1C50 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1C51 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x1C54 | 70 E5 FF FF | SOffset32 | 0xFFFFE570 (-6800) Loc: +0x36E4 | offset to vtable
+ +0x1C58 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x1C5B | 0A | uint8_t | 0x0A (10) | table field `base_type` (Byte)
+ +0x1C5C | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x1C60 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1C64 | 15 00 00 00 | uint32_t | 0x00000015 (21) | length of string
+ +0x1C68 | 73 69 6E 67 6C 65 5F 77 | char[21] | single_w | string literal
+ +0x1C70 | 65 61 6B 5F 72 65 66 65 | | eak_refe
+ +0x1C78 | 72 65 6E 63 65 | | rence
+ +0x1C7D | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1C7E | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x1C80 | 5C F1 FF FF | SOffset32 | 0xFFFFF15C (-3748) Loc: +0x2B24 | offset to vtable
+ +0x1C84 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x1C87 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x1C88 | 23 00 | uint16_t | 0x0023 (35) | table field `id` (UShort)
+ +0x1C8A | 4A 00 | uint16_t | 0x004A (74) | table field `offset` (UShort)
+ +0x1C8C | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x1CD4 | offset to field `name` (string)
+ +0x1C90 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x1CC4 | offset to field `type` (table)
+ +0x1C94 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1CA0 | offset to field `attributes` (vector)
+ +0x1C98 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1C9C | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x1C9C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1CA0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x1CA4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1CA8 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x1CA8 | 44 E7 FF FF | SOffset32 | 0xFFFFE744 (-6332) Loc: +0x3564 | offset to vtable
+ +0x1CAC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1CBC | offset to field `key` (string)
+ +0x1CB0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1CB4 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1CB4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1CB8 | 33 35 | char[2] | 35 | string literal
+ +0x1CBA | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1CBC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1CC0 | 69 64 | char[2] | id | string literal
+ +0x1CC2 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x1CC4 | 14 F3 FF FF | SOffset32 | 0xFFFFF314 (-3308) Loc: +0x29B0 | offset to vtable
+ +0x1CC8 | 00 00 | uint8_t[2] | .. | padding
+ +0x1CCA | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x1CCB | 0F | uint8_t | 0x0F (15) | table field `element` (Byte)
+ +0x1CCC | 02 00 00 00 | uint32_t | 0x00000002 (2) | table field `index` (Int)
+ +0x1CD0 | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1CD4 | 15 00 00 00 | uint32_t | 0x00000015 (21) | length of string
+ +0x1CD8 | 76 65 63 74 6F 72 5F 6F | char[21] | vector_o | string literal
+ +0x1CE0 | 66 5F 72 65 66 65 72 72 | | f_referr
+ +0x1CE8 | 61 62 6C 65 73 | | ables
+ +0x1CED | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1CEE | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x1CF0 | CC F1 FF FF | SOffset32 | 0xFFFFF1CC (-3636) Loc: +0x2B24 | offset to vtable
+ +0x1CF4 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x1CF7 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x1CF8 | 22 00 | uint16_t | 0x0022 (34) | table field `id` (UShort)
+ +0x1CFA | 48 00 | uint16_t | 0x0048 (72) | table field `offset` (UShort)
+ +0x1CFC | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x1D44 | offset to field `name` (string)
+ +0x1D00 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x1D34 | offset to field `type` (table)
+ +0x1D04 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1D10 | offset to field `attributes` (vector)
+ +0x1D08 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1D0C | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x1D0C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1D10 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x1D14 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1D18 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x1D18 | B4 E7 FF FF | SOffset32 | 0xFFFFE7B4 (-6220) Loc: +0x3564 | offset to vtable
+ +0x1D1C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1D2C | offset to field `key` (string)
+ +0x1D20 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1D24 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1D24 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1D28 | 33 34 | char[2] | 34 | string literal
+ +0x1D2A | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1D2C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1D30 | 69 64 | char[2] | id | string literal
+ +0x1D32 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x1D34 | 7C E4 FF FF | SOffset32 | 0xFFFFE47C (-7044) Loc: +0x38B8 | offset to vtable
+ +0x1D38 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x1D3B | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x1D3C | 0B 00 00 00 | uint32_t | 0x0000000B (11) | table field `index` (Int)
+ +0x1D40 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1D44 | 15 00 00 00 | uint32_t | 0x00000015 (21) | length of string
+ +0x1D48 | 70 61 72 65 6E 74 5F 6E | char[21] | parent_n | string literal
+ +0x1D50 | 61 6D 65 73 70 61 63 65 | | amespace
+ +0x1D58 | 5F 74 65 73 74 | | _test
+ +0x1D5D | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1D5E | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x1D60 | 3C F2 FF FF | SOffset32 | 0xFFFFF23C (-3524) Loc: +0x2B24 | offset to vtable
+ +0x1D64 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x1D67 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x1D68 | 21 00 | uint16_t | 0x0021 (33) | table field `id` (UShort)
+ +0x1D6A | 46 00 | uint16_t | 0x0046 (70) | table field `offset` (UShort)
+ +0x1D6C | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x1DB0 | offset to field `name` (string)
+ +0x1D70 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x1DA4 | offset to field `type` (table)
+ +0x1D74 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1D80 | offset to field `attributes` (vector)
+ +0x1D78 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1D7C | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x1D7C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1D80 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x1D84 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1D88 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x1D88 | 24 E8 FF FF | SOffset32 | 0xFFFFE824 (-6108) Loc: +0x3564 | offset to vtable
+ +0x1D8C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1D9C | offset to field `key` (string)
+ +0x1D90 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1D94 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1D94 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1D98 | 33 33 | char[2] | 33 | string literal
+ +0x1D9A | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1D9C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1DA0 | 69 64 | char[2] | id | string literal
+ +0x1DA2 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x1DA4 | 20 F2 FF FF | SOffset32 | 0xFFFFF220 (-3552) Loc: +0x2B84 | offset to vtable
+ +0x1DA8 | 00 00 | uint8_t[2] | .. | padding
+ +0x1DAA | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x1DAB | 0C | uint8_t | 0x0C (12) | table field `element` (Byte)
+ +0x1DAC | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1DB0 | 11 00 00 00 | uint32_t | 0x00000011 (17) | length of string
+ +0x1DB4 | 76 65 63 74 6F 72 5F 6F | char[17] | vector_o | string literal
+ +0x1DBC | 66 5F 64 6F 75 62 6C 65 | | f_double
+ +0x1DC4 | 73 | | s
+ +0x1DC5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1DC6 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x1DC8 | A4 F2 FF FF | SOffset32 | 0xFFFFF2A4 (-3420) Loc: +0x2B24 | offset to vtable
+ +0x1DCC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x1DCF | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x1DD0 | 20 00 | uint16_t | 0x0020 (32) | table field `id` (UShort)
+ +0x1DD2 | 44 00 | uint16_t | 0x0044 (68) | table field `offset` (UShort)
+ +0x1DD4 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x1E18 | offset to field `name` (string)
+ +0x1DD8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x1E0C | offset to field `type` (table)
+ +0x1DDC | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1DE8 | offset to field `attributes` (vector)
+ +0x1DE0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1DE4 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x1DE4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1DE8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x1DEC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1DF0 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x1DF0 | 8C E8 FF FF | SOffset32 | 0xFFFFE88C (-6004) Loc: +0x3564 | offset to vtable
+ +0x1DF4 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1E04 | offset to field `key` (string)
+ +0x1DF8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1DFC | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1DFC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1E00 | 33 32 | char[2] | 32 | string literal
+ +0x1E02 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1E04 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1E08 | 69 64 | char[2] | id | string literal
+ +0x1E0A | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x1E0C | 88 F2 FF FF | SOffset32 | 0xFFFFF288 (-3448) Loc: +0x2B84 | offset to vtable
+ +0x1E10 | 00 00 | uint8_t[2] | .. | padding
+ +0x1E12 | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x1E13 | 09 | uint8_t | 0x09 (9) | table field `element` (Byte)
+ +0x1E14 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1E18 | 0F 00 00 00 | uint32_t | 0x0000000F (15) | length of string
+ +0x1E1C | 76 65 63 74 6F 72 5F 6F | char[15] | vector_o | string literal
+ +0x1E24 | 66 5F 6C 6F 6E 67 73 | | f_longs
+ +0x1E2B | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x1E2C | 08 F3 FF FF | SOffset32 | 0xFFFFF308 (-3320) Loc: +0x2B24 | offset to vtable
+ +0x1E30 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x1E33 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x1E34 | 1F 00 | uint16_t | 0x001F (31) | table field `id` (UShort)
+ +0x1E36 | 42 00 | uint16_t | 0x0042 (66) | table field `offset` (UShort)
+ +0x1E38 | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x1E80 | offset to field `name` (string)
+ +0x1E3C | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x1E70 | offset to field `type` (table)
+ +0x1E40 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1E4C | offset to field `attributes` (vector)
+ +0x1E44 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1E48 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x1E48 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1E4C | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x1E50 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1E54 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x1E54 | F0 E8 FF FF | SOffset32 | 0xFFFFE8F0 (-5904) Loc: +0x3564 | offset to vtable
+ +0x1E58 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1E68 | offset to field `key` (string)
+ +0x1E5C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1E60 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1E60 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1E64 | 33 31 | char[2] | 31 | string literal
+ +0x1E66 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1E68 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1E6C | 69 64 | char[2] | id | string literal
+ +0x1E6E | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x1E70 | C0 F4 FF FF | SOffset32 | 0xFFFFF4C0 (-2880) Loc: +0x29B0 | offset to vtable
+ +0x1E74 | 00 00 | uint8_t[2] | .. | padding
+ +0x1E76 | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x1E77 | 0F | uint8_t | 0x0F (15) | table field `element` (Byte)
+ +0x1E78 | 06 00 00 00 | uint32_t | 0x00000006 (6) | table field `index` (Int)
+ +0x1E7C | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1E80 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x1E84 | 74 65 73 74 35 | char[5] | test5 | string literal
+ +0x1E89 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1E8A | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x1E8C | 68 F3 FF FF | SOffset32 | 0xFFFFF368 (-3224) Loc: +0x2B24 | offset to vtable
+ +0x1E90 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x1E93 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x1E94 | 1E 00 | uint16_t | 0x001E (30) | table field `id` (UShort)
+ +0x1E96 | 40 00 | uint16_t | 0x0040 (64) | table field `offset` (UShort)
+ +0x1E98 | 6C 00 00 00 | UOffset32 | 0x0000006C (108) Loc: +0x1F04 | offset to field `name` (string)
+ +0x1E9C | 5C 00 00 00 | UOffset32 | 0x0000005C (92) Loc: +0x1EF8 | offset to field `type` (table)
+ +0x1EA0 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1EAC | offset to field `attributes` (vector)
+ +0x1EA4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1EA8 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x1EA8 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1EAC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x1EB0 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x1ED4 | offset to table[0]
+ +0x1EB4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1EB8 | offset to table[1]
+
+table (reflection.KeyValue):
+ +0x1EB8 | 54 E9 FF FF | SOffset32 | 0xFFFFE954 (-5804) Loc: +0x3564 | offset to vtable
+ +0x1EBC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1ECC | offset to field `key` (string)
+ +0x1EC0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1EC4 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1EC4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1EC8 | 33 30 | char[2] | 30 | string literal
+ +0x1ECA | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1ECC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1ED0 | 69 64 | char[2] | id | string literal
+ +0x1ED2 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x1ED4 | 70 E9 FF FF | SOffset32 | 0xFFFFE970 (-5776) Loc: +0x3564 | offset to vtable
+ +0x1ED8 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1EE8 | offset to field `key` (string)
+ +0x1EDC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1EE0 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1EE0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x1EE4 | 30 | char[1] | 0 | string literal
+ +0x1EE5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1EE6 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x1EE8 | 0A 00 00 00 | uint32_t | 0x0000000A (10) | length of string
+ +0x1EEC | 66 6C 65 78 62 75 66 66 | char[10] | flexbuff | string literal
+ +0x1EF4 | 65 72 | | er
+ +0x1EF6 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x1EF8 | 74 F3 FF FF | SOffset32 | 0xFFFFF374 (-3212) Loc: +0x2B84 | offset to vtable
+ +0x1EFC | 00 00 | uint8_t[2] | .. | padding
+ +0x1EFE | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x1EFF | 04 | uint8_t | 0x04 (4) | table field `element` (Byte)
+ +0x1F00 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1F04 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x1F08 | 66 6C 65 78 | char[4] | flex | string literal
+ +0x1F0C | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x1F0D | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Field):
+ +0x1F10 | EC F3 FF FF | SOffset32 | 0xFFFFF3EC (-3092) Loc: +0x2B24 | offset to vtable
+ +0x1F14 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x1F17 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x1F18 | 1D 00 | uint16_t | 0x001D (29) | table field `id` (UShort)
+ +0x1F1A | 3E 00 | uint16_t | 0x003E (62) | table field `offset` (UShort)
+ +0x1F1C | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x1F64 | offset to field `name` (string)
+ +0x1F20 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x1F54 | offset to field `type` (table)
+ +0x1F24 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1F30 | offset to field `attributes` (vector)
+ +0x1F28 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1F2C | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x1F2C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1F30 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x1F34 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1F38 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x1F38 | D4 E9 FF FF | SOffset32 | 0xFFFFE9D4 (-5676) Loc: +0x3564 | offset to vtable
+ +0x1F3C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1F4C | offset to field `key` (string)
+ +0x1F40 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1F44 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1F44 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1F48 | 32 39 | char[2] | 29 | string literal
+ +0x1F4A | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1F4C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1F50 | 69 64 | char[2] | id | string literal
+ +0x1F52 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x1F54 | A4 F5 FF FF | SOffset32 | 0xFFFFF5A4 (-2652) Loc: +0x29B0 | offset to vtable
+ +0x1F58 | 00 00 | uint8_t[2] | .. | padding
+ +0x1F5A | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x1F5B | 0F | uint8_t | 0x0F (15) | table field `element` (Byte)
+ +0x1F5C | 00 00 00 00 | uint32_t | 0x00000000 (0) | table field `index` (Int)
+ +0x1F60 | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1F64 | 17 00 00 00 | uint32_t | 0x00000017 (23) | length of string
+ +0x1F68 | 74 65 73 74 61 72 72 61 | char[23] | testarra | string literal
+ +0x1F70 | 79 6F 66 73 6F 72 74 65 | | yofsorte
+ +0x1F78 | 64 73 74 72 75 63 74 | | dstruct
+ +0x1F7F | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x1F80 | 5C F4 FF FF | SOffset32 | 0xFFFFF45C (-2980) Loc: +0x2B24 | offset to vtable
+ +0x1F84 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x1F87 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x1F88 | 1C 00 | uint16_t | 0x001C (28) | table field `id` (UShort)
+ +0x1F8A | 3C 00 | uint16_t | 0x003C (60) | table field `offset` (UShort)
+ +0x1F8C | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x1FD0 | offset to field `name` (string)
+ +0x1F90 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x1FC4 | offset to field `type` (table)
+ +0x1F94 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x1FA0 | offset to field `attributes` (vector)
+ +0x1F98 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1F9C | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x1F9C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x1FA0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x1FA4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1FA8 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x1FA8 | 44 EA FF FF | SOffset32 | 0xFFFFEA44 (-5564) Loc: +0x3564 | offset to vtable
+ +0x1FAC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x1FBC | offset to field `key` (string)
+ +0x1FB0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x1FB4 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x1FB4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1FB8 | 32 38 | char[2] | 28 | string literal
+ +0x1FBA | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x1FBC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x1FC0 | 69 64 | char[2] | id | string literal
+ +0x1FC2 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x1FC4 | 40 F4 FF FF | SOffset32 | 0xFFFFF440 (-3008) Loc: +0x2B84 | offset to vtable
+ +0x1FC8 | 00 00 | uint8_t[2] | .. | padding
+ +0x1FCA | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x1FCB | 0D | uint8_t | 0x0D (13) | table field `element` (Byte)
+ +0x1FCC | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x1FD0 | 12 00 00 00 | uint32_t | 0x00000012 (18) | length of string
+ +0x1FD4 | 74 65 73 74 61 72 72 61 | char[18] | testarra | string literal
+ +0x1FDC | 79 6F 66 73 74 72 69 6E | | yofstrin
+ +0x1FE4 | 67 32 | | g2
+ +0x1FE6 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x1FE8 | AE F5 FF FF | SOffset32 | 0xFFFFF5AE (-2642) Loc: +0x2A3A | offset to vtable
+ +0x1FEC | 1B 00 | uint16_t | 0x001B (27) | table field `id` (UShort)
+ +0x1FEE | 3A 00 | uint16_t | 0x003A (58) | table field `offset` (UShort)
+ +0x1FF0 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x2034 | offset to field `name` (string)
+ +0x1FF4 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x2028 | offset to field `type` (table)
+ +0x1FF8 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x2004 | offset to field `attributes` (vector)
+ +0x1FFC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2000 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2000 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x2004 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x2008 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x200C | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x200C | A8 EA FF FF | SOffset32 | 0xFFFFEAA8 (-5464) Loc: +0x3564 | offset to vtable
+ +0x2010 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2020 | offset to field `key` (string)
+ +0x2014 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2018 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2018 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x201C | 32 37 | char[2] | 27 | string literal
+ +0x201E | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x2020 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2024 | 69 64 | char[2] | id | string literal
+ +0x2026 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x2028 | 8C E6 FF FF | SOffset32 | 0xFFFFE68C (-6516) Loc: +0x399C | offset to vtable
+ +0x202C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x202F | 0B | uint8_t | 0x0B (11) | table field `base_type` (Byte)
+ +0x2030 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2034 | 06 00 00 00 | uint32_t | 0x00000006 (6) | length of string
+ +0x2038 | 74 65 73 74 66 33 | char[6] | testf3 | string literal
+ +0x203E | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x2040 | 9A FF FF FF | SOffset32 | 0xFFFFFF9A (-102) Loc: +0x20A6 | offset to vtable
+ +0x2044 | 1A 00 | uint16_t | 0x001A (26) | table field `id` (UShort)
+ +0x2046 | 38 00 | uint16_t | 0x0038 (56) | table field `offset` (UShort)
+ +0x2048 | 50 00 00 00 | UOffset32 | 0x00000050 (80) Loc: +0x2098 | offset to field `name` (string)
+ +0x204C | 40 00 00 00 | UOffset32 | 0x00000040 (64) Loc: +0x208C | offset to field `type` (table)
+ +0x2050 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x2068 | offset to field `attributes` (vector)
+ +0x2054 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2064 | offset to field `documentation` (vector)
+ +0x2058 | 00 00 00 00 00 00 08 40 | double | 0x4008000000000000 (3) | table field `default_real` (Double)
+ +0x2060 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (reflection.Field.documentation):
+ +0x2064 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x2068 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x206C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2070 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x2070 | 0C EB FF FF | SOffset32 | 0xFFFFEB0C (-5364) Loc: +0x3564 | offset to vtable
+ +0x2074 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2084 | offset to field `key` (string)
+ +0x2078 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x207C | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x207C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2080 | 32 36 | char[2] | 26 | string literal
+ +0x2082 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x2084 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2088 | 69 64 | char[2] | id | string literal
+ +0x208A | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x208C | F0 E6 FF FF | SOffset32 | 0xFFFFE6F0 (-6416) Loc: +0x399C | offset to vtable
+ +0x2090 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2093 | 0B | uint8_t | 0x0B (11) | table field `base_type` (Byte)
+ +0x2094 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2098 | 06 00 00 00 | uint32_t | 0x00000006 (6) | length of string
+ +0x209C | 74 65 73 74 66 32 | char[6] | testf2 | string literal
+ +0x20A2 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x20A3 | 00 00 00 | uint8_t[3] | ... | padding
+
+vtable (reflection.Field):
+ +0x20A6 | 1A 00 | uint16_t | 0x001A (26) | size of this vtable
+ +0x20A8 | 24 00 | uint16_t | 0x0024 (36) | size of referring table
+ +0x20AA | 08 00 | VOffset16 | 0x0008 (8) | offset to field `name` (id: 0)
+ +0x20AC | 0C 00 | VOffset16 | 0x000C (12) | offset to field `type` (id: 1)
+ +0x20AE | 04 00 | VOffset16 | 0x0004 (4) | offset to field `id` (id: 2)
+ +0x20B0 | 06 00 | VOffset16 | 0x0006 (6) | offset to field `offset` (id: 3)
+ +0x20B2 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x20B4 | 18 00 | VOffset16 | 0x0018 (24) | offset to field `default_real` (id: 5)
+ +0x20B6 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x20B8 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x20BA | 00 00 | VOffset16 | 0x0000 (0) | offset to field `key` (id: 8) <defaults to 0> (Bool)
+ +0x20BC | 10 00 | VOffset16 | 0x0010 (16) | offset to field `attributes` (id: 9)
+ +0x20BE | 14 00 | VOffset16 | 0x0014 (20) | offset to field `documentation` (id: 10)
+
+table (reflection.Field):
+ +0x20C0 | 1A 00 00 00 | SOffset32 | 0x0000001A (26) Loc: +0x20A6 | offset to vtable
+ +0x20C4 | 19 00 | uint16_t | 0x0019 (25) | table field `id` (UShort)
+ +0x20C6 | 36 00 | uint16_t | 0x0036 (54) | table field `offset` (UShort)
+ +0x20C8 | 50 00 00 00 | UOffset32 | 0x00000050 (80) Loc: +0x2118 | offset to field `name` (string)
+ +0x20CC | 40 00 00 00 | UOffset32 | 0x00000040 (64) Loc: +0x210C | offset to field `type` (table)
+ +0x20D0 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x20E8 | offset to field `attributes` (vector)
+ +0x20D4 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x20E4 | offset to field `documentation` (vector)
+ +0x20D8 | 6E 86 1B F0 F9 21 09 40 | double | 0x400921F9F01B866E (3.14159) | table field `default_real` (Double)
+ +0x20E0 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (reflection.Field.documentation):
+ +0x20E4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x20E8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x20EC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x20F0 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x20F0 | 8C EB FF FF | SOffset32 | 0xFFFFEB8C (-5236) Loc: +0x3564 | offset to vtable
+ +0x20F4 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2104 | offset to field `key` (string)
+ +0x20F8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x20FC | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x20FC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2100 | 32 35 | char[2] | 25 | string literal
+ +0x2102 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x2104 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2108 | 69 64 | char[2] | id | string literal
+ +0x210A | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x210C | 70 E7 FF FF | SOffset32 | 0xFFFFE770 (-6288) Loc: +0x399C | offset to vtable
+ +0x2110 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2113 | 0B | uint8_t | 0x0B (11) | table field `base_type` (Byte)
+ +0x2114 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2118 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x211C | 74 65 73 74 66 | char[5] | testf | string literal
+ +0x2121 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2122 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x2124 | 00 F6 FF FF | SOffset32 | 0xFFFFF600 (-2560) Loc: +0x2B24 | offset to vtable
+ +0x2128 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x212B | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x212C | 18 00 | uint16_t | 0x0018 (24) | table field `id` (UShort)
+ +0x212E | 34 00 | uint16_t | 0x0034 (52) | table field `offset` (UShort)
+ +0x2130 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x2174 | offset to field `name` (string)
+ +0x2134 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x2168 | offset to field `type` (table)
+ +0x2138 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x2144 | offset to field `attributes` (vector)
+ +0x213C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2140 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2140 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x2144 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x2148 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x214C | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x214C | E8 EB FF FF | SOffset32 | 0xFFFFEBE8 (-5144) Loc: +0x3564 | offset to vtable
+ +0x2150 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2160 | offset to field `key` (string)
+ +0x2154 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2158 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2158 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x215C | 32 34 | char[2] | 24 | string literal
+ +0x215E | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x2160 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2164 | 69 64 | char[2] | id | string literal
+ +0x2166 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x2168 | E4 F5 FF FF | SOffset32 | 0xFFFFF5E4 (-2588) Loc: +0x2B84 | offset to vtable
+ +0x216C | 00 00 | uint8_t[2] | .. | padding
+ +0x216E | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x216F | 02 | uint8_t | 0x02 (2) | table field `element` (Byte)
+ +0x2170 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2174 | 10 00 00 00 | uint32_t | 0x00000010 (16) | length of string
+ +0x2178 | 74 65 73 74 61 72 72 61 | char[16] | testarra | string literal
+ +0x2180 | 79 6F 66 62 6F 6F 6C 73 | | yofbools
+ +0x2188 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2189 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Field):
+ +0x218C | 52 F7 FF FF | SOffset32 | 0xFFFFF752 (-2222) Loc: +0x2A3A | offset to vtable
+ +0x2190 | 17 00 | uint16_t | 0x0017 (23) | table field `id` (UShort)
+ +0x2192 | 32 00 | uint16_t | 0x0032 (50) | table field `offset` (UShort)
+ +0x2194 | 74 00 00 00 | UOffset32 | 0x00000074 (116) Loc: +0x2208 | offset to field `name` (string)
+ +0x2198 | 60 00 00 00 | UOffset32 | 0x00000060 (96) Loc: +0x21F8 | offset to field `type` (table)
+ +0x219C | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x21A8 | offset to field `attributes` (vector)
+ +0x21A0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x21A4 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x21A4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x21A8 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x21AC | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x21D0 | offset to table[0]
+ +0x21B0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x21B4 | offset to table[1]
+
+table (reflection.KeyValue):
+ +0x21B4 | 50 EC FF FF | SOffset32 | 0xFFFFEC50 (-5040) Loc: +0x3564 | offset to vtable
+ +0x21B8 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x21C8 | offset to field `key` (string)
+ +0x21BC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x21C0 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x21C0 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x21C4 | 32 33 | char[2] | 23 | string literal
+ +0x21C6 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x21C8 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x21CC | 69 64 | char[2] | id | string literal
+ +0x21CE | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x21D0 | 6C EC FF FF | SOffset32 | 0xFFFFEC6C (-5012) Loc: +0x3564 | offset to vtable
+ +0x21D4 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x21EC | offset to field `key` (string)
+ +0x21D8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x21DC | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x21DC | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x21E0 | 66 6E 76 31 61 5F 36 34 | char[8] | fnv1a_64 | string literal
+ +0x21E8 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x21E9 | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x21EC | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x21F0 | 68 61 73 68 | char[4] | hash | string literal
+ +0x21F4 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x21F5 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x21F8 | 14 EB FF FF | SOffset32 | 0xFFFFEB14 (-5356) Loc: +0x36E4 | offset to vtable
+ +0x21FC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x21FF | 0A | uint8_t | 0x0A (10) | table field `base_type` (Byte)
+ +0x2200 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x2204 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2208 | 11 00 00 00 | uint32_t | 0x00000011 (17) | length of string
+ +0x220C | 74 65 73 74 68 61 73 68 | char[17] | testhash | string literal
+ +0x2214 | 75 36 34 5F 66 6E 76 31 | | u64_fnv1
+ +0x221C | 61 | | a
+ +0x221D | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x221E | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x2220 | E6 F7 FF FF | SOffset32 | 0xFFFFF7E6 (-2074) Loc: +0x2A3A | offset to vtable
+ +0x2224 | 16 00 | uint16_t | 0x0016 (22) | table field `id` (UShort)
+ +0x2226 | 30 00 | uint16_t | 0x0030 (48) | table field `offset` (UShort)
+ +0x2228 | 74 00 00 00 | UOffset32 | 0x00000074 (116) Loc: +0x229C | offset to field `name` (string)
+ +0x222C | 60 00 00 00 | UOffset32 | 0x00000060 (96) Loc: +0x228C | offset to field `type` (table)
+ +0x2230 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x223C | offset to field `attributes` (vector)
+ +0x2234 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2238 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2238 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x223C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x2240 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x2264 | offset to table[0]
+ +0x2244 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2248 | offset to table[1]
+
+table (reflection.KeyValue):
+ +0x2248 | E4 EC FF FF | SOffset32 | 0xFFFFECE4 (-4892) Loc: +0x3564 | offset to vtable
+ +0x224C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x225C | offset to field `key` (string)
+ +0x2250 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2254 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2254 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2258 | 32 32 | char[2] | 22 | string literal
+ +0x225A | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x225C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2260 | 69 64 | char[2] | id | string literal
+ +0x2262 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x2264 | 00 ED FF FF | SOffset32 | 0xFFFFED00 (-4864) Loc: +0x3564 | offset to vtable
+ +0x2268 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x2280 | offset to field `key` (string)
+ +0x226C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2270 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2270 | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x2274 | 66 6E 76 31 61 5F 36 34 | char[8] | fnv1a_64 | string literal
+ +0x227C | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x227D | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x2280 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x2284 | 68 61 73 68 | char[4] | hash | string literal
+ +0x2288 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2289 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x228C | A8 EB FF FF | SOffset32 | 0xFFFFEBA8 (-5208) Loc: +0x36E4 | offset to vtable
+ +0x2290 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2293 | 09 | uint8_t | 0x09 (9) | table field `base_type` (Byte)
+ +0x2294 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x2298 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x229C | 11 00 00 00 | uint32_t | 0x00000011 (17) | length of string
+ +0x22A0 | 74 65 73 74 68 61 73 68 | char[17] | testhash | string literal
+ +0x22A8 | 73 36 34 5F 66 6E 76 31 | | s64_fnv1
+ +0x22B0 | 61 | | a
+ +0x22B1 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x22B2 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x22B4 | 7A F8 FF FF | SOffset32 | 0xFFFFF87A (-1926) Loc: +0x2A3A | offset to vtable
+ +0x22B8 | 15 00 | uint16_t | 0x0015 (21) | table field `id` (UShort)
+ +0x22BA | 2E 00 | uint16_t | 0x002E (46) | table field `offset` (UShort)
+ +0x22BC | CC 00 00 00 | UOffset32 | 0x000000CC (204) Loc: +0x2388 | offset to field `name` (string)
+ +0x22C0 | BC 00 00 00 | UOffset32 | 0x000000BC (188) Loc: +0x237C | offset to field `type` (table)
+ +0x22C4 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x22D0 | offset to field `attributes` (vector)
+ +0x22C8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x22CC | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x22CC | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x22D0 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of vector (# items)
+ +0x22D4 | 7C 00 00 00 | UOffset32 | 0x0000007C (124) Loc: +0x2350 | offset to table[0]
+ +0x22D8 | 50 00 00 00 | UOffset32 | 0x00000050 (80) Loc: +0x2328 | offset to table[1]
+ +0x22DC | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x2300 | offset to table[2]
+ +0x22E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x22E4 | offset to table[3]
+
+table (reflection.KeyValue):
+ +0x22E4 | 80 ED FF FF | SOffset32 | 0xFFFFED80 (-4736) Loc: +0x3564 | offset to vtable
+ +0x22E8 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x22F8 | offset to field `key` (string)
+ +0x22EC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x22F0 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x22F0 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x22F4 | 32 31 | char[2] | 21 | string literal
+ +0x22F6 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x22F8 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x22FC | 69 64 | char[2] | id | string literal
+ +0x22FE | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x2300 | 9C ED FF FF | SOffset32 | 0xFFFFED9C (-4708) Loc: +0x3564 | offset to vtable
+ +0x2304 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x231C | offset to field `key` (string)
+ +0x2308 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x230C | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x230C | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x2310 | 66 6E 76 31 61 5F 33 32 | char[8] | fnv1a_32 | string literal
+ +0x2318 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2319 | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x231C | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x2320 | 68 61 73 68 | char[4] | hash | string literal
+ +0x2324 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2325 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x2328 | C4 ED FF FF | SOffset32 | 0xFFFFEDC4 (-4668) Loc: +0x3564 | offset to vtable
+ +0x232C | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x2340 | offset to field `key` (string)
+ +0x2330 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2334 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2334 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x2338 | 53 74 61 74 | char[4] | Stat | string literal
+ +0x233C | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x233D | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x2340 | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x2344 | 63 70 70 5F 74 79 70 65 | char[8] | cpp_type | string literal
+ +0x234C | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x234D | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x2350 | EC ED FF FF | SOffset32 | 0xFFFFEDEC (-4628) Loc: +0x3564 | offset to vtable
+ +0x2354 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x2368 | offset to field `key` (string)
+ +0x2358 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x235C | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x235C | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x2360 | 6E 61 6B 65 64 | char[5] | naked | string literal
+ +0x2365 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2366 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x2368 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | length of string
+ +0x236C | 63 70 70 5F 70 74 72 5F | char[12] | cpp_ptr_ | string literal
+ +0x2374 | 74 79 70 65 | | type
+ +0x2378 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2379 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x237C | E0 E9 FF FF | SOffset32 | 0xFFFFE9E0 (-5664) Loc: +0x399C | offset to vtable
+ +0x2380 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2383 | 08 | uint8_t | 0x08 (8) | table field `base_type` (Byte)
+ +0x2384 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2388 | 11 00 00 00 | uint32_t | 0x00000011 (17) | length of string
+ +0x238C | 74 65 73 74 68 61 73 68 | char[17] | testhash | string literal
+ +0x2394 | 75 33 32 5F 66 6E 76 31 | | u32_fnv1
+ +0x239C | 61 | | a
+ +0x239D | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x239E | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x23A0 | 66 F9 FF FF | SOffset32 | 0xFFFFF966 (-1690) Loc: +0x2A3A | offset to vtable
+ +0x23A4 | 14 00 | uint16_t | 0x0014 (20) | table field `id` (UShort)
+ +0x23A6 | 2C 00 | uint16_t | 0x002C (44) | table field `offset` (UShort)
+ +0x23A8 | 70 00 00 00 | UOffset32 | 0x00000070 (112) Loc: +0x2418 | offset to field `name` (string)
+ +0x23AC | 60 00 00 00 | UOffset32 | 0x00000060 (96) Loc: +0x240C | offset to field `type` (table)
+ +0x23B0 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x23BC | offset to field `attributes` (vector)
+ +0x23B4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x23B8 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x23B8 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x23BC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x23C0 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x23E4 | offset to table[0]
+ +0x23C4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x23C8 | offset to table[1]
+
+table (reflection.KeyValue):
+ +0x23C8 | 64 EE FF FF | SOffset32 | 0xFFFFEE64 (-4508) Loc: +0x3564 | offset to vtable
+ +0x23CC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x23DC | offset to field `key` (string)
+ +0x23D0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x23D4 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x23D4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x23D8 | 32 30 | char[2] | 20 | string literal
+ +0x23DA | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x23DC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x23E0 | 69 64 | char[2] | id | string literal
+ +0x23E2 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x23E4 | 80 EE FF FF | SOffset32 | 0xFFFFEE80 (-4480) Loc: +0x3564 | offset to vtable
+ +0x23E8 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x2400 | offset to field `key` (string)
+ +0x23EC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x23F0 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x23F0 | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x23F4 | 66 6E 76 31 61 5F 33 32 | char[8] | fnv1a_32 | string literal
+ +0x23FC | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x23FD | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x2400 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x2404 | 68 61 73 68 | char[4] | hash | string literal
+ +0x2408 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2409 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x240C | 70 EA FF FF | SOffset32 | 0xFFFFEA70 (-5520) Loc: +0x399C | offset to vtable
+ +0x2410 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2413 | 07 | uint8_t | 0x07 (7) | table field `base_type` (Byte)
+ +0x2414 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2418 | 11 00 00 00 | uint32_t | 0x00000011 (17) | length of string
+ +0x241C | 74 65 73 74 68 61 73 68 | char[17] | testhash | string literal
+ +0x2424 | 73 33 32 5F 66 6E 76 31 | | s32_fnv1
+ +0x242C | 61 | | a
+ +0x242D | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x242E | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x2430 | F6 F9 FF FF | SOffset32 | 0xFFFFF9F6 (-1546) Loc: +0x2A3A | offset to vtable
+ +0x2434 | 13 00 | uint16_t | 0x0013 (19) | table field `id` (UShort)
+ +0x2436 | 2A 00 | uint16_t | 0x002A (42) | table field `offset` (UShort)
+ +0x2438 | 70 00 00 00 | UOffset32 | 0x00000070 (112) Loc: +0x24A8 | offset to field `name` (string)
+ +0x243C | 5C 00 00 00 | UOffset32 | 0x0000005C (92) Loc: +0x2498 | offset to field `type` (table)
+ +0x2440 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x244C | offset to field `attributes` (vector)
+ +0x2444 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2448 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2448 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x244C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x2450 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x2474 | offset to table[0]
+ +0x2454 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2458 | offset to table[1]
+
+table (reflection.KeyValue):
+ +0x2458 | F4 EE FF FF | SOffset32 | 0xFFFFEEF4 (-4364) Loc: +0x3564 | offset to vtable
+ +0x245C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x246C | offset to field `key` (string)
+ +0x2460 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2464 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2464 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2468 | 31 39 | char[2] | 19 | string literal
+ +0x246A | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x246C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2470 | 69 64 | char[2] | id | string literal
+ +0x2472 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x2474 | 10 EF FF FF | SOffset32 | 0xFFFFEF10 (-4336) Loc: +0x3564 | offset to vtable
+ +0x2478 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x248C | offset to field `key` (string)
+ +0x247C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2480 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2480 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x2484 | 66 6E 76 31 5F 36 34 | char[7] | fnv1_64 | string literal
+ +0x248B | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x248C | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x2490 | 68 61 73 68 | char[4] | hash | string literal
+ +0x2494 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2495 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x2498 | B4 ED FF FF | SOffset32 | 0xFFFFEDB4 (-4684) Loc: +0x36E4 | offset to vtable
+ +0x249C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x249F | 0A | uint8_t | 0x0A (10) | table field `base_type` (Byte)
+ +0x24A0 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x24A4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x24A8 | 10 00 00 00 | uint32_t | 0x00000010 (16) | length of string
+ +0x24AC | 74 65 73 74 68 61 73 68 | char[16] | testhash | string literal
+ +0x24B4 | 75 36 34 5F 66 6E 76 31 | | u64_fnv1
+ +0x24BC | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x24BD | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Field):
+ +0x24C0 | 86 FA FF FF | SOffset32 | 0xFFFFFA86 (-1402) Loc: +0x2A3A | offset to vtable
+ +0x24C4 | 12 00 | uint16_t | 0x0012 (18) | table field `id` (UShort)
+ +0x24C6 | 28 00 | uint16_t | 0x0028 (40) | table field `offset` (UShort)
+ +0x24C8 | 70 00 00 00 | UOffset32 | 0x00000070 (112) Loc: +0x2538 | offset to field `name` (string)
+ +0x24CC | 5C 00 00 00 | UOffset32 | 0x0000005C (92) Loc: +0x2528 | offset to field `type` (table)
+ +0x24D0 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x24DC | offset to field `attributes` (vector)
+ +0x24D4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x24D8 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x24D8 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x24DC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x24E0 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x2504 | offset to table[0]
+ +0x24E4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x24E8 | offset to table[1]
+
+table (reflection.KeyValue):
+ +0x24E8 | 84 EF FF FF | SOffset32 | 0xFFFFEF84 (-4220) Loc: +0x3564 | offset to vtable
+ +0x24EC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x24FC | offset to field `key` (string)
+ +0x24F0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x24F4 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x24F4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x24F8 | 31 38 | char[2] | 18 | string literal
+ +0x24FA | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x24FC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2500 | 69 64 | char[2] | id | string literal
+ +0x2502 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x2504 | A0 EF FF FF | SOffset32 | 0xFFFFEFA0 (-4192) Loc: +0x3564 | offset to vtable
+ +0x2508 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x251C | offset to field `key` (string)
+ +0x250C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2510 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2510 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x2514 | 66 6E 76 31 5F 36 34 | char[7] | fnv1_64 | string literal
+ +0x251B | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x251C | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x2520 | 68 61 73 68 | char[4] | hash | string literal
+ +0x2524 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2525 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x2528 | 44 EE FF FF | SOffset32 | 0xFFFFEE44 (-4540) Loc: +0x36E4 | offset to vtable
+ +0x252C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x252F | 09 | uint8_t | 0x09 (9) | table field `base_type` (Byte)
+ +0x2530 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x2534 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2538 | 10 00 00 00 | uint32_t | 0x00000010 (16) | length of string
+ +0x253C | 74 65 73 74 68 61 73 68 | char[16] | testhash | string literal
+ +0x2544 | 73 36 34 5F 66 6E 76 31 | | s64_fnv1
+ +0x254C | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x254D | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Field):
+ +0x2550 | 16 FB FF FF | SOffset32 | 0xFFFFFB16 (-1258) Loc: +0x2A3A | offset to vtable
+ +0x2554 | 11 00 | uint16_t | 0x0011 (17) | table field `id` (UShort)
+ +0x2556 | 26 00 | uint16_t | 0x0026 (38) | table field `offset` (UShort)
+ +0x2558 | 6C 00 00 00 | UOffset32 | 0x0000006C (108) Loc: +0x25C4 | offset to field `name` (string)
+ +0x255C | 5C 00 00 00 | UOffset32 | 0x0000005C (92) Loc: +0x25B8 | offset to field `type` (table)
+ +0x2560 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x256C | offset to field `attributes` (vector)
+ +0x2564 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2568 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2568 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x256C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x2570 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x2594 | offset to table[0]
+ +0x2574 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2578 | offset to table[1]
+
+table (reflection.KeyValue):
+ +0x2578 | 14 F0 FF FF | SOffset32 | 0xFFFFF014 (-4076) Loc: +0x3564 | offset to vtable
+ +0x257C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x258C | offset to field `key` (string)
+ +0x2580 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2584 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2584 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2588 | 31 37 | char[2] | 17 | string literal
+ +0x258A | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x258C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2590 | 69 64 | char[2] | id | string literal
+ +0x2592 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x2594 | 30 F0 FF FF | SOffset32 | 0xFFFFF030 (-4048) Loc: +0x3564 | offset to vtable
+ +0x2598 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x25AC | offset to field `key` (string)
+ +0x259C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x25A0 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x25A0 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x25A4 | 66 6E 76 31 5F 33 32 | char[7] | fnv1_32 | string literal
+ +0x25AB | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x25AC | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x25B0 | 68 61 73 68 | char[4] | hash | string literal
+ +0x25B4 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x25B5 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x25B8 | 1C EC FF FF | SOffset32 | 0xFFFFEC1C (-5092) Loc: +0x399C | offset to vtable
+ +0x25BC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x25BF | 08 | uint8_t | 0x08 (8) | table field `base_type` (Byte)
+ +0x25C0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x25C4 | 10 00 00 00 | uint32_t | 0x00000010 (16) | length of string
+ +0x25C8 | 74 65 73 74 68 61 73 68 | char[16] | testhash | string literal
+ +0x25D0 | 75 33 32 5F 66 6E 76 31 | | u32_fnv1
+ +0x25D8 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x25D9 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Field):
+ +0x25DC | A2 FB FF FF | SOffset32 | 0xFFFFFBA2 (-1118) Loc: +0x2A3A | offset to vtable
+ +0x25E0 | 10 00 | uint16_t | 0x0010 (16) | table field `id` (UShort)
+ +0x25E2 | 24 00 | uint16_t | 0x0024 (36) | table field `offset` (UShort)
+ +0x25E4 | 6C 00 00 00 | UOffset32 | 0x0000006C (108) Loc: +0x2650 | offset to field `name` (string)
+ +0x25E8 | 5C 00 00 00 | UOffset32 | 0x0000005C (92) Loc: +0x2644 | offset to field `type` (table)
+ +0x25EC | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x25F8 | offset to field `attributes` (vector)
+ +0x25F0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x25F4 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x25F4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x25F8 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x25FC | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x2620 | offset to table[0]
+ +0x2600 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2604 | offset to table[1]
+
+table (reflection.KeyValue):
+ +0x2604 | A0 F0 FF FF | SOffset32 | 0xFFFFF0A0 (-3936) Loc: +0x3564 | offset to vtable
+ +0x2608 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2618 | offset to field `key` (string)
+ +0x260C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2610 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2610 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2614 | 31 36 | char[2] | 16 | string literal
+ +0x2616 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x2618 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x261C | 69 64 | char[2] | id | string literal
+ +0x261E | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x2620 | BC F0 FF FF | SOffset32 | 0xFFFFF0BC (-3908) Loc: +0x3564 | offset to vtable
+ +0x2624 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x2638 | offset to field `key` (string)
+ +0x2628 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x262C | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x262C | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x2630 | 66 6E 76 31 5F 33 32 | char[7] | fnv1_32 | string literal
+ +0x2637 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x2638 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x263C | 68 61 73 68 | char[4] | hash | string literal
+ +0x2640 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2641 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x2644 | A8 EC FF FF | SOffset32 | 0xFFFFECA8 (-4952) Loc: +0x399C | offset to vtable
+ +0x2648 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x264B | 07 | uint8_t | 0x07 (7) | table field `base_type` (Byte)
+ +0x264C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2650 | 10 00 00 00 | uint32_t | 0x00000010 (16) | length of string
+ +0x2654 | 74 65 73 74 68 61 73 68 | char[16] | testhash | string literal
+ +0x265C | 73 33 32 5F 66 6E 76 31 | | s32_fnv1
+ +0x2664 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2665 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Field):
+ +0x2668 | 2E FC FF FF | SOffset32 | 0xFFFFFC2E (-978) Loc: +0x2A3A | offset to vtable
+ +0x266C | 0F 00 | uint16_t | 0x000F (15) | table field `id` (UShort)
+ +0x266E | 22 00 | uint16_t | 0x0022 (34) | table field `offset` (UShort)
+ +0x2670 | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x26B8 | offset to field `name` (string)
+ +0x2674 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x26A8 | offset to field `type` (table)
+ +0x2678 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x2684 | offset to field `attributes` (vector)
+ +0x267C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2680 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2680 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x2684 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x2688 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x268C | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x268C | 28 F1 FF FF | SOffset32 | 0xFFFFF128 (-3800) Loc: +0x3564 | offset to vtable
+ +0x2690 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x26A0 | offset to field `key` (string)
+ +0x2694 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2698 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2698 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x269C | 31 35 | char[2] | 15 | string literal
+ +0x269E | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x26A0 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x26A4 | 69 64 | char[2] | id | string literal
+ +0x26A6 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x26A8 | C4 EF FF FF | SOffset32 | 0xFFFFEFC4 (-4156) Loc: +0x36E4 | offset to vtable
+ +0x26AC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x26AF | 02 | uint8_t | 0x02 (2) | table field `base_type` (Byte)
+ +0x26B0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x26B4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x26B8 | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x26BC | 74 65 73 74 62 6F 6F 6C | char[8] | testbool | string literal
+ +0x26C4 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x26C5 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Field):
+ +0x26C8 | A4 FB FF FF | SOffset32 | 0xFFFFFBA4 (-1116) Loc: +0x2B24 | offset to vtable
+ +0x26CC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x26CF | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x26D0 | 0E 00 | uint16_t | 0x000E (14) | table field `id` (UShort)
+ +0x26D2 | 20 00 | uint16_t | 0x0020 (32) | table field `offset` (UShort)
+ +0x26D4 | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x271C | offset to field `name` (string)
+ +0x26D8 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x270C | offset to field `type` (table)
+ +0x26DC | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x26E8 | offset to field `attributes` (vector)
+ +0x26E0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x26E4 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x26E4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x26E8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x26EC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x26F0 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x26F0 | 8C F1 FF FF | SOffset32 | 0xFFFFF18C (-3700) Loc: +0x3564 | offset to vtable
+ +0x26F4 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2704 | offset to field `key` (string)
+ +0x26F8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x26FC | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x26FC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2700 | 31 34 | char[2] | 14 | string literal
+ +0x2702 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x2704 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2708 | 69 64 | char[2] | id | string literal
+ +0x270A | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x270C | 54 EE FF FF | SOffset32 | 0xFFFFEE54 (-4524) Loc: +0x38B8 | offset to vtable
+ +0x2710 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2713 | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x2714 | 03 00 00 00 | uint32_t | 0x00000003 (3) | table field `index` (Int)
+ +0x2718 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x271C | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of string
+ +0x2720 | 74 65 73 74 65 6D 70 74 | char[9] | testempt | string literal
+ +0x2728 | 79 | | y
+ +0x2729 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x272A | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x272C | 08 FC FF FF | SOffset32 | 0xFFFFFC08 (-1016) Loc: +0x2B24 | offset to vtable
+ +0x2730 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2733 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x2734 | 0D 00 | uint16_t | 0x000D (13) | table field `id` (UShort)
+ +0x2736 | 1E 00 | uint16_t | 0x001E (30) | table field `offset` (UShort)
+ +0x2738 | 78 00 00 00 | UOffset32 | 0x00000078 (120) Loc: +0x27B0 | offset to field `name` (string)
+ +0x273C | 68 00 00 00 | UOffset32 | 0x00000068 (104) Loc: +0x27A4 | offset to field `type` (table)
+ +0x2740 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x274C | offset to field `attributes` (vector)
+ +0x2744 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2748 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2748 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x274C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x2750 | 38 00 00 00 | UOffset32 | 0x00000038 (56) Loc: +0x2788 | offset to table[0]
+ +0x2754 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2758 | offset to table[1]
+
+table (reflection.KeyValue):
+ +0x2758 | F4 F1 FF FF | SOffset32 | 0xFFFFF1F4 (-3596) Loc: +0x3564 | offset to vtable
+ +0x275C | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x2770 | offset to field `key` (string)
+ +0x2760 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2764 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2764 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x2768 | 4D 6F 6E 73 74 65 72 | char[7] | Monster | string literal
+ +0x276F | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x2770 | 11 00 00 00 | uint32_t | 0x00000011 (17) | length of string
+ +0x2774 | 6E 65 73 74 65 64 5F 66 | char[17] | nested_f | string literal
+ +0x277C | 6C 61 74 62 75 66 66 65 | | latbuffe
+ +0x2784 | 72 | | r
+ +0x2785 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2786 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.KeyValue):
+ +0x2788 | 24 F2 FF FF | SOffset32 | 0xFFFFF224 (-3548) Loc: +0x3564 | offset to vtable
+ +0x278C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x279C | offset to field `key` (string)
+ +0x2790 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2794 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2794 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2798 | 31 33 | char[2] | 13 | string literal
+ +0x279A | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x279C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x27A0 | 69 64 | char[2] | id | string literal
+ +0x27A2 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x27A4 | 20 FC FF FF | SOffset32 | 0xFFFFFC20 (-992) Loc: +0x2B84 | offset to vtable
+ +0x27A8 | 00 00 | uint8_t[2] | .. | padding
+ +0x27AA | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x27AB | 04 | uint8_t | 0x04 (4) | table field `element` (Byte)
+ +0x27AC | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x27B0 | 14 00 00 00 | uint32_t | 0x00000014 (20) | length of string
+ +0x27B4 | 74 65 73 74 6E 65 73 74 | char[20] | testnest | string literal
+ +0x27BC | 65 64 66 6C 61 74 62 75 | | edflatbu
+ +0x27C4 | 66 66 65 72 | | ffer
+ +0x27C8 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x27C9 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Field):
+ +0x27CC | A8 FC FF FF | SOffset32 | 0xFFFFFCA8 (-856) Loc: +0x2B24 | offset to vtable
+ +0x27D0 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x27D3 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x27D4 | 0C 00 | uint16_t | 0x000C (12) | table field `id` (UShort)
+ +0x27D6 | 1C 00 | uint16_t | 0x001C (28) | table field `offset` (UShort)
+ +0x27D8 | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x2820 | offset to field `name` (string)
+ +0x27DC | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x2810 | offset to field `type` (table)
+ +0x27E0 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x27EC | offset to field `attributes` (vector)
+ +0x27E4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x27E8 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x27E8 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x27EC | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x27F0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x27F4 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x27F4 | 90 F2 FF FF | SOffset32 | 0xFFFFF290 (-3440) Loc: +0x3564 | offset to vtable
+ +0x27F8 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2808 | offset to field `key` (string)
+ +0x27FC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2800 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2800 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2804 | 31 32 | char[2] | 12 | string literal
+ +0x2806 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x2808 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x280C | 69 64 | char[2] | id | string literal
+ +0x280E | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x2810 | 58 EF FF FF | SOffset32 | 0xFFFFEF58 (-4264) Loc: +0x38B8 | offset to vtable
+ +0x2814 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2817 | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x2818 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `index` (Int)
+ +0x281C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2820 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x2824 | 65 6E 65 6D 79 | char[5] | enemy | string literal
+ +0x2829 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x282A | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x282C | 08 FD FF FF | SOffset32 | 0xFFFFFD08 (-760) Loc: +0x2B24 | offset to vtable
+ +0x2830 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2833 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x2834 | 0B 00 | uint16_t | 0x000B (11) | table field `id` (UShort)
+ +0x2836 | 1A 00 | uint16_t | 0x001A (26) | table field `offset` (UShort)
+ +0x2838 | B4 00 00 00 | UOffset32 | 0x000000B4 (180) Loc: +0x28EC | offset to field `name` (string)
+ +0x283C | A0 00 00 00 | UOffset32 | 0x000000A0 (160) Loc: +0x28DC | offset to field `type` (table)
+ +0x2840 | 78 00 00 00 | UOffset32 | 0x00000078 (120) Loc: +0x28B8 | offset to field `attributes` (vector)
+ +0x2844 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2848 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2848 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x284C | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x2868 | offset to string[0]
+ +0x2850 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2854 | offset to string[1]
+
+string (reflection.Field.documentation):
+ +0x2854 | 0E 00 00 00 | uint32_t | 0x0000000E (14) | length of string
+ +0x2858 | 20 6D 75 6C 74 69 6C 69 | char[14] | multili | string literal
+ +0x2860 | 6E 65 20 74 6F 6F | | ne too
+ +0x2866 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.Field.documentation):
+ +0x2868 | 49 00 00 00 | uint32_t | 0x00000049 (73) | length of string
+ +0x286C | 20 61 6E 20 65 78 61 6D | char[73] | an exam | string literal
+ +0x2874 | 70 6C 65 20 64 6F 63 75 | | ple docu
+ +0x287C | 6D 65 6E 74 61 74 69 6F | | mentatio
+ +0x2884 | 6E 20 63 6F 6D 6D 65 6E | | n commen
+ +0x288C | 74 3A 20 74 68 69 73 20 | | t: this
+ +0x2894 | 77 69 6C 6C 20 65 6E 64 | | will end
+ +0x289C | 20 75 70 20 69 6E 20 74 | | up in t
+ +0x28A4 | 68 65 20 67 65 6E 65 72 | | he gener
+ +0x28AC | 61 74 65 64 20 63 6F 64 | | ated cod
+ +0x28B4 | 65 | | e
+ +0x28B5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x28B6 | 00 00 | uint8_t[2] | .. | padding
+
+vector (reflection.Field.attributes):
+ +0x28B8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x28BC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x28C0 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x28C0 | 5C F3 FF FF | SOffset32 | 0xFFFFF35C (-3236) Loc: +0x3564 | offset to vtable
+ +0x28C4 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x28D4 | offset to field `key` (string)
+ +0x28C8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x28CC | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x28CC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x28D0 | 31 31 | char[2] | 11 | string literal
+ +0x28D2 | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x28D4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x28D8 | 69 64 | char[2] | id | string literal
+ +0x28DA | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x28DC | 2C FF FF FF | SOffset32 | 0xFFFFFF2C (-212) Loc: +0x29B0 | offset to vtable
+ +0x28E0 | 00 00 | uint8_t[2] | .. | padding
+ +0x28E2 | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x28E3 | 0F | uint8_t | 0x0F (15) | table field `element` (Byte)
+ +0x28E4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `index` (Int)
+ +0x28E8 | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x28EC | 11 00 00 00 | uint32_t | 0x00000011 (17) | length of string
+ +0x28F0 | 74 65 73 74 61 72 72 61 | char[17] | testarra | string literal
+ +0x28F8 | 79 6F 66 74 61 62 6C 65 | | yoftable
+ +0x2900 | 73 | | s
+ +0x2901 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2902 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x2904 | E0 FD FF FF | SOffset32 | 0xFFFFFDE0 (-544) Loc: +0x2B24 | offset to vtable
+ +0x2908 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x290B | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x290C | 0A 00 | uint16_t | 0x000A (10) | table field `id` (UShort)
+ +0x290E | 18 00 | uint16_t | 0x0018 (24) | table field `offset` (UShort)
+ +0x2910 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x2954 | offset to field `name` (string)
+ +0x2914 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x2948 | offset to field `type` (table)
+ +0x2918 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x2924 | offset to field `attributes` (vector)
+ +0x291C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2920 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2920 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x2924 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x2928 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x292C | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x292C | C8 F3 FF FF | SOffset32 | 0xFFFFF3C8 (-3128) Loc: +0x3564 | offset to vtable
+ +0x2930 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2940 | offset to field `key` (string)
+ +0x2934 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2938 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2938 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x293C | 31 30 | char[2] | 10 | string literal
+ +0x293E | 00 | char | 0x00 (0) | string terminator
+
+string (reflection.KeyValue.key):
+ +0x2940 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2944 | 69 64 | char[2] | id | string literal
+ +0x2946 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x2948 | C4 FD FF FF | SOffset32 | 0xFFFFFDC4 (-572) Loc: +0x2B84 | offset to vtable
+ +0x294C | 00 00 | uint8_t[2] | .. | padding
+ +0x294E | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x294F | 0D | uint8_t | 0x0D (13) | table field `element` (Byte)
+ +0x2950 | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2954 | 11 00 00 00 | uint32_t | 0x00000011 (17) | length of string
+ +0x2958 | 74 65 73 74 61 72 72 61 | char[17] | testarra | string literal
+ +0x2960 | 79 6F 66 73 74 72 69 6E | | yofstrin
+ +0x2968 | 67 | | g
+ +0x2969 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x296A | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x296C | 48 FE FF FF | SOffset32 | 0xFFFFFE48 (-440) Loc: +0x2B24 | offset to vtable
+ +0x2970 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2973 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x2974 | 09 00 | uint16_t | 0x0009 (9) | table field `id` (UShort)
+ +0x2976 | 16 00 | uint16_t | 0x0016 (22) | table field `offset` (UShort)
+ +0x2978 | 58 00 00 00 | UOffset32 | 0x00000058 (88) Loc: +0x29D0 | offset to field `name` (string)
+ +0x297C | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x29C0 | offset to field `type` (table)
+ +0x2980 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x298C | offset to field `attributes` (vector)
+ +0x2984 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2988 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2988 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x298C | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x2990 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2994 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x2994 | 30 F4 FF FF | SOffset32 | 0xFFFFF430 (-3024) Loc: +0x3564 | offset to vtable
+ +0x2998 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x29A8 | offset to field `key` (string)
+ +0x299C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x29A0 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x29A0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x29A4 | 39 | char[1] | 9 | string literal
+ +0x29A5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x29A6 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x29A8 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x29AC | 69 64 | char[2] | id | string literal
+ +0x29AE | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.Type):
+ +0x29B0 | 10 00 | uint16_t | 0x0010 (16) | size of this vtable
+ +0x29B2 | 10 00 | uint16_t | 0x0010 (16) | size of referring table
+ +0x29B4 | 06 00 | VOffset16 | 0x0006 (6) | offset to field `base_type` (id: 0)
+ +0x29B6 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `element` (id: 1)
+ +0x29B8 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `index` (id: 2)
+ +0x29BA | 00 00 | VOffset16 | 0x0000 (0) | offset to field `fixed_length` (id: 3) <defaults to 0> (UShort)
+ +0x29BC | 00 00 | VOffset16 | 0x0000 (0) | offset to field `base_size` (id: 4) <defaults to 4> (UInt)
+ +0x29BE | 0C 00 | VOffset16 | 0x000C (12) | offset to field `element_size` (id: 5)
+
+table (reflection.Type):
+ +0x29C0 | 10 00 00 00 | SOffset32 | 0x00000010 (16) Loc: +0x29B0 | offset to vtable
+ +0x29C4 | 00 00 | uint8_t[2] | .. | padding
+ +0x29C6 | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x29C7 | 0F | uint8_t | 0x0F (15) | table field `element` (Byte)
+ +0x29C8 | 06 00 00 00 | uint32_t | 0x00000006 (6) | table field `index` (Int)
+ +0x29CC | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x29D0 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x29D4 | 74 65 73 74 34 | char[5] | test4 | string literal
+ +0x29D9 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x29DA | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x29DC | B8 FE FF FF | SOffset32 | 0xFFFFFEB8 (-328) Loc: +0x2B24 | offset to vtable
+ +0x29E0 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x29E3 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x29E4 | 08 00 | uint16_t | 0x0008 (8) | table field `id` (UShort)
+ +0x29E6 | 14 00 | uint16_t | 0x0014 (20) | table field `offset` (UShort)
+ +0x29E8 | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x2A30 | offset to field `name` (string)
+ +0x29EC | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x2A20 | offset to field `type` (table)
+ +0x29F0 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x29FC | offset to field `attributes` (vector)
+ +0x29F4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x29F8 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x29F8 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x29FC | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x2A00 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2A04 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x2A04 | A0 F4 FF FF | SOffset32 | 0xFFFFF4A0 (-2912) Loc: +0x3564 | offset to vtable
+ +0x2A08 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2A18 | offset to field `key` (string)
+ +0x2A0C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2A10 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2A10 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x2A14 | 38 | char[1] | 8 | string literal
+ +0x2A15 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2A16 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x2A18 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2A1C | 69 64 | char[2] | id | string literal
+ +0x2A1E | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x2A20 | 68 F1 FF FF | SOffset32 | 0xFFFFF168 (-3736) Loc: +0x38B8 | offset to vtable
+ +0x2A24 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2A27 | 10 | uint8_t | 0x10 (16) | table field `base_type` (Byte)
+ +0x2A28 | 00 00 00 00 | uint32_t | 0x00000000 (0) | table field `index` (Int)
+ +0x2A2C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2A30 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x2A34 | 74 65 73 74 | char[4] | test | string literal
+ +0x2A38 | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.Field):
+ +0x2A3A | 1A 00 | uint16_t | 0x001A (26) | size of this vtable
+ +0x2A3C | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x2A3E | 08 00 | VOffset16 | 0x0008 (8) | offset to field `name` (id: 0)
+ +0x2A40 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `type` (id: 1)
+ +0x2A42 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `id` (id: 2)
+ +0x2A44 | 06 00 | VOffset16 | 0x0006 (6) | offset to field `offset` (id: 3)
+ +0x2A46 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x2A48 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x2A4A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x2A4C | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x2A4E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `key` (id: 8) <defaults to 0> (Bool)
+ +0x2A50 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `attributes` (id: 9)
+ +0x2A52 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `documentation` (id: 10)
+
+table (reflection.Field):
+ +0x2A54 | 1A 00 00 00 | SOffset32 | 0x0000001A (26) Loc: +0x2A3A | offset to vtable
+ +0x2A58 | 07 00 | uint16_t | 0x0007 (7) | table field `id` (UShort)
+ +0x2A5A | 12 00 | uint16_t | 0x0012 (18) | table field `offset` (UShort)
+ +0x2A5C | 4C 00 00 00 | UOffset32 | 0x0000004C (76) Loc: +0x2AA8 | offset to field `name` (string)
+ +0x2A60 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x2A94 | offset to field `type` (table)
+ +0x2A64 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x2A70 | offset to field `attributes` (vector)
+ +0x2A68 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2A6C | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2A6C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x2A70 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x2A74 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2A78 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x2A78 | 14 F5 FF FF | SOffset32 | 0xFFFFF514 (-2796) Loc: +0x3564 | offset to vtable
+ +0x2A7C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2A8C | offset to field `key` (string)
+ +0x2A80 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2A84 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2A84 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x2A88 | 37 | char[1] | 7 | string literal
+ +0x2A89 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2A8A | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x2A8C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2A90 | 69 64 | char[2] | id | string literal
+ +0x2A92 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x2A94 | 90 F4 FF FF | SOffset32 | 0xFFFFF490 (-2928) Loc: +0x3604 | offset to vtable
+ +0x2A98 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2A9B | 01 | uint8_t | 0x01 (1) | table field `base_type` (Byte)
+ +0x2A9C | 00 00 00 00 | uint32_t | 0x00000000 (0) | table field `index` (Int)
+ +0x2AA0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x2AA4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2AA8 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of string
+ +0x2AAC | 74 65 73 74 5F 74 79 70 | char[9] | test_typ | string literal
+ +0x2AB4 | 65 | | e
+ +0x2AB5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2AB6 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x2AB8 | 42 FD FF FF | SOffset32 | 0xFFFFFD42 (-702) Loc: +0x2D76 | offset to vtable
+ +0x2ABC | 06 00 | uint16_t | 0x0006 (6) | table field `id` (UShort)
+ +0x2ABE | 10 00 | uint16_t | 0x0010 (16) | table field `offset` (UShort)
+ +0x2AC0 | 58 00 00 00 | UOffset32 | 0x00000058 (88) Loc: +0x2B18 | offset to field `name` (string)
+ +0x2AC4 | 40 00 00 00 | UOffset32 | 0x00000040 (64) Loc: +0x2B04 | offset to field `type` (table)
+ +0x2AC8 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x2AE0 | offset to field `attributes` (vector)
+ +0x2ACC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2ADC | offset to field `documentation` (vector)
+ +0x2AD0 | 08 00 00 00 00 00 00 00 | int64_t | 0x0000000000000008 (8) | table field `default_integer` (Long)
+ +0x2AD8 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (reflection.Field.documentation):
+ +0x2ADC | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x2AE0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x2AE4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2AE8 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x2AE8 | 84 F5 FF FF | SOffset32 | 0xFFFFF584 (-2684) Loc: +0x3564 | offset to vtable
+ +0x2AEC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2AFC | offset to field `key` (string)
+ +0x2AF0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2AF4 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2AF4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x2AF8 | 36 | char[1] | 6 | string literal
+ +0x2AF9 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2AFA | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x2AFC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2B00 | 69 64 | char[2] | id | string literal
+ +0x2B02 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x2B04 | 00 F5 FF FF | SOffset32 | 0xFFFFF500 (-2816) Loc: +0x3604 | offset to vtable
+ +0x2B08 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2B0B | 04 | uint8_t | 0x04 (4) | table field `base_type` (Byte)
+ +0x2B0C | 03 00 00 00 | uint32_t | 0x00000003 (3) | table field `index` (Int)
+ +0x2B10 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x2B14 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2B18 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x2B1C | 63 6F 6C 6F 72 | char[5] | color | string literal
+ +0x2B21 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2B22 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (reflection.Field):
+ +0x2B24 | 1C 00 | uint16_t | 0x001C (28) | size of this vtable
+ +0x2B26 | 1C 00 | uint16_t | 0x001C (28) | size of referring table
+ +0x2B28 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `name` (id: 0)
+ +0x2B2A | 10 00 | VOffset16 | 0x0010 (16) | offset to field `type` (id: 1)
+ +0x2B2C | 08 00 | VOffset16 | 0x0008 (8) | offset to field `id` (id: 2)
+ +0x2B2E | 0A 00 | VOffset16 | 0x000A (10) | offset to field `offset` (id: 3)
+ +0x2B30 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x2B32 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x2B34 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x2B36 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x2B38 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `key` (id: 8) <defaults to 0> (Bool)
+ +0x2B3A | 14 00 | VOffset16 | 0x0014 (20) | offset to field `attributes` (id: 9)
+ +0x2B3C | 18 00 | VOffset16 | 0x0018 (24) | offset to field `documentation` (id: 10)
+ +0x2B3E | 07 00 | VOffset16 | 0x0007 (7) | offset to field `optional` (id: 11)
+
+table (reflection.Field):
+ +0x2B40 | 1C 00 00 00 | SOffset32 | 0x0000001C (28) Loc: +0x2B24 | offset to vtable
+ +0x2B44 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2B47 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x2B48 | 05 00 | uint16_t | 0x0005 (5) | table field `id` (UShort)
+ +0x2B4A | 0E 00 | uint16_t | 0x000E (14) | table field `offset` (UShort)
+ +0x2B4C | 54 00 00 00 | UOffset32 | 0x00000054 (84) Loc: +0x2BA0 | offset to field `name` (string)
+ +0x2B50 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x2B94 | offset to field `type` (table)
+ +0x2B54 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x2B60 | offset to field `attributes` (vector)
+ +0x2B58 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2B5C | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2B5C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x2B60 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x2B64 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2B68 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x2B68 | 04 F6 FF FF | SOffset32 | 0xFFFFF604 (-2556) Loc: +0x3564 | offset to vtable
+ +0x2B6C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2B7C | offset to field `key` (string)
+ +0x2B70 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2B74 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2B74 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x2B78 | 35 | char[1] | 5 | string literal
+ +0x2B79 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2B7A | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x2B7C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2B80 | 69 64 | char[2] | id | string literal
+ +0x2B82 | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.Type):
+ +0x2B84 | 10 00 | uint16_t | 0x0010 (16) | size of this vtable
+ +0x2B86 | 0C 00 | uint16_t | 0x000C (12) | size of referring table
+ +0x2B88 | 06 00 | VOffset16 | 0x0006 (6) | offset to field `base_type` (id: 0)
+ +0x2B8A | 07 00 | VOffset16 | 0x0007 (7) | offset to field `element` (id: 1)
+ +0x2B8C | 00 00 | VOffset16 | 0x0000 (0) | offset to field `index` (id: 2) <defaults to -1> (Int)
+ +0x2B8E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `fixed_length` (id: 3) <defaults to 0> (UShort)
+ +0x2B90 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `base_size` (id: 4) <defaults to 4> (UInt)
+ +0x2B92 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `element_size` (id: 5)
+
+table (reflection.Type):
+ +0x2B94 | 10 00 00 00 | SOffset32 | 0x00000010 (16) Loc: +0x2B84 | offset to vtable
+ +0x2B98 | 00 00 | uint8_t[2] | .. | padding
+ +0x2B9A | 0E | uint8_t | 0x0E (14) | table field `base_type` (Byte)
+ +0x2B9B | 04 | uint8_t | 0x04 (4) | table field `element` (Byte)
+ +0x2B9C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2BA0 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of string
+ +0x2BA4 | 69 6E 76 65 6E 74 6F 72 | char[9] | inventor | string literal
+ +0x2BAC | 79 | | y
+ +0x2BAD | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.Field):
+ +0x2BAE | 1A 00 | uint16_t | 0x001A (26) | size of this vtable
+ +0x2BB0 | 1C 00 | uint16_t | 0x001C (28) | size of referring table
+ +0x2BB2 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `name` (id: 0)
+ +0x2BB4 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `type` (id: 1)
+ +0x2BB6 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `id` (id: 2)
+ +0x2BB8 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `offset` (id: 3)
+ +0x2BBA | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x2BBC | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x2BBE | 07 00 | VOffset16 | 0x0007 (7) | offset to field `deprecated` (id: 6)
+ +0x2BC0 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x2BC2 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `key` (id: 8) <defaults to 0> (Bool)
+ +0x2BC4 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `attributes` (id: 9)
+ +0x2BC6 | 18 00 | VOffset16 | 0x0018 (24) | offset to field `documentation` (id: 10)
+
+table (reflection.Field):
+ +0x2BC8 | 1A 00 00 00 | SOffset32 | 0x0000001A (26) Loc: +0x2BAE | offset to vtable
+ +0x2BCC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2BCF | 01 | uint8_t | 0x01 (1) | table field `deprecated` (Bool)
+ +0x2BD0 | 04 00 | uint16_t | 0x0004 (4) | table field `id` (UShort)
+ +0x2BD2 | 0C 00 | uint16_t | 0x000C (12) | table field `offset` (UShort)
+ +0x2BD4 | 98 00 00 00 | UOffset32 | 0x00000098 (152) Loc: +0x2C6C | offset to field `name` (string)
+ +0x2BD8 | 84 00 00 00 | UOffset32 | 0x00000084 (132) Loc: +0x2C5C | offset to field `type` (table)
+ +0x2BDC | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x2BE8 | offset to field `attributes` (vector)
+ +0x2BE0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2BE4 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2BE4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x2BE8 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x2BEC | 4C 00 00 00 | UOffset32 | 0x0000004C (76) Loc: +0x2C38 | offset to table[0]
+ +0x2BF0 | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x2C1C | offset to table[1]
+ +0x2BF4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2BF8 | offset to table[2]
+
+table (reflection.KeyValue):
+ +0x2BF8 | 94 F6 FF FF | SOffset32 | 0xFFFFF694 (-2412) Loc: +0x3564 | offset to vtable
+ +0x2BFC | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2C0C | offset to field `key` (string)
+ +0x2C00 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2C04 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2C04 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x2C08 | 31 | char[1] | 1 | string literal
+ +0x2C09 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2C0A | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x2C0C | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x2C10 | 70 72 69 6F 72 69 74 79 | char[8] | priority | string literal
+ +0x2C18 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2C19 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.KeyValue):
+ +0x2C1C | B8 F6 FF FF | SOffset32 | 0xFFFFF6B8 (-2376) Loc: +0x3564 | offset to vtable
+ +0x2C20 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2C30 | offset to field `key` (string)
+ +0x2C24 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2C28 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2C28 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x2C2C | 34 | char[1] | 4 | string literal
+ +0x2C2D | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2C2E | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x2C30 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2C34 | 69 64 | char[2] | id | string literal
+ +0x2C36 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x2C38 | D4 F6 FF FF | SOffset32 | 0xFFFFF6D4 (-2348) Loc: +0x3564 | offset to vtable
+ +0x2C3C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2C4C | offset to field `key` (string)
+ +0x2C40 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2C44 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2C44 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x2C48 | 30 | char[1] | 0 | string literal
+ +0x2C49 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2C4A | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x2C4C | 0A 00 00 00 | uint32_t | 0x0000000A (10) | length of string
+ +0x2C50 | 64 65 70 72 65 63 61 74 | char[10] | deprecat | string literal
+ +0x2C58 | 65 64 | | ed
+ +0x2C5A | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x2C5C | 78 F5 FF FF | SOffset32 | 0xFFFFF578 (-2696) Loc: +0x36E4 | offset to vtable
+ +0x2C60 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2C63 | 02 | uint8_t | 0x02 (2) | table field `base_type` (Byte)
+ +0x2C64 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x2C68 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2C6C | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x2C70 | 66 72 69 65 6E 64 6C 79 | char[8] | friendly | string literal
+ +0x2C78 | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.Field):
+ +0x2C7A | 1A 00 | uint16_t | 0x001A (26) | size of this vtable
+ +0x2C7C | 1C 00 | uint16_t | 0x001C (28) | size of referring table
+ +0x2C7E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `name` (id: 0)
+ +0x2C80 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `type` (id: 1)
+ +0x2C82 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `id` (id: 2)
+ +0x2C84 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `offset` (id: 3)
+ +0x2C86 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x2C88 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x2C8A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x2C8C | 06 00 | VOffset16 | 0x0006 (6) | offset to field `required` (id: 7)
+ +0x2C8E | 07 00 | VOffset16 | 0x0007 (7) | offset to field `key` (id: 8)
+ +0x2C90 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `attributes` (id: 9)
+ +0x2C92 | 18 00 | VOffset16 | 0x0018 (24) | offset to field `documentation` (id: 10)
+
+table (reflection.Field):
+ +0x2C94 | 1A 00 00 00 | SOffset32 | 0x0000001A (26) Loc: +0x2C7A | offset to vtable
+ +0x2C98 | 00 00 | uint8_t[2] | .. | padding
+ +0x2C9A | 01 | uint8_t | 0x01 (1) | table field `required` (Bool)
+ +0x2C9B | 01 | uint8_t | 0x01 (1) | table field `key` (Bool)
+ +0x2C9C | 03 00 | uint16_t | 0x0003 (3) | table field `id` (UShort)
+ +0x2C9E | 0A 00 | uint16_t | 0x000A (10) | table field `offset` (UShort)
+ +0x2CA0 | 64 00 00 00 | UOffset32 | 0x00000064 (100) Loc: +0x2D04 | offset to field `name` (string)
+ +0x2CA4 | 54 00 00 00 | UOffset32 | 0x00000054 (84) Loc: +0x2CF8 | offset to field `type` (table)
+ +0x2CA8 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x2CB4 | offset to field `attributes` (vector)
+ +0x2CAC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2CB0 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2CB0 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x2CB4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x2CB8 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x2CDC | offset to table[0]
+ +0x2CBC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2CC0 | offset to table[1]
+
+table (reflection.KeyValue):
+ +0x2CC0 | 5C F7 FF FF | SOffset32 | 0xFFFFF75C (-2212) Loc: +0x3564 | offset to vtable
+ +0x2CC4 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2CD4 | offset to field `key` (string)
+ +0x2CC8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2CCC | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2CCC | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x2CD0 | 30 | char[1] | 0 | string literal
+ +0x2CD1 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2CD2 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x2CD4 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x2CD8 | 6B 65 79 | char[3] | key | string literal
+ +0x2CDB | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x2CDC | 78 F7 FF FF | SOffset32 | 0xFFFFF778 (-2184) Loc: +0x3564 | offset to vtable
+ +0x2CE0 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2CF0 | offset to field `key` (string)
+ +0x2CE4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2CE8 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2CE8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x2CEC | 33 | char[1] | 3 | string literal
+ +0x2CED | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2CEE | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x2CF0 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2CF4 | 69 64 | char[2] | id | string literal
+ +0x2CF6 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x2CF8 | 5C F3 FF FF | SOffset32 | 0xFFFFF35C (-3236) Loc: +0x399C | offset to vtable
+ +0x2CFC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2CFF | 0D | uint8_t | 0x0D (13) | table field `base_type` (Byte)
+ +0x2D00 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2D04 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x2D08 | 6E 61 6D 65 | char[4] | name | string literal
+ +0x2D0C | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2D0D | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Field):
+ +0x2D10 | 9A FF FF FF | SOffset32 | 0xFFFFFF9A (-102) Loc: +0x2D76 | offset to vtable
+ +0x2D14 | 02 00 | uint16_t | 0x0002 (2) | table field `id` (UShort)
+ +0x2D16 | 08 00 | uint16_t | 0x0008 (8) | table field `offset` (UShort)
+ +0x2D18 | 54 00 00 00 | UOffset32 | 0x00000054 (84) Loc: +0x2D6C | offset to field `name` (string)
+ +0x2D1C | 40 00 00 00 | UOffset32 | 0x00000040 (64) Loc: +0x2D5C | offset to field `type` (table)
+ +0x2D20 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x2D38 | offset to field `attributes` (vector)
+ +0x2D24 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2D34 | offset to field `documentation` (vector)
+ +0x2D28 | 64 00 00 00 00 00 00 00 | int64_t | 0x0000000000000064 (100) | table field `default_integer` (Long)
+ +0x2D30 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (reflection.Field.documentation):
+ +0x2D34 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x2D38 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x2D3C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2D40 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x2D40 | DC F7 FF FF | SOffset32 | 0xFFFFF7DC (-2084) Loc: +0x3564 | offset to vtable
+ +0x2D44 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2D54 | offset to field `key` (string)
+ +0x2D48 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2D4C | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2D4C | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x2D50 | 32 | char[1] | 2 | string literal
+ +0x2D51 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2D52 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x2D54 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2D58 | 69 64 | char[2] | id | string literal
+ +0x2D5A | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x2D5C | 78 F6 FF FF | SOffset32 | 0xFFFFF678 (-2440) Loc: +0x36E4 | offset to vtable
+ +0x2D60 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2D63 | 05 | uint8_t | 0x05 (5) | table field `base_type` (Byte)
+ +0x2D64 | 02 00 00 00 | uint32_t | 0x00000002 (2) | table field `base_size` (UInt)
+ +0x2D68 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2D6C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2D70 | 68 70 | char[2] | hp | string literal
+ +0x2D72 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2D73 | 00 00 00 | uint8_t[3] | ... | padding
+
+vtable (reflection.Field):
+ +0x2D76 | 1A 00 | uint16_t | 0x001A (26) | size of this vtable
+ +0x2D78 | 24 00 | uint16_t | 0x0024 (36) | size of referring table
+ +0x2D7A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `name` (id: 0)
+ +0x2D7C | 0C 00 | VOffset16 | 0x000C (12) | offset to field `type` (id: 1)
+ +0x2D7E | 04 00 | VOffset16 | 0x0004 (4) | offset to field `id` (id: 2)
+ +0x2D80 | 06 00 | VOffset16 | 0x0006 (6) | offset to field `offset` (id: 3)
+ +0x2D82 | 18 00 | VOffset16 | 0x0018 (24) | offset to field `default_integer` (id: 4)
+ +0x2D84 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x2D86 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x2D88 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x2D8A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `key` (id: 8) <defaults to 0> (Bool)
+ +0x2D8C | 10 00 | VOffset16 | 0x0010 (16) | offset to field `attributes` (id: 9)
+ +0x2D8E | 14 00 | VOffset16 | 0x0014 (20) | offset to field `documentation` (id: 10)
+
+table (reflection.Field):
+ +0x2D90 | 1A 00 00 00 | SOffset32 | 0x0000001A (26) Loc: +0x2D76 | offset to vtable
+ +0x2D94 | 01 00 | uint16_t | 0x0001 (1) | table field `id` (UShort)
+ +0x2D96 | 06 00 | uint16_t | 0x0006 (6) | table field `offset` (UShort)
+ +0x2D98 | 54 00 00 00 | UOffset32 | 0x00000054 (84) Loc: +0x2DEC | offset to field `name` (string)
+ +0x2D9C | 40 00 00 00 | UOffset32 | 0x00000040 (64) Loc: +0x2DDC | offset to field `type` (table)
+ +0x2DA0 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x2DB8 | offset to field `attributes` (vector)
+ +0x2DA4 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2DB4 | offset to field `documentation` (vector)
+ +0x2DA8 | 96 00 00 00 00 00 00 00 | int64_t | 0x0000000000000096 (150) | table field `default_integer` (Long)
+ +0x2DB0 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (reflection.Field.documentation):
+ +0x2DB4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x2DB8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x2DBC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2DC0 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x2DC0 | 5C F8 FF FF | SOffset32 | 0xFFFFF85C (-1956) Loc: +0x3564 | offset to vtable
+ +0x2DC4 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2DD4 | offset to field `key` (string)
+ +0x2DC8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2DCC | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2DCC | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x2DD0 | 31 | char[1] | 1 | string literal
+ +0x2DD1 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2DD2 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x2DD4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2DD8 | 69 64 | char[2] | id | string literal
+ +0x2DDA | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x2DDC | F8 F6 FF FF | SOffset32 | 0xFFFFF6F8 (-2312) Loc: +0x36E4 | offset to vtable
+ +0x2DE0 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2DE3 | 05 | uint8_t | 0x05 (5) | table field `base_type` (Byte)
+ +0x2DE4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | table field `base_size` (UInt)
+ +0x2DE8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2DEC | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x2DF0 | 6D 61 6E 61 | char[4] | mana | string literal
+ +0x2DF4 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2DF5 | 00 00 00 | uint8_t[3] | ... | padding
+
+vtable (reflection.Field):
+ +0x2DF8 | 1C 00 | uint16_t | 0x001C (28) | size of this vtable
+ +0x2DFA | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x2DFC | 08 00 | VOffset16 | 0x0008 (8) | offset to field `name` (id: 0)
+ +0x2DFE | 0C 00 | VOffset16 | 0x000C (12) | offset to field `type` (id: 1)
+ +0x2E00 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `id` (id: 2) <defaults to 0> (UShort)
+ +0x2E02 | 06 00 | VOffset16 | 0x0006 (6) | offset to field `offset` (id: 3)
+ +0x2E04 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x2E06 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x2E08 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x2E0A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x2E0C | 00 00 | VOffset16 | 0x0000 (0) | offset to field `key` (id: 8) <defaults to 0> (Bool)
+ +0x2E0E | 10 00 | VOffset16 | 0x0010 (16) | offset to field `attributes` (id: 9)
+ +0x2E10 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `documentation` (id: 10)
+ +0x2E12 | 05 00 | VOffset16 | 0x0005 (5) | offset to field `optional` (id: 11)
+
+table (reflection.Field):
+ +0x2E14 | 1C 00 00 00 | SOffset32 | 0x0000001C (28) Loc: +0x2DF8 | offset to vtable
+ +0x2E18 | 00 | uint8_t[1] | . | padding
+ +0x2E19 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x2E1A | 04 00 | uint16_t | 0x0004 (4) | table field `offset` (UShort)
+ +0x2E1C | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x2E64 | offset to field `name` (string)
+ +0x2E20 | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x2E54 | offset to field `type` (table)
+ +0x2E24 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x2E30 | offset to field `attributes` (vector)
+ +0x2E28 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2E2C | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2E2C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x2E30 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x2E34 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2E38 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x2E38 | D4 F8 FF FF | SOffset32 | 0xFFFFF8D4 (-1836) Loc: +0x3564 | offset to vtable
+ +0x2E3C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2E4C | offset to field `key` (string)
+ +0x2E40 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2E44 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2E44 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x2E48 | 30 | char[1] | 0 | string literal
+ +0x2E49 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2E4A | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x2E4C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2E50 | 69 64 | char[2] | id | string literal
+ +0x2E52 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x2E54 | 9C F5 FF FF | SOffset32 | 0xFFFFF59C (-2660) Loc: +0x38B8 | offset to vtable
+ +0x2E58 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2E5B | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x2E5C | 09 00 00 00 | uint32_t | 0x00000009 (9) | table field `index` (Int)
+ +0x2E60 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2E64 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x2E68 | 70 6F 73 | char[3] | pos | string literal
+ +0x2E6B | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Object):
+ +0x2E6C | 44 F6 FF FF | SOffset32 | 0xFFFFF644 (-2492) Loc: +0x3828 | offset to vtable
+ +0x2E70 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x2E90 | offset to field `name` (string)
+ +0x2E74 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x2E88 | offset to field `fields` (vector)
+ +0x2E78 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `minalign` (Int)
+ +0x2E7C | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x2E84 | offset to field `documentation` (vector)
+ +0x2E80 | E0 08 00 00 | UOffset32 | 0x000008E0 (2272) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Object.documentation):
+ +0x2E84 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Object.fields):
+ +0x2E88 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x2E8C | 3C 00 00 00 | UOffset32 | 0x0000003C (60) Loc: +0x2EC8 | offset to table[0]
+
+string (reflection.Object.name):
+ +0x2E90 | 19 00 00 00 | uint32_t | 0x00000019 (25) | length of string
+ +0x2E94 | 4D 79 47 61 6D 65 2E 45 | char[25] | MyGame.E | string literal
+ +0x2E9C | 78 61 6D 70 6C 65 2E 52 | | xample.R
+ +0x2EA4 | 65 66 65 72 72 61 62 6C | | eferrabl
+ +0x2EAC | 65 | | e
+ +0x2EAD | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.Field):
+ +0x2EAE | 1A 00 | uint16_t | 0x001A (26) | size of this vtable
+ +0x2EB0 | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x2EB2 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `name` (id: 0)
+ +0x2EB4 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `type` (id: 1)
+ +0x2EB6 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `id` (id: 2) <defaults to 0> (UShort)
+ +0x2EB8 | 06 00 | VOffset16 | 0x0006 (6) | offset to field `offset` (id: 3)
+ +0x2EBA | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x2EBC | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x2EBE | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x2EC0 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x2EC2 | 05 00 | VOffset16 | 0x0005 (5) | offset to field `key` (id: 8)
+ +0x2EC4 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `attributes` (id: 9)
+ +0x2EC6 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `documentation` (id: 10)
+
+table (reflection.Field):
+ +0x2EC8 | 1A 00 00 00 | SOffset32 | 0x0000001A (26) Loc: +0x2EAE | offset to vtable
+ +0x2ECC | 00 | uint8_t[1] | . | padding
+ +0x2ECD | 01 | uint8_t | 0x01 (1) | table field `key` (Bool)
+ +0x2ECE | 04 00 | uint16_t | 0x0004 (4) | table field `offset` (UShort)
+ +0x2ED0 | 74 00 00 00 | UOffset32 | 0x00000074 (116) Loc: +0x2F44 | offset to field `name` (string)
+ +0x2ED4 | 60 00 00 00 | UOffset32 | 0x00000060 (96) Loc: +0x2F34 | offset to field `type` (table)
+ +0x2ED8 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x2EE4 | offset to field `attributes` (vector)
+ +0x2EDC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2EE0 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2EE0 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x2EE4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x2EE8 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x2F0C | offset to table[0]
+ +0x2EEC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2EF0 | offset to table[1]
+
+table (reflection.KeyValue):
+ +0x2EF0 | 8C F9 FF FF | SOffset32 | 0xFFFFF98C (-1652) Loc: +0x3564 | offset to vtable
+ +0x2EF4 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2F04 | offset to field `key` (string)
+ +0x2EF8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2EFC | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2EFC | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x2F00 | 30 | char[1] | 0 | string literal
+ +0x2F01 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2F02 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x2F04 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x2F08 | 6B 65 79 | char[3] | key | string literal
+ +0x2F0B | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.KeyValue):
+ +0x2F0C | A8 F9 FF FF | SOffset32 | 0xFFFFF9A8 (-1624) Loc: +0x3564 | offset to vtable
+ +0x2F10 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x2F28 | offset to field `key` (string)
+ +0x2F14 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2F18 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2F18 | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x2F1C | 66 6E 76 31 61 5F 36 34 | char[8] | fnv1a_64 | string literal
+ +0x2F24 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2F25 | 00 00 00 | uint8_t[3] | ... | padding
+
+string (reflection.KeyValue.key):
+ +0x2F28 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x2F2C | 68 61 73 68 | char[4] | hash | string literal
+ +0x2F30 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2F31 | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Type):
+ +0x2F34 | 50 F8 FF FF | SOffset32 | 0xFFFFF850 (-1968) Loc: +0x36E4 | offset to vtable
+ +0x2F38 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2F3B | 0A | uint8_t | 0x0A (10) | table field `base_type` (Byte)
+ +0x2F3C | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x2F40 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x2F44 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x2F48 | 69 64 | char[2] | id | string literal
+ +0x2F4A | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Object):
+ +0x2F4C | 24 F7 FF FF | SOffset32 | 0xFFFFF724 (-2268) Loc: +0x3828 | offset to vtable
+ +0x2F50 | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x2F78 | offset to field `name` (string)
+ +0x2F54 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x2F68 | offset to field `fields` (vector)
+ +0x2F58 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `minalign` (Int)
+ +0x2F5C | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x2F64 | offset to field `documentation` (vector)
+ +0x2F60 | 00 08 00 00 | UOffset32 | 0x00000800 (2048) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Object.documentation):
+ +0x2F64 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Object.fields):
+ +0x2F68 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x2F6C | 40 00 00 00 | UOffset32 | 0x00000040 (64) Loc: +0x2FAC | offset to table[0]
+ +0x2F70 | CC 00 00 00 | UOffset32 | 0x000000CC (204) Loc: +0x303C | offset to table[1]
+ +0x2F74 | 98 00 00 00 | UOffset32 | 0x00000098 (152) Loc: +0x300C | offset to table[2]
+
+string (reflection.Object.name):
+ +0x2F78 | 13 00 00 00 | uint32_t | 0x00000013 (19) | length of string
+ +0x2F7C | 4D 79 47 61 6D 65 2E 45 | char[19] | MyGame.E | string literal
+ +0x2F84 | 78 61 6D 70 6C 65 2E 53 | | xample.S
+ +0x2F8C | 74 61 74 | | tat
+ +0x2F8F | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2F90 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (reflection.Field):
+ +0x2F92 | 1A 00 | uint16_t | 0x001A (26) | size of this vtable
+ +0x2F94 | 1C 00 | uint16_t | 0x001C (28) | size of referring table
+ +0x2F96 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `name` (id: 0)
+ +0x2F98 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `type` (id: 1)
+ +0x2F9A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `id` (id: 2)
+ +0x2F9C | 0A 00 | VOffset16 | 0x000A (10) | offset to field `offset` (id: 3)
+ +0x2F9E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x2FA0 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x2FA2 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x2FA4 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x2FA6 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `key` (id: 8)
+ +0x2FA8 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `attributes` (id: 9)
+ +0x2FAA | 18 00 | VOffset16 | 0x0018 (24) | offset to field `documentation` (id: 10)
+
+table (reflection.Field):
+ +0x2FAC | 1A 00 00 00 | SOffset32 | 0x0000001A (26) Loc: +0x2F92 | offset to vtable
+ +0x2FB0 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2FB3 | 01 | uint8_t | 0x01 (1) | table field `key` (Bool)
+ +0x2FB4 | 02 00 | uint16_t | 0x0002 (2) | table field `id` (UShort)
+ +0x2FB6 | 08 00 | uint16_t | 0x0008 (8) | table field `offset` (UShort)
+ +0x2FB8 | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x3000 | offset to field `name` (string)
+ +0x2FBC | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x2FF0 | offset to field `type` (table)
+ +0x2FC0 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x2FCC | offset to field `attributes` (vector)
+ +0x2FC4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2FC8 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x2FC8 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x2FCC | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x2FD0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2FD4 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x2FD4 | 70 FA FF FF | SOffset32 | 0xFFFFFA70 (-1424) Loc: +0x3564 | offset to vtable
+ +0x2FD8 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x2FE8 | offset to field `key` (string)
+ +0x2FDC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x2FE0 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x2FE0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x2FE4 | 30 | char[1] | 0 | string literal
+ +0x2FE5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x2FE6 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x2FE8 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x2FEC | 6B 65 79 | char[3] | key | string literal
+ +0x2FEF | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x2FF0 | 0C F9 FF FF | SOffset32 | 0xFFFFF90C (-1780) Loc: +0x36E4 | offset to vtable
+ +0x2FF4 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x2FF7 | 06 | uint8_t | 0x06 (6) | table field `base_type` (Byte)
+ +0x2FF8 | 02 00 00 00 | uint32_t | 0x00000002 (2) | table field `base_size` (UInt)
+ +0x2FFC | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x3000 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x3004 | 63 6F 75 6E 74 | char[5] | count | string literal
+ +0x3009 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x300A | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x300C | 76 FB FF FF | SOffset32 | 0xFFFFFB76 (-1162) Loc: +0x3496 | offset to vtable
+ +0x3010 | 01 00 | uint16_t | 0x0001 (1) | table field `id` (UShort)
+ +0x3012 | 06 00 | uint16_t | 0x0006 (6) | table field `offset` (UShort)
+ +0x3014 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x3034 | offset to field `name` (string)
+ +0x3018 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x3024 | offset to field `type` (table)
+ +0x301C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x3020 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x3020 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x3024 | 40 F9 FF FF | SOffset32 | 0xFFFFF940 (-1728) Loc: +0x36E4 | offset to vtable
+ +0x3028 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x302B | 09 | uint8_t | 0x09 (9) | table field `base_type` (Byte)
+ +0x302C | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x3030 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x3034 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x3038 | 76 61 6C | char[3] | val | string literal
+ +0x303B | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x303C | B8 F7 FF FF | SOffset32 | 0xFFFFF7B8 (-2120) Loc: +0x3884 | offset to vtable
+ +0x3040 | 00 | uint8_t[1] | . | padding
+ +0x3041 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x3042 | 04 00 | uint16_t | 0x0004 (4) | table field `offset` (UShort)
+ +0x3044 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x3060 | offset to field `name` (string)
+ +0x3048 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x3054 | offset to field `type` (table)
+ +0x304C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x3050 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x3050 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x3054 | B8 F6 FF FF | SOffset32 | 0xFFFFF6B8 (-2376) Loc: +0x399C | offset to vtable
+ +0x3058 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x305B | 0D | uint8_t | 0x0D (13) | table field `base_type` (Byte)
+ +0x305C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x3060 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x3064 | 69 64 | char[2] | id | string literal
+ +0x3066 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Object):
+ +0x3068 | 88 F7 FF FF | SOffset32 | 0xFFFFF788 (-2168) Loc: +0x38E0 | offset to vtable
+ +0x306C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x306F | 01 | uint8_t | 0x01 (1) | table field `is_struct` (Bool)
+ +0x3070 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x3094 | offset to field `name` (string)
+ +0x3074 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x308C | offset to field `fields` (vector)
+ +0x3078 | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `minalign` (Int)
+ +0x307C | 14 00 00 00 | uint32_t | 0x00000014 (20) | table field `bytesize` (Int)
+ +0x3080 | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x3088 | offset to field `documentation` (vector)
+ +0x3084 | DC 06 00 00 | UOffset32 | 0x000006DC (1756) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Object.documentation):
+ +0x3088 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Object.fields):
+ +0x308C | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x3090 | 30 00 00 00 | UOffset32 | 0x00000030 (48) Loc: +0x30C0 | offset to table[0]
+
+string (reflection.Object.name):
+ +0x3094 | 27 00 00 00 | uint32_t | 0x00000027 (39) | length of string
+ +0x3098 | 4D 79 47 61 6D 65 2E 45 | char[39] | MyGame.E | string literal
+ +0x30A0 | 78 61 6D 70 6C 65 2E 53 | | xample.S
+ +0x30A8 | 74 72 75 63 74 4F 66 53 | | tructOfS
+ +0x30B0 | 74 72 75 63 74 73 4F 66 | | tructsOf
+ +0x30B8 | 53 74 72 75 63 74 73 | | Structs
+ +0x30BF | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x30C0 | F4 FE FF FF | SOffset32 | 0xFFFFFEF4 (-268) Loc: +0x31CC | offset to vtable
+ +0x30C4 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x30C7 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x30C8 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x30E8 | offset to field `name` (string)
+ +0x30CC | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x30D8 | offset to field `type` (table)
+ +0x30D0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x30D4 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x30D4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x30D8 | 20 F8 FF FF | SOffset32 | 0xFFFFF820 (-2016) Loc: +0x38B8 | offset to vtable
+ +0x30DC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x30DF | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x30E0 | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `index` (Int)
+ +0x30E4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x30E8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x30EC | 61 | char[1] | a | string literal
+ +0x30ED | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x30EE | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Object):
+ +0x30F0 | 10 F8 FF FF | SOffset32 | 0xFFFFF810 (-2032) Loc: +0x38E0 | offset to vtable
+ +0x30F4 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x30F7 | 01 | uint8_t | 0x01 (1) | table field `is_struct` (Bool)
+ +0x30F8 | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x3124 | offset to field `name` (string)
+ +0x30FC | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x3114 | offset to field `fields` (vector)
+ +0x3100 | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `minalign` (Int)
+ +0x3104 | 14 00 00 00 | uint32_t | 0x00000014 (20) | table field `bytesize` (Int)
+ +0x3108 | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x3110 | offset to field `documentation` (vector)
+ +0x310C | 54 06 00 00 | UOffset32 | 0x00000654 (1620) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Object.documentation):
+ +0x3110 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Object.fields):
+ +0x3114 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x3118 | D0 00 00 00 | UOffset32 | 0x000000D0 (208) Loc: +0x31E8 | offset to table[0]
+ +0x311C | 7C 00 00 00 | UOffset32 | 0x0000007C (124) Loc: +0x3198 | offset to table[1]
+ +0x3120 | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x3148 | offset to table[2]
+
+string (reflection.Object.name):
+ +0x3124 | 1E 00 00 00 | uint32_t | 0x0000001E (30) | length of string
+ +0x3128 | 4D 79 47 61 6D 65 2E 45 | char[30] | MyGame.E | string literal
+ +0x3130 | 78 61 6D 70 6C 65 2E 53 | | xample.S
+ +0x3138 | 74 72 75 63 74 4F 66 53 | | tructOfS
+ +0x3140 | 74 72 75 63 74 73 | | tructs
+ +0x3146 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x3148 | CC FF FF FF | SOffset32 | 0xFFFFFFCC (-52) Loc: +0x317C | offset to vtable
+ +0x314C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x314F | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x3150 | 02 00 | uint16_t | 0x0002 (2) | table field `id` (UShort)
+ +0x3152 | 0C 00 | uint16_t | 0x000C (12) | table field `offset` (UShort)
+ +0x3154 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x3174 | offset to field `name` (string)
+ +0x3158 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x3164 | offset to field `type` (table)
+ +0x315C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x3160 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x3160 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x3164 | AC F8 FF FF | SOffset32 | 0xFFFFF8AC (-1876) Loc: +0x38B8 | offset to vtable
+ +0x3168 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x316B | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x316C | 00 00 00 00 | uint32_t | 0x00000000 (0) | table field `index` (Int)
+ +0x3170 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x3174 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x3178 | 63 | char[1] | c | string literal
+ +0x3179 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x317A | 00 00 | uint8_t[2] | .. | padding
+
+vtable (reflection.Field):
+ +0x317C | 1C 00 | uint16_t | 0x001C (28) | size of this vtable
+ +0x317E | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x3180 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `name` (id: 0)
+ +0x3182 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `type` (id: 1)
+ +0x3184 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `id` (id: 2)
+ +0x3186 | 0A 00 | VOffset16 | 0x000A (10) | offset to field `offset` (id: 3)
+ +0x3188 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x318A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x318C | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x318E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x3190 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `key` (id: 8) <defaults to 0> (Bool)
+ +0x3192 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `attributes` (id: 9) <null> (Vector)
+ +0x3194 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `documentation` (id: 10)
+ +0x3196 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `optional` (id: 11)
+
+table (reflection.Field):
+ +0x3198 | 1C 00 00 00 | SOffset32 | 0x0000001C (28) Loc: +0x317C | offset to vtable
+ +0x319C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x319F | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x31A0 | 01 00 | uint16_t | 0x0001 (1) | table field `id` (UShort)
+ +0x31A2 | 08 00 | uint16_t | 0x0008 (8) | table field `offset` (UShort)
+ +0x31A4 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x31C4 | offset to field `name` (string)
+ +0x31A8 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x31B4 | offset to field `type` (table)
+ +0x31AC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x31B0 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x31B0 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x31B4 | FC F8 FF FF | SOffset32 | 0xFFFFF8FC (-1796) Loc: +0x38B8 | offset to vtable
+ +0x31B8 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x31BB | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x31BC | 06 00 00 00 | uint32_t | 0x00000006 (6) | table field `index` (Int)
+ +0x31C0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x31C4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x31C8 | 62 | char[1] | b | string literal
+ +0x31C9 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x31CA | 00 00 | uint8_t[2] | .. | padding
+
+vtable (reflection.Field):
+ +0x31CC | 1C 00 | uint16_t | 0x001C (28) | size of this vtable
+ +0x31CE | 14 00 | uint16_t | 0x0014 (20) | size of referring table
+ +0x31D0 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `name` (id: 0)
+ +0x31D2 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `type` (id: 1)
+ +0x31D4 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `id` (id: 2) <defaults to 0> (UShort)
+ +0x31D6 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `offset` (id: 3) <defaults to 0> (UShort)
+ +0x31D8 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x31DA | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x31DC | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x31DE | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x31E0 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `key` (id: 8) <defaults to 0> (Bool)
+ +0x31E2 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `attributes` (id: 9) <null> (Vector)
+ +0x31E4 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `documentation` (id: 10)
+ +0x31E6 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `optional` (id: 11)
+
+table (reflection.Field):
+ +0x31E8 | 1C 00 00 00 | SOffset32 | 0x0000001C (28) Loc: +0x31CC | offset to vtable
+ +0x31EC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x31EF | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x31F0 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x3210 | offset to field `name` (string)
+ +0x31F4 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x3200 | offset to field `type` (table)
+ +0x31F8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x31FC | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x31FC | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x3200 | 48 F9 FF FF | SOffset32 | 0xFFFFF948 (-1720) Loc: +0x38B8 | offset to vtable
+ +0x3204 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x3207 | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x3208 | 00 00 00 00 | uint32_t | 0x00000000 (0) | table field `index` (Int)
+ +0x320C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x3210 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x3214 | 61 | char[1] | a | string literal
+ +0x3215 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x3216 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Object):
+ +0x3218 | 38 F9 FF FF | SOffset32 | 0xFFFFF938 (-1736) Loc: +0x38E0 | offset to vtable
+ +0x321C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x321F | 01 | uint8_t | 0x01 (1) | table field `is_struct` (Bool)
+ +0x3220 | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x3248 | offset to field `name` (string)
+ +0x3224 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x323C | offset to field `fields` (vector)
+ +0x3228 | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `minalign` (Int)
+ +0x322C | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `bytesize` (Int)
+ +0x3230 | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x3238 | offset to field `documentation` (vector)
+ +0x3234 | 2C 05 00 00 | UOffset32 | 0x0000052C (1324) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Object.documentation):
+ +0x3238 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Object.fields):
+ +0x323C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x3240 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x3264 | offset to table[0]
+ +0x3244 | 6C 00 00 00 | UOffset32 | 0x0000006C (108) Loc: +0x32B0 | offset to table[1]
+
+string (reflection.Object.name):
+ +0x3248 | 16 00 00 00 | uint32_t | 0x00000016 (22) | length of string
+ +0x324C | 4D 79 47 61 6D 65 2E 45 | char[22] | MyGame.E | string literal
+ +0x3254 | 78 61 6D 70 6C 65 2E 41 | | xample.A
+ +0x325C | 62 69 6C 69 74 79 | | bility
+ +0x3262 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x3264 | CE FD FF FF | SOffset32 | 0xFFFFFDCE (-562) Loc: +0x3496 | offset to vtable
+ +0x3268 | 01 00 | uint16_t | 0x0001 (1) | table field `id` (UShort)
+ +0x326A | 04 00 | uint16_t | 0x0004 (4) | table field `offset` (UShort)
+ +0x326C | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x3288 | offset to field `name` (string)
+ +0x3270 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x327C | offset to field `type` (table)
+ +0x3274 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x3278 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x3278 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x327C | E0 F8 FF FF | SOffset32 | 0xFFFFF8E0 (-1824) Loc: +0x399C | offset to vtable
+ +0x3280 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x3283 | 08 | uint8_t | 0x08 (8) | table field `base_type` (Byte)
+ +0x3284 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x3288 | 08 00 00 00 | uint32_t | 0x00000008 (8) | length of string
+ +0x328C | 64 69 73 74 61 6E 63 65 | char[8] | distance | string literal
+ +0x3294 | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.Field):
+ +0x3296 | 1A 00 | uint16_t | 0x001A (26) | size of this vtable
+ +0x3298 | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x329A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `name` (id: 0)
+ +0x329C | 0C 00 | VOffset16 | 0x000C (12) | offset to field `type` (id: 1)
+ +0x329E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `id` (id: 2) <defaults to 0> (UShort)
+ +0x32A0 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `offset` (id: 3) <defaults to 0> (UShort)
+ +0x32A2 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x32A4 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x32A6 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x32A8 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x32AA | 07 00 | VOffset16 | 0x0007 (7) | offset to field `key` (id: 8)
+ +0x32AC | 10 00 | VOffset16 | 0x0010 (16) | offset to field `attributes` (id: 9)
+ +0x32AE | 14 00 | VOffset16 | 0x0014 (20) | offset to field `documentation` (id: 10)
+
+table (reflection.Field):
+ +0x32B0 | 1A 00 00 00 | SOffset32 | 0x0000001A (26) Loc: +0x3296 | offset to vtable
+ +0x32B4 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x32B7 | 01 | uint8_t | 0x01 (1) | table field `key` (Bool)
+ +0x32B8 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x32FC | offset to field `name` (string)
+ +0x32BC | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x32F0 | offset to field `type` (table)
+ +0x32C0 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x32CC | offset to field `attributes` (vector)
+ +0x32C4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x32C8 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x32C8 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Field.attributes):
+ +0x32CC | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x32D0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x32D4 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x32D4 | 70 FD FF FF | SOffset32 | 0xFFFFFD70 (-656) Loc: +0x3564 | offset to vtable
+ +0x32D8 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x32E8 | offset to field `key` (string)
+ +0x32DC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x32E0 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x32E0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x32E4 | 30 | char[1] | 0 | string literal
+ +0x32E5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x32E6 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x32E8 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x32EC | 6B 65 79 | char[3] | key | string literal
+ +0x32EF | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Type):
+ +0x32F0 | 54 F9 FF FF | SOffset32 | 0xFFFFF954 (-1708) Loc: +0x399C | offset to vtable
+ +0x32F4 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x32F7 | 08 | uint8_t | 0x08 (8) | table field `base_type` (Byte)
+ +0x32F8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x32FC | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of string
+ +0x3300 | 69 64 | char[2] | id | string literal
+ +0x3302 | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.Object):
+ +0x3304 | 14 00 | uint16_t | 0x0014 (20) | size of this vtable
+ +0x3306 | 24 00 | uint16_t | 0x0024 (36) | size of referring table
+ +0x3308 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `name` (id: 0)
+ +0x330A | 0C 00 | VOffset16 | 0x000C (12) | offset to field `fields` (id: 1)
+ +0x330C | 07 00 | VOffset16 | 0x0007 (7) | offset to field `is_struct` (id: 2)
+ +0x330E | 10 00 | VOffset16 | 0x0010 (16) | offset to field `minalign` (id: 3)
+ +0x3310 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `bytesize` (id: 4)
+ +0x3312 | 18 00 | VOffset16 | 0x0018 (24) | offset to field `attributes` (id: 5)
+ +0x3314 | 1C 00 | VOffset16 | 0x001C (28) | offset to field `documentation` (id: 6)
+ +0x3316 | 20 00 | VOffset16 | 0x0020 (32) | offset to field `declaration_file` (id: 7)
+
+table (reflection.Object):
+ +0x3318 | 14 00 00 00 | SOffset32 | 0x00000014 (20) Loc: +0x3304 | offset to vtable
+ +0x331C | 00 00 00 | uint8_t[3] | ... | padding
+ +0x331F | 01 | uint8_t | 0x01 (1) | table field `is_struct` (Bool)
+ +0x3320 | 68 00 00 00 | UOffset32 | 0x00000068 (104) Loc: +0x3388 | offset to field `name` (string)
+ +0x3324 | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x336C | offset to field `fields` (vector)
+ +0x3328 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `minalign` (Int)
+ +0x332C | 20 00 00 00 | uint32_t | 0x00000020 (32) | table field `bytesize` (Int)
+ +0x3330 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x3340 | offset to field `attributes` (vector)
+ +0x3334 | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x333C | offset to field `documentation` (vector)
+ +0x3338 | 28 04 00 00 | UOffset32 | 0x00000428 (1064) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Object.documentation):
+ +0x333C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Object.attributes):
+ +0x3340 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x3344 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x3348 | offset to table[0]
+
+table (reflection.KeyValue):
+ +0x3348 | E4 FD FF FF | SOffset32 | 0xFFFFFDE4 (-540) Loc: +0x3564 | offset to vtable
+ +0x334C | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x335C | offset to field `key` (string)
+ +0x3350 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x3354 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x3354 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x3358 | 38 | char[1] | 8 | string literal
+ +0x3359 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x335A | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x335C | 0B 00 00 00 | uint32_t | 0x0000000B (11) | length of string
+ +0x3360 | 66 6F 72 63 65 5F 61 6C | char[11] | force_al | string literal
+ +0x3368 | 69 67 6E | | ign
+ +0x336B | 00 | char | 0x00 (0) | string terminator
+
+vector (reflection.Object.fields):
+ +0x336C | 06 00 00 00 | uint32_t | 0x00000006 (6) | length of vector (# items)
+ +0x3370 | C4 00 00 00 | UOffset32 | 0x000000C4 (196) Loc: +0x3434 | offset to table[0]
+ +0x3374 | 84 00 00 00 | UOffset32 | 0x00000084 (132) Loc: +0x33F8 | offset to table[1]
+ +0x3378 | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x33C0 | offset to table[2]
+ +0x337C | 60 01 00 00 | UOffset32 | 0x00000160 (352) Loc: +0x34DC | offset to table[3]
+ +0x3380 | 30 01 00 00 | UOffset32 | 0x00000130 (304) Loc: +0x34B0 | offset to table[4]
+ +0x3384 | E4 00 00 00 | UOffset32 | 0x000000E4 (228) Loc: +0x3468 | offset to table[5]
+
+string (reflection.Object.name):
+ +0x3388 | 13 00 00 00 | uint32_t | 0x00000013 (19) | length of string
+ +0x338C | 4D 79 47 61 6D 65 2E 45 | char[19] | MyGame.E | string literal
+ +0x3394 | 78 61 6D 70 6C 65 2E 56 | | xample.V
+ +0x339C | 65 63 33 | | ec3
+ +0x339F | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x33A0 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (reflection.Field):
+ +0x33A2 | 1E 00 | uint16_t | 0x001E (30) | size of this vtable
+ +0x33A4 | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x33A6 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `name` (id: 0)
+ +0x33A8 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `type` (id: 1)
+ +0x33AA | 06 00 | VOffset16 | 0x0006 (6) | offset to field `id` (id: 2)
+ +0x33AC | 08 00 | VOffset16 | 0x0008 (8) | offset to field `offset` (id: 3)
+ +0x33AE | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x33B0 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x33B2 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x33B4 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x33B6 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `key` (id: 8) <defaults to 0> (Bool)
+ +0x33B8 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `attributes` (id: 9) <null> (Vector)
+ +0x33BA | 14 00 | VOffset16 | 0x0014 (20) | offset to field `documentation` (id: 10)
+ +0x33BC | 05 00 | VOffset16 | 0x0005 (5) | offset to field `optional` (id: 11)
+ +0x33BE | 0A 00 | VOffset16 | 0x000A (10) | offset to field `padding` (id: 12)
+
+table (reflection.Field):
+ +0x33C0 | 1E 00 00 00 | SOffset32 | 0x0000001E (30) Loc: +0x33A2 | offset to vtable
+ +0x33C4 | 00 | uint8_t[1] | . | padding
+ +0x33C5 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x33C6 | 05 00 | uint16_t | 0x0005 (5) | table field `id` (UShort)
+ +0x33C8 | 1A 00 | uint16_t | 0x001A (26) | table field `offset` (UShort)
+ +0x33CA | 02 00 | uint16_t | 0x0002 (2) | table field `padding` (UShort)
+ +0x33CC | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x33EC | offset to field `name` (string)
+ +0x33D0 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x33DC | offset to field `type` (table)
+ +0x33D4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x33D8 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x33D8 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x33DC | 24 FB FF FF | SOffset32 | 0xFFFFFB24 (-1244) Loc: +0x38B8 | offset to vtable
+ +0x33E0 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x33E3 | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x33E4 | 06 00 00 00 | uint32_t | 0x00000006 (6) | table field `index` (Int)
+ +0x33E8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x33EC | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x33F0 | 74 65 73 74 33 | char[5] | test3 | string literal
+ +0x33F5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x33F6 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x33F8 | 7A FD FF FF | SOffset32 | 0xFFFFFD7A (-646) Loc: +0x367E | offset to vtable
+ +0x33FC | 00 00 | uint8_t[2] | .. | padding
+ +0x33FE | 04 00 | uint16_t | 0x0004 (4) | table field `id` (UShort)
+ +0x3400 | 18 00 | uint16_t | 0x0018 (24) | table field `offset` (UShort)
+ +0x3402 | 01 00 | uint16_t | 0x0001 (1) | table field `padding` (UShort)
+ +0x3404 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x3428 | offset to field `name` (string)
+ +0x3408 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x3414 | offset to field `type` (table)
+ +0x340C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x3410 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x3410 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x3414 | 10 FE FF FF | SOffset32 | 0xFFFFFE10 (-496) Loc: +0x3604 | offset to vtable
+ +0x3418 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x341B | 04 | uint8_t | 0x04 (4) | table field `base_type` (Byte)
+ +0x341C | 03 00 00 00 | uint32_t | 0x00000003 (3) | table field `index` (Int)
+ +0x3420 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x3424 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x3428 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x342C | 74 65 73 74 32 | char[5] | test2 | string literal
+ +0x3431 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x3432 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x3434 | 9E FF FF FF | SOffset32 | 0xFFFFFF9E (-98) Loc: +0x3496 | offset to vtable
+ +0x3438 | 03 00 | uint16_t | 0x0003 (3) | table field `id` (UShort)
+ +0x343A | 10 00 | uint16_t | 0x0010 (16) | table field `offset` (UShort)
+ +0x343C | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x345C | offset to field `name` (string)
+ +0x3440 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x344C | offset to field `type` (table)
+ +0x3444 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x3448 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x3448 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x344C | 68 FD FF FF | SOffset32 | 0xFFFFFD68 (-664) Loc: +0x36E4 | offset to vtable
+ +0x3450 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x3453 | 0C | uint8_t | 0x0C (12) | table field `base_type` (Byte)
+ +0x3454 | 08 00 00 00 | uint32_t | 0x00000008 (8) | table field `base_size` (UInt)
+ +0x3458 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x345C | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x3460 | 74 65 73 74 31 | char[5] | test1 | string literal
+ +0x3465 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x3466 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x3468 | EA FD FF FF | SOffset32 | 0xFFFFFDEA (-534) Loc: +0x367E | offset to vtable
+ +0x346C | 00 00 | uint8_t[2] | .. | padding
+ +0x346E | 02 00 | uint16_t | 0x0002 (2) | table field `id` (UShort)
+ +0x3470 | 08 00 | uint16_t | 0x0008 (8) | table field `offset` (UShort)
+ +0x3472 | 04 00 | uint16_t | 0x0004 (4) | table field `padding` (UShort)
+ +0x3474 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x3490 | offset to field `name` (string)
+ +0x3478 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x3484 | offset to field `type` (table)
+ +0x347C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x3480 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x3480 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x3484 | E8 FA FF FF | SOffset32 | 0xFFFFFAE8 (-1304) Loc: +0x399C | offset to vtable
+ +0x3488 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x348B | 0B | uint8_t | 0x0B (11) | table field `base_type` (Byte)
+ +0x348C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x3490 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x3494 | 7A | char[1] | z | string literal
+ +0x3495 | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.Field):
+ +0x3496 | 1A 00 | uint16_t | 0x001A (26) | size of this vtable
+ +0x3498 | 14 00 | uint16_t | 0x0014 (20) | size of referring table
+ +0x349A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `name` (id: 0)
+ +0x349C | 0C 00 | VOffset16 | 0x000C (12) | offset to field `type` (id: 1)
+ +0x349E | 04 00 | VOffset16 | 0x0004 (4) | offset to field `id` (id: 2)
+ +0x34A0 | 06 00 | VOffset16 | 0x0006 (6) | offset to field `offset` (id: 3)
+ +0x34A2 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x34A4 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x34A6 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x34A8 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x34AA | 00 00 | VOffset16 | 0x0000 (0) | offset to field `key` (id: 8) <defaults to 0> (Bool)
+ +0x34AC | 00 00 | VOffset16 | 0x0000 (0) | offset to field `attributes` (id: 9) <null> (Vector)
+ +0x34AE | 10 00 | VOffset16 | 0x0010 (16) | offset to field `documentation` (id: 10)
+
+table (reflection.Field):
+ +0x34B0 | 1A 00 00 00 | SOffset32 | 0x0000001A (26) Loc: +0x3496 | offset to vtable
+ +0x34B4 | 01 00 | uint16_t | 0x0001 (1) | table field `id` (UShort)
+ +0x34B6 | 04 00 | uint16_t | 0x0004 (4) | table field `offset` (UShort)
+ +0x34B8 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x34D4 | offset to field `name` (string)
+ +0x34BC | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x34C8 | offset to field `type` (table)
+ +0x34C0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x34C4 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x34C4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x34C8 | 2C FB FF FF | SOffset32 | 0xFFFFFB2C (-1236) Loc: +0x399C | offset to vtable
+ +0x34CC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x34CF | 0B | uint8_t | 0x0B (11) | table field `base_type` (Byte)
+ +0x34D0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x34D4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x34D8 | 79 | char[1] | y | string literal
+ +0x34D9 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x34DA | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x34DC | 6E FB FF FF | SOffset32 | 0xFFFFFB6E (-1170) Loc: +0x396E | offset to vtable
+ +0x34E0 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x34FC | offset to field `name` (string)
+ +0x34E4 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x34F0 | offset to field `type` (table)
+ +0x34E8 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x34EC | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x34EC | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x34F0 | 54 FB FF FF | SOffset32 | 0xFFFFFB54 (-1196) Loc: +0x399C | offset to vtable
+ +0x34F4 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x34F7 | 0B | uint8_t | 0x0B (11) | table field `base_type` (Byte)
+ +0x34F8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x34FC | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x3500 | 78 | char[1] | x | string literal
+ +0x3501 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x3502 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (reflection.Object):
+ +0x3504 | 14 00 | uint16_t | 0x0014 (20) | size of this vtable
+ +0x3506 | 1C 00 | uint16_t | 0x001C (28) | size of referring table
+ +0x3508 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `name` (id: 0)
+ +0x350A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `fields` (id: 1)
+ +0x350C | 00 00 | VOffset16 | 0x0000 (0) | offset to field `is_struct` (id: 2) <defaults to 0> (Bool)
+ +0x350E | 0C 00 | VOffset16 | 0x000C (12) | offset to field `minalign` (id: 3)
+ +0x3510 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `bytesize` (id: 4) <defaults to 0> (Int)
+ +0x3512 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `attributes` (id: 5)
+ +0x3514 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `documentation` (id: 6)
+ +0x3516 | 18 00 | VOffset16 | 0x0018 (24) | offset to field `declaration_file` (id: 7)
+
+table (reflection.Object):
+ +0x3518 | 14 00 00 00 | SOffset32 | 0x00000014 (20) Loc: +0x3504 | offset to vtable
+ +0x351C | 80 00 00 00 | UOffset32 | 0x00000080 (128) Loc: +0x359C | offset to field `name` (string)
+ +0x3520 | 74 00 00 00 | UOffset32 | 0x00000074 (116) Loc: +0x3594 | offset to field `fields` (vector)
+ +0x3524 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `minalign` (Int)
+ +0x3528 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x3538 | offset to field `attributes` (vector)
+ +0x352C | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x3534 | offset to field `documentation` (vector)
+ +0x3530 | 30 02 00 00 | UOffset32 | 0x00000230 (560) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Object.documentation):
+ +0x3534 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Object.attributes):
+ +0x3538 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x353C | 30 00 00 00 | UOffset32 | 0x00000030 (48) Loc: +0x356C | offset to table[0]
+ +0x3540 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x3544 | offset to table[1]
+
+table (reflection.KeyValue):
+ +0x3544 | E0 FF FF FF | SOffset32 | 0xFFFFFFE0 (-32) Loc: +0x3564 | offset to vtable
+ +0x3548 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x3558 | offset to field `key` (string)
+ +0x354C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x3550 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x3550 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x3554 | 30 | char[1] | 0 | string literal
+ +0x3555 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x3556 | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x3558 | 07 00 00 00 | uint32_t | 0x00000007 (7) | length of string
+ +0x355C | 70 72 69 76 61 74 65 | char[7] | private | string literal
+ +0x3563 | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.KeyValue):
+ +0x3564 | 08 00 | uint16_t | 0x0008 (8) | size of this vtable
+ +0x3566 | 0C 00 | uint16_t | 0x000C (12) | size of referring table
+ +0x3568 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `key` (id: 0)
+ +0x356A | 08 00 | VOffset16 | 0x0008 (8) | offset to field `value` (id: 1)
+
+table (reflection.KeyValue):
+ +0x356C | 08 00 00 00 | SOffset32 | 0x00000008 (8) Loc: +0x3564 | offset to vtable
+ +0x3570 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x3580 | offset to field `key` (string)
+ +0x3574 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x3578 | offset to field `value` (string)
+
+string (reflection.KeyValue.value):
+ +0x3578 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x357C | 30 | char[1] | 0 | string literal
+ +0x357D | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x357E | 00 00 | uint8_t[2] | .. | padding
+
+string (reflection.KeyValue.key):
+ +0x3580 | 0E 00 00 00 | uint32_t | 0x0000000E (14) | length of string
+ +0x3584 | 63 73 68 61 72 70 5F 70 | char[14] | csharp_p | string literal
+ +0x358C | 61 72 74 69 61 6C | | artial
+ +0x3592 | 00 | char | 0x00 (0) | string terminator
+
+vector (reflection.Object.fields):
+ +0x3594 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x3598 | 4C 00 00 00 | UOffset32 | 0x0000004C (76) Loc: +0x35E4 | offset to table[0]
+
+string (reflection.Object.name):
+ +0x359C | 26 00 00 00 | uint32_t | 0x00000026 (38) | length of string
+ +0x35A0 | 4D 79 47 61 6D 65 2E 45 | char[38] | MyGame.E | string literal
+ +0x35A8 | 78 61 6D 70 6C 65 2E 54 | | xample.T
+ +0x35B0 | 65 73 74 53 69 6D 70 6C | | estSimpl
+ +0x35B8 | 65 54 61 62 6C 65 57 69 | | eTableWi
+ +0x35C0 | 74 68 45 6E 75 6D | | thEnum
+ +0x35C6 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x35C7 | 00 00 00 | uint8_t[3] | ... | padding
+
+vtable (reflection.Field):
+ +0x35CA | 1A 00 | uint16_t | 0x001A (26) | size of this vtable
+ +0x35CC | 1C 00 | uint16_t | 0x001C (28) | size of referring table
+ +0x35CE | 08 00 | VOffset16 | 0x0008 (8) | offset to field `name` (id: 0)
+ +0x35D0 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `type` (id: 1)
+ +0x35D2 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `id` (id: 2) <defaults to 0> (UShort)
+ +0x35D4 | 06 00 | VOffset16 | 0x0006 (6) | offset to field `offset` (id: 3)
+ +0x35D6 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `default_integer` (id: 4)
+ +0x35D8 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x35DA | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x35DC | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x35DE | 00 00 | VOffset16 | 0x0000 (0) | offset to field `key` (id: 8) <defaults to 0> (Bool)
+ +0x35E0 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `attributes` (id: 9) <null> (Vector)
+ +0x35E2 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `documentation` (id: 10)
+
+table (reflection.Field):
+ +0x35E4 | 1A 00 00 00 | SOffset32 | 0x0000001A (26) Loc: +0x35CA | offset to vtable
+ +0x35E8 | 00 00 | uint8_t[2] | .. | padding
+ +0x35EA | 04 00 | uint16_t | 0x0004 (4) | table field `offset` (UShort)
+ +0x35EC | 3C 00 00 00 | UOffset32 | 0x0000003C (60) Loc: +0x3628 | offset to field `name` (string)
+ +0x35F0 | 24 00 00 00 | UOffset32 | 0x00000024 (36) Loc: +0x3614 | offset to field `type` (table)
+ +0x35F4 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x3600 | offset to field `documentation` (vector)
+ +0x35F8 | 02 00 00 00 00 00 00 00 | int64_t | 0x0000000000000002 (2) | table field `default_integer` (Long)
+
+vector (reflection.Field.documentation):
+ +0x3600 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vtable (reflection.Type):
+ +0x3604 | 10 00 | uint16_t | 0x0010 (16) | size of this vtable
+ +0x3606 | 14 00 | uint16_t | 0x0014 (20) | size of referring table
+ +0x3608 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `base_type` (id: 0)
+ +0x360A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `element` (id: 1) <defaults to 0> (Byte)
+ +0x360C | 08 00 | VOffset16 | 0x0008 (8) | offset to field `index` (id: 2)
+ +0x360E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `fixed_length` (id: 3) <defaults to 0> (UShort)
+ +0x3610 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `base_size` (id: 4)
+ +0x3612 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `element_size` (id: 5)
+
+table (reflection.Type):
+ +0x3614 | 10 00 00 00 | SOffset32 | 0x00000010 (16) Loc: +0x3604 | offset to vtable
+ +0x3618 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x361B | 04 | uint8_t | 0x04 (4) | table field `base_type` (Byte)
+ +0x361C | 03 00 00 00 | uint32_t | 0x00000003 (3) | table field `index` (Int)
+ +0x3620 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x3624 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x3628 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x362C | 63 6F 6C 6F 72 | char[5] | color | string literal
+ +0x3631 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x3632 | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Object):
+ +0x3634 | 54 FD FF FF | SOffset32 | 0xFFFFFD54 (-684) Loc: +0x38E0 | offset to vtable
+ +0x3638 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x363B | 01 | uint8_t | 0x01 (1) | table field `is_struct` (Bool)
+ +0x363C | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x3664 | offset to field `name` (string)
+ +0x3640 | 18 00 00 00 | UOffset32 | 0x00000018 (24) Loc: +0x3658 | offset to field `fields` (vector)
+ +0x3644 | 02 00 00 00 | uint32_t | 0x00000002 (2) | table field `minalign` (Int)
+ +0x3648 | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `bytesize` (Int)
+ +0x364C | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x3654 | offset to field `documentation` (vector)
+ +0x3650 | 10 01 00 00 | UOffset32 | 0x00000110 (272) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Object.documentation):
+ +0x3654 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Object.fields):
+ +0x3658 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x365C | 74 00 00 00 | UOffset32 | 0x00000074 (116) Loc: +0x36D0 | offset to table[0]
+ +0x3660 | 3C 00 00 00 | UOffset32 | 0x0000003C (60) Loc: +0x369C | offset to table[1]
+
+string (reflection.Object.name):
+ +0x3664 | 13 00 00 00 | uint32_t | 0x00000013 (19) | length of string
+ +0x3668 | 4D 79 47 61 6D 65 2E 45 | char[19] | MyGame.E | string literal
+ +0x3670 | 78 61 6D 70 6C 65 2E 54 | | xample.T
+ +0x3678 | 65 73 74 | | est
+ +0x367B | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x367C | 00 00 | uint8_t[2] | .. | padding
+
+vtable (reflection.Field):
+ +0x367E | 1E 00 | uint16_t | 0x001E (30) | size of this vtable
+ +0x3680 | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x3682 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `name` (id: 0)
+ +0x3684 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `type` (id: 1)
+ +0x3686 | 06 00 | VOffset16 | 0x0006 (6) | offset to field `id` (id: 2)
+ +0x3688 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `offset` (id: 3)
+ +0x368A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x368C | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x368E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x3690 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x3692 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `key` (id: 8) <defaults to 0> (Bool)
+ +0x3694 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `attributes` (id: 9) <null> (Vector)
+ +0x3696 | 14 00 | VOffset16 | 0x0014 (20) | offset to field `documentation` (id: 10)
+ +0x3698 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `optional` (id: 11) <defaults to 0> (Bool)
+ +0x369A | 0A 00 | VOffset16 | 0x000A (10) | offset to field `padding` (id: 12)
+
+table (reflection.Field):
+ +0x369C | 1E 00 00 00 | SOffset32 | 0x0000001E (30) Loc: +0x367E | offset to vtable
+ +0x36A0 | 00 00 | uint8_t[2] | .. | padding
+ +0x36A2 | 01 00 | uint16_t | 0x0001 (1) | table field `id` (UShort)
+ +0x36A4 | 02 00 | uint16_t | 0x0002 (2) | table field `offset` (UShort)
+ +0x36A6 | 01 00 | uint16_t | 0x0001 (1) | table field `padding` (UShort)
+ +0x36A8 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x36C8 | offset to field `name` (string)
+ +0x36AC | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x36B8 | offset to field `type` (table)
+ +0x36B0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x36B4 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x36B4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x36B8 | D4 FF FF FF | SOffset32 | 0xFFFFFFD4 (-44) Loc: +0x36E4 | offset to vtable
+ +0x36BC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x36BF | 03 | uint8_t | 0x03 (3) | table field `base_type` (Byte)
+ +0x36C0 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `base_size` (UInt)
+ +0x36C4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x36C8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x36CC | 62 | char[1] | b | string literal
+ +0x36CD | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x36CE | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Field):
+ +0x36D0 | 62 FD FF FF | SOffset32 | 0xFFFFFD62 (-670) Loc: +0x396E | offset to vtable
+ +0x36D4 | 30 00 00 00 | UOffset32 | 0x00000030 (48) Loc: +0x3704 | offset to field `name` (string)
+ +0x36D8 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x36F4 | offset to field `type` (table)
+ +0x36DC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x36E0 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x36E0 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vtable (reflection.Type):
+ +0x36E4 | 10 00 | uint16_t | 0x0010 (16) | size of this vtable
+ +0x36E6 | 10 00 | uint16_t | 0x0010 (16) | size of referring table
+ +0x36E8 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `base_type` (id: 0)
+ +0x36EA | 00 00 | VOffset16 | 0x0000 (0) | offset to field `element` (id: 1) <defaults to 0> (Byte)
+ +0x36EC | 00 00 | VOffset16 | 0x0000 (0) | offset to field `index` (id: 2) <defaults to -1> (Int)
+ +0x36EE | 00 00 | VOffset16 | 0x0000 (0) | offset to field `fixed_length` (id: 3) <defaults to 0> (UShort)
+ +0x36F0 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `base_size` (id: 4)
+ +0x36F2 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `element_size` (id: 5)
+
+table (reflection.Type):
+ +0x36F4 | 10 00 00 00 | SOffset32 | 0x00000010 (16) Loc: +0x36E4 | offset to vtable
+ +0x36F8 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x36FB | 05 | uint8_t | 0x05 (5) | table field `base_type` (Byte)
+ +0x36FC | 02 00 00 00 | uint32_t | 0x00000002 (2) | table field `base_size` (UInt)
+ +0x3700 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x3704 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x3708 | 61 | char[1] | a | string literal
+ +0x3709 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x370A | 00 00 | uint8_t[2] | .. | padding
+
+table (reflection.Object):
+ +0x370C | E4 FE FF FF | SOffset32 | 0xFFFFFEE4 (-284) Loc: +0x3828 | offset to vtable
+ +0x3710 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x372C | offset to field `name` (string)
+ +0x3714 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x3728 | offset to field `fields` (vector)
+ +0x3718 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `minalign` (Int)
+ +0x371C | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x3724 | offset to field `documentation` (vector)
+ +0x3720 | 40 00 00 00 | UOffset32 | 0x00000040 (64) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+vector (reflection.Object.documentation):
+ +0x3724 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Object.fields):
+ +0x3728 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+string (reflection.Object.name):
+ +0x372C | 17 00 00 00 | uint32_t | 0x00000017 (23) | length of string
+ +0x3730 | 4D 79 47 61 6D 65 2E 45 | char[23] | MyGame.E | string literal
+ +0x3738 | 78 61 6D 70 6C 65 32 2E | | xample2.
+ +0x3740 | 4D 6F 6E 73 74 65 72 | | Monster
+ +0x3747 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Object):
+ +0x3748 | 20 FF FF FF | SOffset32 | 0xFFFFFF20 (-224) Loc: +0x3828 | offset to vtable
+ +0x374C | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x3780 | offset to field `name` (string)
+ +0x3750 | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x377C | offset to field `fields` (vector)
+ +0x3754 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `minalign` (Int)
+ +0x3758 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x3778 | offset to field `documentation` (vector)
+ +0x375C | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x3760 | offset to field `declaration_file` (string)
+
+string (reflection.Object.declaration_file):
+ +0x3760 | 12 00 00 00 | uint32_t | 0x00000012 (18) | length of string
+ +0x3764 | 2F 2F 6D 6F 6E 73 74 65 | char[18] | //monste | string literal
+ +0x376C | 72 5F 74 65 73 74 2E 66 | | r_test.f
+ +0x3774 | 62 73 | | bs
+ +0x3776 | 00 | char | 0x00 (0) | string terminator
+
+vector (reflection.Object.documentation):
+ +0x3778 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Object.fields):
+ +0x377C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+string (reflection.Object.name):
+ +0x3780 | 18 00 00 00 | uint32_t | 0x00000018 (24) | length of string
+ +0x3784 | 4D 79 47 61 6D 65 2E 49 | char[24] | MyGame.I | string literal
+ +0x378C | 6E 50 61 72 65 6E 74 4E | | nParentN
+ +0x3794 | 61 6D 65 73 70 61 63 65 | | amespace
+ +0x379C | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x379D | 00 00 00 | uint8_t[3] | ... | padding
+
+table (reflection.Object):
+ +0x37A0 | 78 FF FF FF | SOffset32 | 0xFFFFFF78 (-136) Loc: +0x3828 | offset to vtable
+ +0x37A4 | 48 00 00 00 | UOffset32 | 0x00000048 (72) Loc: +0x37EC | offset to field `name` (string)
+ +0x37A8 | 3C 00 00 00 | UOffset32 | 0x0000003C (60) Loc: +0x37E4 | offset to field `fields` (vector)
+ +0x37AC | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `minalign` (Int)
+ +0x37B0 | 30 00 00 00 | UOffset32 | 0x00000030 (48) Loc: +0x37E0 | offset to field `documentation` (vector)
+ +0x37B4 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x37B8 | offset to field `declaration_file` (string)
+
+string (reflection.Object.declaration_file):
+ +0x37B8 | 20 00 00 00 | uint32_t | 0x00000020 (32) | length of string
+ +0x37BC | 2F 2F 69 6E 63 6C 75 64 | char[32] | //includ | string literal
+ +0x37C4 | 65 5F 74 65 73 74 2F 69 | | e_test/i
+ +0x37CC | 6E 63 6C 75 64 65 5F 74 | | nclude_t
+ +0x37D4 | 65 73 74 31 2E 66 62 73 | | est1.fbs
+ +0x37DC | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x37DD | 00 00 00 | uint8_t[3] | ... | padding
+
+vector (reflection.Object.documentation):
+ +0x37E0 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Object.fields):
+ +0x37E4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x37E8 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x37F8 | offset to table[0]
+
+string (reflection.Object.name):
+ +0x37EC | 06 00 00 00 | uint32_t | 0x00000006 (6) | length of string
+ +0x37F0 | 54 61 62 6C 65 41 | char[6] | TableA | string literal
+ +0x37F6 | 00 | char | 0x00 (0) | string terminator
+
+table (reflection.Field):
+ +0x37F8 | 74 FF FF FF | SOffset32 | 0xFFFFFF74 (-140) Loc: +0x3884 | offset to vtable
+ +0x37FC | 00 | uint8_t[1] | . | padding
+ +0x37FD | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x37FE | 04 00 | uint16_t | 0x0004 (4) | table field `offset` (UShort)
+ +0x3800 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x3820 | offset to field `name` (string)
+ +0x3804 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x3810 | offset to field `type` (table)
+ +0x3808 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x380C | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x380C | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+table (reflection.Type):
+ +0x3810 | 58 FF FF FF | SOffset32 | 0xFFFFFF58 (-168) Loc: +0x38B8 | offset to vtable
+ +0x3814 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x3817 | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x3818 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | table field `index` (Int)
+ +0x381C | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x3820 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x3824 | 62 | char[1] | b | string literal
+ +0x3825 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x3826 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (reflection.Object):
+ +0x3828 | 14 00 | uint16_t | 0x0014 (20) | size of this vtable
+ +0x382A | 18 00 | uint16_t | 0x0018 (24) | size of referring table
+ +0x382C | 04 00 | VOffset16 | 0x0004 (4) | offset to field `name` (id: 0)
+ +0x382E | 08 00 | VOffset16 | 0x0008 (8) | offset to field `fields` (id: 1)
+ +0x3830 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `is_struct` (id: 2) <defaults to 0> (Bool)
+ +0x3832 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `minalign` (id: 3)
+ +0x3834 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `bytesize` (id: 4) <defaults to 0> (Int)
+ +0x3836 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `attributes` (id: 5) <null> (Vector)
+ +0x3838 | 10 00 | VOffset16 | 0x0010 (16) | offset to field `documentation` (id: 6)
+ +0x383A | 14 00 | VOffset16 | 0x0014 (20) | offset to field `declaration_file` (id: 7)
+
+table (reflection.Object):
+ +0x383C | 14 00 00 00 | SOffset32 | 0x00000014 (20) Loc: +0x3828 | offset to vtable
+ +0x3840 | 20 00 00 00 | UOffset32 | 0x00000020 (32) Loc: +0x3860 | offset to field `name` (string)
+ +0x3844 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x3858 | offset to field `fields` (vector)
+ +0x3848 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `minalign` (Int)
+ +0x384C | 08 00 00 00 | UOffset32 | 0x00000008 (8) Loc: +0x3854 | offset to field `documentation` (vector)
+ +0x3850 | C4 00 00 00 | UOffset32 | 0x000000C4 (196) Loc: +0x3914 | offset to field `declaration_file` (string)
+
+vector (reflection.Object.documentation):
+ +0x3854 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Object.fields):
+ +0x3858 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x385C | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x38A0 | offset to table[0]
+
+string (reflection.Object.name):
+ +0x3860 | 1C 00 00 00 | uint32_t | 0x0000001C (28) | length of string
+ +0x3864 | 4D 79 47 61 6D 65 2E 4F | char[28] | MyGame.O | string literal
+ +0x386C | 74 68 65 72 4E 61 6D 65 | | therName
+ +0x3874 | 53 70 61 63 65 2E 54 61 | | Space.Ta
+ +0x387C | 62 6C 65 42 | | bleB
+ +0x3880 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x3881 | 00 00 00 | uint8_t[3] | ... | padding
+
+vtable (reflection.Field):
+ +0x3884 | 1C 00 | uint16_t | 0x001C (28) | size of this vtable
+ +0x3886 | 14 00 | uint16_t | 0x0014 (20) | size of referring table
+ +0x3888 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `name` (id: 0)
+ +0x388A | 0C 00 | VOffset16 | 0x000C (12) | offset to field `type` (id: 1)
+ +0x388C | 00 00 | VOffset16 | 0x0000 (0) | offset to field `id` (id: 2) <defaults to 0> (UShort)
+ +0x388E | 06 00 | VOffset16 | 0x0006 (6) | offset to field `offset` (id: 3)
+ +0x3890 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x3892 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x3894 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x3896 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x3898 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `key` (id: 8) <defaults to 0> (Bool)
+ +0x389A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `attributes` (id: 9) <null> (Vector)
+ +0x389C | 10 00 | VOffset16 | 0x0010 (16) | offset to field `documentation` (id: 10)
+ +0x389E | 05 00 | VOffset16 | 0x0005 (5) | offset to field `optional` (id: 11)
+
+table (reflection.Field):
+ +0x38A0 | 1C 00 00 00 | SOffset32 | 0x0000001C (28) Loc: +0x3884 | offset to vtable
+ +0x38A4 | 00 | uint8_t[1] | . | padding
+ +0x38A5 | 01 | uint8_t | 0x01 (1) | table field `optional` (Bool)
+ +0x38A6 | 04 00 | uint16_t | 0x0004 (4) | table field `offset` (UShort)
+ +0x38A8 | 30 00 00 00 | UOffset32 | 0x00000030 (48) Loc: +0x38D8 | offset to field `name` (string)
+ +0x38AC | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x38C8 | offset to field `type` (table)
+ +0x38B0 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x38B4 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x38B4 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vtable (reflection.Type):
+ +0x38B8 | 10 00 | uint16_t | 0x0010 (16) | size of this vtable
+ +0x38BA | 10 00 | uint16_t | 0x0010 (16) | size of referring table
+ +0x38BC | 07 00 | VOffset16 | 0x0007 (7) | offset to field `base_type` (id: 0)
+ +0x38BE | 00 00 | VOffset16 | 0x0000 (0) | offset to field `element` (id: 1) <defaults to 0> (Byte)
+ +0x38C0 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `index` (id: 2)
+ +0x38C2 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `fixed_length` (id: 3) <defaults to 0> (UShort)
+ +0x38C4 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `base_size` (id: 4) <defaults to 4> (UInt)
+ +0x38C6 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `element_size` (id: 5)
+
+table (reflection.Type):
+ +0x38C8 | 10 00 00 00 | SOffset32 | 0x00000010 (16) Loc: +0x38B8 | offset to vtable
+ +0x38CC | 00 00 00 | uint8_t[3] | ... | padding
+ +0x38CF | 0F | uint8_t | 0x0F (15) | table field `base_type` (Byte)
+ +0x38D0 | 0E 00 00 00 | uint32_t | 0x0000000E (14) | table field `index` (Int)
+ +0x38D4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x38D8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x38DC | 61 | char[1] | a | string literal
+ +0x38DD | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x38DE | 00 00 | uint8_t[2] | .. | padding
+
+vtable (reflection.Object):
+ +0x38E0 | 14 00 | uint16_t | 0x0014 (20) | size of this vtable
+ +0x38E2 | 20 00 | uint16_t | 0x0020 (32) | size of referring table
+ +0x38E4 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `name` (id: 0)
+ +0x38E6 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `fields` (id: 1)
+ +0x38E8 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `is_struct` (id: 2)
+ +0x38EA | 10 00 | VOffset16 | 0x0010 (16) | offset to field `minalign` (id: 3)
+ +0x38EC | 14 00 | VOffset16 | 0x0014 (20) | offset to field `bytesize` (id: 4)
+ +0x38EE | 00 00 | VOffset16 | 0x0000 (0) | offset to field `attributes` (id: 5) <null> (Vector)
+ +0x38F0 | 18 00 | VOffset16 | 0x0018 (24) | offset to field `documentation` (id: 6)
+ +0x38F2 | 1C 00 | VOffset16 | 0x001C (28) | offset to field `declaration_file` (id: 7)
+
+table (reflection.Object):
+ +0x38F4 | 14 00 00 00 | SOffset32 | 0x00000014 (20) Loc: +0x38E0 | offset to vtable
+ +0x38F8 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x38FB | 01 | uint8_t | 0x01 (1) | table field `is_struct` (Bool)
+ +0x38FC | 50 00 00 00 | UOffset32 | 0x00000050 (80) Loc: +0x394C | offset to field `name` (string)
+ +0x3900 | 44 00 00 00 | UOffset32 | 0x00000044 (68) Loc: +0x3944 | offset to field `fields` (vector)
+ +0x3904 | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `minalign` (Int)
+ +0x3908 | 04 00 00 00 | uint32_t | 0x00000004 (4) | table field `bytesize` (Int)
+ +0x390C | 34 00 00 00 | UOffset32 | 0x00000034 (52) Loc: +0x3940 | offset to field `documentation` (vector)
+ +0x3910 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x3914 | offset to field `declaration_file` (string)
+
+string (reflection.Object.declaration_file):
+ +0x3914 | 24 00 00 00 | uint32_t | 0x00000024 (36) | length of string
+ +0x3918 | 2F 2F 69 6E 63 6C 75 64 | char[36] | //includ | string literal
+ +0x3920 | 65 5F 74 65 73 74 2F 73 | | e_test/s
+ +0x3928 | 75 62 2F 69 6E 63 6C 75 | | ub/inclu
+ +0x3930 | 64 65 5F 74 65 73 74 32 | | de_test2
+ +0x3938 | 2E 66 62 73 | | .fbs
+ +0x393C | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x393D | 00 00 00 | uint8_t[3] | ... | padding
+
+vector (reflection.Object.documentation):
+ +0x3940 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vector (reflection.Object.fields):
+ +0x3944 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of vector (# items)
+ +0x3948 | 40 00 00 00 | UOffset32 | 0x00000040 (64) Loc: +0x3988 | offset to table[0]
+
+string (reflection.Object.name):
+ +0x394C | 1C 00 00 00 | uint32_t | 0x0000001C (28) | length of string
+ +0x3950 | 4D 79 47 61 6D 65 2E 4F | char[28] | MyGame.O | string literal
+ +0x3958 | 74 68 65 72 4E 61 6D 65 | | therName
+ +0x3960 | 53 70 61 63 65 2E 55 6E | | Space.Un
+ +0x3968 | 75 73 65 64 | | used
+ +0x396C | 00 | char | 0x00 (0) | string terminator
+
+vtable (reflection.Field):
+ +0x396E | 1A 00 | uint16_t | 0x001A (26) | size of this vtable
+ +0x3970 | 10 00 | uint16_t | 0x0010 (16) | size of referring table
+ +0x3972 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `name` (id: 0)
+ +0x3974 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `type` (id: 1)
+ +0x3976 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `id` (id: 2) <defaults to 0> (UShort)
+ +0x3978 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `offset` (id: 3) <defaults to 0> (UShort)
+ +0x397A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_integer` (id: 4) <defaults to 0> (Long)
+ +0x397C | 00 00 | VOffset16 | 0x0000 (0) | offset to field `default_real` (id: 5) <defaults to 0.000000> (Double)
+ +0x397E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `deprecated` (id: 6) <defaults to 0> (Bool)
+ +0x3980 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `required` (id: 7) <defaults to 0> (Bool)
+ +0x3982 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `key` (id: 8) <defaults to 0> (Bool)
+ +0x3984 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `attributes` (id: 9) <null> (Vector)
+ +0x3986 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `documentation` (id: 10)
+
+table (reflection.Field):
+ +0x3988 | 1A 00 00 00 | SOffset32 | 0x0000001A (26) Loc: +0x396E | offset to vtable
+ +0x398C | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x39B8 | offset to field `name` (string)
+ +0x3990 | 1C 00 00 00 | UOffset32 | 0x0000001C (28) Loc: +0x39AC | offset to field `type` (table)
+ +0x3994 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x3998 | offset to field `documentation` (vector)
+
+vector (reflection.Field.documentation):
+ +0x3998 | 00 00 00 00 | uint32_t | 0x00000000 (0) | length of vector (# items)
+
+vtable (reflection.Type):
+ +0x399C | 10 00 | uint16_t | 0x0010 (16) | size of this vtable
+ +0x399E | 0C 00 | uint16_t | 0x000C (12) | size of referring table
+ +0x39A0 | 07 00 | VOffset16 | 0x0007 (7) | offset to field `base_type` (id: 0)
+ +0x39A2 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `element` (id: 1) <defaults to 0> (Byte)
+ +0x39A4 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `index` (id: 2) <defaults to -1> (Int)
+ +0x39A6 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `fixed_length` (id: 3) <defaults to 0> (UShort)
+ +0x39A8 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `base_size` (id: 4) <defaults to 4> (UInt)
+ +0x39AA | 08 00 | VOffset16 | 0x0008 (8) | offset to field `element_size` (id: 5)
+
+table (reflection.Type):
+ +0x39AC | 10 00 00 00 | SOffset32 | 0x00000010 (16) Loc: +0x399C | offset to vtable
+ +0x39B0 | 00 00 00 | uint8_t[3] | ... | padding
+ +0x39B3 | 07 | uint8_t | 0x07 (7) | table field `base_type` (Byte)
+ +0x39B4 | 01 00 00 00 | uint32_t | 0x00000001 (1) | table field `element_size` (UInt)
+
+string (reflection.Field.name):
+ +0x39B8 | 01 00 00 00 | uint32_t | 0x00000001 (1) | length of string
+ +0x39BC | 61 | char[1] | a | string literal
+ +0x39BD | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x39BE | 00 00 | uint8_t[2] | .. | padding
diff --git a/tests/monster_test.bfbs b/tests/monster_test.bfbs
index 0eb130a..d389aab 100644
--- a/tests/monster_test.bfbs
+++ b/tests/monster_test.bfbs
Binary files differ
diff --git a/tests/monster_test.cpp b/tests/monster_test.cpp
new file mode 100644
index 0000000..4fc9e14
--- /dev/null
+++ b/tests/monster_test.cpp
@@ -0,0 +1,845 @@
+#include "monster_test.h"
+
+#include <vector>
+
+#include "flatbuffers/flatbuffer_builder.h"
+#include "flatbuffers/idl.h"
+#include "flatbuffers/registry.h"
+#include "flatbuffers/verifier.h"
+#include "is_quiet_nan.h"
+#include "monster_extra_generated.h"
+#include "monster_test_generated.h"
+#include "test_assert.h"
+
+namespace flatbuffers {
+namespace tests {
+
+// Shortcuts for the infinity.
+static const auto infinity_f = std::numeric_limits<float>::infinity();
+static const auto infinity_d = std::numeric_limits<double>::infinity();
+
+using namespace MyGame::Example;
+
+// example of how to build up a serialized buffer algorithmically:
+flatbuffers::DetachedBuffer CreateFlatBufferTest(std::string &buffer) {
+ flatbuffers::FlatBufferBuilder builder;
+
+ auto vec = Vec3(1, 2, 3, 0, Color_Red, Test(10, 20));
+
+ auto name = builder.CreateString("MyMonster");
+
+ // Use the initializer_list specialization of CreateVector.
+ auto inventory =
+ builder.CreateVector<uint8_t>({ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 });
+
+ // Alternatively, create the vector first, and fill in data later:
+ // unsigned char *inv_buf = nullptr;
+ // auto inventory = builder.CreateUninitializedVector<unsigned char>(
+ // 10, &inv_buf);
+ // memcpy(inv_buf, inv_data, 10);
+
+ Test tests[] = { Test(10, 20), Test(30, 40) };
+ auto testv = builder.CreateVectorOfStructs(tests, 2);
+
+ // Create a vector of structures from a lambda.
+ auto testv2 = builder.CreateVectorOfStructs<Test>(
+ 2, [&](size_t i, Test *s) -> void { *s = tests[i]; });
+
+ // create monster with very few fields set:
+ // (same functionality as CreateMonster below, but sets fields manually)
+ flatbuffers::Offset<Monster> mlocs[3];
+ auto fred = builder.CreateString("Fred");
+ auto barney = builder.CreateString("Barney");
+ auto wilma = builder.CreateString("Wilma");
+ MonsterBuilder mb1(builder);
+ mb1.add_name(fred);
+ mlocs[0] = mb1.Finish();
+ MonsterBuilder mb2(builder);
+ mb2.add_name(barney);
+ mb2.add_hp(1000);
+ mlocs[1] = mb2.Finish();
+ MonsterBuilder mb3(builder);
+ mb3.add_name(wilma);
+ mlocs[2] = mb3.Finish();
+
+ // Create an array of strings. Also test string pooling, and lambdas.
+ auto vecofstrings =
+ builder.CreateVector<flatbuffers::Offset<flatbuffers::String>>(
+ 4,
+ [](size_t i, flatbuffers::FlatBufferBuilder *b)
+ -> flatbuffers::Offset<flatbuffers::String> {
+ static const char *names[] = { "bob", "fred", "bob", "fred" };
+ return b->CreateSharedString(names[i]);
+ },
+ &builder);
+
+ // Creating vectors of strings in one convenient call.
+ std::vector<std::string> names2;
+ names2.push_back("jane");
+ names2.push_back("mary");
+ auto vecofstrings2 = builder.CreateVectorOfStrings(names2);
+
+ // Creating vectors from types that are different from std::string
+ std::vector<const char *> names3;
+ names3.push_back("foo");
+ names3.push_back("bar");
+ builder.CreateVectorOfStrings(names3); // Also an accepted type
+
+#ifdef FLATBUFFERS_HAS_STRING_VIEW
+ std::vector<flatbuffers::string_view> names4;
+ names3.push_back("baz");
+ names3.push_back("quux");
+ builder.CreateVectorOfStrings(names4); // Also an accepted type
+#endif
+
+ // Make sure the template deduces an initializer as std::vector<std::string>
+ builder.CreateVectorOfStrings({ "hello", "world" });
+
+ // Create many vectors of strings
+ std::vector<std::string> manyNames;
+ for (auto i = 0; i < 100; i++) { manyNames.push_back("john_doe"); }
+ auto manyNamesVec = builder.CreateVectorOfStrings(manyNames);
+ TEST_EQ(false, manyNamesVec.IsNull());
+ auto manyNamesVec2 =
+ builder.CreateVectorOfStrings(manyNames.cbegin(), manyNames.cend());
+ TEST_EQ(false, manyNamesVec2.IsNull());
+
+ // Create an array of sorted tables, can be used with binary search when read:
+ auto vecoftables = builder.CreateVectorOfSortedTables(mlocs, 3);
+
+ // Create an array of sorted structs,
+ // can be used with binary search when read:
+ std::vector<Ability> abilities;
+ abilities.push_back(Ability(4, 40));
+ abilities.push_back(Ability(3, 30));
+ abilities.push_back(Ability(2, 20));
+ abilities.push_back(Ability(0, 0));
+ auto vecofstructs = builder.CreateVectorOfSortedStructs(&abilities);
+
+ flatbuffers::Offset<Stat> mlocs_stats[1];
+ auto miss = builder.CreateString("miss");
+ StatBuilder mb_miss(builder);
+ mb_miss.add_id(miss);
+ mb_miss.add_val(0);
+ mb_miss.add_count(0); // key
+ mlocs_stats[0] = mb_miss.Finish();
+ auto vec_of_stats = builder.CreateVectorOfSortedTables(mlocs_stats, 1);
+
+ // Create a nested FlatBuffer.
+ // Nested FlatBuffers are stored in a ubyte vector, which can be convenient
+ // since they can be memcpy'd around much easier than other FlatBuffer
+ // values. They have little overhead compared to storing the table directly.
+ // As a test, create a mostly empty Monster buffer:
+ flatbuffers::FlatBufferBuilder nested_builder;
+ auto nmloc = CreateMonster(nested_builder, nullptr, 0, 0,
+ nested_builder.CreateString("NestedMonster"));
+ FinishMonsterBuffer(nested_builder, nmloc);
+ // Now we can store the buffer in the parent. Note that by default, vectors
+ // are only aligned to their elements or size field, so in this case if the
+ // buffer contains 64-bit elements, they may not be correctly aligned. We fix
+ // that with:
+ builder.ForceVectorAlignment(nested_builder.GetSize(), sizeof(uint8_t),
+ nested_builder.GetBufferMinAlignment());
+ // If for whatever reason you don't have the nested_builder available, you
+ // can substitute flatbuffers::largest_scalar_t (64-bit) for the alignment, or
+ // the largest force_align value in your schema if you're using it.
+ auto nested_flatbuffer_vector = builder.CreateVector(
+ nested_builder.GetBufferPointer(), nested_builder.GetSize());
+
+ // Test a nested FlexBuffer:
+ flexbuffers::Builder flexbuild;
+ flexbuild.Int(1234);
+ flexbuild.Finish();
+ auto flex = builder.CreateVector(flexbuild.GetBuffer());
+ // Test vector of enums.
+ Color colors[] = { Color_Blue, Color_Green };
+ // We use this special creation function because we have an array of
+ // pre-C++11 (enum class) enums whose size likely is int, yet its declared
+ // type in the schema is byte.
+ auto vecofcolors = builder.CreateVectorScalarCast<uint8_t, Color>(colors, 2);
+
+ // shortcut for creating monster with all fields set:
+ auto mloc = CreateMonster(
+ builder, &vec, 150, 80, name, inventory, Color_Blue, Any_Monster,
+ mlocs[1].Union(), // Store a union.
+ testv, vecofstrings, vecoftables, 0, nested_flatbuffer_vector, 0, false,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3.14159f, 3.0f, 0.0f, vecofstrings2,
+ vecofstructs, flex, testv2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ AnyUniqueAliases_NONE, 0, AnyAmbiguousAliases_NONE, 0, vecofcolors,
+ MyGame::Example::Race_None, 0, vec_of_stats);
+
+ FinishMonsterBuffer(builder, mloc);
+
+ // clang-format off
+ #ifdef FLATBUFFERS_TEST_VERBOSE
+ // print byte data for debugging:
+ auto p = builder.GetBufferPointer();
+ for (flatbuffers::uoffset_t i = 0; i < builder.GetSize(); i++)
+ printf("%d ", p[i]);
+ #endif
+ // clang-format on
+
+ // return the buffer for the caller to use.
+ auto bufferpointer =
+ reinterpret_cast<const char *>(builder.GetBufferPointer());
+ buffer.assign(bufferpointer, bufferpointer + builder.GetSize());
+
+ return builder.Release();
+}
+
+// example of accessing a buffer loaded in memory:
+void AccessFlatBufferTest(const uint8_t *flatbuf, size_t length, bool pooled) {
+ // First, verify the buffers integrity (optional)
+ flatbuffers::Verifier verifier(flatbuf, length);
+ std::vector<uint8_t> flex_reuse_tracker;
+ verifier.SetFlexReuseTracker(&flex_reuse_tracker);
+ TEST_EQ(VerifyMonsterBuffer(verifier), true);
+
+ // clang-format off
+ #ifdef FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE
+ std::vector<uint8_t> test_buff;
+ test_buff.resize(length * 2);
+ std::memcpy(&test_buff[0], flatbuf, length);
+ std::memcpy(&test_buff[length], flatbuf, length);
+
+ flatbuffers::Verifier verifier1(&test_buff[0], length);
+ TEST_EQ(VerifyMonsterBuffer(verifier1), true);
+ TEST_EQ(verifier1.GetComputedSize(), length);
+
+ flatbuffers::Verifier verifier2(&test_buff[length], length);
+ TEST_EQ(VerifyMonsterBuffer(verifier2), true);
+ TEST_EQ(verifier2.GetComputedSize(), length);
+ #endif
+ // clang-format on
+
+ TEST_EQ(strcmp(MonsterIdentifier(), "MONS"), 0);
+ TEST_EQ(MonsterBufferHasIdentifier(flatbuf), true);
+ TEST_EQ(strcmp(MonsterExtension(), "mon"), 0);
+
+ // Access the buffer from the root.
+ auto monster = GetMonster(flatbuf);
+
+ TEST_EQ(monster->hp(), 80);
+ TEST_EQ(monster->mana(), 150); // default
+ TEST_EQ_STR(monster->name()->c_str(), "MyMonster");
+ // Can't access the following field, it is deprecated in the schema,
+ // which means accessors are not generated:
+ // monster.friendly()
+
+ auto pos = monster->pos();
+ TEST_NOTNULL(pos);
+ TEST_EQ(pos->z(), 3);
+ TEST_EQ(pos->test3().a(), 10);
+ TEST_EQ(pos->test3().b(), 20);
+
+ auto inventory = monster->inventory();
+ TEST_EQ(VectorLength(inventory), 10UL); // Works even if inventory is null.
+ TEST_NOTNULL(inventory);
+ unsigned char inv_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ // Check compatibilty of iterators with STL.
+ std::vector<unsigned char> inv_vec(inventory->begin(), inventory->end());
+ size_t n = 0;
+ for (auto it = inventory->begin(); it != inventory->end(); ++it, ++n) {
+ auto indx = it - inventory->begin();
+ TEST_EQ(*it, inv_vec.at(indx)); // Use bounds-check.
+ TEST_EQ(*it, inv_data[indx]);
+ }
+ TEST_EQ(n, inv_vec.size());
+
+ n = 0;
+ for (auto it = inventory->cbegin(); it != inventory->cend(); ++it, ++n) {
+ auto indx = it - inventory->cbegin();
+ TEST_EQ(*it, inv_vec.at(indx)); // Use bounds-check.
+ TEST_EQ(*it, inv_data[indx]);
+ }
+ TEST_EQ(n, inv_vec.size());
+
+ n = 0;
+ for (auto it = inventory->rbegin(); it != inventory->rend(); ++it, ++n) {
+ auto indx = inventory->rend() - it - 1;
+ TEST_EQ(*it, inv_vec.at(indx)); // Use bounds-check.
+ TEST_EQ(*it, inv_data[indx]);
+ }
+ TEST_EQ(n, inv_vec.size());
+
+ n = 0;
+ for (auto it = inventory->crbegin(); it != inventory->crend(); ++it, ++n) {
+ auto indx = inventory->crend() - it - 1;
+ TEST_EQ(*it, inv_vec.at(indx)); // Use bounds-check.
+ TEST_EQ(*it, inv_data[indx]);
+ }
+ TEST_EQ(n, inv_vec.size());
+
+ TEST_EQ(monster->color(), Color_Blue);
+
+ // Example of accessing a union:
+ TEST_EQ(monster->test_type(), Any_Monster); // First make sure which it is.
+ auto monster2 = reinterpret_cast<const Monster *>(monster->test());
+ TEST_NOTNULL(monster2);
+ TEST_EQ_STR(monster2->name()->c_str(), "Fred");
+
+ // Example of accessing a vector of strings:
+ auto vecofstrings = monster->testarrayofstring();
+ TEST_EQ(vecofstrings->size(), 4U);
+ TEST_EQ_STR(vecofstrings->Get(0)->c_str(), "bob");
+ TEST_EQ_STR(vecofstrings->Get(1)->c_str(), "fred");
+ if (pooled) {
+ // These should have pointer equality because of string pooling.
+ TEST_EQ(vecofstrings->Get(0)->c_str(), vecofstrings->Get(2)->c_str());
+ TEST_EQ(vecofstrings->Get(1)->c_str(), vecofstrings->Get(3)->c_str());
+ }
+
+ auto vecofstrings2 = monster->testarrayofstring2();
+ if (vecofstrings2) {
+ TEST_EQ(vecofstrings2->size(), 2U);
+ TEST_EQ_STR(vecofstrings2->Get(0)->c_str(), "jane");
+ TEST_EQ_STR(vecofstrings2->Get(1)->c_str(), "mary");
+ }
+
+ // Example of accessing a vector of tables:
+ auto vecoftables = monster->testarrayoftables();
+ TEST_EQ(vecoftables->size(), 3U);
+ for (auto it = vecoftables->begin(); it != vecoftables->end(); ++it) {
+ TEST_EQ(strlen(it->name()->c_str()) >= 4, true);
+ }
+ TEST_EQ_STR(vecoftables->Get(0)->name()->c_str(), "Barney");
+ TEST_EQ(vecoftables->Get(0)->hp(), 1000);
+ TEST_EQ_STR(vecoftables->Get(1)->name()->c_str(), "Fred");
+ TEST_EQ_STR(vecoftables->Get(2)->name()->c_str(), "Wilma");
+ TEST_NOTNULL(vecoftables->LookupByKey("Barney"));
+ TEST_NOTNULL(vecoftables->LookupByKey("Fred"));
+ TEST_NOTNULL(vecoftables->LookupByKey("Wilma"));
+
+ // Test accessing a vector of sorted structs
+ auto vecofstructs = monster->testarrayofsortedstruct();
+ if (vecofstructs) { // not filled in monster_test.bfbs
+ for (flatbuffers::uoffset_t i = 0; i < vecofstructs->size() - 1; i++) {
+ auto left = vecofstructs->Get(i);
+ auto right = vecofstructs->Get(i + 1);
+ TEST_EQ(true, (left->KeyCompareLessThan(right)));
+ }
+ TEST_NOTNULL(vecofstructs->LookupByKey(0)); // test default value
+ TEST_NOTNULL(vecofstructs->LookupByKey(3));
+ TEST_EQ(static_cast<const Ability *>(nullptr),
+ vecofstructs->LookupByKey(5));
+ }
+
+ if (auto vec_of_stat = monster->scalar_key_sorted_tables()) {
+ auto stat_0 = vec_of_stat->LookupByKey(static_cast<uint16_t>(0u));
+ TEST_NOTNULL(stat_0);
+ TEST_NOTNULL(stat_0->id());
+ TEST_EQ(0, stat_0->count());
+ TEST_EQ_STR("miss", stat_0->id()->c_str());
+ }
+
+ // Test nested FlatBuffers if available:
+ auto nested_buffer = monster->testnestedflatbuffer();
+ if (nested_buffer) {
+ // nested_buffer is a vector of bytes you can memcpy. However, if you
+ // actually want to access the nested data, this is a convenient
+ // accessor that directly gives you the root table:
+ auto nested_monster = monster->testnestedflatbuffer_nested_root();
+ TEST_EQ_STR(nested_monster->name()->c_str(), "NestedMonster");
+ }
+
+ // Test flexbuffer if available:
+ auto flex = monster->flex();
+ // flex is a vector of bytes you can memcpy etc.
+ TEST_EQ(flex->size(), 4); // Encoded FlexBuffer bytes.
+ // However, if you actually want to access the nested data, this is a
+ // convenient accessor that directly gives you the root value:
+ TEST_EQ(monster->flex_flexbuffer_root().AsInt16(), 1234);
+
+ // Test vector of enums:
+ auto colors = monster->vector_of_enums();
+ if (colors) {
+ TEST_EQ(colors->size(), 2);
+ TEST_EQ(colors->Get(0), Color_Blue);
+ TEST_EQ(colors->Get(1), Color_Green);
+ }
+
+ // Since Flatbuffers uses explicit mechanisms to override the default
+ // compiler alignment, double check that the compiler indeed obeys them:
+ // (Test consists of a short and byte):
+ TEST_EQ(flatbuffers::AlignOf<Test>(), 2UL);
+ TEST_EQ(sizeof(Test), 4UL);
+
+ const flatbuffers::Vector<const Test *> *tests_array[] = {
+ monster->test4(),
+ monster->test5(),
+ };
+ for (size_t i = 0; i < sizeof(tests_array) / sizeof(tests_array[0]); ++i) {
+ auto tests = tests_array[i];
+ TEST_NOTNULL(tests);
+ auto test_0 = tests->Get(0);
+ auto test_1 = tests->Get(1);
+ TEST_EQ(test_0->a(), 10);
+ TEST_EQ(test_0->b(), 20);
+ TEST_EQ(test_1->a(), 30);
+ TEST_EQ(test_1->b(), 40);
+ for (auto it = tests->begin(); it != tests->end(); ++it) {
+ TEST_EQ(it->a() == 10 || it->a() == 30, true); // Just testing iterators.
+ }
+ }
+
+ // Checking for presence of fields:
+ TEST_EQ(flatbuffers::IsFieldPresent(monster, Monster::VT_HP), true);
+ TEST_EQ(flatbuffers::IsFieldPresent(monster, Monster::VT_MANA), false);
+
+ // Obtaining a buffer from a root:
+ TEST_EQ(GetBufferStartFromRootPointer(monster), flatbuf);
+}
+
+// Change a FlatBuffer in-place, after it has been constructed.
+void MutateFlatBuffersTest(uint8_t *flatbuf, std::size_t length) {
+ // Get non-const pointer to root.
+ auto monster = GetMutableMonster(flatbuf);
+
+ // Each of these tests mutates, then tests, then set back to the original,
+ // so we can test that the buffer in the end still passes our original test.
+ auto hp_ok = monster->mutate_hp(10);
+ TEST_EQ(hp_ok, true); // Field was present.
+ TEST_EQ(monster->hp(), 10);
+ // Mutate to default value
+ auto hp_ok_default = monster->mutate_hp(100);
+ TEST_EQ(hp_ok_default, true); // Field was present.
+ TEST_EQ(monster->hp(), 100);
+ // Test that mutate to default above keeps field valid for further mutations
+ auto hp_ok_2 = monster->mutate_hp(20);
+ TEST_EQ(hp_ok_2, true);
+ TEST_EQ(monster->hp(), 20);
+ monster->mutate_hp(80);
+
+ // Monster originally at 150 mana (default value)
+ auto mana_default_ok = monster->mutate_mana(150); // Mutate to default value.
+ TEST_EQ(mana_default_ok,
+ true); // Mutation should succeed, because default value.
+ TEST_EQ(monster->mana(), 150);
+ auto mana_ok = monster->mutate_mana(10);
+ TEST_EQ(mana_ok, false); // Field was NOT present, because default value.
+ TEST_EQ(monster->mana(), 150);
+
+ // Mutate structs.
+ auto pos = monster->mutable_pos();
+ auto test3 = pos->mutable_test3(); // Struct inside a struct.
+ test3.mutate_a(50); // Struct fields never fail.
+ TEST_EQ(test3.a(), 50);
+ test3.mutate_a(10);
+
+ // Mutate vectors.
+ auto inventory = monster->mutable_inventory();
+ inventory->Mutate(9, 100);
+ TEST_EQ(inventory->Get(9), 100);
+ inventory->Mutate(9, 9);
+
+ auto tables = monster->mutable_testarrayoftables();
+ auto first = tables->GetMutableObject(0);
+ TEST_EQ(first->hp(), 1000);
+ first->mutate_hp(0);
+ TEST_EQ(first->hp(), 0);
+ first->mutate_hp(1000);
+
+ // Mutate via LookupByKey
+ TEST_NOTNULL(tables->MutableLookupByKey("Barney"));
+ TEST_EQ(static_cast<Monster *>(nullptr),
+ tables->MutableLookupByKey("DoesntExist"));
+ TEST_EQ(tables->MutableLookupByKey("Barney")->hp(), 1000);
+ TEST_EQ(tables->MutableLookupByKey("Barney")->mutate_hp(0), true);
+ TEST_EQ(tables->LookupByKey("Barney")->hp(), 0);
+ TEST_EQ(tables->MutableLookupByKey("Barney")->mutate_hp(1000), true);
+
+ // Run the verifier and the regular test to make sure we didn't trample on
+ // anything.
+ AccessFlatBufferTest(flatbuf, length);
+}
+
+// Unpack a FlatBuffer into objects.
+void ObjectFlatBuffersTest(uint8_t *flatbuf) {
+ // Optional: we can specify resolver and rehasher functions to turn hashed
+ // strings into object pointers and back, to implement remote references
+ // and such.
+ auto resolver = flatbuffers::resolver_function_t(
+ [](void **pointer_adr, flatbuffers::hash_value_t hash) {
+ (void)pointer_adr;
+ (void)hash;
+ // Don't actually do anything, leave variable null.
+ });
+ auto rehasher = flatbuffers::rehasher_function_t(
+ [](void *pointer) -> flatbuffers::hash_value_t {
+ (void)pointer;
+ return 0;
+ });
+
+ // Turn a buffer into C++ objects.
+ auto monster1 = UnPackMonster(flatbuf, &resolver);
+
+ // Re-serialize the data.
+ flatbuffers::FlatBufferBuilder fbb1;
+ fbb1.Finish(CreateMonster(fbb1, monster1.get(), &rehasher),
+ MonsterIdentifier());
+
+ // Unpack again, and re-serialize again.
+ auto monster2 = UnPackMonster(fbb1.GetBufferPointer(), &resolver);
+ flatbuffers::FlatBufferBuilder fbb2;
+ fbb2.Finish(CreateMonster(fbb2, monster2.get(), &rehasher),
+ MonsterIdentifier());
+
+ // Now we've gone full round-trip, the two buffers should match.
+ const auto len1 = fbb1.GetSize();
+ const auto len2 = fbb2.GetSize();
+ TEST_EQ(len1, len2);
+ TEST_EQ(memcmp(fbb1.GetBufferPointer(), fbb2.GetBufferPointer(), len1), 0);
+
+ // Test it with the original buffer test to make sure all data survived.
+ AccessFlatBufferTest(fbb2.GetBufferPointer(), len2, false);
+
+ // Test accessing fields, similar to AccessFlatBufferTest above.
+ CheckMonsterObject(monster2.get());
+
+ // Test object copy.
+ auto monster3 = *monster2;
+ flatbuffers::FlatBufferBuilder fbb3;
+ fbb3.Finish(CreateMonster(fbb3, &monster3, &rehasher), MonsterIdentifier());
+ const auto len3 = fbb3.GetSize();
+ TEST_EQ(len2, len3);
+ TEST_EQ(memcmp(fbb2.GetBufferPointer(), fbb3.GetBufferPointer(), len2), 0);
+ // Delete monster1 and monster2, then test accessing fields in monster3.
+ monster1.reset();
+ monster2.reset();
+ CheckMonsterObject(&monster3);
+}
+
+// Utility function to check a Monster object.
+void CheckMonsterObject(MonsterT *monster2) {
+ TEST_EQ(monster2->hp, 80);
+ TEST_EQ(monster2->mana, 150); // default
+ TEST_EQ_STR(monster2->name.c_str(), "MyMonster");
+
+ auto &pos = monster2->pos;
+ TEST_NOTNULL(pos);
+ TEST_EQ(pos->z(), 3);
+ TEST_EQ(pos->test3().a(), 10);
+ TEST_EQ(pos->test3().b(), 20);
+
+ auto &inventory = monster2->inventory;
+ TEST_EQ(inventory.size(), 10UL);
+ unsigned char inv_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ for (auto it = inventory.begin(); it != inventory.end(); ++it)
+ TEST_EQ(*it, inv_data[it - inventory.begin()]);
+
+ TEST_EQ(monster2->color, Color_Blue);
+
+ auto monster3 = monster2->test.AsMonster();
+ TEST_NOTNULL(monster3);
+ TEST_EQ_STR(monster3->name.c_str(), "Fred");
+
+ auto &vecofstrings = monster2->testarrayofstring;
+ TEST_EQ(vecofstrings.size(), 4U);
+ TEST_EQ_STR(vecofstrings[0].c_str(), "bob");
+ TEST_EQ_STR(vecofstrings[1].c_str(), "fred");
+
+ auto &vecofstrings2 = monster2->testarrayofstring2;
+ TEST_EQ(vecofstrings2.size(), 2U);
+ TEST_EQ_STR(vecofstrings2[0].c_str(), "jane");
+ TEST_EQ_STR(vecofstrings2[1].c_str(), "mary");
+
+ auto &vecoftables = monster2->testarrayoftables;
+ TEST_EQ(vecoftables.size(), 3U);
+ TEST_EQ_STR(vecoftables[0]->name.c_str(), "Barney");
+ TEST_EQ(vecoftables[0]->hp, 1000);
+ TEST_EQ_STR(vecoftables[1]->name.c_str(), "Fred");
+ TEST_EQ_STR(vecoftables[2]->name.c_str(), "Wilma");
+
+ auto &tests = monster2->test4;
+ TEST_EQ(tests[0].a(), 10);
+ TEST_EQ(tests[0].b(), 20);
+ TEST_EQ(tests[1].a(), 30);
+ TEST_EQ(tests[1].b(), 40);
+}
+
+// Prefix a FlatBuffer with a size field.
+void SizePrefixedTest() {
+ // Create size prefixed buffer.
+ flatbuffers::FlatBufferBuilder fbb;
+ FinishSizePrefixedMonsterBuffer(
+ fbb, CreateMonster(fbb, nullptr, 200, 300, fbb.CreateString("bob")));
+
+ // Verify it.
+ flatbuffers::Verifier verifier(fbb.GetBufferPointer(), fbb.GetSize());
+ TEST_EQ(VerifySizePrefixedMonsterBuffer(verifier), true);
+
+ // Access it.
+ auto m = GetSizePrefixedMonster(fbb.GetBufferPointer());
+ TEST_EQ(m->mana(), 200);
+ TEST_EQ(m->hp(), 300);
+ TEST_EQ_STR(m->name()->c_str(), "bob");
+}
+
+void TestMonsterExtraFloats(const std::string &tests_data_path) {
+#if defined(FLATBUFFERS_HAS_NEW_STRTOD) && (FLATBUFFERS_HAS_NEW_STRTOD > 0)
+ TEST_EQ(is_quiet_nan(1.0), false);
+ TEST_EQ(is_quiet_nan(infinity_d), false);
+ TEST_EQ(is_quiet_nan(-infinity_f), false);
+ TEST_EQ(is_quiet_nan(std::numeric_limits<float>::quiet_NaN()), true);
+ TEST_EQ(is_quiet_nan(std::numeric_limits<double>::quiet_NaN()), true);
+
+ using namespace flatbuffers;
+ using namespace MyGame;
+ // Load FlatBuffer schema (.fbs) from disk.
+ std::string schemafile;
+ TEST_EQ(LoadFile((tests_data_path + "monster_extra.fbs").c_str(), false,
+ &schemafile),
+ true);
+ // Parse schema first, so we can use it to parse the data after.
+ Parser parser;
+ auto include_test_path = ConCatPathFileName(tests_data_path, "include_test");
+ const char *include_directories[] = { tests_data_path.c_str(),
+ include_test_path.c_str(), nullptr };
+ TEST_EQ(parser.Parse(schemafile.c_str(), include_directories), true);
+ // Create empty extra and store to json.
+ parser.opts.output_default_scalars_in_json = true;
+ parser.opts.output_enum_identifiers = true;
+ FlatBufferBuilder builder;
+ const auto def_root = MonsterExtraBuilder(builder).Finish();
+ FinishMonsterExtraBuffer(builder, def_root);
+ const auto def_obj = builder.GetBufferPointer();
+ const auto def_extra = GetMonsterExtra(def_obj);
+ TEST_NOTNULL(def_extra);
+ TEST_EQ(is_quiet_nan(def_extra->f0()), true);
+ TEST_EQ(is_quiet_nan(def_extra->f1()), true);
+ TEST_EQ(def_extra->f2(), +infinity_f);
+ TEST_EQ(def_extra->f3(), -infinity_f);
+ TEST_EQ(is_quiet_nan(def_extra->d0()), true);
+ TEST_EQ(is_quiet_nan(def_extra->d1()), true);
+ TEST_EQ(def_extra->d2(), +infinity_d);
+ TEST_EQ(def_extra->d3(), -infinity_d);
+ std::string jsongen;
+ auto result = GenerateText(parser, def_obj, &jsongen);
+ TEST_EQ(result, true);
+ // Check expected default values.
+ TEST_EQ(std::string::npos != jsongen.find("f0: nan"), true);
+ TEST_EQ(std::string::npos != jsongen.find("f1: nan"), true);
+ TEST_EQ(std::string::npos != jsongen.find("f2: inf"), true);
+ TEST_EQ(std::string::npos != jsongen.find("f3: -inf"), true);
+ TEST_EQ(std::string::npos != jsongen.find("d0: nan"), true);
+ TEST_EQ(std::string::npos != jsongen.find("d1: nan"), true);
+ TEST_EQ(std::string::npos != jsongen.find("d2: inf"), true);
+ TEST_EQ(std::string::npos != jsongen.find("d3: -inf"), true);
+ // Parse 'mosterdata_extra.json'.
+ const auto extra_base = tests_data_path + "monsterdata_extra";
+ jsongen = "";
+ TEST_EQ(LoadFile((extra_base + ".json").c_str(), false, &jsongen), true);
+ TEST_EQ(parser.Parse(jsongen.c_str()), true);
+ const auto test_file = parser.builder_.GetBufferPointer();
+ const auto test_size = parser.builder_.GetSize();
+ Verifier verifier(test_file, test_size);
+ TEST_ASSERT(VerifyMonsterExtraBuffer(verifier));
+ const auto extra = GetMonsterExtra(test_file);
+ TEST_NOTNULL(extra);
+ TEST_EQ(is_quiet_nan(extra->f0()), true);
+ TEST_EQ(is_quiet_nan(extra->f1()), true);
+ TEST_EQ(extra->f2(), +infinity_f);
+ TEST_EQ(extra->f3(), -infinity_f);
+ TEST_EQ(is_quiet_nan(extra->d0()), true);
+ TEST_EQ(extra->d1(), +infinity_d);
+ TEST_EQ(extra->d2(), -infinity_d);
+ TEST_EQ(is_quiet_nan(extra->d3()), true);
+ TEST_NOTNULL(extra->fvec());
+ TEST_EQ(extra->fvec()->size(), 4);
+ TEST_EQ(extra->fvec()->Get(0), 1.0f);
+ TEST_EQ(extra->fvec()->Get(1), -infinity_f);
+ TEST_EQ(extra->fvec()->Get(2), +infinity_f);
+ TEST_EQ(is_quiet_nan(extra->fvec()->Get(3)), true);
+ TEST_NOTNULL(extra->dvec());
+ TEST_EQ(extra->dvec()->size(), 4);
+ TEST_EQ(extra->dvec()->Get(0), 2.0);
+ TEST_EQ(extra->dvec()->Get(1), +infinity_d);
+ TEST_EQ(extra->dvec()->Get(2), -infinity_d);
+ TEST_EQ(is_quiet_nan(extra->dvec()->Get(3)), true);
+#endif
+}
+
+void EnumNamesTest() {
+ TEST_EQ_STR("Red", EnumNameColor(Color_Red));
+ TEST_EQ_STR("Green", EnumNameColor(Color_Green));
+ TEST_EQ_STR("Blue", EnumNameColor(Color_Blue));
+ // Check that Color to string don't crash while decode a mixture of Colors.
+ // 1) Example::Color enum is enum with unfixed underlying type.
+ // 2) Valid enum range: [0; 2^(ceil(log2(Color_ANY))) - 1].
+ // Consequence: A value is out of this range will lead to UB (since C++17).
+ // For details see C++17 standard or explanation on the SO:
+ // stackoverflow.com/questions/18195312/what-happens-if-you-static-cast-invalid-value-to-enum-class
+ TEST_EQ_STR("", EnumNameColor(static_cast<Color>(0)));
+ TEST_EQ_STR("", EnumNameColor(static_cast<Color>(Color_ANY - 1)));
+ TEST_EQ_STR("", EnumNameColor(static_cast<Color>(Color_ANY + 1)));
+}
+
+void TypeAliasesTest() {
+ flatbuffers::FlatBufferBuilder builder;
+
+ builder.Finish(CreateTypeAliases(
+ builder, flatbuffers::numeric_limits<int8_t>::min(),
+ flatbuffers::numeric_limits<uint8_t>::max(),
+ flatbuffers::numeric_limits<int16_t>::min(),
+ flatbuffers::numeric_limits<uint16_t>::max(),
+ flatbuffers::numeric_limits<int32_t>::min(),
+ flatbuffers::numeric_limits<uint32_t>::max(),
+ flatbuffers::numeric_limits<int64_t>::min(),
+ flatbuffers::numeric_limits<uint64_t>::max(), 2.3f, 2.3));
+
+ auto p = builder.GetBufferPointer();
+ auto ta = flatbuffers::GetRoot<TypeAliases>(p);
+
+ TEST_EQ(ta->i8(), flatbuffers::numeric_limits<int8_t>::min());
+ TEST_EQ(ta->u8(), flatbuffers::numeric_limits<uint8_t>::max());
+ TEST_EQ(ta->i16(), flatbuffers::numeric_limits<int16_t>::min());
+ TEST_EQ(ta->u16(), flatbuffers::numeric_limits<uint16_t>::max());
+ TEST_EQ(ta->i32(), flatbuffers::numeric_limits<int32_t>::min());
+ TEST_EQ(ta->u32(), flatbuffers::numeric_limits<uint32_t>::max());
+ TEST_EQ(ta->i64(), flatbuffers::numeric_limits<int64_t>::min());
+ TEST_EQ(ta->u64(), flatbuffers::numeric_limits<uint64_t>::max());
+ TEST_EQ(ta->f32(), 2.3f);
+ TEST_EQ(ta->f64(), 2.3);
+ using namespace flatbuffers; // is_same
+ static_assert(is_same<decltype(ta->i8()), int8_t>::value, "invalid type");
+ static_assert(is_same<decltype(ta->i16()), int16_t>::value, "invalid type");
+ static_assert(is_same<decltype(ta->i32()), int32_t>::value, "invalid type");
+ static_assert(is_same<decltype(ta->i64()), int64_t>::value, "invalid type");
+ static_assert(is_same<decltype(ta->u8()), uint8_t>::value, "invalid type");
+ static_assert(is_same<decltype(ta->u16()), uint16_t>::value, "invalid type");
+ static_assert(is_same<decltype(ta->u32()), uint32_t>::value, "invalid type");
+ static_assert(is_same<decltype(ta->u64()), uint64_t>::value, "invalid type");
+ static_assert(is_same<decltype(ta->f32()), float>::value, "invalid type");
+ static_assert(is_same<decltype(ta->f64()), double>::value, "invalid type");
+}
+
+// example of parsing text straight into a buffer, and generating
+// text back from it:
+void ParseAndGenerateTextTest(const std::string &tests_data_path, bool binary) {
+ // load FlatBuffer schema (.fbs) and JSON from disk
+ std::string schemafile;
+ std::string jsonfile;
+ TEST_EQ(flatbuffers::LoadFile(
+ (tests_data_path + "monster_test." + (binary ? "bfbs" : "fbs"))
+ .c_str(),
+ binary, &schemafile),
+ true);
+ TEST_EQ(flatbuffers::LoadFile(
+ (tests_data_path + "monsterdata_test.golden").c_str(), false,
+ &jsonfile),
+ true);
+
+ auto include_test_path =
+ flatbuffers::ConCatPathFileName(tests_data_path, "include_test");
+ const char *include_directories[] = { tests_data_path.c_str(),
+ include_test_path.c_str(), nullptr };
+
+ // parse schema first, so we can use it to parse the data after
+ flatbuffers::Parser parser;
+ if (binary) {
+ flatbuffers::Verifier verifier(
+ reinterpret_cast<const uint8_t *>(schemafile.c_str()),
+ schemafile.size());
+ TEST_EQ(reflection::VerifySchemaBuffer(verifier), true);
+ // auto schema = reflection::GetSchema(schemafile.c_str());
+ TEST_EQ(parser.Deserialize(
+ reinterpret_cast<const uint8_t *>(schemafile.c_str()),
+ schemafile.size()),
+ true);
+ } else {
+ TEST_EQ(parser.Parse(schemafile.c_str(), include_directories), true);
+ }
+ TEST_EQ(parser.ParseJson(jsonfile.c_str()), true);
+
+ // here, parser.builder_ contains a binary buffer that is the parsed data.
+
+ // First, verify it, just in case:
+ flatbuffers::Verifier verifier(parser.builder_.GetBufferPointer(),
+ parser.builder_.GetSize());
+ TEST_EQ(VerifyMonsterBuffer(verifier), true);
+
+ AccessFlatBufferTest(parser.builder_.GetBufferPointer(),
+ parser.builder_.GetSize(), false);
+
+ // to ensure it is correct, we now generate text back from the binary,
+ // and compare the two:
+ std::string jsongen;
+ auto result =
+ GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen);
+ TEST_EQ(result, true);
+ TEST_EQ_STR(jsongen.c_str(), jsonfile.c_str());
+
+ // We can also do the above using the convenient Registry that knows about
+ // a set of file_identifiers mapped to schemas.
+ flatbuffers::Registry registry;
+ // Make sure schemas can find their includes.
+ registry.AddIncludeDirectory(tests_data_path.c_str());
+ registry.AddIncludeDirectory(include_test_path.c_str());
+ // Call this with many schemas if possible.
+ registry.Register(MonsterIdentifier(),
+ (tests_data_path + "monster_test.fbs").c_str());
+ // Now we got this set up, we can parse by just specifying the identifier,
+ // the correct schema will be loaded on the fly:
+ auto buf = registry.TextToFlatBuffer(jsonfile.c_str(), MonsterIdentifier());
+ // If this fails, check registry.lasterror_.
+ TEST_NOTNULL(buf.data());
+ // Test the buffer, to be sure:
+ AccessFlatBufferTest(buf.data(), buf.size(), false);
+ // We can use the registry to turn this back into text, in this case it
+ // will get the file_identifier from the binary:
+ std::string text;
+ auto ok = registry.FlatBufferToText(buf.data(), buf.size(), &text);
+ // If this fails, check registry.lasterror_.
+ TEST_EQ(ok, true);
+ TEST_EQ_STR(text.c_str(), jsonfile.c_str());
+
+ // Generate text for UTF-8 strings without escapes.
+ std::string jsonfile_utf8;
+ TEST_EQ(flatbuffers::LoadFile((tests_data_path + "unicode_test.json").c_str(),
+ false, &jsonfile_utf8),
+ true);
+ TEST_EQ(parser.Parse(jsonfile_utf8.c_str(), include_directories), true);
+ // To ensure it is correct, generate utf-8 text back from the binary.
+ std::string jsongen_utf8;
+ // request natural printing for utf-8 strings
+ parser.opts.natural_utf8 = true;
+ parser.opts.strict_json = true;
+ TEST_EQ(
+ GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen_utf8),
+ true);
+ TEST_EQ_STR(jsongen_utf8.c_str(), jsonfile_utf8.c_str());
+}
+
+void UnPackTo(const uint8_t *flatbuf) {
+ // Get a monster that has a name and no enemy
+ auto orig_monster = GetMonster(flatbuf);
+ TEST_EQ_STR(orig_monster->name()->c_str(), "MyMonster");
+ TEST_ASSERT(orig_monster->enemy() == nullptr);
+
+ // Create an enemy
+ MonsterT *enemy = new MonsterT();
+ enemy->name = "Enemy";
+
+ // And create another monster owning the enemy,
+ MonsterT mon;
+ mon.name = "I'm monster 1";
+ mon.enemy.reset(enemy);
+ TEST_ASSERT(mon.enemy != nullptr);
+
+ // Assert that all the Monster objects are correct.
+ TEST_EQ_STR(mon.name.c_str(), "I'm monster 1");
+ TEST_EQ_STR(enemy->name.c_str(), "Enemy");
+ TEST_EQ_STR(mon.enemy->name.c_str(), "Enemy");
+
+ // Now unpack monster ("MyMonster") into monster
+ orig_monster->UnPackTo(&mon);
+
+ // Monster name should be from monster
+ TEST_EQ_STR(mon.name.c_str(), "MyMonster");
+
+ // The monster shouldn't have any enemies, because monster didn't.
+ TEST_ASSERT(mon.enemy == nullptr);
+}
+
+} // namespace tests
+} // namespace flatbuffers
\ No newline at end of file
diff --git a/tests/monster_test.fbs b/tests/monster_test.fbs
index b28ddc8..14d34cb 100644
--- a/tests/monster_test.fbs
+++ b/tests/monster_test.fbs
@@ -70,6 +70,10 @@
c: Ability;
}
+struct StructOfStructsOfStructs {
+ a: StructOfStructs;
+}
+
table Stat {
id:string;
val:long;
diff --git a/tests/monster_test.grpc.fb.h b/tests/monster_test.grpc.fb.h
index 4d726e1..e3f3037 100644
--- a/tests/monster_test.grpc.fb.h
+++ b/tests/monster_test.grpc.fb.h
@@ -201,7 +201,7 @@
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
- ::grpc::Status GetMaxHitPoint(::grpc::ServerContext* /*context*/, ::grpc::ServerReader< flatbuffers::grpc::Message<Monster>>* /*reader*/, flatbuffers::grpc::Message<Stat>* response) final override {
+ ::grpc::Status GetMaxHitPoint(::grpc::ServerContext* /*context*/, ::grpc::ServerReader< flatbuffers::grpc::Message<Monster>>* /*reader*/, flatbuffers::grpc::Message<Stat>* /*response*/) final override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
diff --git a/tests/monster_test.h b/tests/monster_test.h
new file mode 100644
index 0000000..5ab968b
--- /dev/null
+++ b/tests/monster_test.h
@@ -0,0 +1,38 @@
+#ifndef TESTS_MONSTER_TEST_H
+#define TESTS_MONSTER_TEST_H
+
+#include <string>
+
+#include "flatbuffers/detached_buffer.h"
+#include "monster_test_generated.h"
+
+namespace flatbuffers {
+namespace tests {
+
+flatbuffers::DetachedBuffer CreateFlatBufferTest(std::string &buffer);
+
+void AccessFlatBufferTest(const uint8_t *flatbuf, size_t length,
+ bool pooled = true);
+
+void MutateFlatBuffersTest(uint8_t *flatbuf, std::size_t length);
+
+void ObjectFlatBuffersTest(uint8_t *flatbuf);
+
+void CheckMonsterObject(MyGame::Example::MonsterT *monster2);
+
+void SizePrefixedTest();
+
+void TestMonsterExtraFloats(const std::string& tests_data_path);
+
+void EnumNamesTest();
+
+void TypeAliasesTest();
+
+void ParseAndGenerateTextTest(const std::string& tests_data_path, bool binary);
+
+void UnPackTo(const uint8_t *flatbuf);
+
+} // namespace tests
+} // namespace flatbuffers
+
+#endif
\ No newline at end of file
diff --git a/tests/monster_test.schema.json b/tests/monster_test.schema.json
index 7517269..5e98ef4 100644
--- a/tests/monster_test.schema.json
+++ b/tests/monster_test.schema.json
@@ -140,6 +140,15 @@
},
"additionalProperties" : false
},
+ "MyGame_Example_StructOfStructsOfStructs" : {
+ "type" : "object",
+ "properties" : {
+ "a" : {
+ "$ref" : "#/definitions/MyGame_Example_StructOfStructs"
+ }
+ },
+ "additionalProperties" : false
+ },
"MyGame_Example_Stat" : {
"type" : "object",
"properties" : {
diff --git a/tests/monster_test/mod.rs b/tests/monster_test/mod.rs
index fdbc26b..7f1fab1 100644
--- a/tests/monster_test/mod.rs
+++ b/tests/monster_test/mod.rs
@@ -1,4 +1,5 @@
// Automatically generated by the Flatbuffers compiler. Do not modify.
+// @generated
pub mod my_game {
use super::*;
pub mod example {
@@ -25,6 +26,8 @@
pub use self::ability_generated::*;
mod struct_of_structs_generated;
pub use self::struct_of_structs_generated::*;
+ mod struct_of_structs_of_structs_generated;
+ pub use self::struct_of_structs_of_structs_generated::*;
mod stat_generated;
pub use self::stat_generated::*;
mod referrable_generated;
diff --git a/tests/monster_test/my_game/example/ability_generated.rs b/tests/monster_test/my_game/example/ability_generated.rs
index 5746e8e..d1f177c 100644
--- a/tests/monster_test/my_game/example/ability_generated.rs
+++ b/tests/monster_test/my_game/example/ability_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct Ability, aligned to 4
@@ -13,8 +18,8 @@
Self([0; 8])
}
}
-impl std::fmt::Debug for Ability {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for Ability {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ability")
.field("id", &self.id())
.field("distance", &self.distance())
@@ -43,7 +48,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(self as *const Ability as *const u8, Self::size())
+ ::core::slice::from_raw_parts(self as *const Ability as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -54,7 +59,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(*self as *const Ability as *const u8, Self::size())
+ ::core::slice::from_raw_parts(*self as *const Ability as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -115,7 +120,7 @@
}
#[inline]
- pub fn key_compare_with_value(&self, val: u32) -> ::std::cmp::Ordering {
+ pub fn key_compare_with_value(&self, val: u32) -> ::core::cmp::Ordering {
let key = self.id();
key.cmp(&val)
}
diff --git a/tests/monster_test/my_game/example/any_ambiguous_aliases_generated.rs b/tests/monster_test/my_game/example/any_ambiguous_aliases_generated.rs
index 321007a..ee8cba7 100644
--- a/tests/monster_test/my_game/example/any_ambiguous_aliases_generated.rs
+++ b/tests/monster_test/my_game/example/any_ambiguous_aliases_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
@@ -46,8 +51,8 @@
}
}
}
-impl std::fmt::Debug for AnyAmbiguousAliases {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for AnyAmbiguousAliases {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -135,7 +140,7 @@
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m1(&mut self) -> Option<Box<MonsterT>> {
if let Self::M1(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::M1(w) = v {
Some(w)
} else {
@@ -156,7 +161,7 @@
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m2(&mut self) -> Option<Box<MonsterT>> {
if let Self::M2(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::M2(w) = v {
Some(w)
} else {
@@ -177,7 +182,7 @@
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m3(&mut self) -> Option<Box<MonsterT>> {
if let Self::M3(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::M3(w) = v {
Some(w)
} else {
diff --git a/tests/monster_test/my_game/example/any_generated.rs b/tests/monster_test/my_game/example/any_generated.rs
index 6f7f6fd..adddc10 100644
--- a/tests/monster_test/my_game/example/any_generated.rs
+++ b/tests/monster_test/my_game/example/any_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
@@ -46,8 +51,8 @@
}
}
}
-impl std::fmt::Debug for Any {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for Any {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -135,7 +140,7 @@
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_monster(&mut self) -> Option<Box<MonsterT>> {
if let Self::Monster(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::Monster(w) = v {
Some(w)
} else {
@@ -156,7 +161,7 @@
/// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
pub fn take_test_simple_table_with_enum(&mut self) -> Option<Box<TestSimpleTableWithEnumT>> {
if let Self::TestSimpleTableWithEnum(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::TestSimpleTableWithEnum(w) = v {
Some(w)
} else {
@@ -177,7 +182,7 @@
/// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
pub fn take_my_game_example_2_monster(&mut self) -> Option<Box<super::example_2::MonsterT>> {
if let Self::MyGameExample2Monster(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::MyGameExample2Monster(w) = v {
Some(w)
} else {
diff --git a/tests/monster_test/my_game/example/any_unique_aliases_generated.rs b/tests/monster_test/my_game/example/any_unique_aliases_generated.rs
index 1749d5d..5142d0e 100644
--- a/tests/monster_test/my_game/example/any_unique_aliases_generated.rs
+++ b/tests/monster_test/my_game/example/any_unique_aliases_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
@@ -46,8 +51,8 @@
}
}
}
-impl std::fmt::Debug for AnyUniqueAliases {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for AnyUniqueAliases {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -135,7 +140,7 @@
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m(&mut self) -> Option<Box<MonsterT>> {
if let Self::M(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::M(w) = v {
Some(w)
} else {
@@ -156,7 +161,7 @@
/// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
pub fn take_ts(&mut self) -> Option<Box<TestSimpleTableWithEnumT>> {
if let Self::TS(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::TS(w) = v {
Some(w)
} else {
@@ -177,7 +182,7 @@
/// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
pub fn take_m2(&mut self) -> Option<Box<super::example_2::MonsterT>> {
if let Self::M2(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::M2(w) = v {
Some(w)
} else {
diff --git a/tests/monster_test/my_game/example/color_generated.rs b/tests/monster_test/my_game/example/color_generated.rs
index 4a3282b..1b9287f 100644
--- a/tests/monster_test/my_game/example/color_generated.rs
+++ b/tests/monster_test/my_game/example/color_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[allow(non_upper_case_globals)]
diff --git a/tests/monster_test/my_game/example/long_enum_generated.rs b/tests/monster_test/my_game/example/long_enum_generated.rs
index b22f826..6a24d74 100644
--- a/tests/monster_test/my_game/example/long_enum_generated.rs
+++ b/tests/monster_test/my_game/example/long_enum_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[allow(non_upper_case_globals)]
diff --git a/tests/monster_test/my_game/example/monster_generated.rs b/tests/monster_test/my_game/example/monster_generated.rs
index 58e7628..dd325b2 100644
--- a/tests/monster_test/my_game/example/monster_generated.rs
+++ b/tests/monster_test/my_game/example/monster_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum MonsterOffset {}
@@ -379,7 +384,7 @@
}
#[inline]
- pub fn key_compare_with_value(&self, val: & str) -> ::std::cmp::Ordering {
+ pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering {
let key = self.name();
key.cmp(val)
}
@@ -1116,8 +1121,8 @@
}
}
-impl std::fmt::Debug for Monster<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for Monster<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Monster");
ds.field("pos", &self.pos());
ds.field("mana", &self.mana());
diff --git a/tests/monster_test/my_game/example/race_generated.rs b/tests/monster_test/my_game/example/race_generated.rs
index ab012f9..47f3855 100644
--- a/tests/monster_test/my_game/example/race_generated.rs
+++ b/tests/monster_test/my_game/example/race_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
@@ -46,8 +51,8 @@
}
}
}
-impl std::fmt::Debug for Race {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for Race {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
diff --git a/tests/monster_test/my_game/example/referrable_generated.rs b/tests/monster_test/my_game/example/referrable_generated.rs
index 877e3b8..81a9d60 100644
--- a/tests/monster_test/my_game/example/referrable_generated.rs
+++ b/tests/monster_test/my_game/example/referrable_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum ReferrableOffset {}
@@ -57,7 +62,7 @@
}
#[inline]
- pub fn key_compare_with_value(&self, val: u64) -> ::std::cmp::Ordering {
+ pub fn key_compare_with_value(&self, val: u64) -> ::core::cmp::Ordering {
let key = self.id();
key.cmp(&val)
}
@@ -111,8 +116,8 @@
}
}
-impl std::fmt::Debug for Referrable<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for Referrable<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Referrable");
ds.field("id", &self.id());
ds.finish()
diff --git a/tests/monster_test/my_game/example/stat_generated.rs b/tests/monster_test/my_game/example/stat_generated.rs
index d6e5fad..98bc331 100644
--- a/tests/monster_test/my_game/example/stat_generated.rs
+++ b/tests/monster_test/my_game/example/stat_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum StatOffset {}
@@ -75,7 +80,7 @@
}
#[inline]
- pub fn key_compare_with_value(&self, val: u16) -> ::std::cmp::Ordering {
+ pub fn key_compare_with_value(&self, val: u16) -> ::core::cmp::Ordering {
let key = self.count();
key.cmp(&val)
}
@@ -143,8 +148,8 @@
}
}
-impl std::fmt::Debug for Stat<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for Stat<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Stat");
ds.field("id", &self.id());
ds.field("val", &self.val());
diff --git a/tests/monster_test/my_game/example/struct_of_structs_generated.rs b/tests/monster_test/my_game/example/struct_of_structs_generated.rs
index 9994f7e..bc05c77 100644
--- a/tests/monster_test/my_game/example/struct_of_structs_generated.rs
+++ b/tests/monster_test/my_game/example/struct_of_structs_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct StructOfStructs, aligned to 4
@@ -13,8 +18,8 @@
Self([0; 20])
}
}
-impl std::fmt::Debug for StructOfStructs {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for StructOfStructs {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("StructOfStructs")
.field("a", &self.a())
.field("b", &self.b())
@@ -44,7 +49,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(self as *const StructOfStructs as *const u8, Self::size())
+ ::core::slice::from_raw_parts(self as *const StructOfStructs as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -55,7 +60,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(*self as *const StructOfStructs as *const u8, Self::size())
+ ::core::slice::from_raw_parts(*self as *const StructOfStructs as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
diff --git a/tests/monster_test/my_game/example/struct_of_structs_of_structs_generated.rs b/tests/monster_test/my_game/example/struct_of_structs_of_structs_generated.rs
new file mode 100644
index 0000000..9c7ae0b
--- /dev/null
+++ b/tests/monster_test/my_game/example/struct_of_structs_of_structs_generated.rs
@@ -0,0 +1,118 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
+extern crate flatbuffers;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
+use self::flatbuffers::{EndianScalar, Follow};
+use super::*;
+// struct StructOfStructsOfStructs, aligned to 4
+#[repr(transparent)]
+#[derive(Clone, Copy, PartialEq)]
+pub struct StructOfStructsOfStructs(pub [u8; 20]);
+impl Default for StructOfStructsOfStructs {
+ fn default() -> Self {
+ Self([0; 20])
+ }
+}
+impl core::fmt::Debug for StructOfStructsOfStructs {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
+ f.debug_struct("StructOfStructsOfStructs")
+ .field("a", &self.a())
+ .finish()
+ }
+}
+
+impl flatbuffers::SimpleToVerifyInSlice for StructOfStructsOfStructs {}
+impl flatbuffers::SafeSliceAccess for StructOfStructsOfStructs {}
+impl<'a> flatbuffers::Follow<'a> for StructOfStructsOfStructs {
+ type Inner = &'a StructOfStructsOfStructs;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ <&'a StructOfStructsOfStructs>::follow(buf, loc)
+ }
+}
+impl<'a> flatbuffers::Follow<'a> for &'a StructOfStructsOfStructs {
+ type Inner = &'a StructOfStructsOfStructs;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ flatbuffers::follow_cast_ref::<StructOfStructsOfStructs>(buf, loc)
+ }
+}
+impl<'b> flatbuffers::Push for StructOfStructsOfStructs {
+ type Output = StructOfStructsOfStructs;
+ #[inline]
+ fn push(&self, dst: &mut [u8], _rest: &[u8]) {
+ let src = unsafe {
+ ::core::slice::from_raw_parts(self as *const StructOfStructsOfStructs as *const u8, Self::size())
+ };
+ dst.copy_from_slice(src);
+ }
+}
+impl<'b> flatbuffers::Push for &'b StructOfStructsOfStructs {
+ type Output = StructOfStructsOfStructs;
+
+ #[inline]
+ fn push(&self, dst: &mut [u8], _rest: &[u8]) {
+ let src = unsafe {
+ ::core::slice::from_raw_parts(*self as *const StructOfStructsOfStructs as *const u8, Self::size())
+ };
+ dst.copy_from_slice(src);
+ }
+}
+
+impl<'a> flatbuffers::Verifiable for StructOfStructsOfStructs {
+ #[inline]
+ fn run_verifier(
+ v: &mut flatbuffers::Verifier, pos: usize
+ ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
+ use self::flatbuffers::Verifiable;
+ v.in_buffer::<Self>(pos)
+ }
+}
+
+impl<'a> StructOfStructsOfStructs {
+ #[allow(clippy::too_many_arguments)]
+ pub fn new(
+ a: &StructOfStructs,
+ ) -> Self {
+ let mut s = Self([0; 20]);
+ s.set_a(a);
+ s
+ }
+
+ pub const fn get_fully_qualified_name() -> &'static str {
+ "MyGame.Example.StructOfStructsOfStructs"
+ }
+
+ pub fn a(&self) -> &StructOfStructs {
+ unsafe { &*(self.0[0..].as_ptr() as *const StructOfStructs) }
+ }
+
+ #[allow(clippy::identity_op)]
+ pub fn set_a(&mut self, x: &StructOfStructs) {
+ self.0[0..0 + 20].copy_from_slice(&x.0)
+ }
+
+ pub fn unpack(&self) -> StructOfStructsOfStructsT {
+ StructOfStructsOfStructsT {
+ a: self.a().unpack(),
+ }
+ }
+}
+
+#[derive(Debug, Clone, PartialEq, Default)]
+pub struct StructOfStructsOfStructsT {
+ pub a: StructOfStructsT,
+}
+impl StructOfStructsOfStructsT {
+ pub fn pack(&self) -> StructOfStructsOfStructs {
+ StructOfStructsOfStructs::new(
+ &self.a.pack(),
+ )
+ }
+}
+
diff --git a/tests/monster_test/my_game/example/test_generated.rs b/tests/monster_test/my_game/example/test_generated.rs
index 187b7cd..1b72ee6 100644
--- a/tests/monster_test/my_game/example/test_generated.rs
+++ b/tests/monster_test/my_game/example/test_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct Test, aligned to 2
@@ -13,8 +18,8 @@
Self([0; 4])
}
}
-impl std::fmt::Debug for Test {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for Test {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Test")
.field("a", &self.a())
.field("b", &self.b())
@@ -43,7 +48,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(self as *const Test as *const u8, Self::size())
+ ::core::slice::from_raw_parts(self as *const Test as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -54,7 +59,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(*self as *const Test as *const u8, Self::size())
+ ::core::slice::from_raw_parts(*self as *const Test as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
diff --git a/tests/monster_test/my_game/example/test_simple_table_with_enum_generated.rs b/tests/monster_test/my_game/example/test_simple_table_with_enum_generated.rs
index 6ebe31f..e97dfa0 100644
--- a/tests/monster_test/my_game/example/test_simple_table_with_enum_generated.rs
+++ b/tests/monster_test/my_game/example/test_simple_table_with_enum_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TestSimpleTableWithEnumOffset {}
@@ -101,8 +106,8 @@
}
}
-impl std::fmt::Debug for TestSimpleTableWithEnum<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for TestSimpleTableWithEnum<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TestSimpleTableWithEnum");
ds.field("color", &self.color());
ds.finish()
diff --git a/tests/monster_test/my_game/example/type_aliases_generated.rs b/tests/monster_test/my_game/example/type_aliases_generated.rs
index 5b3ede5..dfa8d56 100644
--- a/tests/monster_test/my_game/example/type_aliases_generated.rs
+++ b/tests/monster_test/my_game/example/type_aliases_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TypeAliasesOffset {}
@@ -270,8 +275,8 @@
}
}
-impl std::fmt::Debug for TypeAliases<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for TypeAliases<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TypeAliases");
ds.field("i8_", &self.i8_());
ds.field("u8_", &self.u8_());
diff --git a/tests/monster_test/my_game/example/vec_3_generated.rs b/tests/monster_test/my_game/example/vec_3_generated.rs
index e5a25bb..fa0ab53 100644
--- a/tests/monster_test/my_game/example/vec_3_generated.rs
+++ b/tests/monster_test/my_game/example/vec_3_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct Vec3, aligned to 8
@@ -13,8 +18,8 @@
Self([0; 32])
}
}
-impl std::fmt::Debug for Vec3 {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for Vec3 {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Vec3")
.field("x", &self.x())
.field("y", &self.y())
@@ -47,7 +52,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(self as *const Vec3 as *const u8, Self::size())
+ ::core::slice::from_raw_parts(self as *const Vec3 as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -58,7 +63,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(*self as *const Vec3 as *const u8, Self::size())
+ ::core::slice::from_raw_parts(*self as *const Vec3 as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
diff --git a/tests/monster_test/my_game/example_2/monster_generated.rs b/tests/monster_test/my_game/example_2/monster_generated.rs
index 54384b5..34e0db1 100644
--- a/tests/monster_test/my_game/example_2/monster_generated.rs
+++ b/tests/monster_test/my_game/example_2/monster_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum MonsterOffset {}
@@ -85,8 +90,8 @@
}
}
-impl std::fmt::Debug for Monster<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for Monster<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Monster");
ds.finish()
}
diff --git a/tests/monster_test/my_game/in_parent_namespace_generated.rs b/tests/monster_test/my_game/in_parent_namespace_generated.rs
index aabd4b8..263fae7 100644
--- a/tests/monster_test/my_game/in_parent_namespace_generated.rs
+++ b/tests/monster_test/my_game/in_parent_namespace_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum InParentNamespaceOffset {}
@@ -85,8 +90,8 @@
}
}
-impl std::fmt::Debug for InParentNamespace<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for InParentNamespace<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("InParentNamespace");
ds.finish()
}
diff --git a/tests/monster_test/my_game/other_name_space/from_include_generated.rs b/tests/monster_test/my_game/other_name_space/from_include_generated.rs
index 048bafd..3c5165d 100644
--- a/tests/monster_test/my_game/other_name_space/from_include_generated.rs
+++ b/tests/monster_test/my_game/other_name_space/from_include_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
@@ -34,8 +39,8 @@
}
}
}
-impl std::fmt::Debug for FromInclude {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for FromInclude {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
diff --git a/tests/monster_test/my_game/other_name_space/table_b_generated.rs b/tests/monster_test/my_game/other_name_space/table_b_generated.rs
index 46a99cb..da7b937 100644
--- a/tests/monster_test/my_game/other_name_space/table_b_generated.rs
+++ b/tests/monster_test/my_game/other_name_space/table_b_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TableBOffset {}
@@ -103,8 +108,8 @@
}
}
-impl std::fmt::Debug for TableB<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for TableB<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TableB");
ds.field("a", &self.a());
ds.finish()
diff --git a/tests/monster_test/my_game/other_name_space/unused_generated.rs b/tests/monster_test/my_game/other_name_space/unused_generated.rs
index 1dc5913..1e4ad9c 100644
--- a/tests/monster_test/my_game/other_name_space/unused_generated.rs
+++ b/tests/monster_test/my_game/other_name_space/unused_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct Unused, aligned to 4
@@ -13,8 +18,8 @@
Self([0; 4])
}
}
-impl std::fmt::Debug for Unused {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for Unused {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Unused")
.field("a", &self.a())
.finish()
@@ -42,7 +47,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(self as *const Unused as *const u8, Self::size())
+ ::core::slice::from_raw_parts(self as *const Unused as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -53,7 +58,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(*self as *const Unused as *const u8, Self::size())
+ ::core::slice::from_raw_parts(*self as *const Unused as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
diff --git a/tests/monster_test/table_a_generated.rs b/tests/monster_test/table_a_generated.rs
index 9188b29..0e6a78d 100644
--- a/tests/monster_test/table_a_generated.rs
+++ b/tests/monster_test/table_a_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TableAOffset {}
@@ -103,8 +108,8 @@
}
}
-impl std::fmt::Debug for TableA<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for TableA<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TableA");
ds.field("b", &self.b());
ds.finish()
diff --git a/tests/monster_test_bfbs_generated.h b/tests/monster_test_bfbs_generated.h
index fc611db..f8bc4aa 100644
--- a/tests/monster_test_bfbs_generated.h
+++ b/tests/monster_test_bfbs_generated.h
@@ -6,107 +6,114 @@
#include "flatbuffers/flatbuffers.h"
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
+
namespace MyGame {
namespace Example {
struct MonsterBinarySchema {
static const uint8_t *data() {
// Buffer containing the binary schema.
- static const uint8_t bfbsData[14648] = {
- 0x20,0x00,0x00,0x00,0x42,0x46,0x42,0x53,0x00,0x00,0x00,0x00,0x14,0x00,0x20,0x00,0x04,0x00,0x08,0x00,
- 0x0C,0x00,0x10,0x00,0x14,0x00,0x18,0x00,0x00,0x00,0x1C,0x00,0x14,0x00,0x00,0x00,0x58,0x00,0x00,0x00,
- 0x34,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x9C,0x0E,0x00,0x00,0x08,0x00,0x00,0x00,
- 0x7C,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xD8,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x6D,0x6F,0x6E,0x00,
- 0x04,0x00,0x00,0x00,0x4D,0x4F,0x4E,0x53,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x48,0x05,0x00,0x00,
- 0xB4,0x02,0x00,0x00,0xF4,0x03,0x00,0x00,0x00,0x09,0x00,0x00,0x8C,0x06,0x00,0x00,0xB8,0x07,0x00,0x00,
- 0xE8,0x0A,0x00,0x00,0x0E,0x00,0x00,0x00,0x10,0x31,0x00,0x00,0x4C,0x0E,0x00,0x00,0xE4,0x2D,0x00,0x00,
- 0xC0,0x2E,0x00,0x00,0xD8,0x2F,0x00,0x00,0x18,0x35,0x00,0x00,0xF8,0x33,0x00,0x00,0x70,0x0B,0x00,0x00,
- 0xF0,0x31,0x00,0x00,0xE0,0x35,0x00,0x00,0x18,0x36,0x00,0x00,0x08,0x37,0x00,0x00,0xBC,0x37,0x00,0x00,
- 0x64,0x36,0x00,0x00,0x03,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0xEC,0xCB,0xFF,0xFF,0x0C,0x36,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x58,0x36,0x00,0x00,
- 0x00,0xCC,0xFF,0xFF,0xAC,0x37,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x44,0x36,0x00,0x00,
- 0x9C,0x37,0x00,0x00,0x18,0xCC,0xFF,0xFF,0x38,0x36,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x2C,0x36,0x00,0x00,0x84,0x37,0x00,0x00,0x00,0x00,0x0E,0x00,0x14,0x00,0x04,0x00,0x08,0x00,0x00,0x00,
+ static const uint8_t bfbsData[14784] = {
+ 0x1C,0x00,0x00,0x00,0x42,0x46,0x42,0x53,0x14,0x00,0x20,0x00,0x04,0x00,0x08,0x00,0x0C,0x00,0x10,0x00,
+ 0x14,0x00,0x18,0x00,0x00,0x00,0x1C,0x00,0x14,0x00,0x00,0x00,0x58,0x00,0x00,0x00,0x34,0x00,0x00,0x00,
+ 0x24,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0xA0,0x0E,0x00,0x00,0x08,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x00,0xDC,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x6D,0x6F,0x6E,0x00,0x04,0x00,0x00,0x00,
+ 0x4D,0x4F,0x4E,0x53,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x4C,0x05,0x00,0x00,0xB8,0x02,0x00,0x00,
+ 0xF8,0x03,0x00,0x00,0x04,0x09,0x00,0x00,0x90,0x06,0x00,0x00,0xBC,0x07,0x00,0x00,0xEC,0x0A,0x00,0x00,
+ 0x0F,0x00,0x00,0x00,0x9C,0x31,0x00,0x00,0x50,0x0E,0x00,0x00,0xE8,0x2D,0x00,0x00,0xC4,0x2E,0x00,0x00,
+ 0x64,0x30,0x00,0x00,0xD8,0x2F,0x00,0x00,0xA0,0x35,0x00,0x00,0x80,0x34,0x00,0x00,0x70,0x0B,0x00,0x00,
+ 0x78,0x32,0x00,0x00,0x68,0x36,0x00,0x00,0xA0,0x36,0x00,0x00,0x90,0x37,0x00,0x00,0x44,0x38,0x00,0x00,
+ 0xEC,0x36,0x00,0x00,0x03,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x64,0xCB,0xFF,0xFF,0x94,0x36,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xE0,0x36,0x00,0x00,
+ 0x78,0xCB,0xFF,0xFF,0x34,0x38,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0xCC,0x36,0x00,0x00,
+ 0x24,0x38,0x00,0x00,0x90,0xCB,0xFF,0xFF,0xC0,0x36,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
+ 0xB4,0x36,0x00,0x00,0x0C,0x38,0x00,0x00,0x00,0x00,0x0E,0x00,0x14,0x00,0x04,0x00,0x08,0x00,0x00,0x00,
0x0C,0x00,0x10,0x00,0x0E,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
- 0xAC,0x35,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x88,0x01,0x00,0x00,0xF4,0x00,0x00,0x00,
+ 0x34,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x88,0x01,0x00,0x00,0xF4,0x00,0x00,0x00,
0x90,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x1D,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,
0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x4D,0x6F,0x6E,0x73,0x74,0x65,0x72,0x53,0x74,0x6F,0x72,0x61,0x67,
0x65,0x00,0x00,0x00,0xBA,0xFE,0xFF,0xFF,0x48,0x00,0x00,0x00,0x5C,0x0D,0x00,0x00,0xD4,0x2D,0x00,0x00,
0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0xB4,0xCC,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x62,0x69,0x64,0x69,
+ 0x2C,0xCC,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x62,0x69,0x64,0x69,
0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x73,0x74,0x72,0x65,0x61,0x6D,0x69,0x6E,0x67,0x00,0x00,0x00,
0x12,0x00,0x00,0x00,0x47,0x65,0x74,0x4D,0x69,0x6E,0x4D,0x61,0x78,0x48,0x69,0x74,0x50,0x6F,0x69,0x6E,
0x74,0x73,0x00,0x00,0x1E,0xFF,0xFF,0xFF,0x48,0x00,0x00,0x00,0xF8,0x0C,0x00,0x00,0x70,0x2D,0x00,0x00,
0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x18,0xCD,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x63,0x6C,0x69,0x65,
+ 0x90,0xCC,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x63,0x6C,0x69,0x65,
0x6E,0x74,0x00,0x00,0x09,0x00,0x00,0x00,0x73,0x74,0x72,0x65,0x61,0x6D,0x69,0x6E,0x67,0x00,0x00,0x00,
0x0E,0x00,0x00,0x00,0x47,0x65,0x74,0x4D,0x61,0x78,0x48,0x69,0x74,0x50,0x6F,0x69,0x6E,0x74,0x00,0x00,
0x7E,0xFF,0xFF,0xFF,0x70,0x00,0x00,0x00,0x14,0x2D,0x00,0x00,0x94,0x0C,0x00,0x00,0x0C,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x7C,0xCD,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x73,0x65,0x72,0x76,
+ 0xF4,0xCC,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x73,0x65,0x72,0x76,
0x65,0x72,0x00,0x00,0x09,0x00,0x00,0x00,0x73,0x74,0x72,0x65,0x61,0x6D,0x69,0x6E,0x67,0x00,0x00,0x00,
- 0xA4,0xCD,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
+ 0x1C,0xCD,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
0x0A,0x00,0x00,0x00,0x69,0x64,0x65,0x6D,0x70,0x6F,0x74,0x65,0x6E,0x74,0x00,0x00,0x08,0x00,0x00,0x00,
0x52,0x65,0x74,0x72,0x69,0x65,0x76,0x65,0x00,0x00,0x0E,0x00,0x18,0x00,0x04,0x00,0x08,0x00,0x0C,0x00,
0x10,0x00,0x14,0x00,0x0E,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x08,0x0C,0x00,0x00,0x80,0x2C,0x00,0x00,
0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x08,0xCE,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x6E,0x6F,0x6E,0x65,
+ 0x80,0xCD,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x6E,0x6F,0x6E,0x65,
0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x73,0x74,0x72,0x65,0x61,0x6D,0x69,0x6E,0x67,0x00,0x00,0x00,
0x05,0x00,0x00,0x00,0x53,0x74,0x6F,0x72,0x65,0x00,0x00,0x00,0x82,0xFD,0xFF,0xFF,0x00,0x00,0x00,0x01,
- 0x40,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0xA8,0x33,0x00,0x00,
- 0x00,0x00,0x00,0x00,0xBC,0xCD,0xFF,0xFF,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x40,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x30,0x34,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x34,0xCD,0xFF,0xFF,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0xA4,0x00,0x00,0x00,0x68,0x00,0x00,0x00,
0x2C,0x00,0x00,0x00,0x22,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,
0x6C,0x65,0x2E,0x41,0x6E,0x79,0x41,0x6D,0x62,0x69,0x67,0x75,0x6F,0x75,0x73,0x41,0x6C,0x69,0x61,0x73,
0x65,0x73,0x00,0x00,0x7E,0xF8,0xFF,0xFF,0x2C,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
- 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0xCB,0xFF,0xFF,
+ 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xCA,0xFF,0xFF,
0x00,0x00,0x00,0x0F,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x4D,0x33,0x00,0x00,
0xB6,0xF8,0xFF,0xFF,0x2C,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB0,0xCB,0xFF,0xFF,0x00,0x00,0x00,0x0F,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x28,0xCB,0xFF,0xFF,0x00,0x00,0x00,0x0F,
0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x4D,0x32,0x00,0x00,0xEE,0xF8,0xFF,0xFF,
0x2C,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE8,0xCB,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x01,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xCB,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x01,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x4D,0x31,0x00,0x00,0x72,0xF8,0xFF,0xFF,0x1C,0x00,0x00,0x00,
0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x64,0xF8,0xFF,0xFF,0x01,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x4E,0x4F,0x4E,0x45,0x00,0x00,0x00,0x00,0xC6,0xFE,0xFF,0xFF,
0x00,0x00,0x00,0x01,0x40,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
- 0x64,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCF,0xFF,0xFF,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00,
+ 0xEC,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0xCE,0xFF,0xFF,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xD8,0x00,0x00,0x00,0xA0,0x00,0x00,0x00,
0x64,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,
0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x41,0x6E,0x79,0x55,0x6E,0x69,0x71,0x75,0x65,0x41,0x6C,0x69,0x61,
0x73,0x65,0x73,0x00,0xBE,0xF9,0xFF,0xFF,0x2C,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
- 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB8,0xCC,0xFF,0xFF,
- 0x00,0x00,0x00,0x0F,0x09,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x4D,0x32,0x00,0x00,
+ 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0xCC,0xFF,0xFF,
+ 0x00,0x00,0x00,0x0F,0x0A,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x4D,0x32,0x00,0x00,
0xF6,0xF9,0xFF,0xFF,0x2C,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xCC,0xFF,0xFF,0x00,0x00,0x00,0x0F,
- 0x06,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x54,0x53,0x00,0x00,0x1E,0xFC,0xFF,0xFF,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x68,0xCC,0xFF,0xFF,0x00,0x00,0x00,0x0F,
+ 0x07,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x54,0x53,0x00,0x00,0x1E,0xFC,0xFF,0xFF,
0x28,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x24,0xCD,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x9C,0xCC,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x4D,0x00,0x00,0x00,0xAE,0xF9,0xFF,0xFF,0x1C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0xF9,0xFF,0xFF,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x4E,0x4F,0x4E,0x45,0x00,0x00,0x12,0x00,0x1C,0x00,0x08,0x00,0x0C,0x00,0x07,0x00,
0x10,0x00,0x00,0x00,0x14,0x00,0x18,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x40,0x00,0x00,0x00,
- 0x28,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x18,0x31,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x4C,0xD0,0xFF,0xFF,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x28,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0xA0,0x31,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xC4,0xCF,0xFF,0xFF,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0xB4,0x00,0x00,0x00,0x68,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,
0x12,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x41,
0x6E,0x79,0x00,0x00,0xEE,0xFC,0xFF,0xFF,0x28,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
- 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF4,0xCD,0xFF,0xFF,0x00,0x00,0x00,0x0F,
- 0x09,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x5F,0x45,
+ 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0xCD,0xFF,0xFF,0x00,0x00,0x00,0x0F,
+ 0x0A,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x5F,0x45,
0x78,0x61,0x6D,0x70,0x6C,0x65,0x32,0x5F,0x4D,0x6F,0x6E,0x73,0x74,0x65,0x72,0x00,0x36,0xFD,0xFF,0xFF,
0x28,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x3C,0xCE,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x06,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xB4,0xCD,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x07,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x17,0x00,0x00,0x00,0x54,0x65,0x73,0x74,0x53,0x69,0x6D,0x70,0x6C,0x65,0x54,0x61,0x62,0x6C,0x65,0x57,
0x69,0x74,0x68,0x45,0x6E,0x75,0x6D,0x00,0x7E,0xFD,0xFF,0xFF,0x28,0x00,0x00,0x00,0x14,0x00,0x00,0x00,
- 0x0C,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x84,0xCE,0xFF,0xFF,
+ 0x0C,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xCD,0xFF,0xFF,
0x00,0x00,0x00,0x0F,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x4D,0x6F,0x6E,0x73,
0x74,0x65,0x72,0x00,0x12,0xFB,0xFF,0xFF,0x1C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x04,0xFB,0xFF,0xFF,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x4E,0x4F,0x4E,0x45,0x00,0x00,0x00,0x00,0xA2,0xFD,0xFF,0xFF,0x6C,0x00,0x00,0x00,0x58,0x00,0x00,0x00,
- 0x40,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0xC4,0x2F,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x48,0xD2,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x40,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x4C,0x30,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xC0,0xD1,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x62,0x69,0x74,0x5F,0x66,0x6C,0x61,0x67,
- 0x73,0x00,0x00,0x00,0xCC,0xD1,0xFF,0xFF,0x00,0x00,0x00,0x0A,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
+ 0x73,0x00,0x00,0x00,0x44,0xD1,0xFF,0xFF,0x00,0x00,0x00,0x0A,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x98,0x00,0x00,0x00,0x5C,0x00,0x00,0x00,0x20,0x00,0x00,0x00,
0x17,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x4C,
0x6F,0x6E,0x67,0x45,0x6E,0x75,0x6D,0x00,0x7E,0xFC,0xFF,0xFF,0x28,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
@@ -118,8 +125,8 @@
0xDE,0xFE,0xFF,0xFF,0x24,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0xFC,0xFF,0xFF,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x07,0x00,0x00,0x00,0x4C,0x6F,0x6E,0x67,0x4F,0x6E,0x65,0x00,0xDE,0xFC,0xFF,0xFF,0x40,0x00,0x00,0x00,
- 0x28,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x98,0x2E,0x00,0x00,0x00,0x00,0x00,0x00,
- 0xCC,0xD2,0xFF,0xFF,0x00,0x00,0x00,0x03,0x05,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x28,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x20,0x2F,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x44,0xD2,0xFF,0xFF,0x00,0x00,0x00,0x03,0x05,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0xC8,0x00,0x00,0x00,0x8C,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,
0x13,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x52,
0x61,0x63,0x65,0x00,0x6E,0xFF,0xFF,0xFF,0x24,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
@@ -134,12 +141,12 @@
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x64,0xFD,0xFF,0xFF,0x01,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x4E,0x6F,0x6E,0x65,0x00,0x00,0x12,0x00,0x1C,0x00,0x04,0x00,
0x08,0x00,0x00,0x00,0x0C,0x00,0x10,0x00,0x14,0x00,0x18,0x00,0x12,0x00,0x00,0x00,0x9C,0x00,0x00,0x00,
- 0x88,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x54,0x2D,0x00,0x00,
+ 0x88,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0xDC,0x2D,0x00,0x00,
0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x27,0x00,0x00,0x00,0x20,0x43,0x6F,0x6D,0x70,0x6F,0x73,0x69,
0x74,0x65,0x20,0x63,0x6F,0x6D,0x70,0x6F,0x6E,0x65,0x6E,0x74,0x73,0x20,0x6F,0x66,0x20,0x4D,0x6F,0x6E,
0x73,0x74,0x65,0x72,0x20,0x63,0x6F,0x6C,0x6F,0x72,0x2E,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0xE8,0xD4,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
- 0x09,0x00,0x00,0x00,0x62,0x69,0x74,0x5F,0x66,0x6C,0x61,0x67,0x73,0x00,0x00,0x00,0x6C,0xD4,0xFF,0xFF,
+ 0x60,0xD4,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
+ 0x09,0x00,0x00,0x00,0x62,0x69,0x74,0x5F,0x66,0x6C,0x61,0x67,0x73,0x00,0x00,0x00,0xE4,0xD3,0xFF,0xFF,
0x00,0x00,0x00,0x04,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x18,0x01,0x00,0x00,0x84,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,
0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x43,0x6F,0x6C,0x6F,0x72,0x00,0x00,0x00,0x00,
@@ -159,51 +166,51 @@
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x52,0x65,0x64,0x00,0x00,0x00,0x12,0x00,0x18,0x00,0x04,0x00,
0x08,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x10,0x00,0x14,0x00,0x12,0x00,0x00,0x00,0x34,0x00,0x00,0x00,
- 0x28,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x18,0x2D,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0xD6,0xFF,0xFF,0x00,0x00,0x00,0x09,0x06,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x28,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0xA0,0x2D,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x78,0xD5,0xFF,0xFF,0x00,0x00,0x00,0x09,0x06,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x4F,
0x74,0x68,0x65,0x72,0x4E,0x61,0x6D,0x65,0x53,0x70,0x61,0x63,0x65,0x2E,0x46,0x72,0x6F,0x6D,0x49,0x6E,
0x63,0x6C,0x75,0x64,0x65,0x00,0x0E,0x00,0x10,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x0C,0x00,
0x0E,0x00,0x00,0x00,0x2C,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x10,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x49,0x6E,0x63,0x6C,0x75,0x64,0x65,0x56,
- 0x61,0x6C,0x00,0x00,0x6C,0xD4,0xFF,0xFF,0x4C,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x08,0x00,0x00,0x00,0xB8,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0xE4,0x00,0x00,0x00,
+ 0x61,0x6C,0x00,0x00,0xE4,0xD3,0xFF,0xFF,0x4C,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x08,0x00,0x00,0x00,0x40,0x2B,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0xE4,0x00,0x00,0x00,
0xB0,0x00,0x00,0x00,0xF0,0x01,0x00,0x00,0x90,0x01,0x00,0x00,0x30,0x01,0x00,0x00,0x60,0x02,0x00,0x00,
0xB0,0x01,0x00,0x00,0x54,0x01,0x00,0x00,0xF0,0x00,0x00,0x00,0x04,0x02,0x00,0x00,0x5C,0x00,0x00,0x00,
0x24,0x00,0x00,0x00,0x1A,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,
- 0x6C,0x65,0x2E,0x54,0x79,0x70,0x65,0x41,0x6C,0x69,0x61,0x73,0x65,0x73,0x00,0x00,0x88,0xDB,0xFF,0xFF,
+ 0x6C,0x65,0x2E,0x54,0x79,0x70,0x65,0x41,0x6C,0x69,0x61,0x73,0x65,0x73,0x00,0x00,0x00,0xDB,0xFF,0xFF,
0x00,0x00,0x00,0x01,0x0B,0x00,0x1A,0x00,0x1C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x14,0xE1,0xFF,0xFF,0x00,0x00,0x0E,0x0C,0x08,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x76,0x66,0x36,0x34,0x00,0x00,0x00,0x00,0xBC,0xDB,0xFF,0xFF,0x00,0x00,0x00,0x01,0x0A,0x00,0x18,0x00,
+ 0x76,0x66,0x36,0x34,0x00,0x00,0x00,0x00,0x34,0xDB,0xFF,0xFF,0x00,0x00,0x00,0x01,0x0A,0x00,0x18,0x00,
0x1C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x48,0xE1,0xFF,0xFF,
- 0x00,0x00,0x0E,0x03,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x76,0x38,0x00,0x00,0xD2,0xD8,0xFF,0xFF,
+ 0x00,0x00,0x0E,0x03,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x76,0x38,0x00,0x00,0x4A,0xD8,0xFF,0xFF,
0x09,0x00,0x16,0x00,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x9C,0xD6,0xFF,0xFF,0x00,0x00,0x00,0x0C,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
- 0x66,0x36,0x34,0x00,0x02,0xD9,0xFF,0xFF,0x08,0x00,0x14,0x00,0x1C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0xD4,0xFF,0xFF,0x00,0x00,0x00,0x0B,0x01,0x00,0x00,0x00,
- 0x03,0x00,0x00,0x00,0x66,0x33,0x32,0x00,0x2E,0xD9,0xFF,0xFF,0x07,0x00,0x12,0x00,0x20,0x00,0x00,0x00,
- 0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xD6,0xFF,0xFF,0x00,0x00,0x00,0x0A,
- 0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x75,0x36,0x34,0x00,0x5E,0xD9,0xFF,0xFF,
+ 0x14,0xD6,0xFF,0xFF,0x00,0x00,0x00,0x0C,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
+ 0x66,0x36,0x34,0x00,0x7A,0xD8,0xFF,0xFF,0x08,0x00,0x14,0x00,0x1C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8C,0xD3,0xFF,0xFF,0x00,0x00,0x00,0x0B,0x01,0x00,0x00,0x00,
+ 0x03,0x00,0x00,0x00,0x66,0x33,0x32,0x00,0xA6,0xD8,0xFF,0xFF,0x07,0x00,0x12,0x00,0x20,0x00,0x00,0x00,
+ 0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0xD6,0xFF,0xFF,0x00,0x00,0x00,0x0A,
+ 0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x75,0x36,0x34,0x00,0xD6,0xD8,0xFF,0xFF,
0x06,0x00,0x10,0x00,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x28,0xD7,0xFF,0xFF,0x00,0x00,0x00,0x09,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
- 0x69,0x36,0x34,0x00,0x8E,0xD9,0xFF,0xFF,0x05,0x00,0x0E,0x00,0x1C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0xD4,0xFF,0xFF,0x00,0x00,0x00,0x08,0x01,0x00,0x00,0x00,
- 0x03,0x00,0x00,0x00,0x75,0x33,0x32,0x00,0xBA,0xD9,0xFF,0xFF,0x04,0x00,0x0C,0x00,0x1C,0x00,0x00,0x00,
- 0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCC,0xD4,0xFF,0xFF,0x00,0x00,0x00,0x07,
- 0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x69,0x33,0x32,0x00,0xE6,0xD9,0xFF,0xFF,0x03,0x00,0x0A,0x00,
- 0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB0,0xD7,0xFF,0xFF,
+ 0xA0,0xD6,0xFF,0xFF,0x00,0x00,0x00,0x09,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
+ 0x69,0x36,0x34,0x00,0x06,0xD9,0xFF,0xFF,0x05,0x00,0x0E,0x00,0x1C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0xD4,0xFF,0xFF,0x00,0x00,0x00,0x08,0x01,0x00,0x00,0x00,
+ 0x03,0x00,0x00,0x00,0x75,0x33,0x32,0x00,0x32,0xD9,0xFF,0xFF,0x04,0x00,0x0C,0x00,0x1C,0x00,0x00,0x00,
+ 0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0xD4,0xFF,0xFF,0x00,0x00,0x00,0x07,
+ 0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x69,0x33,0x32,0x00,0x5E,0xD9,0xFF,0xFF,0x03,0x00,0x0A,0x00,
+ 0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x28,0xD7,0xFF,0xFF,
0x00,0x00,0x00,0x06,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x75,0x31,0x36,0x00,
- 0x16,0xDA,0xFF,0xFF,0x02,0x00,0x08,0x00,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0xE0,0xD7,0xFF,0xFF,0x00,0x00,0x00,0x05,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x03,0x00,0x00,0x00,0x69,0x31,0x36,0x00,0x46,0xDA,0xFF,0xFF,0x01,0x00,0x06,0x00,0x20,0x00,0x00,0x00,
- 0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0xD8,0xFF,0xFF,0x00,0x00,0x00,0x04,
+ 0x8E,0xD9,0xFF,0xFF,0x02,0x00,0x08,0x00,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x58,0xD7,0xFF,0xFF,0x00,0x00,0x00,0x05,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x03,0x00,0x00,0x00,0x69,0x31,0x36,0x00,0xBE,0xD9,0xFF,0xFF,0x01,0x00,0x06,0x00,0x20,0x00,0x00,0x00,
+ 0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0xD7,0xFF,0xFF,0x00,0x00,0x00,0x04,
0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x75,0x38,0x00,0x00,0x00,0x00,0x1A,0x00,
0x14,0x00,0x08,0x00,0x0C,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x10,0x00,0x1A,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5C,0xD8,0xFF,0xFF,0x00,0x00,0x00,0x03,0x01,0x00,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x38,0x00,0x00,0x30,0xD7,0xFF,0xFF,0x30,0x01,0x00,0x00,
- 0x50,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0xF4,0x27,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD4,0xD7,0xFF,0xFF,0x00,0x00,0x00,0x03,0x01,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x38,0x00,0x00,0xA8,0xD6,0xFF,0xFF,0x30,0x01,0x00,0x00,
+ 0x50,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x7C,0x28,0x00,0x00,0x01,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x33,0x00,0x00,0x00,0x20,0x61,0x6E,0x20,0x65,0x78,0x61,0x6D,0x70,0x6C,0x65,0x20,
0x64,0x6F,0x63,0x75,0x6D,0x65,0x6E,0x74,0x61,0x74,0x69,0x6F,0x6E,0x20,0x63,0x6F,0x6D,0x6D,0x65,0x6E,
0x74,0x3A,0x20,0x22,0x6D,0x6F,0x6E,0x73,0x74,0x65,0x72,0x20,0x6F,0x62,0x6A,0x65,0x63,0x74,0x22,0x00,
@@ -221,112 +228,112 @@
0x16,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x4D,
0x6F,0x6E,0x73,0x74,0x65,0x72,0x00,0x00,0x62,0xFD,0xFF,0xFF,0x35,0x00,0x6E,0x00,0x54,0x00,0x00,0x00,
0x3C,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x70,0xDB,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xE8,0xDA,0xFF,0xFF,0x10,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x35,0x33,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,
- 0xEC,0xDA,0xFF,0xFF,0x00,0x00,0x00,0x0A,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x64,0xDA,0xFF,0xFF,0x00,0x00,0x00,0x0A,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x18,0x00,0x00,0x00,0x6C,0x6F,0x6E,0x67,0x5F,0x65,0x6E,0x75,0x6D,0x5F,0x6E,0x6F,0x72,0x6D,0x61,0x6C,
0x5F,0x64,0x65,0x66,0x61,0x75,0x6C,0x74,0x00,0x00,0x00,0x00,0x62,0xE6,0xFF,0xFF,0x34,0x00,0x6C,0x00,
0x4C,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xE4,0xDB,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x35,0x32,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x60,0xDB,0xFF,0xFF,
+ 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x5C,0xDB,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x35,0x32,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xD8,0xDA,0xFF,0xFF,
0x00,0x00,0x00,0x0A,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x1A,0x00,0x00,0x00,
0x6C,0x6F,0x6E,0x67,0x5F,0x65,0x6E,0x75,0x6D,0x5F,0x6E,0x6F,0x6E,0x5F,0x65,0x6E,0x75,0x6D,0x5F,0x64,
0x65,0x66,0x61,0x75,0x6C,0x74,0x00,0x00,0xEC,0xE5,0xFF,0xFF,0x00,0x00,0x00,0x01,0x33,0x00,0x6A,0x00,
0x74,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x60,0xDC,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xD8,0xDB,0xFF,0xFF,0x10,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x0D,0x00,0x00,0x00,0x6E,0x61,0x74,0x69,
- 0x76,0x65,0x5F,0x69,0x6E,0x6C,0x69,0x6E,0x65,0x00,0x00,0x00,0x88,0xDC,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x76,0x65,0x5F,0x69,0x6E,0x6C,0x69,0x6E,0x65,0x00,0x00,0x00,0x00,0xDC,0xFF,0xFF,0x10,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x35,0x31,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,
- 0x50,0xD9,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x05,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0D,0x00,0x00,0x00,
+ 0xC8,0xD8,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x06,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0D,0x00,0x00,0x00,
0x6E,0x61,0x74,0x69,0x76,0x65,0x5F,0x69,0x6E,0x6C,0x69,0x6E,0x65,0x00,0x00,0x00,0x80,0xE6,0xFF,0xFF,
0x00,0x00,0x00,0x01,0x32,0x00,0x68,0x00,0x48,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xF0,0xDC,0xFF,0xFF,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x68,0xDC,0xFF,0xFF,
0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x35,0x30,0x00,0x00,0x02,0x00,0x00,0x00,
0x69,0x64,0x00,0x00,0x38,0xE8,0xFF,0xFF,0x00,0x00,0x0E,0x0F,0x03,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x18,0x00,0x00,0x00,0x73,0x63,0x61,0x6C,0x61,0x72,0x5F,0x6B,0x65,0x79,0x5F,0x73,0x6F,0x72,0x74,0x65,
0x64,0x5F,0x74,0x61,0x62,0x6C,0x65,0x73,0x00,0x00,0x00,0x00,0xF4,0xE6,0xFF,0xFF,0x00,0x00,0x00,0x01,
0x31,0x00,0x66,0x00,0x78,0x00,0x00,0x00,0x68,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x68,0xDD,0xFF,0xFF,
+ 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xE0,0xDC,0xFF,0xFF,
0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x4D,0x6F,0x6E,0x73,0x74,0x65,0x72,0x00,
0x11,0x00,0x00,0x00,0x6E,0x65,0x73,0x74,0x65,0x64,0x5F,0x66,0x6C,0x61,0x74,0x62,0x75,0x66,0x66,0x65,
- 0x72,0x00,0x00,0x00,0x98,0xDD,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
+ 0x72,0x00,0x00,0x00,0x10,0xDD,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x34,0x39,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x0C,0xE7,0xFF,0xFF,0x00,0x00,0x0E,0x04,
0x01,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x72,0x65,0x71,0x75,0x69,0x72,0x65,0x64,
0x6E,0x65,0x73,0x74,0x65,0x64,0x66,0x6C,0x61,0x74,0x62,0x75,0x66,0x66,0x65,0x72,0x00,0x00,0x1A,0x00,
0x20,0x00,0x08,0x00,0x0C,0x00,0x04,0x00,0x06,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x10,0x00,0x14,0x00,0x1A,0x00,0x00,0x00,0x30,0x00,0x64,0x00,0x54,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,
0x14,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x28,0xDE,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x34,0x38,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xA4,0xDD,0xFF,0xFF,
+ 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xA0,0xDD,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x34,0x38,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x1C,0xDD,0xFF,0xFF,
0x00,0x00,0x00,0x03,0x05,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,
0x73,0x69,0x67,0x6E,0x65,0x64,0x5F,0x65,0x6E,0x75,0x6D,0x00,0x20,0xE8,0xFF,0xFF,0x00,0x00,0x00,0x01,
0x2F,0x00,0x62,0x00,0x48,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x90,0xDE,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0xDE,0xFF,0xFF,0x10,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x34,0x37,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,
0xD8,0xE9,0xFF,0xFF,0x00,0x00,0x0E,0x04,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,
0x76,0x65,0x63,0x74,0x6F,0x72,0x5F,0x6F,0x66,0x5F,0x65,0x6E,0x75,0x6D,0x73,0x00,0x88,0xE8,0xFF,0xFF,
0x00,0x00,0x00,0x01,0x2E,0x00,0x60,0x00,0x48,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xF8,0xDE,0xFF,0xFF,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x70,0xDE,0xFF,0xFF,
0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x34,0x36,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x69,0x64,0x00,0x00,0xC0,0xDB,0xFF,0xFF,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x69,0x64,0x00,0x00,0x38,0xDB,0xFF,0xFF,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x0D,0x00,0x00,0x00,0x61,0x6E,0x79,0x5F,0x61,0x6D,0x62,0x69,0x67,0x75,0x6F,0x75,0x73,0x00,0x00,0x00,
0xDA,0xE9,0xFF,0xFF,0x2D,0x00,0x5E,0x00,0x4C,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x5C,0xDF,0xFF,0xFF,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xD4,0xDE,0xFF,0xFF,
0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x34,0x35,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x69,0x64,0x00,0x00,0xD8,0xDE,0xFF,0xFF,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x69,0x64,0x00,0x00,0x50,0xDE,0xFF,0xFF,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x61,0x6E,0x79,0x5F,0x61,0x6D,0x62,0x69,0x67,0x75,0x6F,0x75,
0x73,0x5F,0x74,0x79,0x70,0x65,0x00,0x00,0x5C,0xE9,0xFF,0xFF,0x00,0x00,0x00,0x01,0x2C,0x00,0x5C,0x00,
0x48,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xCC,0xDF,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x34,0x34,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x94,0xDC,0xFF,0xFF,
+ 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x44,0xDF,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x34,0x34,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x0C,0xDC,0xFF,0xFF,
0x00,0x00,0x00,0x10,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x61,0x6E,0x79,0x5F,
0x75,0x6E,0x69,0x71,0x75,0x65,0x00,0x00,0xAA,0xEA,0xFF,0xFF,0x2B,0x00,0x5A,0x00,0x4C,0x00,0x00,0x00,
0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x2C,0xE0,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x34,0x33,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xA8,0xDF,0xFF,0xFF,0x00,0x00,0x00,0x01,
+ 0x04,0x00,0x00,0x00,0xA4,0xDF,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
+ 0x34,0x33,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x20,0xDF,0xFF,0xFF,0x00,0x00,0x00,0x01,
0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x61,0x6E,0x79,0x5F,
0x75,0x6E,0x69,0x71,0x75,0x65,0x5F,0x74,0x79,0x70,0x65,0x00,0x28,0xEA,0xFF,0xFF,0x00,0x00,0x00,0x01,
0x2A,0x00,0x58,0x00,0x00,0x01,0x00,0x00,0xF0,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0xB0,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x50,0x00,0x00,0x00,
- 0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xA8,0xE0,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x34,0x32,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xC4,0xE0,0xFF,0xFF,
+ 0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x20,0xE0,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x34,0x32,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x3C,0xE0,0xFF,0xFF,
0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x66,0x6E,0x76,0x31,0x61,0x5F,0x36,0x34,
- 0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0xEC,0xE0,0xFF,0xFF,
+ 0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0x64,0xE0,0xFF,0xFF,
0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x52,0x65,0x66,0x65,0x72,0x72,0x61,0x62,
0x6C,0x65,0x54,0x00,0x08,0x00,0x00,0x00,0x63,0x70,0x70,0x5F,0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x00,
- 0x18,0xE1,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x90,0xE0,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x10,0x00,0x00,0x00,0x63,0x70,0x70,0x5F,0x70,0x74,0x72,0x5F,0x74,0x79,0x70,0x65,0x5F,0x67,0x65,0x74,
- 0x00,0x00,0x00,0x00,0x44,0xE1,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xBC,0xE0,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,
0x6E,0x61,0x6B,0x65,0x64,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x63,0x70,0x70,0x5F,0x70,0x74,0x72,0x5F,
0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x00,0xC8,0xEA,0xFF,0xFF,0x00,0x00,0x0E,0x0A,0x08,0x00,0x00,0x00,
0x1F,0x00,0x00,0x00,0x76,0x65,0x63,0x74,0x6F,0x72,0x5F,0x6F,0x66,0x5F,0x6E,0x6F,0x6E,0x5F,0x6F,0x77,
0x6E,0x69,0x6E,0x67,0x5F,0x72,0x65,0x66,0x65,0x72,0x65,0x6E,0x63,0x65,0x73,0x00,0x42,0xEC,0xFF,0xFF,
0x29,0x00,0x56,0x00,0x04,0x01,0x00,0x00,0xF0,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0xB0,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x50,0x00,0x00,0x00,
- 0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xD4,0xE1,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x34,0x31,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xF0,0xE1,0xFF,0xFF,
+ 0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x4C,0xE1,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x34,0x31,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x68,0xE1,0xFF,0xFF,
0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x66,0x6E,0x76,0x31,0x61,0x5F,0x36,0x34,
- 0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0x18,0xE2,0xFF,0xFF,
+ 0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0x90,0xE1,0xFF,0xFF,
0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x52,0x65,0x66,0x65,0x72,0x72,0x61,0x62,
0x6C,0x65,0x54,0x00,0x08,0x00,0x00,0x00,0x63,0x70,0x70,0x5F,0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x00,
- 0x44,0xE2,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xBC,0xE1,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x10,0x00,0x00,0x00,0x63,0x70,0x70,0x5F,0x70,0x74,0x72,0x5F,0x74,0x79,0x70,0x65,0x5F,0x67,0x65,0x74,
- 0x00,0x00,0x00,0x00,0x70,0xE2,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xE8,0xE1,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,
0x6E,0x61,0x6B,0x65,0x64,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x63,0x70,0x70,0x5F,0x70,0x74,0x72,0x5F,
- 0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x00,0x1C,0xE1,0xFF,0xFF,0x00,0x00,0x00,0x0A,0x08,0x00,0x00,0x00,
+ 0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x00,0x94,0xE0,0xFF,0xFF,0x00,0x00,0x00,0x0A,0x08,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x6E,0x6F,0x6E,0x5F,0x6F,0x77,0x6E,0x69,0x6E,0x67,0x5F,0x72,
0x65,0x66,0x65,0x72,0x65,0x6E,0x63,0x65,0x00,0x00,0x00,0x00,0x80,0xEC,0xFF,0xFF,0x00,0x00,0x00,0x01,
0x28,0x00,0x54,0x00,0x10,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0xB4,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x50,0x00,0x00,0x00,
- 0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0xE3,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x34,0x30,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x1C,0xE3,0xFF,0xFF,
+ 0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x78,0xE2,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x34,0x30,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x94,0xE2,0xFF,0xFF,
0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x66,0x6E,0x76,0x31,0x61,0x5F,0x36,0x34,
- 0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0x44,0xE3,0xFF,0xFF,
+ 0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0xBC,0xE2,0xFF,0xFF,
0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x52,0x65,0x66,0x65,0x72,0x72,0x61,0x62,
0x6C,0x65,0x54,0x00,0x08,0x00,0x00,0x00,0x63,0x70,0x70,0x5F,0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x00,
- 0x70,0xE3,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x2E,0x67,0x65,0x74,
+ 0xE8,0xE2,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x2E,0x67,0x65,0x74,
0x28,0x29,0x00,0x00,0x10,0x00,0x00,0x00,0x63,0x70,0x70,0x5F,0x70,0x74,0x72,0x5F,0x74,0x79,0x70,0x65,
- 0x5F,0x67,0x65,0x74,0x00,0x00,0x00,0x00,0xA0,0xE3,0xFF,0xFF,0x20,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x5F,0x67,0x65,0x74,0x00,0x00,0x00,0x00,0x18,0xE3,0xFF,0xFF,0x20,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x10,0x00,0x00,0x00,0x64,0x65,0x66,0x61,0x75,0x6C,0x74,0x5F,0x70,0x74,0x72,0x5F,0x74,0x79,0x70,0x65,
0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x63,0x70,0x70,0x5F,0x70,0x74,0x72,0x5F,0x74,0x79,0x70,0x65,
0x00,0x00,0x00,0x00,0x30,0xED,0xFF,0xFF,0x00,0x00,0x0E,0x0A,0x08,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,
@@ -334,20 +341,20 @@
0x72,0x65,0x66,0x65,0x72,0x65,0x6E,0x63,0x65,0x73,0x00,0x00,0xAA,0xEE,0xFF,0xFF,0x27,0x00,0x52,0x00,
0xD4,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x38,0xE4,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x33,0x39,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x54,0xE4,0xFF,0xFF,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0xB0,0xE3,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x33,0x39,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xCC,0xE3,0xFF,0xFF,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x08,0x00,0x00,0x00,0x66,0x6E,0x76,0x31,0x61,0x5F,0x36,0x34,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0x7C,0xE4,0xFF,0xFF,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0xF4,0xE3,0xFF,0xFF,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x0B,0x00,0x00,0x00,0x52,0x65,0x66,0x65,0x72,0x72,0x61,0x62,0x6C,0x65,0x54,0x00,0x08,0x00,0x00,0x00,
- 0x63,0x70,0x70,0x5F,0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x00,0xA8,0xE4,0xFF,0xFF,0x14,0x00,0x00,0x00,
+ 0x63,0x70,0x70,0x5F,0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x00,0x20,0xE4,0xFF,0xFF,0x14,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6E,0x61,0x6B,0x65,0x64,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
- 0x63,0x70,0x70,0x5F,0x70,0x74,0x72,0x5F,0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x00,0x54,0xE3,0xFF,0xFF,
+ 0x63,0x70,0x70,0x5F,0x70,0x74,0x72,0x5F,0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x00,0xCC,0xE2,0xFF,0xFF,
0x00,0x00,0x00,0x0A,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x63,0x6F,0x5F,0x6F,
0x77,0x6E,0x69,0x6E,0x67,0x5F,0x72,0x65,0x66,0x65,0x72,0x65,0x6E,0x63,0x65,0x00,0xB4,0xEE,0xFF,0xFF,
0x00,0x00,0x00,0x01,0x26,0x00,0x50,0x00,0x84,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x28,0xE5,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x33,0x38,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x44,0xE5,0xFF,0xFF,0x20,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0xA0,0xE4,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x33,0x38,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xBC,0xE4,0xFF,0xFF,0x20,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x10,0x00,0x00,0x00,0x64,0x65,0x66,0x61,0x75,0x6C,0x74,0x5F,0x70,0x74,0x72,0x5F,0x74,0x79,0x70,0x65,
0x00,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x63,0x70,0x70,0x5F,0x70,0x74,0x72,0x5F,0x74,0x79,0x70,0x65,
0x00,0x00,0x00,0x00,0xA8,0xF0,0xFF,0xFF,0x00,0x00,0x0E,0x0F,0x02,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
@@ -355,177 +362,177 @@
0x5F,0x72,0x65,0x66,0x65,0x72,0x72,0x61,0x62,0x6C,0x65,0x73,0x00,0x00,0x00,0x00,0x68,0xEF,0xFF,0xFF,
0x00,0x00,0x00,0x01,0x25,0x00,0x4E,0x00,0xD0,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x50,0x00,0x00,0x00,
- 0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xE4,0xE5,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x33,0x37,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x00,0xE6,0xFF,0xFF,
+ 0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x5C,0xE5,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x33,0x37,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x78,0xE5,0xFF,0xFF,
0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x66,0x6E,0x76,0x31,0x61,0x5F,0x36,0x34,
- 0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0x28,0xE6,0xFF,0xFF,
+ 0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0xA0,0xE5,0xFF,0xFF,
0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x52,0x65,0x66,0x65,0x72,0x72,0x61,0x62,
0x6C,0x65,0x54,0x00,0x08,0x00,0x00,0x00,0x63,0x70,0x70,0x5F,0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x00,
- 0x54,0xE6,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6E,0x61,0x6B,0x65,
+ 0xCC,0xE5,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6E,0x61,0x6B,0x65,
0x64,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x63,0x70,0x70,0x5F,0x70,0x74,0x72,0x5F,0x74,0x79,0x70,0x65,
0x00,0x00,0x00,0x00,0xD8,0xEF,0xFF,0xFF,0x00,0x00,0x0E,0x0A,0x08,0x00,0x00,0x00,0x19,0x00,0x00,0x00,
0x76,0x65,0x63,0x74,0x6F,0x72,0x5F,0x6F,0x66,0x5F,0x77,0x65,0x61,0x6B,0x5F,0x72,0x65,0x66,0x65,0x72,
0x65,0x6E,0x63,0x65,0x73,0x00,0x00,0x00,0x4E,0xF1,0xFF,0xFF,0x24,0x00,0x4C,0x00,0xD4,0x00,0x00,0x00,
0xC0,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x80,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xDC,0xE6,0xFF,0xFF,
+ 0x80,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x54,0xE6,0xFF,0xFF,
0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x33,0x36,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x69,0x64,0x00,0x00,0xF8,0xE6,0xFF,0xFF,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
+ 0x69,0x64,0x00,0x00,0x70,0xE6,0xFF,0xFF,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
0x66,0x6E,0x76,0x31,0x61,0x5F,0x36,0x34,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,
- 0x00,0x00,0x00,0x00,0x20,0xE7,0xFF,0xFF,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x98,0xE6,0xFF,0xFF,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,
0x52,0x65,0x66,0x65,0x72,0x72,0x61,0x62,0x6C,0x65,0x54,0x00,0x08,0x00,0x00,0x00,0x63,0x70,0x70,0x5F,
- 0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x00,0x4C,0xE7,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x00,0xC4,0xE6,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x05,0x00,0x00,0x00,0x6E,0x61,0x6B,0x65,0x64,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x63,0x70,0x70,0x5F,
- 0x70,0x74,0x72,0x5F,0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x00,0xF8,0xE5,0xFF,0xFF,0x00,0x00,0x00,0x0A,
+ 0x70,0x74,0x72,0x5F,0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x00,0x70,0xE5,0xFF,0xFF,0x00,0x00,0x00,0x0A,
0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x73,0x69,0x6E,0x67,0x6C,0x65,0x5F,0x77,
0x65,0x61,0x6B,0x5F,0x72,0x65,0x66,0x65,0x72,0x65,0x6E,0x63,0x65,0x00,0x00,0x00,0x5C,0xF1,0xFF,0xFF,
0x00,0x00,0x00,0x01,0x23,0x00,0x4A,0x00,0x48,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xCC,0xE7,0xFF,0xFF,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x44,0xE7,0xFF,0xFF,
0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x33,0x35,0x00,0x00,0x02,0x00,0x00,0x00,
0x69,0x64,0x00,0x00,0x14,0xF3,0xFF,0xFF,0x00,0x00,0x0E,0x0F,0x02,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x15,0x00,0x00,0x00,0x76,0x65,0x63,0x74,0x6F,0x72,0x5F,0x6F,0x66,0x5F,0x72,0x65,0x66,0x65,0x72,0x72,
0x61,0x62,0x6C,0x65,0x73,0x00,0x00,0x00,0xCC,0xF1,0xFF,0xFF,0x00,0x00,0x00,0x01,0x22,0x00,0x48,0x00,
0x48,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x3C,0xE8,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x33,0x34,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x04,0xE5,0xFF,0xFF,
- 0x00,0x00,0x00,0x0F,0x0A,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x70,0x61,0x72,0x65,
+ 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xB4,0xE7,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x33,0x34,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x7C,0xE4,0xFF,0xFF,
+ 0x00,0x00,0x00,0x0F,0x0B,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x70,0x61,0x72,0x65,
0x6E,0x74,0x5F,0x6E,0x61,0x6D,0x65,0x73,0x70,0x61,0x63,0x65,0x5F,0x74,0x65,0x73,0x74,0x00,0x00,0x00,
0x3C,0xF2,0xFF,0xFF,0x00,0x00,0x00,0x01,0x21,0x00,0x46,0x00,0x44,0x00,0x00,0x00,0x34,0x00,0x00,0x00,
0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0xAC,0xE8,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x33,0x33,0x00,0x00,
+ 0x24,0xE8,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x33,0x33,0x00,0x00,
0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x20,0xF2,0xFF,0xFF,0x00,0x00,0x0E,0x0C,0x08,0x00,0x00,0x00,
0x11,0x00,0x00,0x00,0x76,0x65,0x63,0x74,0x6F,0x72,0x5F,0x6F,0x66,0x5F,0x64,0x6F,0x75,0x62,0x6C,0x65,
0x73,0x00,0x00,0x00,0xA4,0xF2,0xFF,0xFF,0x00,0x00,0x00,0x01,0x20,0x00,0x44,0x00,0x44,0x00,0x00,0x00,
0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x14,0xE9,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0x8C,0xE8,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x33,0x32,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x88,0xF2,0xFF,0xFF,0x00,0x00,0x0E,0x09,
0x08,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x76,0x65,0x63,0x74,0x6F,0x72,0x5F,0x6F,0x66,0x5F,0x6C,0x6F,
0x6E,0x67,0x73,0x00,0x08,0xF3,0xFF,0xFF,0x00,0x00,0x00,0x01,0x1F,0x00,0x42,0x00,0x48,0x00,0x00,0x00,
0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x78,0xE9,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0xF0,0xE8,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x33,0x31,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xC0,0xF4,0xFF,0xFF,0x00,0x00,0x0E,0x0F,
- 0x05,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x35,0x00,0x00,0x00,
+ 0x06,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x35,0x00,0x00,0x00,
0x68,0xF3,0xFF,0xFF,0x00,0x00,0x00,0x01,0x1E,0x00,0x40,0x00,0x6C,0x00,0x00,0x00,0x5C,0x00,0x00,0x00,
0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0xDC,0xE9,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x33,0x30,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xF8,0xE9,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0x54,0xE9,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
+ 0x33,0x30,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x70,0xE9,0xFF,0xFF,0x10,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x66,0x6C,0x65,0x78,
0x62,0x75,0x66,0x66,0x65,0x72,0x00,0x00,0x74,0xF3,0xFF,0xFF,0x00,0x00,0x0E,0x04,0x01,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x66,0x6C,0x65,0x78,0x00,0x00,0x00,0x00,0xEC,0xF3,0xFF,0xFF,0x00,0x00,0x00,0x01,
0x1D,0x00,0x3E,0x00,0x48,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x5C,0xEA,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xD4,0xE9,0xFF,0xFF,0x10,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x32,0x39,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,
0xA4,0xF5,0xFF,0xFF,0x00,0x00,0x0E,0x0F,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x17,0x00,0x00,0x00,
0x74,0x65,0x73,0x74,0x61,0x72,0x72,0x61,0x79,0x6F,0x66,0x73,0x6F,0x72,0x74,0x65,0x64,0x73,0x74,0x72,
0x75,0x63,0x74,0x00,0x5C,0xF4,0xFF,0xFF,0x00,0x00,0x00,0x01,0x1C,0x00,0x3C,0x00,0x44,0x00,0x00,0x00,
0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0xCC,0xEA,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0x44,0xEA,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x32,0x38,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x40,0xF4,0xFF,0xFF,0x00,0x00,0x0E,0x0D,
0x04,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x61,0x72,0x72,0x61,0x79,0x6F,0x66,0x73,
0x74,0x72,0x69,0x6E,0x67,0x32,0x00,0x00,0xAE,0xF5,0xFF,0xFF,0x1B,0x00,0x3A,0x00,0x44,0x00,0x00,0x00,
0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x30,0xEB,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x32,0x37,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x14,0xE7,0xFF,0xFF,0x00,0x00,0x00,0x0B,
+ 0x04,0x00,0x00,0x00,0xA8,0xEA,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
+ 0x32,0x37,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x8C,0xE6,0xFF,0xFF,0x00,0x00,0x00,0x0B,
0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x66,0x33,0x00,0x00,0x9A,0xFF,0xFF,0xFF,
0x1A,0x00,0x38,0x00,0x50,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x94,0xEB,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x32,0x36,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x78,0xE7,0xFF,0xFF,0x00,0x00,0x00,0x0B,
+ 0x04,0x00,0x00,0x00,0x0C,0xEB,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
+ 0x32,0x36,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xF0,0xE6,0xFF,0xFF,0x00,0x00,0x00,0x0B,
0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x66,0x32,0x00,0x00,0x00,0x00,0x1A,0x00,
0x24,0x00,0x08,0x00,0x0C,0x00,0x04,0x00,0x06,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x10,0x00,0x14,0x00,0x1A,0x00,0x00,0x00,0x19,0x00,0x36,0x00,0x50,0x00,0x00,0x00,0x40,0x00,0x00,0x00,
0x18,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x6E,0x86,0x1B,0xF0,0xF9,0x21,0x09,0x40,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x14,0xEC,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x8C,0xEB,0xFF,0xFF,0x10,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x32,0x35,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,
- 0xF8,0xE7,0xFF,0xFF,0x00,0x00,0x00,0x0B,0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x74,0x65,0x73,0x74,
+ 0x70,0xE7,0xFF,0xFF,0x00,0x00,0x00,0x0B,0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x74,0x65,0x73,0x74,
0x66,0x00,0x00,0x00,0x00,0xF6,0xFF,0xFF,0x00,0x00,0x00,0x01,0x18,0x00,0x34,0x00,0x44,0x00,0x00,0x00,
0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x70,0xEC,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0xE8,0xEB,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x32,0x34,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xE4,0xF5,0xFF,0xFF,0x00,0x00,0x0E,0x02,
0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x61,0x72,0x72,0x61,0x79,0x6F,0x66,0x62,
0x6F,0x6F,0x6C,0x73,0x00,0x00,0x00,0x00,0x52,0xF7,0xFF,0xFF,0x17,0x00,0x32,0x00,0x74,0x00,0x00,0x00,
0x60,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xD8,0xEC,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x32,0x33,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xF4,0xEC,0xFF,0xFF,
+ 0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x50,0xEC,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x32,0x33,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x6C,0xEC,0xFF,0xFF,
0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x66,0x6E,0x76,0x31,0x61,0x5F,0x36,0x34,
- 0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0x9C,0xEB,0xFF,0xFF,
+ 0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0x14,0xEB,0xFF,0xFF,
0x00,0x00,0x00,0x0A,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x74,0x65,0x73,0x74,
0x68,0x61,0x73,0x68,0x75,0x36,0x34,0x5F,0x66,0x6E,0x76,0x31,0x61,0x00,0x00,0x00,0xE6,0xF7,0xFF,0xFF,
0x16,0x00,0x30,0x00,0x74,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x6C,0xED,0xFF,0xFF,
+ 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xE4,0xEC,0xFF,0xFF,
0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x32,0x32,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x69,0x64,0x00,0x00,0x88,0xED,0xFF,0xFF,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
+ 0x69,0x64,0x00,0x00,0x00,0xED,0xFF,0xFF,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
0x66,0x6E,0x76,0x31,0x61,0x5F,0x36,0x34,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,
- 0x00,0x00,0x00,0x00,0x30,0xEC,0xFF,0xFF,0x00,0x00,0x00,0x09,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xA8,0xEB,0xFF,0xFF,0x00,0x00,0x00,0x09,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x11,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x68,0x61,0x73,0x68,0x73,0x36,0x34,0x5F,0x66,0x6E,0x76,0x31,
0x61,0x00,0x00,0x00,0x7A,0xF8,0xFF,0xFF,0x15,0x00,0x2E,0x00,0xCC,0x00,0x00,0x00,0xBC,0x00,0x00,0x00,
0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,
- 0x50,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0xEE,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x50,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x80,0xED,0xFF,0xFF,0x10,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x32,0x31,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,
- 0x24,0xEE,0xFF,0xFF,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x66,0x6E,0x76,0x31,
+ 0x9C,0xED,0xFF,0xFF,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x66,0x6E,0x76,0x31,
0x61,0x5F,0x33,0x32,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,
- 0x4C,0xEE,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x53,0x74,0x61,0x74,
+ 0xC4,0xED,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x53,0x74,0x61,0x74,
0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x63,0x70,0x70,0x5F,0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x00,
- 0x74,0xEE,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6E,0x61,0x6B,0x65,
+ 0xEC,0xED,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x6E,0x61,0x6B,0x65,
0x64,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x63,0x70,0x70,0x5F,0x70,0x74,0x72,0x5F,0x74,0x79,0x70,0x65,
- 0x00,0x00,0x00,0x00,0x68,0xEA,0xFF,0xFF,0x00,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xE0,0xE9,0xFF,0xFF,0x00,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x11,0x00,0x00,0x00,
0x74,0x65,0x73,0x74,0x68,0x61,0x73,0x68,0x75,0x33,0x32,0x5F,0x66,0x6E,0x76,0x31,0x61,0x00,0x00,0x00,
0x66,0xF9,0xFF,0xFF,0x14,0x00,0x2C,0x00,0x70,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0xEC,0xEE,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x32,0x30,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x08,0xEF,0xFF,0xFF,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x64,0xEE,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x32,0x30,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x80,0xEE,0xFF,0xFF,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x08,0x00,0x00,0x00,0x66,0x6E,0x76,0x31,0x61,0x5F,0x33,0x32,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0xF8,0xEA,0xFF,0xFF,0x00,0x00,0x00,0x07,0x01,0x00,0x00,0x00,
+ 0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0x70,0xEA,0xFF,0xFF,0x00,0x00,0x00,0x07,0x01,0x00,0x00,0x00,
0x11,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x68,0x61,0x73,0x68,0x73,0x33,0x32,0x5F,0x66,0x6E,0x76,0x31,
0x61,0x00,0x00,0x00,0xF6,0xF9,0xFF,0xFF,0x13,0x00,0x2A,0x00,0x70,0x00,0x00,0x00,0x5C,0x00,0x00,0x00,
0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x7C,0xEF,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x31,0x39,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x98,0xEF,0xFF,0xFF,0x14,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0xF4,0xEE,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
+ 0x31,0x39,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x10,0xEF,0xFF,0xFF,0x14,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x66,0x6E,0x76,0x31,0x5F,0x36,0x34,0x00,0x04,0x00,0x00,0x00,
- 0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0x3C,0xEE,0xFF,0xFF,0x00,0x00,0x00,0x0A,0x08,0x00,0x00,0x00,
+ 0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0xB4,0xED,0xFF,0xFF,0x00,0x00,0x00,0x0A,0x08,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x68,0x61,0x73,0x68,0x75,0x36,0x34,0x5F,
0x66,0x6E,0x76,0x31,0x00,0x00,0x00,0x00,0x86,0xFA,0xFF,0xFF,0x12,0x00,0x28,0x00,0x70,0x00,0x00,0x00,
0x5C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x0C,0xF0,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x31,0x38,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x28,0xF0,0xFF,0xFF,
+ 0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x84,0xEF,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x31,0x38,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xA0,0xEF,0xFF,0xFF,
0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x66,0x6E,0x76,0x31,0x5F,0x36,0x34,0x00,
- 0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0xCC,0xEE,0xFF,0xFF,0x00,0x00,0x00,0x09,
+ 0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0x44,0xEE,0xFF,0xFF,0x00,0x00,0x00,0x09,
0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x68,0x61,0x73,0x68,
0x73,0x36,0x34,0x5F,0x66,0x6E,0x76,0x31,0x00,0x00,0x00,0x00,0x16,0xFB,0xFF,0xFF,0x11,0x00,0x26,0x00,
0x6C,0x00,0x00,0x00,0x5C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x9C,0xF0,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x14,0xF0,0xFF,0xFF,0x10,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x31,0x37,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,
- 0xB8,0xF0,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x66,0x6E,0x76,0x31,
- 0x5F,0x33,0x32,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0xA4,0xEC,0xFF,0xFF,
+ 0x30,0xF0,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x66,0x6E,0x76,0x31,
+ 0x5F,0x33,0x32,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0x1C,0xEC,0xFF,0xFF,
0x00,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x68,0x61,0x73,0x68,
0x75,0x33,0x32,0x5F,0x66,0x6E,0x76,0x31,0x00,0x00,0x00,0x00,0xA2,0xFB,0xFF,0xFF,0x10,0x00,0x24,0x00,
0x6C,0x00,0x00,0x00,0x5C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x28,0xF1,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xA0,0xF0,0xFF,0xFF,0x10,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x31,0x36,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,
- 0x44,0xF1,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x66,0x6E,0x76,0x31,
- 0x5F,0x33,0x32,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0x30,0xED,0xFF,0xFF,
+ 0xBC,0xF0,0xFF,0xFF,0x14,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x66,0x6E,0x76,0x31,
+ 0x5F,0x33,0x32,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,0x00,0x00,0x00,0x00,0xA8,0xEC,0xFF,0xFF,
0x00,0x00,0x00,0x07,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x68,0x61,0x73,0x68,
0x73,0x33,0x32,0x5F,0x66,0x6E,0x76,0x31,0x00,0x00,0x00,0x00,0x2E,0xFC,0xFF,0xFF,0x0F,0x00,0x22,0x00,
0x48,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xB0,0xF1,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x31,0x35,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x4C,0xF0,0xFF,0xFF,
+ 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x28,0xF1,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x31,0x35,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xC4,0xEF,0xFF,0xFF,
0x00,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x74,0x65,0x73,0x74,
0x62,0x6F,0x6F,0x6C,0x00,0x00,0x00,0x00,0xA4,0xFB,0xFF,0xFF,0x00,0x00,0x00,0x01,0x0E,0x00,0x20,0x00,
0x48,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x14,0xF2,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x31,0x34,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xDC,0xEE,0xFF,0xFF,
+ 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x8C,0xF1,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x31,0x34,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x54,0xEE,0xFF,0xFF,
0x00,0x00,0x00,0x0F,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x74,0x65,0x73,0x74,
0x65,0x6D,0x70,0x74,0x79,0x00,0x00,0x00,0x08,0xFC,0xFF,0xFF,0x00,0x00,0x00,0x01,0x0D,0x00,0x1E,0x00,
0x78,0x00,0x00,0x00,0x68,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x7C,0xF2,0xFF,0xFF,0x14,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xF4,0xF1,0xFF,0xFF,0x14,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x4D,0x6F,0x6E,0x73,0x74,0x65,0x72,0x00,0x11,0x00,0x00,0x00,
0x6E,0x65,0x73,0x74,0x65,0x64,0x5F,0x66,0x6C,0x61,0x74,0x62,0x75,0x66,0x66,0x65,0x72,0x00,0x00,0x00,
- 0xAC,0xF2,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x31,0x33,0x00,0x00,
+ 0x24,0xF2,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x31,0x33,0x00,0x00,
0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x20,0xFC,0xFF,0xFF,0x00,0x00,0x0E,0x04,0x01,0x00,0x00,0x00,
0x14,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x6E,0x65,0x73,0x74,0x65,0x64,0x66,0x6C,0x61,0x74,0x62,0x75,
0x66,0x66,0x65,0x72,0x00,0x00,0x00,0x00,0xA8,0xFC,0xFF,0xFF,0x00,0x00,0x00,0x01,0x0C,0x00,0x1C,0x00,
0x48,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x18,0xF3,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x31,0x32,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xE0,0xEF,0xFF,0xFF,
+ 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x90,0xF2,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x31,0x32,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x58,0xEF,0xFF,0xFF,
0x00,0x00,0x00,0x0F,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x65,0x6E,0x65,0x6D,
0x79,0x00,0x00,0x00,0x08,0xFD,0xFF,0xFF,0x00,0x00,0x00,0x01,0x0B,0x00,0x1A,0x00,0xB4,0x00,0x00,0x00,
0xA0,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,
@@ -534,223 +541,230 @@
0x64,0x6F,0x63,0x75,0x6D,0x65,0x6E,0x74,0x61,0x74,0x69,0x6F,0x6E,0x20,0x63,0x6F,0x6D,0x6D,0x65,0x6E,
0x74,0x3A,0x20,0x74,0x68,0x69,0x73,0x20,0x77,0x69,0x6C,0x6C,0x20,0x65,0x6E,0x64,0x20,0x75,0x70,0x20,
0x69,0x6E,0x20,0x74,0x68,0x65,0x20,0x67,0x65,0x6E,0x65,0x72,0x61,0x74,0x65,0x64,0x20,0x63,0x6F,0x64,
- 0x65,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xE4,0xF3,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x65,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x5C,0xF3,0xFF,0xFF,0x10,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x31,0x31,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,
0x2C,0xFF,0xFF,0xFF,0x00,0x00,0x0E,0x0F,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x11,0x00,0x00,0x00,
0x74,0x65,0x73,0x74,0x61,0x72,0x72,0x61,0x79,0x6F,0x66,0x74,0x61,0x62,0x6C,0x65,0x73,0x00,0x00,0x00,
0xE0,0xFD,0xFF,0xFF,0x00,0x00,0x00,0x01,0x0A,0x00,0x18,0x00,0x44,0x00,0x00,0x00,0x34,0x00,0x00,0x00,
0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x50,0xF4,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x31,0x30,0x00,0x00,
+ 0xC8,0xF3,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x31,0x30,0x00,0x00,
0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xC4,0xFD,0xFF,0xFF,0x00,0x00,0x0E,0x0D,0x04,0x00,0x00,0x00,
0x11,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x61,0x72,0x72,0x61,0x79,0x6F,0x66,0x73,0x74,0x72,0x69,0x6E,
0x67,0x00,0x00,0x00,0x48,0xFE,0xFF,0xFF,0x00,0x00,0x00,0x01,0x09,0x00,0x16,0x00,0x58,0x00,0x00,0x00,
0x44,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0xB8,0xF4,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0x30,0xF4,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x39,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x10,0x00,0x10,0x00,0x06,0x00,0x07,0x00,
- 0x08,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x0E,0x0F,0x05,0x00,0x00,0x00,
+ 0x08,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x0E,0x0F,0x06,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x34,0x00,0x00,0x00,0xB8,0xFE,0xFF,0xFF,
0x00,0x00,0x00,0x01,0x08,0x00,0x14,0x00,0x48,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x28,0xF5,0xFF,0xFF,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xA0,0xF4,0xFF,0xFF,
0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x69,0x64,0x00,0x00,0xF0,0xF1,0xFF,0xFF,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x69,0x64,0x00,0x00,0x68,0xF1,0xFF,0xFF,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x00,0x00,0x1A,0x00,0x18,0x00,0x08,0x00,0x0C,0x00,0x04,0x00,
0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x14,0x00,0x1A,0x00,0x00,0x00,
0x07,0x00,0x12,0x00,0x4C,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x9C,0xF5,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x14,0xF5,0xFF,0xFF,0x10,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x37,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,
- 0x18,0xF5,0xFF,0xFF,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x90,0xF4,0xFF,0xFF,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
0x09,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x5F,0x74,0x79,0x70,0x65,0x00,0x00,0x00,0x42,0xFD,0xFF,0xFF,
0x06,0x00,0x10,0x00,0x58,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x0C,0xF6,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x36,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x88,0xF5,0xFF,0xFF,0x00,0x00,0x00,0x04,
+ 0x04,0x00,0x00,0x00,0x84,0xF5,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x36,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x00,0xF5,0xFF,0xFF,0x00,0x00,0x00,0x04,
0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x63,0x6F,0x6C,0x6F,
0x72,0x00,0x00,0x00,0x1C,0x00,0x1C,0x00,0x0C,0x00,0x10,0x00,0x08,0x00,0x0A,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x00,0x18,0x00,0x07,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x05,0x00,0x0E,0x00,0x54,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x8C,0xF6,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0xF6,0xFF,0xFF,0x10,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x35,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,
0x10,0x00,0x0C,0x00,0x06,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x10,0x00,0x00,0x00,
0x00,0x00,0x0E,0x04,0x01,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x69,0x6E,0x76,0x65,0x6E,0x74,0x6F,0x72,
0x79,0x00,0x1A,0x00,0x1C,0x00,0x0C,0x00,0x10,0x00,0x08,0x00,0x0A,0x00,0x00,0x00,0x00,0x00,0x07,0x00,
0x00,0x00,0x00,0x00,0x14,0x00,0x18,0x00,0x1A,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x04,0x00,0x0C,0x00,
0x98,0x00,0x00,0x00,0x84,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x03,0x00,0x00,0x00,0x4C,0x00,0x00,0x00,0x2C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x1C,0xF7,0xFF,0xFF,
+ 0x03,0x00,0x00,0x00,0x4C,0x00,0x00,0x00,0x2C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x94,0xF6,0xFF,0xFF,
0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x31,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
- 0x70,0x72,0x69,0x6F,0x72,0x69,0x74,0x79,0x00,0x00,0x00,0x00,0x40,0xF7,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x70,0x72,0x69,0x6F,0x72,0x69,0x74,0x79,0x00,0x00,0x00,0x00,0xB8,0xF6,0xFF,0xFF,0x10,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,
- 0x5C,0xF7,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
- 0x0A,0x00,0x00,0x00,0x64,0x65,0x70,0x72,0x65,0x63,0x61,0x74,0x65,0x64,0x00,0x00,0x00,0xF6,0xFF,0xFF,
+ 0xD4,0xF6,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
+ 0x0A,0x00,0x00,0x00,0x64,0x65,0x70,0x72,0x65,0x63,0x61,0x74,0x65,0x64,0x00,0x00,0x78,0xF5,0xFF,0xFF,
0x00,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x66,0x72,0x69,0x65,
0x6E,0x64,0x6C,0x79,0x00,0x00,0x1A,0x00,0x1C,0x00,0x0C,0x00,0x10,0x00,0x08,0x00,0x0A,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x06,0x00,0x07,0x00,0x14,0x00,0x18,0x00,0x1A,0x00,0x00,0x00,0x00,0x00,0x01,0x01,
0x03,0x00,0x0A,0x00,0x64,0x00,0x00,0x00,0x54,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xE4,0xF7,0xFF,0xFF,
+ 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x5C,0xF7,0xFF,0xFF,
0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
- 0x6B,0x65,0x79,0x00,0x00,0xF8,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x33,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xE4,0xF3,0xFF,0xFF,0x00,0x00,0x00,0x0D,
+ 0x6B,0x65,0x79,0x00,0x78,0xF7,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x33,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x5C,0xF3,0xFF,0xFF,0x00,0x00,0x00,0x0D,
0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x6E,0x61,0x6D,0x65,0x00,0x00,0x00,0x00,0x9A,0xFF,0xFF,0xFF,
0x02,0x00,0x08,0x00,0x54,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
0x64,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x64,0xF8,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x32,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x00,0xF7,0xFF,0xFF,0x00,0x00,0x00,0x05,
+ 0x04,0x00,0x00,0x00,0xDC,0xF7,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x32,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x78,0xF6,0xFF,0xFF,0x00,0x00,0x00,0x05,
0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x68,0x70,0x00,0x00,0x00,0x00,0x1A,0x00,
0x24,0x00,0x08,0x00,0x0C,0x00,0x04,0x00,0x06,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x10,0x00,0x14,0x00,0x1A,0x00,0x00,0x00,0x01,0x00,0x06,0x00,0x54,0x00,0x00,0x00,0x40,0x00,0x00,0x00,
0x18,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x96,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xE4,0xF8,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x5C,0xF8,0xFF,0xFF,0x10,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x31,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,
- 0x80,0xF7,0xFF,0xFF,0x00,0x00,0x00,0x05,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0xF8,0xF6,0xFF,0xFF,0x00,0x00,0x00,0x05,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
0x6D,0x61,0x6E,0x61,0x00,0x00,0x00,0x00,0x1C,0x00,0x18,0x00,0x08,0x00,0x0C,0x00,0x00,0x00,0x06,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x14,0x00,0x05,0x00,0x1C,0x00,0x00,0x00,
0x00,0x01,0x04,0x00,0x48,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x5C,0xF9,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xD4,0xF8,0xFF,0xFF,0x10,0x00,0x00,0x00,
0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,
- 0x24,0xF6,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
- 0x70,0x6F,0x73,0x00,0xCC,0xF6,0xFF,0xFF,0x20,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x08,0x00,0x00,0x00,0x58,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,
+ 0x9C,0xF5,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x09,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
+ 0x70,0x6F,0x73,0x00,0x44,0xF6,0xFF,0xFF,0x20,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x08,0x00,0x00,0x00,0xE0,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,
0x19,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x52,
0x65,0x66,0x65,0x72,0x72,0x61,0x62,0x6C,0x65,0x00,0x1A,0x00,0x18,0x00,0x08,0x00,0x0C,0x00,0x00,0x00,
0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x10,0x00,0x14,0x00,0x1A,0x00,0x00,0x00,
0x00,0x01,0x04,0x00,0x74,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x14,0xFA,0xFF,0xFF,
+ 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x8C,0xF9,0xFF,0xFF,
0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
- 0x6B,0x65,0x79,0x00,0x30,0xFA,0xFF,0xFF,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
+ 0x6B,0x65,0x79,0x00,0xA8,0xF9,0xFF,0xFF,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
0x66,0x6E,0x76,0x31,0x61,0x5F,0x36,0x34,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x68,0x61,0x73,0x68,
- 0x00,0x00,0x00,0x00,0xD8,0xF8,0xFF,0xFF,0x00,0x00,0x00,0x0A,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0xAC,0xF7,0xFF,0xFF,0x28,0x00,0x00,0x00,0x14,0x00,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x78,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x50,0xF8,0xFF,0xFF,0x00,0x00,0x00,0x0A,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x24,0xF7,0xFF,0xFF,0x28,0x00,0x00,0x00,0x14,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
0x40,0x00,0x00,0x00,0xCC,0x00,0x00,0x00,0x98,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,
0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x53,0x74,0x61,0x74,0x00,0x00,0x00,0x1A,0x00,
0x1C,0x00,0x0C,0x00,0x10,0x00,0x08,0x00,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,
0x14,0x00,0x18,0x00,0x1A,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x00,0x08,0x00,0x48,0x00,0x00,0x00,
0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0xF8,0xFA,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x30,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x6B,0x65,0x79,0x00,0x94,0xF9,0xFF,0xFF,0x00,0x00,0x00,0x06,
+ 0x04,0x00,0x00,0x00,0x70,0xFA,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x30,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x6B,0x65,0x79,0x00,0x0C,0xF9,0xFF,0xFF,0x00,0x00,0x00,0x06,
0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x63,0x6F,0x75,0x6E,0x74,0x00,0x00,0x00,
- 0xFE,0xFB,0xFF,0xFF,0x01,0x00,0x06,0x00,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0xC8,0xF9,0xFF,0xFF,0x00,0x00,0x00,0x09,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x03,0x00,0x00,0x00,0x76,0x61,0x6C,0x00,0x40,0xF8,0xFF,0xFF,0x00,0x01,0x04,0x00,0x1C,0x00,0x00,0x00,
- 0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xF7,0xFF,0xFF,0x00,0x00,0x00,0x0D,
- 0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x10,0xF8,0xFF,0xFF,0x00,0x00,0x00,0x01,
- 0x2C,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
- 0x54,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0xD0,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,
- 0x28,0x00,0x00,0x00,0x1E,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,
- 0x6C,0x65,0x2E,0x53,0x74,0x72,0x75,0x63,0x74,0x4F,0x66,0x53,0x74,0x72,0x75,0x63,0x74,0x73,0x00,0x00,
- 0xCC,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x01,0x02,0x00,0x0C,0x00,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xAC,0xF8,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x63,0x00,0x00,0x00,0x1C,0x00,0x18,0x00,0x0C,0x00,0x10,0x00,
- 0x08,0x00,0x0A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x00,0x07,0x00,
- 0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x08,0x00,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xF8,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x05,0x00,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x62,0x00,0x00,0x00,0x1C,0x00,0x14,0x00,0x08,0x00,0x0C,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x07,0x00,
- 0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x48,0xF9,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x61,0x00,0x00,0x00,0x38,0xF9,0xFF,0xFF,0x00,0x00,0x00,0x01,0x28,0x00,0x00,0x00,
- 0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x2C,0x05,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x6C,0x00,0x00,0x00,0x16,0x00,0x00,0x00,
- 0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x41,0x62,0x69,0x6C,0x69,
- 0x74,0x79,0x00,0x00,0xCE,0xFD,0xFF,0xFF,0x01,0x00,0x04,0x00,0x1C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF8,0xFF,0xFF,0x00,0x00,0x00,0x08,0x01,0x00,0x00,0x00,
- 0x08,0x00,0x00,0x00,0x64,0x69,0x73,0x74,0x61,0x6E,0x63,0x65,0x00,0x00,0x1A,0x00,0x18,0x00,0x08,0x00,
- 0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x10,0x00,0x14,0x00,
- 0x1A,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x44,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x70,0xFD,0xFF,0xFF,
- 0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x03,0x00,0x00,0x00,
- 0x6B,0x65,0x79,0x00,0x54,0xF9,0xFF,0xFF,0x00,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x69,0x64,0x00,0x00,0x14,0x00,0x24,0x00,0x08,0x00,0x0C,0x00,0x07,0x00,0x10,0x00,0x14,0x00,0x18,0x00,
- 0x1C,0x00,0x20,0x00,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x68,0x00,0x00,0x00,0x48,0x00,0x00,0x00,
- 0x08,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x28,0x04,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xE4,0xFD,0xFF,0xFF,0x10,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x66,0x6F,0x72,0x63,
- 0x65,0x5F,0x61,0x6C,0x69,0x67,0x6E,0x00,0x06,0x00,0x00,0x00,0xC4,0x00,0x00,0x00,0x84,0x00,0x00,0x00,
- 0x48,0x00,0x00,0x00,0x60,0x01,0x00,0x00,0x30,0x01,0x00,0x00,0xE4,0x00,0x00,0x00,0x13,0x00,0x00,0x00,
- 0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x56,0x65,0x63,0x33,0x00,
- 0x00,0x00,0x1E,0x00,0x18,0x00,0x0C,0x00,0x10,0x00,0x06,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x00,0x05,0x00,0x0A,0x00,0x1E,0x00,0x00,0x00,0x00,0x01,0x05,0x00,
- 0x1A,0x00,0x02,0x00,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x24,0xFB,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x05,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,
- 0x74,0x65,0x73,0x74,0x33,0x00,0x00,0x00,0x7A,0xFD,0xFF,0xFF,0x00,0x00,0x04,0x00,0x18,0x00,0x01,0x00,
- 0x24,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0xFE,0xFF,0xFF,
- 0x00,0x00,0x00,0x04,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,
- 0x74,0x65,0x73,0x74,0x32,0x00,0x00,0x00,0x9E,0xFF,0xFF,0xFF,0x03,0x00,0x10,0x00,0x20,0x00,0x00,0x00,
- 0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x68,0xFD,0xFF,0xFF,0x00,0x00,0x00,0x0C,
- 0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x31,0x00,0x00,0x00,
- 0xEA,0xFD,0xFF,0xFF,0x00,0x00,0x02,0x00,0x08,0x00,0x04,0x00,0x1C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE8,0xFA,0xFF,0xFF,0x00,0x00,0x00,0x0B,0x01,0x00,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x7A,0x00,0x1A,0x00,0x14,0x00,0x08,0x00,0x0C,0x00,0x04,0x00,0x06,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x1A,0x00,0x00,0x00,0x01,0x00,0x04,0x00,
- 0x1C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2C,0xFB,0xFF,0xFF,
- 0x00,0x00,0x00,0x0B,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x79,0x00,0x00,0x00,0x6E,0xFB,0xFF,0xFF,
- 0x1C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x54,0xFB,0xFF,0xFF,
- 0x00,0x00,0x00,0x0B,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x14,0x00,0x1C,0x00,
- 0x04,0x00,0x08,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x10,0x00,0x14,0x00,0x18,0x00,0x14,0x00,0x00,0x00,
- 0x80,0x00,0x00,0x00,0x74,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
- 0x30,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0xE0,0xFF,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
- 0x07,0x00,0x00,0x00,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x00,0x08,0x00,0x0C,0x00,0x04,0x00,0x08,0x00,
- 0x08,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
- 0x0E,0x00,0x00,0x00,0x63,0x73,0x68,0x61,0x72,0x70,0x5F,0x70,0x61,0x72,0x74,0x69,0x61,0x6C,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x4C,0x00,0x00,0x00,0x26,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,
- 0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x54,0x65,0x73,0x74,0x53,0x69,0x6D,0x70,0x6C,0x65,0x54,0x61,0x62,
- 0x6C,0x65,0x57,0x69,0x74,0x68,0x45,0x6E,0x75,0x6D,0x00,0x00,0x00,0x00,0x1A,0x00,0x1C,0x00,0x08,0x00,
- 0x0C,0x00,0x00,0x00,0x06,0x00,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,
- 0x1A,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x3C,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
- 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x14,0x00,0x07,0x00,0x00,0x00,
- 0x08,0x00,0x00,0x00,0x0C,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x03,0x00,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x63,0x6F,0x6C,0x6F,0x72,0x00,0x00,0x00,
- 0x54,0xFD,0xFF,0xFF,0x00,0x00,0x00,0x01,0x28,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
- 0x74,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,
- 0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x54,0x65,0x73,0x74,0x00,0x00,0x00,0x1E,0x00,0x18,0x00,0x0C,0x00,
- 0x10,0x00,0x06,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x00,
- 0x00,0x00,0x0A,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x02,0x00,0x01,0x00,0x20,0x00,0x00,0x00,
- 0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD4,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x03,
- 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x62,0x00,0x00,0x00,0x62,0xFD,0xFF,0xFF,
- 0x30,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,
- 0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x0C,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x05,
- 0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x61,0x00,0x00,0x00,0xE4,0xFE,0xFF,0xFF,
- 0x1C,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x40,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,
- 0x78,0x61,0x6D,0x70,0x6C,0x65,0x32,0x2E,0x4D,0x6F,0x6E,0x73,0x74,0x65,0x72,0x00,0x20,0xFF,0xFF,0xFF,
- 0x34,0x00,0x00,0x00,0x2C,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x12,0x00,0x00,0x00,0x2F,0x2F,0x6D,0x6F,0x6E,0x73,0x74,0x65,0x72,0x5F,0x74,0x65,0x73,0x74,0x2E,0x66,
- 0x62,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,
- 0x6D,0x65,0x2E,0x49,0x6E,0x50,0x61,0x72,0x65,0x6E,0x74,0x4E,0x61,0x6D,0x65,0x73,0x70,0x61,0x63,0x65,
- 0x00,0x00,0x00,0x00,0x78,0xFF,0xFF,0xFF,0x48,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x30,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x2F,0x2F,0x69,0x6E,0x63,0x6C,0x75,0x64,
- 0x65,0x5F,0x74,0x65,0x73,0x74,0x2F,0x69,0x6E,0x63,0x6C,0x75,0x64,0x65,0x5F,0x74,0x65,0x73,0x74,0x31,
- 0x2E,0x66,0x62,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,
- 0x06,0x00,0x00,0x00,0x54,0x61,0x62,0x6C,0x65,0x41,0x00,0x00,0x74,0xFF,0xFF,0xFF,0x00,0x01,0x04,0x00,
- 0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0xFF,0xFF,0xFF,
- 0x00,0x00,0x00,0x0F,0x0B,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x62,0x00,0x00,0x00,
- 0x14,0x00,0x18,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x14,0x00,
- 0x14,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
- 0xC4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,
- 0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x4F,0x74,0x68,0x65,0x72,0x4E,0x61,0x6D,0x65,0x53,0x70,0x61,0x63,
- 0x65,0x2E,0x54,0x61,0x62,0x6C,0x65,0x42,0x00,0x00,0x00,0x00,0x1C,0x00,0x14,0x00,0x08,0x00,0x0C,0x00,
- 0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x05,0x00,
- 0x1C,0x00,0x00,0x00,0x00,0x01,0x04,0x00,0x30,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x07,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,
- 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x0D,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
- 0x61,0x00,0x00,0x00,0x14,0x00,0x20,0x00,0x08,0x00,0x0C,0x00,0x07,0x00,0x10,0x00,0x14,0x00,0x00,0x00,
- 0x18,0x00,0x1C,0x00,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x50,0x00,0x00,0x00,0x44,0x00,0x00,0x00,
- 0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x24,0x00,0x00,0x00,
- 0x2F,0x2F,0x69,0x6E,0x63,0x6C,0x75,0x64,0x65,0x5F,0x74,0x65,0x73,0x74,0x2F,0x73,0x75,0x62,0x2F,0x69,
- 0x6E,0x63,0x6C,0x75,0x64,0x65,0x5F,0x74,0x65,0x73,0x74,0x32,0x2E,0x66,0x62,0x73,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,
- 0x6D,0x65,0x2E,0x4F,0x74,0x68,0x65,0x72,0x4E,0x61,0x6D,0x65,0x53,0x70,0x61,0x63,0x65,0x2E,0x55,0x6E,
- 0x75,0x73,0x65,0x64,0x00,0x00,0x1A,0x00,0x10,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x1A,0x00,0x00,0x00,0x2C,0x00,0x00,0x00,
- 0x1C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x0C,0x00,0x07,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x01,0x00,0x00,0x00,
- 0x01,0x00,0x00,0x00,0x61,0x00,0x00,0x00
+ 0x76,0xFB,0xFF,0xFF,0x01,0x00,0x06,0x00,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x40,0xF9,0xFF,0xFF,0x00,0x00,0x00,0x09,0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x03,0x00,0x00,0x00,0x76,0x61,0x6C,0x00,0xB8,0xF7,0xFF,0xFF,0x00,0x01,0x04,0x00,0x1C,0x00,0x00,0x00,
+ 0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB8,0xF6,0xFF,0xFF,0x00,0x00,0x00,0x0D,
+ 0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,0x88,0xF7,0xFF,0xFF,0x00,0x00,0x00,0x01,
+ 0x24,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
+ 0xDC,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x27,0x00,0x00,0x00,
+ 0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x53,0x74,0x72,0x75,0x63,
+ 0x74,0x4F,0x66,0x53,0x74,0x72,0x75,0x63,0x74,0x73,0x4F,0x66,0x53,0x74,0x72,0x75,0x63,0x74,0x73,0x00,
+ 0xF4,0xFE,0xFF,0xFF,0x00,0x00,0x00,0x01,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x20,0xF8,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x00,0x61,0x00,0x00,0x00,0x10,0xF8,0xFF,0xFF,0x00,0x00,0x00,0x01,0x2C,0x00,0x00,0x00,
+ 0x18,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x54,0x06,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0xD0,0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x28,0x00,0x00,0x00,
+ 0x1E,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x53,
+ 0x74,0x72,0x75,0x63,0x74,0x4F,0x66,0x53,0x74,0x72,0x75,0x63,0x74,0x73,0x00,0x00,0xCC,0xFF,0xFF,0xFF,
+ 0x00,0x00,0x00,0x01,0x02,0x00,0x0C,0x00,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xAC,0xF8,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x00,0x63,0x00,0x00,0x00,0x1C,0x00,0x18,0x00,0x0C,0x00,0x10,0x00,0x08,0x00,0x0A,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x00,0x07,0x00,0x1C,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x01,0x01,0x00,0x08,0x00,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xFC,0xF8,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x06,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x00,0x62,0x00,0x00,0x00,0x1C,0x00,0x14,0x00,0x08,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x07,0x00,0x1C,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x01,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x48,0xF9,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x61,0x00,0x00,0x00,0x38,0xF9,0xFF,0xFF,0x00,0x00,0x00,0x01,0x28,0x00,0x00,0x00,0x18,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x2C,0x05,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x02,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x6C,0x00,0x00,0x00,0x16,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,
+ 0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x41,0x62,0x69,0x6C,0x69,0x74,0x79,0x00,0x00,
+ 0xCE,0xFD,0xFF,0xFF,0x01,0x00,0x04,0x00,0x1C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xE0,0xF8,0xFF,0xFF,0x00,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
+ 0x64,0x69,0x73,0x74,0x61,0x6E,0x63,0x65,0x00,0x00,0x1A,0x00,0x18,0x00,0x08,0x00,0x0C,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x10,0x00,0x14,0x00,0x1A,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x01,0x44,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x70,0xFD,0xFF,0xFF,0x10,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x6B,0x65,0x79,0x00,
+ 0x54,0xF9,0xFF,0xFF,0x00,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x69,0x64,0x00,0x00,
+ 0x14,0x00,0x24,0x00,0x08,0x00,0x0C,0x00,0x07,0x00,0x10,0x00,0x14,0x00,0x18,0x00,0x1C,0x00,0x20,0x00,
+ 0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x68,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
+ 0x20,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x28,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xE4,0xFD,0xFF,0xFF,0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x66,0x6F,0x72,0x63,0x65,0x5F,0x61,0x6C,
+ 0x69,0x67,0x6E,0x00,0x06,0x00,0x00,0x00,0xC4,0x00,0x00,0x00,0x84,0x00,0x00,0x00,0x48,0x00,0x00,0x00,
+ 0x60,0x01,0x00,0x00,0x30,0x01,0x00,0x00,0xE4,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,
+ 0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,0x6C,0x65,0x2E,0x56,0x65,0x63,0x33,0x00,0x00,0x00,0x1E,0x00,
+ 0x18,0x00,0x0C,0x00,0x10,0x00,0x06,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x14,0x00,0x05,0x00,0x0A,0x00,0x1E,0x00,0x00,0x00,0x00,0x01,0x05,0x00,0x1A,0x00,0x02,0x00,
+ 0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0xFB,0xFF,0xFF,
+ 0x00,0x00,0x00,0x0F,0x06,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x74,0x65,0x73,0x74,
+ 0x33,0x00,0x00,0x00,0x7A,0xFD,0xFF,0xFF,0x00,0x00,0x04,0x00,0x18,0x00,0x01,0x00,0x24,0x00,0x00,0x00,
+ 0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0xFE,0xFF,0xFF,0x00,0x00,0x00,0x04,
+ 0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x74,0x65,0x73,0x74,
+ 0x32,0x00,0x00,0x00,0x9E,0xFF,0xFF,0xFF,0x03,0x00,0x10,0x00,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x68,0xFD,0xFF,0xFF,0x00,0x00,0x00,0x0C,0x08,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x74,0x65,0x73,0x74,0x31,0x00,0x00,0x00,0xEA,0xFD,0xFF,0xFF,
+ 0x00,0x00,0x02,0x00,0x08,0x00,0x04,0x00,0x1C,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xE8,0xFA,0xFF,0xFF,0x00,0x00,0x00,0x0B,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x7A,0x00,0x1A,0x00,0x14,0x00,0x08,0x00,0x0C,0x00,0x04,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x1A,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x1C,0x00,0x00,0x00,
+ 0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2C,0xFB,0xFF,0xFF,0x00,0x00,0x00,0x0B,
+ 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x79,0x00,0x00,0x00,0x6E,0xFB,0xFF,0xFF,0x1C,0x00,0x00,0x00,
+ 0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x54,0xFB,0xFF,0xFF,0x00,0x00,0x00,0x0B,
+ 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x78,0x00,0x00,0x00,0x14,0x00,0x1C,0x00,0x04,0x00,0x08,0x00,
+ 0x00,0x00,0x0C,0x00,0x00,0x00,0x10,0x00,0x14,0x00,0x18,0x00,0x14,0x00,0x00,0x00,0x80,0x00,0x00,0x00,
+ 0x74,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x30,0x02,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0xE0,0xFF,0xFF,0xFF,
+ 0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x07,0x00,0x00,0x00,
+ 0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x00,0x08,0x00,0x0C,0x00,0x04,0x00,0x08,0x00,0x08,0x00,0x00,0x00,
+ 0x10,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,
+ 0x63,0x73,0x68,0x61,0x72,0x70,0x5F,0x70,0x61,0x72,0x74,0x69,0x61,0x6C,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x4C,0x00,0x00,0x00,0x26,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,
+ 0x6C,0x65,0x2E,0x54,0x65,0x73,0x74,0x53,0x69,0x6D,0x70,0x6C,0x65,0x54,0x61,0x62,0x6C,0x65,0x57,0x69,
+ 0x74,0x68,0x45,0x6E,0x75,0x6D,0x00,0x00,0x00,0x00,0x1A,0x00,0x1C,0x00,0x08,0x00,0x0C,0x00,0x00,0x00,
+ 0x06,0x00,0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x1A,0x00,0x00,0x00,
+ 0x00,0x00,0x04,0x00,0x3C,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x14,0x00,0x07,0x00,0x00,0x00,0x08,0x00,0x00,0x00,
+ 0x0C,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x03,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x63,0x6F,0x6C,0x6F,0x72,0x00,0x00,0x00,0x54,0xFD,0xFF,0xFF,
+ 0x00,0x00,0x00,0x01,0x28,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x08,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x74,0x00,0x00,0x00,
+ 0x3C,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,
+ 0x6C,0x65,0x2E,0x54,0x65,0x73,0x74,0x00,0x00,0x00,0x1E,0x00,0x18,0x00,0x0C,0x00,0x10,0x00,0x06,0x00,
+ 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x0A,0x00,
+ 0x1E,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x02,0x00,0x01,0x00,0x20,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD4,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x03,0x01,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x62,0x00,0x00,0x00,0x62,0xFD,0xFF,0xFF,0x30,0x00,0x00,0x00,
+ 0x1C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x07,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x08,0x00,0x0C,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x02,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x61,0x00,0x00,0x00,0xE4,0xFE,0xFF,0xFF,0x1C,0x00,0x00,0x00,
+ 0x14,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x45,0x78,0x61,0x6D,0x70,
+ 0x6C,0x65,0x32,0x2E,0x4D,0x6F,0x6E,0x73,0x74,0x65,0x72,0x00,0x20,0xFF,0xFF,0xFF,0x34,0x00,0x00,0x00,
+ 0x2C,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x12,0x00,0x00,0x00,
+ 0x2F,0x2F,0x6D,0x6F,0x6E,0x73,0x74,0x65,0x72,0x5F,0x74,0x65,0x73,0x74,0x2E,0x66,0x62,0x73,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x49,
+ 0x6E,0x50,0x61,0x72,0x65,0x6E,0x74,0x4E,0x61,0x6D,0x65,0x73,0x70,0x61,0x63,0x65,0x00,0x00,0x00,0x00,
+ 0x78,0xFF,0xFF,0xFF,0x48,0x00,0x00,0x00,0x3C,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x2F,0x2F,0x69,0x6E,0x63,0x6C,0x75,0x64,0x65,0x5F,0x74,0x65,
+ 0x73,0x74,0x2F,0x69,0x6E,0x63,0x6C,0x75,0x64,0x65,0x5F,0x74,0x65,0x73,0x74,0x31,0x2E,0x66,0x62,0x73,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x06,0x00,0x00,0x00,
+ 0x54,0x61,0x62,0x6C,0x65,0x41,0x00,0x00,0x74,0xFF,0xFF,0xFF,0x00,0x01,0x04,0x00,0x20,0x00,0x00,0x00,
+ 0x0C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x58,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x0F,
+ 0x0C,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x62,0x00,0x00,0x00,0x14,0x00,0x18,0x00,
+ 0x04,0x00,0x08,0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x14,0x00,0x14,0x00,0x00,0x00,
+ 0x20,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0xC4,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,
+ 0x6D,0x65,0x2E,0x4F,0x74,0x68,0x65,0x72,0x4E,0x61,0x6D,0x65,0x53,0x70,0x61,0x63,0x65,0x2E,0x54,0x61,
+ 0x62,0x6C,0x65,0x42,0x00,0x00,0x00,0x00,0x1C,0x00,0x14,0x00,0x08,0x00,0x0C,0x00,0x00,0x00,0x06,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x05,0x00,0x1C,0x00,0x00,0x00,
+ 0x00,0x01,0x04,0x00,0x30,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x10,0x00,0x10,0x00,0x07,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x10,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x0F,0x0E,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x61,0x00,0x00,0x00,
+ 0x14,0x00,0x20,0x00,0x08,0x00,0x0C,0x00,0x07,0x00,0x10,0x00,0x14,0x00,0x00,0x00,0x18,0x00,0x1C,0x00,
+ 0x14,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x50,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0x34,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x24,0x00,0x00,0x00,0x2F,0x2F,0x69,0x6E,
+ 0x63,0x6C,0x75,0x64,0x65,0x5F,0x74,0x65,0x73,0x74,0x2F,0x73,0x75,0x62,0x2F,0x69,0x6E,0x63,0x6C,0x75,
+ 0x64,0x65,0x5F,0x74,0x65,0x73,0x74,0x32,0x2E,0x66,0x62,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,0x4D,0x79,0x47,0x61,0x6D,0x65,0x2E,0x4F,
+ 0x74,0x68,0x65,0x72,0x4E,0x61,0x6D,0x65,0x53,0x70,0x61,0x63,0x65,0x2E,0x55,0x6E,0x75,0x73,0x65,0x64,
+ 0x00,0x00,0x1A,0x00,0x10,0x00,0x04,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,0x1A,0x00,0x00,0x00,0x2C,0x00,0x00,0x00,0x1C,0x00,0x00,0x00,
+ 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x0C,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x08,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x61,0x00,0x00,0x00
};
return bfbsData;
}
static size_t size() {
- return 14648;
+ return 14784;
}
const uint8_t *begin() {
return data();
diff --git a/tests/monster_test_generated.h b/tests/monster_test_generated.h
index eeaa341..deab77b 100644
--- a/tests/monster_test_generated.h
+++ b/tests/monster_test_generated.h
@@ -6,6 +6,14 @@
#include "flatbuffers/flatbuffers.h"
#include "flatbuffers/flexbuffers.h"
+#include "flatbuffers/flex_flat_util.h"
+
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
namespace MyGame {
@@ -35,6 +43,8 @@
struct StructOfStructs;
+struct StructOfStructsOfStructs;
+
struct Stat;
struct StatBuilder;
struct StatT;
@@ -73,6 +83,8 @@
bool operator!=(const Ability &lhs, const Ability &rhs);
bool operator==(const StructOfStructs &lhs, const StructOfStructs &rhs);
bool operator!=(const StructOfStructs &lhs, const StructOfStructs &rhs);
+bool operator==(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs);
+bool operator!=(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs);
bool operator==(const StatT &lhs, const StatT &rhs);
bool operator!=(const StatT &lhs, const StatT &rhs);
bool operator==(const ReferrableT &lhs, const ReferrableT &rhs);
@@ -104,6 +116,8 @@
inline const flatbuffers::TypeTable *StructOfStructsTypeTable();
+inline const flatbuffers::TypeTable *StructOfStructsOfStructsTypeTable();
+
inline const flatbuffers::TypeTable *StatTypeTable();
inline const flatbuffers::TypeTable *ReferrableTypeTable();
@@ -890,6 +904,39 @@
}
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructOfStructsOfStructs FLATBUFFERS_FINAL_CLASS {
+ private:
+ MyGame::Example::StructOfStructs a_;
+
+ public:
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return StructOfStructsOfStructsTypeTable();
+ }
+ StructOfStructsOfStructs()
+ : a_() {
+ }
+ StructOfStructsOfStructs(const MyGame::Example::StructOfStructs &_a)
+ : a_(_a) {
+ }
+ const MyGame::Example::StructOfStructs &a() const {
+ return a_;
+ }
+ MyGame::Example::StructOfStructs &mutable_a() {
+ return a_;
+ }
+};
+FLATBUFFERS_STRUCT_END(StructOfStructsOfStructs, 20);
+
+inline bool operator==(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs) {
+ return
+ (lhs.a() == rhs.a());
+}
+
+inline bool operator!=(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs) {
+ return !(lhs == rhs);
+}
+
+
} // namespace Example
struct InParentNamespaceT : public flatbuffers::NativeTable {
@@ -2680,7 +2727,7 @@
(lhs.test == rhs.test) &&
(lhs.test4 == rhs.test4) &&
(lhs.testarrayofstring == rhs.testarrayofstring) &&
- (lhs.testarrayoftables == rhs.testarrayoftables) &&
+ (lhs.testarrayoftables.size() == rhs.testarrayoftables.size() && std::equal(lhs.testarrayoftables.cbegin(), lhs.testarrayoftables.cend(), rhs.testarrayoftables.cbegin(), [](flatbuffers::unique_ptr<MyGame::Example::MonsterT> const &a, flatbuffers::unique_ptr<MyGame::Example::MonsterT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
((lhs.enemy == rhs.enemy) || (lhs.enemy && rhs.enemy && *lhs.enemy == *rhs.enemy)) &&
(lhs.testnestedflatbuffer == rhs.testnestedflatbuffer) &&
((lhs.testempty == rhs.testempty) || (lhs.testempty && rhs.testempty && *lhs.testempty == *rhs.testempty)) &&
@@ -2704,10 +2751,10 @@
(lhs.vector_of_longs == rhs.vector_of_longs) &&
(lhs.vector_of_doubles == rhs.vector_of_doubles) &&
((lhs.parent_namespace_test == rhs.parent_namespace_test) || (lhs.parent_namespace_test && rhs.parent_namespace_test && *lhs.parent_namespace_test == *rhs.parent_namespace_test)) &&
- (lhs.vector_of_referrables == rhs.vector_of_referrables) &&
+ (lhs.vector_of_referrables.size() == rhs.vector_of_referrables.size() && std::equal(lhs.vector_of_referrables.cbegin(), lhs.vector_of_referrables.cend(), rhs.vector_of_referrables.cbegin(), [](flatbuffers::unique_ptr<MyGame::Example::ReferrableT> const &a, flatbuffers::unique_ptr<MyGame::Example::ReferrableT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
(lhs.single_weak_reference == rhs.single_weak_reference) &&
(lhs.vector_of_weak_references == rhs.vector_of_weak_references) &&
- (lhs.vector_of_strong_referrables == rhs.vector_of_strong_referrables) &&
+ (lhs.vector_of_strong_referrables.size() == rhs.vector_of_strong_referrables.size() && std::equal(lhs.vector_of_strong_referrables.cbegin(), lhs.vector_of_strong_referrables.cend(), rhs.vector_of_strong_referrables.cbegin(), [](flatbuffers::unique_ptr<MyGame::Example::ReferrableT> const &a, flatbuffers::unique_ptr<MyGame::Example::ReferrableT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
(lhs.co_owning_reference == rhs.co_owning_reference) &&
(lhs.vector_of_co_owning_references == rhs.vector_of_co_owning_references) &&
(lhs.non_owning_reference == rhs.non_owning_reference) &&
@@ -2717,7 +2764,7 @@
(lhs.vector_of_enums == rhs.vector_of_enums) &&
(lhs.signed_enum == rhs.signed_enum) &&
(lhs.testrequirednestedflatbuffer == rhs.testrequirednestedflatbuffer) &&
- (lhs.scalar_key_sorted_tables == rhs.scalar_key_sorted_tables) &&
+ (lhs.scalar_key_sorted_tables.size() == rhs.scalar_key_sorted_tables.size() && std::equal(lhs.scalar_key_sorted_tables.cbegin(), lhs.scalar_key_sorted_tables.cend(), rhs.scalar_key_sorted_tables.cbegin(), [](flatbuffers::unique_ptr<MyGame::Example::StatT> const &a, flatbuffers::unique_ptr<MyGame::Example::StatT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
(lhs.native_inline == rhs.native_inline) &&
(lhs.long_enum_non_enum_default == rhs.long_enum_non_enum_default) &&
(lhs.long_enum_normal_default == rhs.long_enum_normal_default);
@@ -2857,55 +2904,48 @@
{ auto _e = color(); _o->color = _e; }
{ auto _e = test_type(); _o->test.type = _e; }
{ auto _e = test(); if (_e) _o->test.value = MyGame::Example::AnyUnion::UnPack(_e, test_type(), _resolver); }
- { auto _e = test4(); if (_e) { _o->test4.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test4[_i] = *_e->Get(_i); } } }
- { auto _e = testarrayofstring(); if (_e) { _o->testarrayofstring.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring[_i] = _e->Get(_i)->str(); } } }
- { auto _e = testarrayoftables(); if (_e) { _o->testarrayoftables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->testarrayoftables[_i]) { _e->Get(_i)->UnPackTo(_o->testarrayoftables[_i].get(), _resolver); } else { _o->testarrayoftables[_i] = flatbuffers::unique_ptr<MyGame::Example::MonsterT>(_e->Get(_i)->UnPack(_resolver)); }; } } }
- { auto _e = enemy(); if (_e) { if(_o->enemy) { _e->UnPackTo(_o->enemy.get(), _resolver); } else { _o->enemy = flatbuffers::unique_ptr<MyGame::Example::MonsterT>(_e->UnPack(_resolver)); } } }
+ { auto _e = test4(); if (_e) { _o->test4.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test4[_i] = *_e->Get(_i); } } else { _o->test4.resize(0); } }
+ { auto _e = testarrayofstring(); if (_e) { _o->testarrayofstring.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring[_i] = _e->Get(_i)->str(); } } else { _o->testarrayofstring.resize(0); } }
+ { auto _e = testarrayoftables(); if (_e) { _o->testarrayoftables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->testarrayoftables[_i]) { _e->Get(_i)->UnPackTo(_o->testarrayoftables[_i].get(), _resolver); } else { _o->testarrayoftables[_i] = flatbuffers::unique_ptr<MyGame::Example::MonsterT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->testarrayoftables.resize(0); } }
+ { auto _e = enemy(); if (_e) { if(_o->enemy) { _e->UnPackTo(_o->enemy.get(), _resolver); } else { _o->enemy = flatbuffers::unique_ptr<MyGame::Example::MonsterT>(_e->UnPack(_resolver)); } } else if (_o->enemy) { _o->enemy.reset(); } }
{ auto _e = testnestedflatbuffer(); if (_e) { _o->testnestedflatbuffer.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->testnestedflatbuffer.begin()); } }
- { auto _e = testempty(); if (_e) { if(_o->testempty) { _e->UnPackTo(_o->testempty.get(), _resolver); } else { _o->testempty = flatbuffers::unique_ptr<MyGame::Example::StatT>(_e->UnPack(_resolver)); } } }
+ { auto _e = testempty(); if (_e) { if(_o->testempty) { _e->UnPackTo(_o->testempty.get(), _resolver); } else { _o->testempty = flatbuffers::unique_ptr<MyGame::Example::StatT>(_e->UnPack(_resolver)); } } else if (_o->testempty) { _o->testempty.reset(); } }
{ auto _e = testbool(); _o->testbool = _e; }
{ auto _e = testhashs32_fnv1(); _o->testhashs32_fnv1 = _e; }
{ auto _e = testhashu32_fnv1(); _o->testhashu32_fnv1 = _e; }
{ auto _e = testhashs64_fnv1(); _o->testhashs64_fnv1 = _e; }
{ auto _e = testhashu64_fnv1(); _o->testhashu64_fnv1 = _e; }
{ auto _e = testhashs32_fnv1a(); _o->testhashs32_fnv1a = _e; }
- { auto _e = testhashu32_fnv1a(); //scalar resolver, naked
-if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->testhashu32_fnv1a), static_cast<flatbuffers::hash_value_t>(_e)); else _o->testhashu32_fnv1a = nullptr; }
+ { auto _e = testhashu32_fnv1a(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->testhashu32_fnv1a), static_cast<flatbuffers::hash_value_t>(_e)); else _o->testhashu32_fnv1a = nullptr; }
{ auto _e = testhashs64_fnv1a(); _o->testhashs64_fnv1a = _e; }
{ auto _e = testhashu64_fnv1a(); _o->testhashu64_fnv1a = _e; }
- { auto _e = testarrayofbools(); if (_e) { _o->testarrayofbools.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofbools[_i] = _e->Get(_i) != 0; } } }
+ { auto _e = testarrayofbools(); if (_e) { _o->testarrayofbools.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofbools[_i] = _e->Get(_i) != 0; } } else { _o->testarrayofbools.resize(0); } }
{ auto _e = testf(); _o->testf = _e; }
{ auto _e = testf2(); _o->testf2 = _e; }
{ auto _e = testf3(); _o->testf3 = _e; }
- { auto _e = testarrayofstring2(); if (_e) { _o->testarrayofstring2.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring2[_i] = _e->Get(_i)->str(); } } }
- { auto _e = testarrayofsortedstruct(); if (_e) { _o->testarrayofsortedstruct.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofsortedstruct[_i] = *_e->Get(_i); } } }
+ { auto _e = testarrayofstring2(); if (_e) { _o->testarrayofstring2.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring2[_i] = _e->Get(_i)->str(); } } else { _o->testarrayofstring2.resize(0); } }
+ { auto _e = testarrayofsortedstruct(); if (_e) { _o->testarrayofsortedstruct.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofsortedstruct[_i] = *_e->Get(_i); } } else { _o->testarrayofsortedstruct.resize(0); } }
{ auto _e = flex(); if (_e) { _o->flex.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->flex.begin()); } }
- { auto _e = test5(); if (_e) { _o->test5.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test5[_i] = *_e->Get(_i); } } }
- { auto _e = vector_of_longs(); if (_e) { _o->vector_of_longs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_longs[_i] = _e->Get(_i); } } }
- { auto _e = vector_of_doubles(); if (_e) { _o->vector_of_doubles.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_doubles[_i] = _e->Get(_i); } } }
- { auto _e = parent_namespace_test(); if (_e) { if(_o->parent_namespace_test) { _e->UnPackTo(_o->parent_namespace_test.get(), _resolver); } else { _o->parent_namespace_test = flatbuffers::unique_ptr<MyGame::InParentNamespaceT>(_e->UnPack(_resolver)); } } }
- { auto _e = vector_of_referrables(); if (_e) { _o->vector_of_referrables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->vector_of_referrables[_i]) { _e->Get(_i)->UnPackTo(_o->vector_of_referrables[_i].get(), _resolver); } else { _o->vector_of_referrables[_i] = flatbuffers::unique_ptr<MyGame::Example::ReferrableT>(_e->Get(_i)->UnPack(_resolver)); }; } } }
- { auto _e = single_weak_reference(); //scalar resolver, naked
-if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->single_weak_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->single_weak_reference = nullptr; }
- { auto _e = vector_of_weak_references(); if (_e) { _o->vector_of_weak_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { //vector resolver, naked
-if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_weak_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i))); else _o->vector_of_weak_references[_i] = nullptr; } } }
- { auto _e = vector_of_strong_referrables(); if (_e) { _o->vector_of_strong_referrables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->vector_of_strong_referrables[_i]) { _e->Get(_i)->UnPackTo(_o->vector_of_strong_referrables[_i].get(), _resolver); } else { _o->vector_of_strong_referrables[_i] = flatbuffers::unique_ptr<MyGame::Example::ReferrableT>(_e->Get(_i)->UnPack(_resolver)); }; } } }
- { auto _e = co_owning_reference(); //scalar resolver, naked
-if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->co_owning_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->co_owning_reference = nullptr; }
- { auto _e = vector_of_co_owning_references(); if (_e) { _o->vector_of_co_owning_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { //vector resolver, default_ptr_type
-if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_co_owning_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i)));/* else do nothing */; } } }
- { auto _e = non_owning_reference(); //scalar resolver, naked
-if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->non_owning_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->non_owning_reference = nullptr; }
- { auto _e = vector_of_non_owning_references(); if (_e) { _o->vector_of_non_owning_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { //vector resolver, naked
-if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_non_owning_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i))); else _o->vector_of_non_owning_references[_i] = nullptr; } } }
+ { auto _e = test5(); if (_e) { _o->test5.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test5[_i] = *_e->Get(_i); } } else { _o->test5.resize(0); } }
+ { auto _e = vector_of_longs(); if (_e) { _o->vector_of_longs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_longs[_i] = _e->Get(_i); } } else { _o->vector_of_longs.resize(0); } }
+ { auto _e = vector_of_doubles(); if (_e) { _o->vector_of_doubles.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_doubles[_i] = _e->Get(_i); } } else { _o->vector_of_doubles.resize(0); } }
+ { auto _e = parent_namespace_test(); if (_e) { if(_o->parent_namespace_test) { _e->UnPackTo(_o->parent_namespace_test.get(), _resolver); } else { _o->parent_namespace_test = flatbuffers::unique_ptr<MyGame::InParentNamespaceT>(_e->UnPack(_resolver)); } } else if (_o->parent_namespace_test) { _o->parent_namespace_test.reset(); } }
+ { auto _e = vector_of_referrables(); if (_e) { _o->vector_of_referrables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->vector_of_referrables[_i]) { _e->Get(_i)->UnPackTo(_o->vector_of_referrables[_i].get(), _resolver); } else { _o->vector_of_referrables[_i] = flatbuffers::unique_ptr<MyGame::Example::ReferrableT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->vector_of_referrables.resize(0); } }
+ { auto _e = single_weak_reference(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->single_weak_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->single_weak_reference = nullptr; }
+ { auto _e = vector_of_weak_references(); if (_e) { _o->vector_of_weak_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { /*vector resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_weak_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i))); else _o->vector_of_weak_references[_i] = nullptr; } } else { _o->vector_of_weak_references.resize(0); } }
+ { auto _e = vector_of_strong_referrables(); if (_e) { _o->vector_of_strong_referrables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->vector_of_strong_referrables[_i]) { _e->Get(_i)->UnPackTo(_o->vector_of_strong_referrables[_i].get(), _resolver); } else { _o->vector_of_strong_referrables[_i] = flatbuffers::unique_ptr<MyGame::Example::ReferrableT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->vector_of_strong_referrables.resize(0); } }
+ { auto _e = co_owning_reference(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->co_owning_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->co_owning_reference = nullptr; }
+ { auto _e = vector_of_co_owning_references(); if (_e) { _o->vector_of_co_owning_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { /*vector resolver, default_ptr_type*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_co_owning_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i)));/* else do nothing */; } } else { _o->vector_of_co_owning_references.resize(0); } }
+ { auto _e = non_owning_reference(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->non_owning_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->non_owning_reference = nullptr; }
+ { auto _e = vector_of_non_owning_references(); if (_e) { _o->vector_of_non_owning_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { /*vector resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_non_owning_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i))); else _o->vector_of_non_owning_references[_i] = nullptr; } } else { _o->vector_of_non_owning_references.resize(0); } }
{ auto _e = any_unique_type(); _o->any_unique.type = _e; }
{ auto _e = any_unique(); if (_e) _o->any_unique.value = MyGame::Example::AnyUniqueAliasesUnion::UnPack(_e, any_unique_type(), _resolver); }
{ auto _e = any_ambiguous_type(); _o->any_ambiguous.type = _e; }
{ auto _e = any_ambiguous(); if (_e) _o->any_ambiguous.value = MyGame::Example::AnyAmbiguousAliasesUnion::UnPack(_e, any_ambiguous_type(), _resolver); }
- { auto _e = vector_of_enums(); if (_e) { _o->vector_of_enums.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_enums[_i] = static_cast<MyGame::Example::Color>(_e->Get(_i)); } } }
+ { auto _e = vector_of_enums(); if (_e) { _o->vector_of_enums.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_enums[_i] = static_cast<MyGame::Example::Color>(_e->Get(_i)); } } else { _o->vector_of_enums.resize(0); } }
{ auto _e = signed_enum(); _o->signed_enum = _e; }
{ auto _e = testrequirednestedflatbuffer(); if (_e) { _o->testrequirednestedflatbuffer.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->testrequirednestedflatbuffer.begin()); } }
- { auto _e = scalar_key_sorted_tables(); if (_e) { _o->scalar_key_sorted_tables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->scalar_key_sorted_tables[_i]) { _e->Get(_i)->UnPackTo(_o->scalar_key_sorted_tables[_i].get(), _resolver); } else { _o->scalar_key_sorted_tables[_i] = flatbuffers::unique_ptr<MyGame::Example::StatT>(_e->Get(_i)->UnPack(_resolver)); }; } } }
+ { auto _e = scalar_key_sorted_tables(); if (_e) { _o->scalar_key_sorted_tables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->scalar_key_sorted_tables[_i]) { _e->Get(_i)->UnPackTo(_o->scalar_key_sorted_tables[_i].get(), _resolver); } else { _o->scalar_key_sorted_tables[_i] = flatbuffers::unique_ptr<MyGame::Example::StatT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->scalar_key_sorted_tables.resize(0); } }
{ auto _e = native_inline(); if (_e) _o->native_inline = *_e; }
{ auto _e = long_enum_non_enum_default(); _o->long_enum_non_enum_default = _e; }
{ auto _e = long_enum_normal_default(); _o->long_enum_normal_default = _e; }
@@ -2919,7 +2959,7 @@
(void)_rehasher;
(void)_o;
struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const MonsterT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
- auto _pos = _o->pos ? _o->pos.get() : 0;
+ auto _pos = _o->pos ? _o->pos.get() : nullptr;
auto _mana = _o->mana;
auto _hp = _o->hp;
auto _name = _fbb.CreateString(_o->name);
@@ -3071,7 +3111,7 @@
{ auto _e = f32(); _o->f32 = _e; }
{ auto _e = f64(); _o->f64 = _e; }
{ auto _e = v8(); if (_e) { _o->v8.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->v8.begin()); } }
- { auto _e = vf64(); if (_e) { _o->vf64.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vf64[_i] = _e->Get(_i); } } }
+ { auto _e = vf64(); if (_e) { _o->vf64.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vf64[_i] = _e->Get(_i); } } else { _o->vf64.resize(0); } }
}
inline flatbuffers::Offset<TypeAliases> TypeAliases::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
@@ -3704,6 +3744,23 @@
return &tt;
}
+inline const flatbuffers::TypeTable *StructOfStructsOfStructsTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::StructOfStructsTypeTable
+ };
+ static const int64_t values[] = { 0, 20 };
+ static const char * const names[] = {
+ "a"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 1, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
inline const flatbuffers::TypeTable *StatTypeTable() {
static const flatbuffers::TypeCode type_codes[] = {
{ flatbuffers::ET_STRING, 0, -1 },
diff --git a/tests/monster_test_generated.lobster b/tests/monster_test_generated.lobster
index 238206f..c3ee785 100644
--- a/tests/monster_test_generated.lobster
+++ b/tests/monster_test_generated.lobster
@@ -61,6 +61,8 @@
class StructOfStructs
+class StructOfStructsOfStructs
+
class Stat
class Referrable
@@ -100,9 +102,9 @@
namespace MyGame_Example
class Test : flatbuffers_handle
- def a():
+ def a() -> int:
return buf_.read_int16_le(pos_ + 0)
- def b():
+ def b() -> int:
return buf_.read_int8_le(pos_ + 2)
def CreateTest(b_:flatbuffers_builder, a:int, b:int):
@@ -113,7 +115,7 @@
return b_.Offset()
class TestSimpleTableWithEnum : flatbuffers_handle
- def color():
+ def color() -> Color:
return Color(buf_.flatbuffers_field_uint8(pos_, 4, 2))
def GetRootAsTestSimpleTableWithEnum(buf:string): return TestSimpleTableWithEnum { buf, buf.flatbuffers_indirect(0) }
@@ -130,17 +132,17 @@
return b_.EndObject()
class Vec3 : flatbuffers_handle
- def x():
+ def x() -> float:
return buf_.read_float32_le(pos_ + 0)
- def y():
+ def y() -> float:
return buf_.read_float32_le(pos_ + 4)
- def z():
+ def z() -> float:
return buf_.read_float32_le(pos_ + 8)
- def test1():
+ def test1() -> float:
return buf_.read_float64_le(pos_ + 16)
- def test2():
+ def test2() -> Color:
return Color(buf_.read_uint8_le(pos_ + 24))
- def test3():
+ def test3() -> MyGame_Example_Test:
return MyGame_Example_Test{ buf_, pos_ + 26 }
def CreateVec3(b_:flatbuffers_builder, x:float, y:float, z:float, test1:float, test2:Color, test3_a:int, test3_b:int):
@@ -160,9 +162,9 @@
return b_.Offset()
class Ability : flatbuffers_handle
- def id():
+ def id() -> int:
return buf_.read_uint32_le(pos_ + 0)
- def distance():
+ def distance() -> int:
return buf_.read_uint32_le(pos_ + 4)
def CreateAbility(b_:flatbuffers_builder, id:int, distance:int):
@@ -172,11 +174,11 @@
return b_.Offset()
class StructOfStructs : flatbuffers_handle
- def a():
+ def a() -> MyGame_Example_Ability:
return MyGame_Example_Ability{ buf_, pos_ + 0 }
- def b():
+ def b() -> MyGame_Example_Test:
return MyGame_Example_Test{ buf_, pos_ + 8 }
- def c():
+ def c() -> MyGame_Example_Ability:
return MyGame_Example_Ability{ buf_, pos_ + 12 }
def CreateStructOfStructs(b_:flatbuffers_builder, a_id:int, a_distance:int, b_a:int, b_b:int, c_id:int, c_distance:int):
@@ -193,12 +195,31 @@
b_.PrependUint32(a_id)
return b_.Offset()
+class StructOfStructsOfStructs : flatbuffers_handle
+ def a() -> MyGame_Example_StructOfStructs:
+ return MyGame_Example_StructOfStructs{ buf_, pos_ + 0 }
+
+def CreateStructOfStructsOfStructs(b_:flatbuffers_builder, a_a_id:int, a_a_distance:int, a_b_a:int, a_b_b:int, a_c_id:int, a_c_distance:int):
+ b_.Prep(4, 20)
+ b_.Prep(4, 20)
+ b_.Prep(4, 8)
+ b_.PrependUint32(a_c_distance)
+ b_.PrependUint32(a_c_id)
+ b_.Prep(2, 4)
+ b_.Pad(1)
+ b_.PrependInt8(a_b_b)
+ b_.PrependInt16(a_b_a)
+ b_.Prep(4, 8)
+ b_.PrependUint32(a_a_distance)
+ b_.PrependUint32(a_a_id)
+ return b_.Offset()
+
class Stat : flatbuffers_handle
- def id():
+ def id() -> string:
return buf_.flatbuffers_field_string(pos_, 4)
- def val():
+ def val() -> int:
return buf_.flatbuffers_field_int64(pos_, 6, 0)
- def count():
+ def count() -> int:
return buf_.flatbuffers_field_uint16(pos_, 8, 0)
def GetRootAsStat(buf:string): return Stat { buf, buf.flatbuffers_indirect(0) }
@@ -221,7 +242,7 @@
return b_.EndObject()
class Referrable : flatbuffers_handle
- def id():
+ def id() -> int:
return buf_.flatbuffers_field_uint64(pos_, 4, 0)
def GetRootAsReferrable(buf:string): return Referrable { buf, buf.flatbuffers_indirect(0) }
@@ -239,22 +260,22 @@
/// an example documentation comment: "monster object"
class Monster : flatbuffers_handle
- def pos():
+ def pos() -> MyGame_Example_Vec3?:
let o = buf_.flatbuffers_field_struct(pos_, 4)
return if o: MyGame_Example_Vec3 { buf_, o } else: nil
- def mana():
+ def mana() -> int:
return buf_.flatbuffers_field_int16(pos_, 6, 150)
- def hp():
+ def hp() -> int:
return buf_.flatbuffers_field_int16(pos_, 8, 100)
- def name():
+ def name() -> string:
return buf_.flatbuffers_field_string(pos_, 10)
- def inventory(i:int):
+ def inventory(i:int) -> int:
return buf_.read_uint8_le(buf_.flatbuffers_field_vector(pos_, 14) + i * 1)
- def inventory_length():
+ def inventory_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 14)
- def color():
+ def color() -> Color:
return Color(buf_.flatbuffers_field_uint8(pos_, 16, 8))
- def test_type():
+ def test_type() -> Any:
return Any(buf_.flatbuffers_field_uint8(pos_, 18, 0))
def test_as_Monster():
return MyGame_Example_Monster { buf_, buf_.flatbuffers_field_table(pos_, 20) }
@@ -262,112 +283,112 @@
return MyGame_Example_TestSimpleTableWithEnum { buf_, buf_.flatbuffers_field_table(pos_, 20) }
def test_as_MyGame_Example2_Monster():
return MyGame_Example2_Monster { buf_, buf_.flatbuffers_field_table(pos_, 20) }
- def test4(i:int):
+ def test4(i:int) -> MyGame_Example_Test:
return MyGame_Example_Test { buf_, buf_.flatbuffers_field_vector(pos_, 22) + i * 4 }
- def test4_length():
+ def test4_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 22)
- def testarrayofstring(i:int):
+ def testarrayofstring(i:int) -> string:
return buf_.flatbuffers_string(buf_.flatbuffers_field_vector(pos_, 24) + i * 4)
- def testarrayofstring_length():
+ def testarrayofstring_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 24)
/// an example documentation comment: this will end up in the generated code
/// multiline too
- def testarrayoftables(i:int):
+ def testarrayoftables(i:int) -> MyGame_Example_Monster:
return MyGame_Example_Monster { buf_, buf_.flatbuffers_indirect(buf_.flatbuffers_field_vector(pos_, 26) + i * 4) }
- def testarrayoftables_length():
+ def testarrayoftables_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 26)
- def enemy():
+ def enemy() -> MyGame_Example_Monster?:
let o = buf_.flatbuffers_field_table(pos_, 28)
return if o: MyGame_Example_Monster { buf_, o } else: nil
- def testnestedflatbuffer(i:int):
+ def testnestedflatbuffer(i:int) -> int:
return buf_.read_uint8_le(buf_.flatbuffers_field_vector(pos_, 30) + i * 1)
- def testnestedflatbuffer_length():
+ def testnestedflatbuffer_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 30)
- def testempty():
+ def testempty() -> MyGame_Example_Stat?:
let o = buf_.flatbuffers_field_table(pos_, 32)
return if o: MyGame_Example_Stat { buf_, o } else: nil
- def testbool():
- return buf_.flatbuffers_field_int8(pos_, 34, 0)
- def testhashs32_fnv1():
+ def testbool() -> bool:
+ return bool(buf_.flatbuffers_field_int8(pos_, 34, 0))
+ def testhashs32_fnv1() -> int:
return buf_.flatbuffers_field_int32(pos_, 36, 0)
- def testhashu32_fnv1():
+ def testhashu32_fnv1() -> int:
return buf_.flatbuffers_field_uint32(pos_, 38, 0)
- def testhashs64_fnv1():
+ def testhashs64_fnv1() -> int:
return buf_.flatbuffers_field_int64(pos_, 40, 0)
- def testhashu64_fnv1():
+ def testhashu64_fnv1() -> int:
return buf_.flatbuffers_field_uint64(pos_, 42, 0)
- def testhashs32_fnv1a():
+ def testhashs32_fnv1a() -> int:
return buf_.flatbuffers_field_int32(pos_, 44, 0)
- def testhashu32_fnv1a():
+ def testhashu32_fnv1a() -> int:
return buf_.flatbuffers_field_uint32(pos_, 46, 0)
- def testhashs64_fnv1a():
+ def testhashs64_fnv1a() -> int:
return buf_.flatbuffers_field_int64(pos_, 48, 0)
- def testhashu64_fnv1a():
+ def testhashu64_fnv1a() -> int:
return buf_.flatbuffers_field_uint64(pos_, 50, 0)
- def testarrayofbools(i:int):
+ def testarrayofbools(i:int) -> bool:
return buf_.read_int8_le(buf_.flatbuffers_field_vector(pos_, 52) + i * 1)
- def testarrayofbools_length():
+ def testarrayofbools_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 52)
- def testf():
+ def testf() -> float:
return buf_.flatbuffers_field_float32(pos_, 54, 3.14159)
- def testf2():
+ def testf2() -> float:
return buf_.flatbuffers_field_float32(pos_, 56, 3.0)
- def testf3():
+ def testf3() -> float:
return buf_.flatbuffers_field_float32(pos_, 58, 0.0)
- def testarrayofstring2(i:int):
+ def testarrayofstring2(i:int) -> string:
return buf_.flatbuffers_string(buf_.flatbuffers_field_vector(pos_, 60) + i * 4)
- def testarrayofstring2_length():
+ def testarrayofstring2_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 60)
- def testarrayofsortedstruct(i:int):
+ def testarrayofsortedstruct(i:int) -> MyGame_Example_Ability:
return MyGame_Example_Ability { buf_, buf_.flatbuffers_field_vector(pos_, 62) + i * 8 }
- def testarrayofsortedstruct_length():
+ def testarrayofsortedstruct_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 62)
- def flex(i:int):
+ def flex(i:int) -> int:
return buf_.read_uint8_le(buf_.flatbuffers_field_vector(pos_, 64) + i * 1)
- def flex_length():
+ def flex_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 64)
- def test5(i:int):
+ def test5(i:int) -> MyGame_Example_Test:
return MyGame_Example_Test { buf_, buf_.flatbuffers_field_vector(pos_, 66) + i * 4 }
- def test5_length():
+ def test5_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 66)
- def vector_of_longs(i:int):
+ def vector_of_longs(i:int) -> int:
return buf_.read_int64_le(buf_.flatbuffers_field_vector(pos_, 68) + i * 8)
- def vector_of_longs_length():
+ def vector_of_longs_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 68)
- def vector_of_doubles(i:int):
+ def vector_of_doubles(i:int) -> float:
return buf_.read_float64_le(buf_.flatbuffers_field_vector(pos_, 70) + i * 8)
- def vector_of_doubles_length():
+ def vector_of_doubles_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 70)
- def parent_namespace_test():
+ def parent_namespace_test() -> MyGame_InParentNamespace?:
let o = buf_.flatbuffers_field_table(pos_, 72)
return if o: MyGame_InParentNamespace { buf_, o } else: nil
- def vector_of_referrables(i:int):
+ def vector_of_referrables(i:int) -> MyGame_Example_Referrable:
return MyGame_Example_Referrable { buf_, buf_.flatbuffers_indirect(buf_.flatbuffers_field_vector(pos_, 74) + i * 4) }
- def vector_of_referrables_length():
+ def vector_of_referrables_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 74)
- def single_weak_reference():
+ def single_weak_reference() -> int:
return buf_.flatbuffers_field_uint64(pos_, 76, 0)
- def vector_of_weak_references(i:int):
+ def vector_of_weak_references(i:int) -> int:
return buf_.read_uint64_le(buf_.flatbuffers_field_vector(pos_, 78) + i * 8)
- def vector_of_weak_references_length():
+ def vector_of_weak_references_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 78)
- def vector_of_strong_referrables(i:int):
+ def vector_of_strong_referrables(i:int) -> MyGame_Example_Referrable:
return MyGame_Example_Referrable { buf_, buf_.flatbuffers_indirect(buf_.flatbuffers_field_vector(pos_, 80) + i * 4) }
- def vector_of_strong_referrables_length():
+ def vector_of_strong_referrables_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 80)
- def co_owning_reference():
+ def co_owning_reference() -> int:
return buf_.flatbuffers_field_uint64(pos_, 82, 0)
- def vector_of_co_owning_references(i:int):
+ def vector_of_co_owning_references(i:int) -> int:
return buf_.read_uint64_le(buf_.flatbuffers_field_vector(pos_, 84) + i * 8)
- def vector_of_co_owning_references_length():
+ def vector_of_co_owning_references_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 84)
- def non_owning_reference():
+ def non_owning_reference() -> int:
return buf_.flatbuffers_field_uint64(pos_, 86, 0)
- def vector_of_non_owning_references(i:int):
+ def vector_of_non_owning_references(i:int) -> int:
return buf_.read_uint64_le(buf_.flatbuffers_field_vector(pos_, 88) + i * 8)
- def vector_of_non_owning_references_length():
+ def vector_of_non_owning_references_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 88)
- def any_unique_type():
+ def any_unique_type() -> AnyUniqueAliases:
return AnyUniqueAliases(buf_.flatbuffers_field_uint8(pos_, 90, 0))
def any_unique_as_M():
return MyGame_Example_Monster { buf_, buf_.flatbuffers_field_table(pos_, 92) }
@@ -375,7 +396,7 @@
return MyGame_Example_TestSimpleTableWithEnum { buf_, buf_.flatbuffers_field_table(pos_, 92) }
def any_unique_as_M2():
return MyGame_Example2_Monster { buf_, buf_.flatbuffers_field_table(pos_, 92) }
- def any_ambiguous_type():
+ def any_ambiguous_type() -> AnyAmbiguousAliases:
return AnyAmbiguousAliases(buf_.flatbuffers_field_uint8(pos_, 94, 0))
def any_ambiguous_as_M1():
return MyGame_Example_Monster { buf_, buf_.flatbuffers_field_table(pos_, 96) }
@@ -383,26 +404,26 @@
return MyGame_Example_Monster { buf_, buf_.flatbuffers_field_table(pos_, 96) }
def any_ambiguous_as_M3():
return MyGame_Example_Monster { buf_, buf_.flatbuffers_field_table(pos_, 96) }
- def vector_of_enums(i:int):
+ def vector_of_enums(i:int) -> Color:
return buf_.read_uint8_le(buf_.flatbuffers_field_vector(pos_, 98) + i * 1)
- def vector_of_enums_length():
+ def vector_of_enums_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 98)
- def signed_enum():
+ def signed_enum() -> Race:
return Race(buf_.flatbuffers_field_int8(pos_, 100, -1))
- def testrequirednestedflatbuffer(i:int):
+ def testrequirednestedflatbuffer(i:int) -> int:
return buf_.read_uint8_le(buf_.flatbuffers_field_vector(pos_, 102) + i * 1)
- def testrequirednestedflatbuffer_length():
+ def testrequirednestedflatbuffer_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 102)
- def scalar_key_sorted_tables(i:int):
+ def scalar_key_sorted_tables(i:int) -> MyGame_Example_Stat:
return MyGame_Example_Stat { buf_, buf_.flatbuffers_indirect(buf_.flatbuffers_field_vector(pos_, 104) + i * 4) }
- def scalar_key_sorted_tables_length():
+ def scalar_key_sorted_tables_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 104)
- def native_inline():
+ def native_inline() -> MyGame_Example_Test?:
let o = buf_.flatbuffers_field_struct(pos_, 106)
return if o: MyGame_Example_Test { buf_, o } else: nil
- def long_enum_non_enum_default():
+ def long_enum_non_enum_default() -> LongEnum:
return LongEnum(buf_.flatbuffers_field_uint64(pos_, 108, 0))
- def long_enum_normal_default():
+ def long_enum_normal_default() -> LongEnum:
return LongEnum(buf_.flatbuffers_field_uint64(pos_, 110, 2))
def GetRootAsMonster(buf:string): return Monster { buf, buf.flatbuffers_indirect(0) }
@@ -454,7 +475,7 @@
def add_testempty(testempty:flatbuffers_offset):
b_.PrependUOffsetTRelativeSlot(14, testempty)
return this
- def add_testbool(testbool:int):
+ def add_testbool(testbool:bool):
b_.PrependBoolSlot(15, testbool, 0)
return this
def add_testhashs32_fnv1(testhashs32_fnv1:int):
@@ -607,7 +628,7 @@
def MonsterStartTestarrayofboolsVector(b_:flatbuffers_builder, n_:int):
b_.StartVector(1, n_, 1)
-def MonsterCreateTestarrayofboolsVector(b_:flatbuffers_builder, v_:[int]):
+def MonsterCreateTestarrayofboolsVector(b_:flatbuffers_builder, v_:[bool]):
b_.StartVector(1, v_.length, 1)
reverse(v_) e_: b_.PrependBool(e_)
return b_.EndVector(v_.length)
@@ -703,33 +724,33 @@
return b_.EndVector(v_.length)
class TypeAliases : flatbuffers_handle
- def i8():
+ def i8() -> int:
return buf_.flatbuffers_field_int8(pos_, 4, 0)
- def u8():
+ def u8() -> int:
return buf_.flatbuffers_field_uint8(pos_, 6, 0)
- def i16():
+ def i16() -> int:
return buf_.flatbuffers_field_int16(pos_, 8, 0)
- def u16():
+ def u16() -> int:
return buf_.flatbuffers_field_uint16(pos_, 10, 0)
- def i32():
+ def i32() -> int:
return buf_.flatbuffers_field_int32(pos_, 12, 0)
- def u32():
+ def u32() -> int:
return buf_.flatbuffers_field_uint32(pos_, 14, 0)
- def i64():
+ def i64() -> int:
return buf_.flatbuffers_field_int64(pos_, 16, 0)
- def u64():
+ def u64() -> int:
return buf_.flatbuffers_field_uint64(pos_, 18, 0)
- def f32():
+ def f32() -> float:
return buf_.flatbuffers_field_float32(pos_, 20, 0.0)
- def f64():
+ def f64() -> float:
return buf_.flatbuffers_field_float64(pos_, 22, 0.0)
- def v8(i:int):
+ def v8(i:int) -> int:
return buf_.read_int8_le(buf_.flatbuffers_field_vector(pos_, 24) + i * 1)
- def v8_length():
+ def v8_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 24)
- def vf64(i:int):
+ def vf64(i:int) -> float:
return buf_.read_float64_le(buf_.flatbuffers_field_vector(pos_, 26) + i * 8)
- def vf64_length():
+ def vf64_length() -> int:
return buf_.flatbuffers_field_vector_len(pos_, 26)
def GetRootAsTypeAliases(buf:string): return TypeAliases { buf, buf.flatbuffers_indirect(0) }
diff --git a/tests/monster_test_generated.py b/tests/monster_test_generated.py
index 71e266d..0fa2140 100644
--- a/tests/monster_test_generated.py
+++ b/tests/monster_test_generated.py
@@ -543,6 +543,73 @@
return CreateStructOfStructs(builder, self.a.id, self.a.distance, self.b.a, self.b.b, self.c.id, self.c.distance)
+class StructOfStructsOfStructs(object):
+ __slots__ = ['_tab']
+
+ @classmethod
+ def SizeOf(cls):
+ return 20
+
+ # StructOfStructsOfStructs
+ def Init(self, buf, pos):
+ self._tab = flatbuffers.table.Table(buf, pos)
+
+ # StructOfStructsOfStructs
+ def A(self, obj):
+ obj.Init(self._tab.Bytes, self._tab.Pos + 0)
+ return obj
+
+
+def 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.PrependUint32(a_c_distance)
+ builder.PrependUint32(a_c_id)
+ builder.Prep(2, 4)
+ builder.Pad(1)
+ builder.PrependInt8(a_b_b)
+ builder.PrependInt16(a_b_a)
+ builder.Prep(4, 8)
+ builder.PrependUint32(a_a_distance)
+ builder.PrependUint32(a_a_id)
+ return builder.Offset()
+
+try:
+ from typing import Optional
+except:
+ pass
+
+class StructOfStructsOfStructsT(object):
+
+ # StructOfStructsOfStructsT
+ def __init__(self):
+ self.a = None # type: Optional[StructOfStructsT]
+
+ @classmethod
+ def InitFromBuf(cls, buf, pos):
+ structOfStructsOfStructs = StructOfStructsOfStructs()
+ structOfStructsOfStructs.Init(buf, pos)
+ return cls.InitFromObj(structOfStructsOfStructs)
+
+ @classmethod
+ def InitFromObj(cls, structOfStructsOfStructs):
+ x = StructOfStructsOfStructsT()
+ x._UnPack(structOfStructsOfStructs)
+ return x
+
+ # StructOfStructsOfStructsT
+ def _UnPack(self, structOfStructsOfStructs):
+ if structOfStructsOfStructs is None:
+ return
+ if structOfStructsOfStructs.A(StructOfStructs()) is not None:
+ self.a = StructOfStructsT.InitFromObj(structOfStructsOfStructs.A(StructOfStructs()))
+
+ # StructOfStructsOfStructsT
+ def Pack(self, builder):
+ return CreateStructOfStructsOfStructs(builder, self.a.a.id, self.a.a.distance, self.a.b.a, self.a.b.b, self.a.c.id, self.a.c.distance)
+
+
class Stat(object):
__slots__ = ['_tab']
diff --git a/tests/monster_test.js b/tests/monster_test_generated.ts
similarity index 78%
copy from tests/monster_test.js
copy to tests/monster_test_generated.ts
index b4e13d1..5fd080e 100644
--- a/tests/monster_test.js
+++ b/tests/monster_test_generated.ts
@@ -1,4 +1,6 @@
-export { Monster as MyGameExample2Monster, MonsterT as MyGameExample2MonsterT } from './my-game/example2/monster';
+// automatically generated by the FlatBuffers compiler, do not modify
+
+export { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from './my-game/example2/monster';
export { Ability, AbilityT } from './my-game/example/ability';
export { Any, unionToAny, unionListToAny } from './my-game/example/any';
export { AnyAmbiguousAliases, unionToAnyAmbiguousAliases, unionListToAnyAmbiguousAliases } from './my-game/example/any-ambiguous-aliases';
@@ -9,6 +11,7 @@
export { Referrable, ReferrableT } from './my-game/example/referrable';
export { Stat, StatT } from './my-game/example/stat';
export { StructOfStructs, StructOfStructsT } from './my-game/example/struct-of-structs';
+export { StructOfStructsOfStructs, StructOfStructsOfStructsT } from './my-game/example/struct-of-structs-of-structs';
export { Test, TestT } from './my-game/example/test';
export { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from './my-game/example/test-simple-table-with-enum';
export { TypeAliases, TypeAliasesT } from './my-game/example/type-aliases';
diff --git a/tests/monster_test_my_game.example_generated.dart b/tests/monster_test_my_game.example_generated.dart
index dd816d9..174fe1d 100644
--- a/tests/monster_test_my_game.example_generated.dart
+++ b/tests/monster_test_my_game.example_generated.dart
@@ -152,7 +152,7 @@
const _LongEnumReader();
@override
- int get size => 1;
+ int get size => 8;
@override
LongEnum read(fb.BufferContext bc, int offset) =>
@@ -316,7 +316,7 @@
@override
String toString() {
- return 'Test{a: $a, b: $b}';
+ return 'Test{a: ${a}, b: ${b}}';
}
TestT unpack() => TestT(
@@ -347,7 +347,7 @@
@override
String toString() {
- return 'TestT{a: $a, b: $b}';
+ return 'TestT{a: ${a}, b: ${b}}';
}
}
@@ -420,7 +420,7 @@
@override
String toString() {
- return 'TestSimpleTableWithEnum{color: $color}';
+ return 'TestSimpleTableWithEnum{color: ${color}}';
}
TestSimpleTableWithEnumT unpack() => TestSimpleTableWithEnumT(
@@ -447,7 +447,7 @@
@override
String toString() {
- return 'TestSimpleTableWithEnumT{color: $color}';
+ return 'TestSimpleTableWithEnumT{color: ${color}}';
}
}
@@ -519,7 +519,7 @@
@override
String toString() {
- return 'Vec3{x: $x, y: $y, z: $z, test1: $test1, test2: $test2, test3: $test3}';
+ return 'Vec3{x: ${x}, y: ${y}, z: ${z}, test1: ${test1}, test2: ${test2}, test3: ${test3}}';
}
Vec3T unpack() => Vec3T(
@@ -568,7 +568,7 @@
@override
String toString() {
- return 'Vec3T{x: $x, y: $y, z: $z, test1: $test1, test2: $test2, test3: $test3}';
+ return 'Vec3T{x: ${x}, y: ${y}, z: ${z}, test1: ${test1}, test2: ${test2}, test3: ${test3}}';
}
}
@@ -662,7 +662,7 @@
@override
String toString() {
- return 'Ability{id: $id, distance: $distance}';
+ return 'Ability{id: ${id}, distance: ${distance}}';
}
AbilityT unpack() => AbilityT(
@@ -692,7 +692,7 @@
@override
String toString() {
- return 'AbilityT{id: $id, distance: $distance}';
+ return 'AbilityT{id: ${id}, distance: ${distance}}';
}
}
@@ -761,7 +761,7 @@
@override
String toString() {
- return 'StructOfStructs{a: $a, b: $b, c: $c}';
+ return 'StructOfStructs{a: ${a}, b: ${b}, c: ${c}}';
}
StructOfStructsT unpack() => StructOfStructsT(
@@ -795,7 +795,7 @@
@override
String toString() {
- return 'StructOfStructsT{a: $a, b: $b, c: $c}';
+ return 'StructOfStructsT{a: ${a}, b: ${b}, c: ${c}}';
}
}
@@ -855,6 +855,94 @@
return fbBuilder.buffer;
}
}
+class StructOfStructsOfStructs {
+ StructOfStructsOfStructs._(this._bc, this._bcOffset);
+
+ static const fb.Reader<StructOfStructsOfStructs> reader = _StructOfStructsOfStructsReader();
+
+ final fb.BufferContext _bc;
+ final int _bcOffset;
+
+ StructOfStructs get a => StructOfStructs.reader.read(_bc, _bcOffset + 0);
+
+ @override
+ String toString() {
+ return 'StructOfStructsOfStructs{a: ${a}}';
+ }
+
+ StructOfStructsOfStructsT unpack() => StructOfStructsOfStructsT(
+ a: a.unpack());
+
+ static int pack(fb.Builder fbBuilder, StructOfStructsOfStructsT? object) {
+ if (object == null) return 0;
+ return object.pack(fbBuilder);
+ }
+}
+
+class StructOfStructsOfStructsT implements fb.Packable {
+ StructOfStructsT a;
+
+ StructOfStructsOfStructsT({
+ required this.a});
+
+ @override
+ int pack(fb.Builder fbBuilder) {
+ a.pack(fbBuilder);
+ return fbBuilder.offset;
+ }
+
+ @override
+ String toString() {
+ return 'StructOfStructsOfStructsT{a: ${a}}';
+ }
+}
+
+class _StructOfStructsOfStructsReader extends fb.StructReader<StructOfStructsOfStructs> {
+ const _StructOfStructsOfStructsReader();
+
+ @override
+ int get size => 20;
+
+ @override
+ StructOfStructsOfStructs createObject(fb.BufferContext bc, int offset) =>
+ StructOfStructsOfStructs._(bc, offset);
+}
+
+class StructOfStructsOfStructsBuilder {
+ StructOfStructsOfStructsBuilder(this.fbBuilder);
+
+ final fb.Builder fbBuilder;
+
+ int finish(fb.StructBuilder a) {
+ a();
+ return fbBuilder.offset;
+ }
+
+}
+
+class StructOfStructsOfStructsObjectBuilder extends fb.ObjectBuilder {
+ final StructOfStructsObjectBuilder _a;
+
+ StructOfStructsOfStructsObjectBuilder({
+ required StructOfStructsObjectBuilder a,
+ })
+ : _a = a;
+
+ /// Finish building, and store into the [fbBuilder].
+ @override
+ int finish(fb.Builder fbBuilder) {
+ _a.finish(fbBuilder);
+ return fbBuilder.offset;
+ }
+
+ /// Convenience method to serialize to byte list.
+ @override
+ Uint8List toBytes([String? fileIdentifier]) {
+ final fbBuilder = fb.Builder(deduplicateTables: false);
+ fbBuilder.finish(finish(fbBuilder), fileIdentifier);
+ return fbBuilder.buffer;
+ }
+}
class Stat {
Stat._(this._bc, this._bcOffset);
factory Stat(List<int> bytes) {
@@ -873,7 +961,7 @@
@override
String toString() {
- return 'Stat{id: $id, val: $val, count: $count}';
+ return 'Stat{id: ${id}, val: ${val}, count: ${count}}';
}
StatT unpack() => StatT(
@@ -910,7 +998,7 @@
@override
String toString() {
- return 'StatT{id: $id, val: $val, count: $count}';
+ return 'StatT{id: ${id}, val: ${val}, count: ${count}}';
}
}
@@ -999,7 +1087,7 @@
@override
String toString() {
- return 'Referrable{id: $id}';
+ return 'Referrable{id: ${id}}';
}
ReferrableT unpack() => ReferrableT(
@@ -1026,7 +1114,7 @@
@override
String toString() {
- return 'ReferrableT{id: $id}';
+ return 'ReferrableT{id: ${id}}';
}
}
@@ -1173,7 +1261,7 @@
@override
String toString() {
- return 'Monster{pos: $pos, mana: $mana, hp: $hp, name: $name, inventory: $inventory, color: $color, testType: $testType, test: $test, test4: $test4, testarrayofstring: $testarrayofstring, testarrayoftables: $testarrayoftables, enemy: $enemy, testnestedflatbuffer: $testnestedflatbuffer, testempty: $testempty, testbool: $testbool, testhashs32Fnv1: $testhashs32Fnv1, testhashu32Fnv1: $testhashu32Fnv1, testhashs64Fnv1: $testhashs64Fnv1, testhashu64Fnv1: $testhashu64Fnv1, testhashs32Fnv1a: $testhashs32Fnv1a, testhashu32Fnv1a: $testhashu32Fnv1a, testhashs64Fnv1a: $testhashs64Fnv1a, testhashu64Fnv1a: $testhashu64Fnv1a, testarrayofbools: $testarrayofbools, testf: $testf, testf2: $testf2, testf3: $testf3, testarrayofstring2: $testarrayofstring2, testarrayofsortedstruct: $testarrayofsortedstruct, flex: $flex, test5: $test5, vectorOfLongs: $vectorOfLongs, vectorOfDoubles: $vectorOfDoubles, parentNamespaceTest: $parentNamespaceTest, vectorOfReferrables: $vectorOfReferrables, singleWeakReference: $singleWeakReference, vectorOfWeakReferences: $vectorOfWeakReferences, vectorOfStrongReferrables: $vectorOfStrongReferrables, coOwningReference: $coOwningReference, vectorOfCoOwningReferences: $vectorOfCoOwningReferences, nonOwningReference: $nonOwningReference, vectorOfNonOwningReferences: $vectorOfNonOwningReferences, anyUniqueType: $anyUniqueType, anyUnique: $anyUnique, anyAmbiguousType: $anyAmbiguousType, anyAmbiguous: $anyAmbiguous, vectorOfEnums: $vectorOfEnums, signedEnum: $signedEnum, testrequirednestedflatbuffer: $testrequirednestedflatbuffer, scalarKeySortedTables: $scalarKeySortedTables, nativeInline: $nativeInline, longEnumNonEnumDefault: $longEnumNonEnumDefault, longEnumNormalDefault: $longEnumNormalDefault}';
+ return 'Monster{pos: ${pos}, mana: ${mana}, hp: ${hp}, name: ${name}, inventory: ${inventory}, color: ${color}, testType: ${testType}, test: ${test}, test4: ${test4}, testarrayofstring: ${testarrayofstring}, testarrayoftables: ${testarrayoftables}, enemy: ${enemy}, testnestedflatbuffer: ${testnestedflatbuffer}, testempty: ${testempty}, testbool: ${testbool}, testhashs32Fnv1: ${testhashs32Fnv1}, testhashu32Fnv1: ${testhashu32Fnv1}, testhashs64Fnv1: ${testhashs64Fnv1}, testhashu64Fnv1: ${testhashu64Fnv1}, testhashs32Fnv1a: ${testhashs32Fnv1a}, testhashu32Fnv1a: ${testhashu32Fnv1a}, testhashs64Fnv1a: ${testhashs64Fnv1a}, testhashu64Fnv1a: ${testhashu64Fnv1a}, testarrayofbools: ${testarrayofbools}, testf: ${testf}, testf2: ${testf2}, testf3: ${testf3}, testarrayofstring2: ${testarrayofstring2}, testarrayofsortedstruct: ${testarrayofsortedstruct}, flex: ${flex}, test5: ${test5}, vectorOfLongs: ${vectorOfLongs}, vectorOfDoubles: ${vectorOfDoubles}, parentNamespaceTest: ${parentNamespaceTest}, vectorOfReferrables: ${vectorOfReferrables}, singleWeakReference: ${singleWeakReference}, vectorOfWeakReferences: ${vectorOfWeakReferences}, vectorOfStrongReferrables: ${vectorOfStrongReferrables}, coOwningReference: ${coOwningReference}, vectorOfCoOwningReferences: ${vectorOfCoOwningReferences}, nonOwningReference: ${nonOwningReference}, vectorOfNonOwningReferences: ${vectorOfNonOwningReferences}, anyUniqueType: ${anyUniqueType}, anyUnique: ${anyUnique}, anyAmbiguousType: ${anyAmbiguousType}, anyAmbiguous: ${anyAmbiguous}, vectorOfEnums: ${vectorOfEnums}, signedEnum: ${signedEnum}, testrequirednestedflatbuffer: ${testrequirednestedflatbuffer}, scalarKeySortedTables: ${scalarKeySortedTables}, nativeInline: ${nativeInline}, longEnumNonEnumDefault: ${longEnumNonEnumDefault}, longEnumNormalDefault: ${longEnumNormalDefault}}';
}
MonsterT unpack() => MonsterT(
@@ -1472,7 +1560,7 @@
@override
String toString() {
- return 'MonsterT{pos: $pos, mana: $mana, hp: $hp, name: $name, inventory: $inventory, color: $color, testType: $testType, test: $test, test4: $test4, testarrayofstring: $testarrayofstring, testarrayoftables: $testarrayoftables, enemy: $enemy, testnestedflatbuffer: $testnestedflatbuffer, testempty: $testempty, testbool: $testbool, testhashs32Fnv1: $testhashs32Fnv1, testhashu32Fnv1: $testhashu32Fnv1, testhashs64Fnv1: $testhashs64Fnv1, testhashu64Fnv1: $testhashu64Fnv1, testhashs32Fnv1a: $testhashs32Fnv1a, testhashu32Fnv1a: $testhashu32Fnv1a, testhashs64Fnv1a: $testhashs64Fnv1a, testhashu64Fnv1a: $testhashu64Fnv1a, testarrayofbools: $testarrayofbools, testf: $testf, testf2: $testf2, testf3: $testf3, testarrayofstring2: $testarrayofstring2, testarrayofsortedstruct: $testarrayofsortedstruct, flex: $flex, test5: $test5, vectorOfLongs: $vectorOfLongs, vectorOfDoubles: $vectorOfDoubles, parentNamespaceTest: $parentNamespaceTest, vectorOfReferrables: $vectorOfReferrables, singleWeakReference: $singleWeakReference, vectorOfWeakReferences: $vectorOfWeakReferences, vectorOfStrongReferrables: $vectorOfStrongReferrables, coOwningReference: $coOwningReference, vectorOfCoOwningReferences: $vectorOfCoOwningReferences, nonOwningReference: $nonOwningReference, vectorOfNonOwningReferences: $vectorOfNonOwningReferences, anyUniqueType: $anyUniqueType, anyUnique: $anyUnique, anyAmbiguousType: $anyAmbiguousType, anyAmbiguous: $anyAmbiguous, vectorOfEnums: $vectorOfEnums, signedEnum: $signedEnum, testrequirednestedflatbuffer: $testrequirednestedflatbuffer, scalarKeySortedTables: $scalarKeySortedTables, nativeInline: $nativeInline, longEnumNonEnumDefault: $longEnumNonEnumDefault, longEnumNormalDefault: $longEnumNormalDefault}';
+ return 'MonsterT{pos: ${pos}, mana: ${mana}, hp: ${hp}, name: ${name}, inventory: ${inventory}, color: ${color}, testType: ${testType}, test: ${test}, test4: ${test4}, testarrayofstring: ${testarrayofstring}, testarrayoftables: ${testarrayoftables}, enemy: ${enemy}, testnestedflatbuffer: ${testnestedflatbuffer}, testempty: ${testempty}, testbool: ${testbool}, testhashs32Fnv1: ${testhashs32Fnv1}, testhashu32Fnv1: ${testhashu32Fnv1}, testhashs64Fnv1: ${testhashs64Fnv1}, testhashu64Fnv1: ${testhashu64Fnv1}, testhashs32Fnv1a: ${testhashs32Fnv1a}, testhashu32Fnv1a: ${testhashu32Fnv1a}, testhashs64Fnv1a: ${testhashs64Fnv1a}, testhashu64Fnv1a: ${testhashu64Fnv1a}, testarrayofbools: ${testarrayofbools}, testf: ${testf}, testf2: ${testf2}, testf3: ${testf3}, testarrayofstring2: ${testarrayofstring2}, testarrayofsortedstruct: ${testarrayofsortedstruct}, flex: ${flex}, test5: ${test5}, vectorOfLongs: ${vectorOfLongs}, vectorOfDoubles: ${vectorOfDoubles}, parentNamespaceTest: ${parentNamespaceTest}, vectorOfReferrables: ${vectorOfReferrables}, singleWeakReference: ${singleWeakReference}, vectorOfWeakReferences: ${vectorOfWeakReferences}, vectorOfStrongReferrables: ${vectorOfStrongReferrables}, coOwningReference: ${coOwningReference}, vectorOfCoOwningReferences: ${vectorOfCoOwningReferences}, nonOwningReference: ${nonOwningReference}, vectorOfNonOwningReferences: ${vectorOfNonOwningReferences}, anyUniqueType: ${anyUniqueType}, anyUnique: ${anyUnique}, anyAmbiguousType: ${anyAmbiguousType}, anyAmbiguous: ${anyAmbiguous}, vectorOfEnums: ${vectorOfEnums}, signedEnum: ${signedEnum}, testrequirednestedflatbuffer: ${testrequirednestedflatbuffer}, scalarKeySortedTables: ${scalarKeySortedTables}, nativeInline: ${nativeInline}, longEnumNonEnumDefault: ${longEnumNonEnumDefault}, longEnumNormalDefault: ${longEnumNormalDefault}}';
}
}
@@ -2022,7 +2110,7 @@
@override
String toString() {
- return 'TypeAliases{i8: $i8, u8: $u8, i16: $i16, u16: $u16, i32: $i32, u32: $u32, i64: $i64, u64: $u64, f32: $f32, f64: $f64, v8: $v8, vf64: $vf64}';
+ return 'TypeAliases{i8: ${i8}, u8: ${u8}, i16: ${i16}, u16: ${u16}, i32: ${i32}, u32: ${u32}, i64: ${i64}, u64: ${u64}, f32: ${f32}, f64: ${f64}, v8: ${v8}, vf64: ${vf64}}';
}
TypeAliasesT unpack() => TypeAliasesT(
@@ -2097,7 +2185,7 @@
@override
String toString() {
- return 'TypeAliasesT{i8: $i8, u8: $u8, i16: $i16, u16: $u16, i32: $i32, u32: $u32, i64: $i64, u64: $u64, f32: $f32, f64: $f64, v8: $v8, vf64: $vf64}';
+ return 'TypeAliasesT{i8: ${i8}, u8: ${u8}, i16: ${i16}, u16: ${u16}, i32: ${i32}, u32: ${u32}, i64: ${i64}, u64: ${u64}, f32: ${f32}, f64: ${f64}, v8: ${v8}, vf64: ${vf64}}';
}
}
diff --git a/tests/monster_test_serialize/mod.rs b/tests/monster_test_serialize/mod.rs
index fdbc26b..7f1fab1 100644
--- a/tests/monster_test_serialize/mod.rs
+++ b/tests/monster_test_serialize/mod.rs
@@ -1,4 +1,5 @@
// Automatically generated by the Flatbuffers compiler. Do not modify.
+// @generated
pub mod my_game {
use super::*;
pub mod example {
@@ -25,6 +26,8 @@
pub use self::ability_generated::*;
mod struct_of_structs_generated;
pub use self::struct_of_structs_generated::*;
+ mod struct_of_structs_of_structs_generated;
+ pub use self::struct_of_structs_of_structs_generated::*;
mod stat_generated;
pub use self::stat_generated::*;
mod referrable_generated;
diff --git a/tests/monster_test_serialize/my_game/example/ability_generated.rs b/tests/monster_test_serialize/my_game/example/ability_generated.rs
index cdc7882..5c8bcf8 100644
--- a/tests/monster_test_serialize/my_game/example/ability_generated.rs
+++ b/tests/monster_test_serialize/my_game/example/ability_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -15,8 +20,8 @@
Self([0; 8])
}
}
-impl std::fmt::Debug for Ability {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for Ability {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ability")
.field("id", &self.id())
.field("distance", &self.distance())
@@ -45,7 +50,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(self as *const Ability as *const u8, Self::size())
+ ::core::slice::from_raw_parts(self as *const Ability as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -56,7 +61,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(*self as *const Ability as *const u8, Self::size())
+ ::core::slice::from_raw_parts(*self as *const Ability as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -129,7 +134,7 @@
}
#[inline]
- pub fn key_compare_with_value(&self, val: u32) -> ::std::cmp::Ordering {
+ pub fn key_compare_with_value(&self, val: u32) -> ::core::cmp::Ordering {
let key = self.id();
key.cmp(&val)
}
diff --git a/tests/monster_test_serialize/my_game/example/any_ambiguous_aliases_generated.rs b/tests/monster_test_serialize/my_game/example/any_ambiguous_aliases_generated.rs
index 2e757a8..b278ca1 100644
--- a/tests/monster_test_serialize/my_game/example/any_ambiguous_aliases_generated.rs
+++ b/tests/monster_test_serialize/my_game/example/any_ambiguous_aliases_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -48,8 +53,8 @@
}
}
}
-impl std::fmt::Debug for AnyAmbiguousAliases {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for AnyAmbiguousAliases {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -146,7 +151,7 @@
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m1(&mut self) -> Option<Box<MonsterT>> {
if let Self::M1(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::M1(w) = v {
Some(w)
} else {
@@ -167,7 +172,7 @@
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m2(&mut self) -> Option<Box<MonsterT>> {
if let Self::M2(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::M2(w) = v {
Some(w)
} else {
@@ -188,7 +193,7 @@
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m3(&mut self) -> Option<Box<MonsterT>> {
if let Self::M3(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::M3(w) = v {
Some(w)
} else {
diff --git a/tests/monster_test_serialize/my_game/example/any_generated.rs b/tests/monster_test_serialize/my_game/example/any_generated.rs
index d572642..f67392d 100644
--- a/tests/monster_test_serialize/my_game/example/any_generated.rs
+++ b/tests/monster_test_serialize/my_game/example/any_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -48,8 +53,8 @@
}
}
}
-impl std::fmt::Debug for Any {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for Any {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -146,7 +151,7 @@
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_monster(&mut self) -> Option<Box<MonsterT>> {
if let Self::Monster(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::Monster(w) = v {
Some(w)
} else {
@@ -167,7 +172,7 @@
/// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
pub fn take_test_simple_table_with_enum(&mut self) -> Option<Box<TestSimpleTableWithEnumT>> {
if let Self::TestSimpleTableWithEnum(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::TestSimpleTableWithEnum(w) = v {
Some(w)
} else {
@@ -188,7 +193,7 @@
/// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
pub fn take_my_game_example_2_monster(&mut self) -> Option<Box<super::example_2::MonsterT>> {
if let Self::MyGameExample2Monster(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::MyGameExample2Monster(w) = v {
Some(w)
} else {
diff --git a/tests/monster_test_serialize/my_game/example/any_unique_aliases_generated.rs b/tests/monster_test_serialize/my_game/example/any_unique_aliases_generated.rs
index 8a3fa66..1b3d091 100644
--- a/tests/monster_test_serialize/my_game/example/any_unique_aliases_generated.rs
+++ b/tests/monster_test_serialize/my_game/example/any_unique_aliases_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -48,8 +53,8 @@
}
}
}
-impl std::fmt::Debug for AnyUniqueAliases {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for AnyUniqueAliases {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -146,7 +151,7 @@
/// If the union variant matches, return the owned MonsterT, setting the union to NONE.
pub fn take_m(&mut self) -> Option<Box<MonsterT>> {
if let Self::M(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::M(w) = v {
Some(w)
} else {
@@ -167,7 +172,7 @@
/// If the union variant matches, return the owned TestSimpleTableWithEnumT, setting the union to NONE.
pub fn take_ts(&mut self) -> Option<Box<TestSimpleTableWithEnumT>> {
if let Self::TS(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::TS(w) = v {
Some(w)
} else {
@@ -188,7 +193,7 @@
/// If the union variant matches, return the owned super::example_2::MonsterT, setting the union to NONE.
pub fn take_m2(&mut self) -> Option<Box<super::example_2::MonsterT>> {
if let Self::M2(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::M2(w) = v {
Some(w)
} else {
diff --git a/tests/monster_test_serialize/my_game/example/color_generated.rs b/tests/monster_test_serialize/my_game/example/color_generated.rs
index e27f79c..e001d43 100644
--- a/tests/monster_test_serialize/my_game/example/color_generated.rs
+++ b/tests/monster_test_serialize/my_game/example/color_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
diff --git a/tests/monster_test_serialize/my_game/example/long_enum_generated.rs b/tests/monster_test_serialize/my_game/example/long_enum_generated.rs
index f513d29..b29b97f 100644
--- a/tests/monster_test_serialize/my_game/example/long_enum_generated.rs
+++ b/tests/monster_test_serialize/my_game/example/long_enum_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
diff --git a/tests/monster_test_serialize/my_game/example/monster_generated.rs b/tests/monster_test_serialize/my_game/example/monster_generated.rs
index cd5730f..7aa3ec7 100644
--- a/tests/monster_test_serialize/my_game/example/monster_generated.rs
+++ b/tests/monster_test_serialize/my_game/example/monster_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -381,7 +386,7 @@
}
#[inline]
- pub fn key_compare_with_value(&self, val: & str) -> ::std::cmp::Ordering {
+ pub fn key_compare_with_value(&self, val: & str) -> ::core::cmp::Ordering {
let key = self.name();
key.cmp(val)
}
@@ -1335,8 +1340,8 @@
}
}
-impl std::fmt::Debug for Monster<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for Monster<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Monster");
ds.field("pos", &self.pos());
ds.field("mana", &self.mana());
diff --git a/tests/monster_test_serialize/my_game/example/race_generated.rs b/tests/monster_test_serialize/my_game/example/race_generated.rs
index 63754ff..a1a6749 100644
--- a/tests/monster_test_serialize/my_game/example/race_generated.rs
+++ b/tests/monster_test_serialize/my_game/example/race_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -48,8 +53,8 @@
}
}
}
-impl std::fmt::Debug for Race {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for Race {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
diff --git a/tests/monster_test_serialize/my_game/example/referrable_generated.rs b/tests/monster_test_serialize/my_game/example/referrable_generated.rs
index 490980d..9992293 100644
--- a/tests/monster_test_serialize/my_game/example/referrable_generated.rs
+++ b/tests/monster_test_serialize/my_game/example/referrable_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -59,7 +64,7 @@
}
#[inline]
- pub fn key_compare_with_value(&self, val: u64) -> ::std::cmp::Ordering {
+ pub fn key_compare_with_value(&self, val: u64) -> ::core::cmp::Ordering {
let key = self.id();
key.cmp(&val)
}
@@ -124,8 +129,8 @@
}
}
-impl std::fmt::Debug for Referrable<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for Referrable<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Referrable");
ds.field("id", &self.id());
ds.finish()
diff --git a/tests/monster_test_serialize/my_game/example/stat_generated.rs b/tests/monster_test_serialize/my_game/example/stat_generated.rs
index abfa05d..fbd7ce8 100644
--- a/tests/monster_test_serialize/my_game/example/stat_generated.rs
+++ b/tests/monster_test_serialize/my_game/example/stat_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -77,7 +82,7 @@
}
#[inline]
- pub fn key_compare_with_value(&self, val: u16) -> ::std::cmp::Ordering {
+ pub fn key_compare_with_value(&self, val: u16) -> ::core::cmp::Ordering {
let key = self.count();
key.cmp(&val)
}
@@ -162,8 +167,8 @@
}
}
-impl std::fmt::Debug for Stat<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for Stat<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Stat");
ds.field("id", &self.id());
ds.field("val", &self.val());
diff --git a/tests/monster_test_serialize/my_game/example/struct_of_structs_generated.rs b/tests/monster_test_serialize/my_game/example/struct_of_structs_generated.rs
index 75b8865..0046447 100644
--- a/tests/monster_test_serialize/my_game/example/struct_of_structs_generated.rs
+++ b/tests/monster_test_serialize/my_game/example/struct_of_structs_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -15,8 +20,8 @@
Self([0; 20])
}
}
-impl std::fmt::Debug for StructOfStructs {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for StructOfStructs {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("StructOfStructs")
.field("a", &self.a())
.field("b", &self.b())
@@ -46,7 +51,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(self as *const StructOfStructs as *const u8, Self::size())
+ ::core::slice::from_raw_parts(self as *const StructOfStructs as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -57,7 +62,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(*self as *const StructOfStructs as *const u8, Self::size())
+ ::core::slice::from_raw_parts(*self as *const StructOfStructs as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
diff --git a/tests/monster_test_serialize/my_game/example/struct_of_structs_of_structs_generated.rs b/tests/monster_test_serialize/my_game/example/struct_of_structs_of_structs_generated.rs
new file mode 100644
index 0000000..234eb91
--- /dev/null
+++ b/tests/monster_test_serialize/my_game/example/struct_of_structs_of_structs_generated.rs
@@ -0,0 +1,131 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
+extern crate flatbuffers;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
+extern crate serde;
+use self::serde::ser::{Serialize, Serializer, SerializeStruct};
+use self::flatbuffers::{EndianScalar, Follow};
+use super::*;
+// struct StructOfStructsOfStructs, aligned to 4
+#[repr(transparent)]
+#[derive(Clone, Copy, PartialEq)]
+pub struct StructOfStructsOfStructs(pub [u8; 20]);
+impl Default for StructOfStructsOfStructs {
+ fn default() -> Self {
+ Self([0; 20])
+ }
+}
+impl core::fmt::Debug for StructOfStructsOfStructs {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
+ f.debug_struct("StructOfStructsOfStructs")
+ .field("a", &self.a())
+ .finish()
+ }
+}
+
+impl flatbuffers::SimpleToVerifyInSlice for StructOfStructsOfStructs {}
+impl flatbuffers::SafeSliceAccess for StructOfStructsOfStructs {}
+impl<'a> flatbuffers::Follow<'a> for StructOfStructsOfStructs {
+ type Inner = &'a StructOfStructsOfStructs;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ <&'a StructOfStructsOfStructs>::follow(buf, loc)
+ }
+}
+impl<'a> flatbuffers::Follow<'a> for &'a StructOfStructsOfStructs {
+ type Inner = &'a StructOfStructsOfStructs;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ flatbuffers::follow_cast_ref::<StructOfStructsOfStructs>(buf, loc)
+ }
+}
+impl<'b> flatbuffers::Push for StructOfStructsOfStructs {
+ type Output = StructOfStructsOfStructs;
+ #[inline]
+ fn push(&self, dst: &mut [u8], _rest: &[u8]) {
+ let src = unsafe {
+ ::core::slice::from_raw_parts(self as *const StructOfStructsOfStructs as *const u8, Self::size())
+ };
+ dst.copy_from_slice(src);
+ }
+}
+impl<'b> flatbuffers::Push for &'b StructOfStructsOfStructs {
+ type Output = StructOfStructsOfStructs;
+
+ #[inline]
+ fn push(&self, dst: &mut [u8], _rest: &[u8]) {
+ let src = unsafe {
+ ::core::slice::from_raw_parts(*self as *const StructOfStructsOfStructs as *const u8, Self::size())
+ };
+ dst.copy_from_slice(src);
+ }
+}
+
+impl<'a> flatbuffers::Verifiable for StructOfStructsOfStructs {
+ #[inline]
+ fn run_verifier(
+ v: &mut flatbuffers::Verifier, pos: usize
+ ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
+ use self::flatbuffers::Verifiable;
+ v.in_buffer::<Self>(pos)
+ }
+}
+
+impl Serialize for StructOfStructsOfStructs {
+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
+ where
+ S: Serializer,
+ {
+ let mut s = serializer.serialize_struct("StructOfStructsOfStructs", 1)?;
+ s.serialize_field("a", &self.a())?;
+ s.end()
+ }
+}
+
+impl<'a> StructOfStructsOfStructs {
+ #[allow(clippy::too_many_arguments)]
+ pub fn new(
+ a: &StructOfStructs,
+ ) -> Self {
+ let mut s = Self([0; 20]);
+ s.set_a(a);
+ s
+ }
+
+ pub const fn get_fully_qualified_name() -> &'static str {
+ "MyGame.Example.StructOfStructsOfStructs"
+ }
+
+ pub fn a(&self) -> &StructOfStructs {
+ unsafe { &*(self.0[0..].as_ptr() as *const StructOfStructs) }
+ }
+
+ #[allow(clippy::identity_op)]
+ pub fn set_a(&mut self, x: &StructOfStructs) {
+ self.0[0..0 + 20].copy_from_slice(&x.0)
+ }
+
+ pub fn unpack(&self) -> StructOfStructsOfStructsT {
+ StructOfStructsOfStructsT {
+ a: self.a().unpack(),
+ }
+ }
+}
+
+#[derive(Debug, Clone, PartialEq, Default)]
+pub struct StructOfStructsOfStructsT {
+ pub a: StructOfStructsT,
+}
+impl StructOfStructsOfStructsT {
+ pub fn pack(&self) -> StructOfStructsOfStructs {
+ StructOfStructsOfStructs::new(
+ &self.a.pack(),
+ )
+ }
+}
+
diff --git a/tests/monster_test_serialize/my_game/example/test_generated.rs b/tests/monster_test_serialize/my_game/example/test_generated.rs
index 56493ba..472bff9 100644
--- a/tests/monster_test_serialize/my_game/example/test_generated.rs
+++ b/tests/monster_test_serialize/my_game/example/test_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -15,8 +20,8 @@
Self([0; 4])
}
}
-impl std::fmt::Debug for Test {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for Test {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Test")
.field("a", &self.a())
.field("b", &self.b())
@@ -45,7 +50,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(self as *const Test as *const u8, Self::size())
+ ::core::slice::from_raw_parts(self as *const Test as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -56,7 +61,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(*self as *const Test as *const u8, Self::size())
+ ::core::slice::from_raw_parts(*self as *const Test as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
diff --git a/tests/monster_test_serialize/my_game/example/test_simple_table_with_enum_generated.rs b/tests/monster_test_serialize/my_game/example/test_simple_table_with_enum_generated.rs
index cd64311..8a7b627 100644
--- a/tests/monster_test_serialize/my_game/example/test_simple_table_with_enum_generated.rs
+++ b/tests/monster_test_serialize/my_game/example/test_simple_table_with_enum_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -114,8 +119,8 @@
}
}
-impl std::fmt::Debug for TestSimpleTableWithEnum<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for TestSimpleTableWithEnum<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TestSimpleTableWithEnum");
ds.field("color", &self.color());
ds.finish()
diff --git a/tests/monster_test_serialize/my_game/example/type_aliases_generated.rs b/tests/monster_test_serialize/my_game/example/type_aliases_generated.rs
index 44d1198..f6f7bb7 100644
--- a/tests/monster_test_serialize/my_game/example/type_aliases_generated.rs
+++ b/tests/monster_test_serialize/my_game/example/type_aliases_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -302,8 +307,8 @@
}
}
-impl std::fmt::Debug for TypeAliases<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for TypeAliases<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TypeAliases");
ds.field("i8_", &self.i8_());
ds.field("u8_", &self.u8_());
diff --git a/tests/monster_test_serialize/my_game/example/vec_3_generated.rs b/tests/monster_test_serialize/my_game/example/vec_3_generated.rs
index f04d0e8..ebbe94c 100644
--- a/tests/monster_test_serialize/my_game/example/vec_3_generated.rs
+++ b/tests/monster_test_serialize/my_game/example/vec_3_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -15,8 +20,8 @@
Self([0; 32])
}
}
-impl std::fmt::Debug for Vec3 {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for Vec3 {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Vec3")
.field("x", &self.x())
.field("y", &self.y())
@@ -49,7 +54,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(self as *const Vec3 as *const u8, Self::size())
+ ::core::slice::from_raw_parts(self as *const Vec3 as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -60,7 +65,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(*self as *const Vec3 as *const u8, Self::size())
+ ::core::slice::from_raw_parts(*self as *const Vec3 as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
diff --git a/tests/monster_test_serialize/my_game/example_2/monster_generated.rs b/tests/monster_test_serialize/my_game/example_2/monster_generated.rs
index 7687c5e..9422b57 100644
--- a/tests/monster_test_serialize/my_game/example_2/monster_generated.rs
+++ b/tests/monster_test_serialize/my_game/example_2/monster_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -97,8 +102,8 @@
}
}
-impl std::fmt::Debug for Monster<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for Monster<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Monster");
ds.finish()
}
diff --git a/tests/monster_test_serialize/my_game/in_parent_namespace_generated.rs b/tests/monster_test_serialize/my_game/in_parent_namespace_generated.rs
index b2b0a09..71ceaa0 100644
--- a/tests/monster_test_serialize/my_game/in_parent_namespace_generated.rs
+++ b/tests/monster_test_serialize/my_game/in_parent_namespace_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -97,8 +102,8 @@
}
}
-impl std::fmt::Debug for InParentNamespace<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for InParentNamespace<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("InParentNamespace");
ds.finish()
}
diff --git a/tests/monster_test_serialize/my_game/other_name_space/from_include_generated.rs b/tests/monster_test_serialize/my_game/other_name_space/from_include_generated.rs
index 06a0fa8..de5e5e2 100644
--- a/tests/monster_test_serialize/my_game/other_name_space/from_include_generated.rs
+++ b/tests/monster_test_serialize/my_game/other_name_space/from_include_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -36,8 +41,8 @@
}
}
}
-impl std::fmt::Debug for FromInclude {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for FromInclude {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
diff --git a/tests/monster_test_serialize/my_game/other_name_space/table_b_generated.rs b/tests/monster_test_serialize/my_game/other_name_space/table_b_generated.rs
index f09e175..e593299 100644
--- a/tests/monster_test_serialize/my_game/other_name_space/table_b_generated.rs
+++ b/tests/monster_test_serialize/my_game/other_name_space/table_b_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -120,8 +125,8 @@
}
}
-impl std::fmt::Debug for TableB<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for TableB<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TableB");
ds.field("a", &self.a());
ds.finish()
diff --git a/tests/monster_test_serialize/my_game/other_name_space/unused_generated.rs b/tests/monster_test_serialize/my_game/other_name_space/unused_generated.rs
index 7b91447..2991781 100644
--- a/tests/monster_test_serialize/my_game/other_name_space/unused_generated.rs
+++ b/tests/monster_test_serialize/my_game/other_name_space/unused_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -15,8 +20,8 @@
Self([0; 4])
}
}
-impl std::fmt::Debug for Unused {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for Unused {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Unused")
.field("a", &self.a())
.finish()
@@ -44,7 +49,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(self as *const Unused as *const u8, Self::size())
+ ::core::slice::from_raw_parts(self as *const Unused as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -55,7 +60,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(*self as *const Unused as *const u8, Self::size())
+ ::core::slice::from_raw_parts(*self as *const Unused as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
diff --git a/tests/monster_test_serialize/table_a_generated.rs b/tests/monster_test_serialize/table_a_generated.rs
index eb03f49..c4bbd69 100644
--- a/tests/monster_test_serialize/table_a_generated.rs
+++ b/tests/monster_test_serialize/table_a_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
extern crate serde;
use self::serde::ser::{Serialize, Serializer, SerializeStruct};
use self::flatbuffers::{EndianScalar, Follow};
@@ -120,8 +125,8 @@
}
}
-impl std::fmt::Debug for TableA<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for TableA<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TableA");
ds.field("b", &self.b());
ds.finish()
diff --git a/tests/monster_test_suffix/ext_only/monster_test.grpc.fb.cc b/tests/monster_test_suffix/ext_only/monster_test.grpc.fb.cc
new file mode 100644
index 0000000..3cc72ed
--- /dev/null
+++ b/tests/monster_test_suffix/ext_only/monster_test.grpc.fb.cc
@@ -0,0 +1,131 @@
+// Generated by the gRPC C++ plugin.
+// If you make any local change, they will be lost.
+// source: monster_test
+
+#include "monster_test_generated.hpp"
+#include "monster_test.grpc.fb.h"
+
+#include <grpcpp/impl/codegen/async_stream.h>
+#include <grpcpp/impl/codegen/async_unary_call.h>
+#include <grpcpp/impl/codegen/channel_interface.h>
+#include <grpcpp/impl/codegen/client_unary_call.h>
+#include <grpcpp/impl/codegen/method_handler.h>
+#include <grpcpp/impl/codegen/rpc_service_method.h>
+#include <grpcpp/impl/codegen/service_type.h>
+#include <grpcpp/impl/codegen/sync_stream.h>
+namespace MyGame {
+namespace Example {
+
+static const char* MonsterStorage_method_names[] = {
+ "/MyGame.Example.MonsterStorage/Store",
+ "/MyGame.Example.MonsterStorage/Retrieve",
+ "/MyGame.Example.MonsterStorage/GetMaxHitPoint",
+ "/MyGame.Example.MonsterStorage/GetMinMaxHitPoints",
+};
+
+std::unique_ptr< MonsterStorage::Stub> MonsterStorage::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& /*options*/) {
+ std::unique_ptr< MonsterStorage::Stub> stub(new MonsterStorage::Stub(channel));
+ return stub;
+}
+
+MonsterStorage::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel)
+ : channel_(channel) , rpcmethod_Store_(MonsterStorage_method_names[0], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
+ , rpcmethod_Retrieve_(MonsterStorage_method_names[1], ::grpc::internal::RpcMethod::SERVER_STREAMING, channel)
+ , rpcmethod_GetMaxHitPoint_(MonsterStorage_method_names[2], ::grpc::internal::RpcMethod::CLIENT_STREAMING, channel)
+ , rpcmethod_GetMinMaxHitPoints_(MonsterStorage_method_names[3], ::grpc::internal::RpcMethod::BIDI_STREAMING, channel)
+ {}
+
+::grpc::Status MonsterStorage::Stub::Store(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, flatbuffers::grpc::Message<Stat>* response) {
+ return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_Store_, context, request, response);
+}
+
+::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::AsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return ::grpc::internal::ClientAsyncResponseReaderFactory< flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), cq, rpcmethod_Store_, context, request, true);
+}
+
+::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::PrepareAsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return ::grpc::internal::ClientAsyncResponseReaderFactory< flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), cq, rpcmethod_Store_, context, request, false);
+}
+
+::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::RetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) {
+ return ::grpc::internal::ClientReaderFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), rpcmethod_Retrieve_, context, request);
+}
+
+::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::AsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) {
+ return ::grpc::internal::ClientAsyncReaderFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), cq, rpcmethod_Retrieve_, context, request, true, tag);
+}
+
+::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::PrepareAsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) {
+ return ::grpc::internal::ClientAsyncReaderFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), cq, rpcmethod_Retrieve_, context, request, false, nullptr);
+}
+
+::grpc::ClientWriter< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::GetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response) {
+ return ::grpc::internal::ClientWriterFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), rpcmethod_GetMaxHitPoint_, context, response);
+}
+
+::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::AsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq, void* tag) {
+ return ::grpc::internal::ClientAsyncWriterFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), cq, rpcmethod_GetMaxHitPoint_, context, response, true, tag);
+}
+
+::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::PrepareAsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq) {
+ return ::grpc::internal::ClientAsyncWriterFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), cq, rpcmethod_GetMaxHitPoint_, context, response, false, nullptr);
+}
+
+::grpc::ClientReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::GetMinMaxHitPointsRaw(::grpc::ClientContext* context) {
+ return ::grpc::internal::ClientReaderWriterFactory< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), rpcmethod_GetMinMaxHitPoints_, context);
+}
+
+::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::AsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) {
+ return ::grpc::internal::ClientAsyncReaderWriterFactory< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), cq, rpcmethod_GetMinMaxHitPoints_, context, true, tag);
+}
+
+::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::PrepareAsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) {
+ return ::grpc::internal::ClientAsyncReaderWriterFactory< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), cq, rpcmethod_GetMinMaxHitPoints_, context, false, nullptr);
+}
+
+MonsterStorage::Service::Service() {
+ AddMethod(new ::grpc::internal::RpcServiceMethod(
+ MonsterStorage_method_names[0],
+ ::grpc::internal::RpcMethod::NORMAL_RPC,
+ new ::grpc::internal::RpcMethodHandler< MonsterStorage::Service, flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>(
+ std::mem_fn(&MonsterStorage::Service::Store), this)));
+ AddMethod(new ::grpc::internal::RpcServiceMethod(
+ MonsterStorage_method_names[1],
+ ::grpc::internal::RpcMethod::SERVER_STREAMING,
+ new ::grpc::internal::ServerStreamingHandler< MonsterStorage::Service, flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>(
+ std::mem_fn(&MonsterStorage::Service::Retrieve), this)));
+ AddMethod(new ::grpc::internal::RpcServiceMethod(
+ MonsterStorage_method_names[2],
+ ::grpc::internal::RpcMethod::CLIENT_STREAMING,
+ new ::grpc::internal::ClientStreamingHandler< MonsterStorage::Service, flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>(
+ std::mem_fn(&MonsterStorage::Service::GetMaxHitPoint), this)));
+ AddMethod(new ::grpc::internal::RpcServiceMethod(
+ MonsterStorage_method_names[3],
+ ::grpc::internal::RpcMethod::BIDI_STREAMING,
+ new ::grpc::internal::BidiStreamingHandler< MonsterStorage::Service, flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>(
+ std::mem_fn(&MonsterStorage::Service::GetMinMaxHitPoints), this)));
+}
+
+MonsterStorage::Service::~Service() {
+}
+
+::grpc::Status MonsterStorage::Service::Store(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Monster>* /*request*/, flatbuffers::grpc::Message<Stat>* /*response*/) {
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+}
+
+::grpc::Status MonsterStorage::Service::Retrieve(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Stat>* /*request*/, ::grpc::ServerWriter< flatbuffers::grpc::Message<Monster>>* /*writer*/) {
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+}
+
+::grpc::Status MonsterStorage::Service::GetMaxHitPoint(::grpc::ServerContext* /*context*/, ::grpc::ServerReader< flatbuffers::grpc::Message<Monster>>* /*reader*/, flatbuffers::grpc::Message<Stat>* /*response*/) {
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+}
+
+::grpc::Status MonsterStorage::Service::GetMinMaxHitPoints(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* /*stream*/) {
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+}
+
+
+} // namespace MyGame
+} // namespace Example
+
diff --git a/tests/monster_test_suffix/ext_only/monster_test.grpc.fb.h b/tests/monster_test_suffix/ext_only/monster_test.grpc.fb.h
new file mode 100644
index 0000000..530504e
--- /dev/null
+++ b/tests/monster_test_suffix/ext_only/monster_test.grpc.fb.h
@@ -0,0 +1,350 @@
+// Generated by the gRPC C++ plugin.
+// If you make any local change, they will be lost.
+// source: monster_test
+#ifndef GRPC_monster_5ftest__INCLUDED
+#define GRPC_monster_5ftest__INCLUDED
+
+#include "monster_test_generated.hpp"
+#include "flatbuffers/grpc.h"
+
+#include <grpcpp/impl/codegen/async_stream.h>
+#include <grpcpp/impl/codegen/async_unary_call.h>
+#include <grpcpp/impl/codegen/method_handler.h>
+#include <grpcpp/impl/codegen/proto_utils.h>
+#include <grpcpp/impl/codegen/rpc_method.h>
+#include <grpcpp/impl/codegen/service_type.h>
+#include <grpcpp/impl/codegen/status.h>
+#include <grpcpp/impl/codegen/stub_options.h>
+#include <grpcpp/impl/codegen/sync_stream.h>
+
+namespace grpc {
+class CompletionQueue;
+class Channel;
+class ServerCompletionQueue;
+class ServerContext;
+} // namespace grpc
+
+namespace MyGame {
+namespace Example {
+
+class MonsterStorage final {
+ public:
+ static constexpr char const* service_full_name() {
+ return "MyGame.Example.MonsterStorage";
+ }
+ class StubInterface {
+ public:
+ virtual ~StubInterface() {}
+ virtual ::grpc::Status Store(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, flatbuffers::grpc::Message<Stat>* response) = 0;
+ std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>> AsyncStore(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>>(AsyncStoreRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>> PrepareAsyncStore(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>>(PrepareAsyncStoreRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientReaderInterface< flatbuffers::grpc::Message<Monster>>> Retrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) {
+ return std::unique_ptr< ::grpc::ClientReaderInterface< flatbuffers::grpc::Message<Monster>>>(RetrieveRaw(context, request));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>> AsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>>(AsyncRetrieveRaw(context, request, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>> PrepareAsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>>(PrepareAsyncRetrieveRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientWriterInterface< flatbuffers::grpc::Message<Monster>>> GetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response) {
+ return std::unique_ptr< ::grpc::ClientWriterInterface< flatbuffers::grpc::Message<Monster>>>(GetMaxHitPointRaw(context, response));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>> AsyncGetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>>(AsyncGetMaxHitPointRaw(context, response, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>> PrepareAsyncGetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>>(PrepareAsyncGetMaxHitPointRaw(context, response, cq));
+ }
+ std::unique_ptr< ::grpc::ClientReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> GetMinMaxHitPoints(::grpc::ClientContext* context) {
+ return std::unique_ptr< ::grpc::ClientReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(GetMinMaxHitPointsRaw(context));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> AsyncGetMinMaxHitPoints(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(AsyncGetMinMaxHitPointsRaw(context, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> PrepareAsyncGetMinMaxHitPoints(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(PrepareAsyncGetMinMaxHitPointsRaw(context, cq));
+ }
+ private:
+ virtual ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>* AsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>* PrepareAsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientReaderInterface< flatbuffers::grpc::Message<Monster>>* RetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) = 0;
+ virtual ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>* AsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) = 0;
+ virtual ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>* PrepareAsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientWriterInterface< flatbuffers::grpc::Message<Monster>>* GetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response) = 0;
+ virtual ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>* AsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq, void* tag) = 0;
+ virtual ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>* PrepareAsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* GetMinMaxHitPointsRaw(::grpc::ClientContext* context) = 0;
+ virtual ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* AsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) = 0;
+ virtual ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* PrepareAsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) = 0;
+ };
+ class Stub final : public StubInterface {
+ public:
+ Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);
+ ::grpc::Status Store(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, flatbuffers::grpc::Message<Stat>* response) override;
+ std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>> AsyncStore(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>>(AsyncStoreRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>> PrepareAsyncStore(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>>(PrepareAsyncStoreRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>> Retrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) {
+ return std::unique_ptr< ::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>>(RetrieveRaw(context, request));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>> AsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>>(AsyncRetrieveRaw(context, request, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>> PrepareAsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>>(PrepareAsyncRetrieveRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientWriter< flatbuffers::grpc::Message<Monster>>> GetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response) {
+ return std::unique_ptr< ::grpc::ClientWriter< flatbuffers::grpc::Message<Monster>>>(GetMaxHitPointRaw(context, response));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>> AsyncGetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>>(AsyncGetMaxHitPointRaw(context, response, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>> PrepareAsyncGetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>>(PrepareAsyncGetMaxHitPointRaw(context, response, cq));
+ }
+ std::unique_ptr< ::grpc::ClientReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> GetMinMaxHitPoints(::grpc::ClientContext* context) {
+ return std::unique_ptr< ::grpc::ClientReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(GetMinMaxHitPointsRaw(context));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> AsyncGetMinMaxHitPoints(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(AsyncGetMinMaxHitPointsRaw(context, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> PrepareAsyncGetMinMaxHitPoints(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(PrepareAsyncGetMinMaxHitPointsRaw(context, cq));
+ }
+
+ private:
+ std::shared_ptr< ::grpc::ChannelInterface> channel_;
+ ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>* AsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>* PrepareAsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>* RetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) override;
+ ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>* AsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) override;
+ ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>* PrepareAsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientWriter< flatbuffers::grpc::Message<Monster>>* GetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response) override;
+ ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>* AsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq, void* tag) override;
+ ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>* PrepareAsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* GetMinMaxHitPointsRaw(::grpc::ClientContext* context) override;
+ ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* AsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) override;
+ ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* PrepareAsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) override;
+ const ::grpc::internal::RpcMethod rpcmethod_Store_;
+ const ::grpc::internal::RpcMethod rpcmethod_Retrieve_;
+ const ::grpc::internal::RpcMethod rpcmethod_GetMaxHitPoint_;
+ const ::grpc::internal::RpcMethod rpcmethod_GetMinMaxHitPoints_;
+ };
+ static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
+
+ class Service : public ::grpc::Service {
+ public:
+ Service();
+ virtual ~Service();
+ virtual ::grpc::Status Store(::grpc::ServerContext* context, const flatbuffers::grpc::Message<Monster>* request, flatbuffers::grpc::Message<Stat>* response);
+ virtual ::grpc::Status Retrieve(::grpc::ServerContext* context, const flatbuffers::grpc::Message<Stat>* request, ::grpc::ServerWriter< flatbuffers::grpc::Message<Monster>>* writer);
+ virtual ::grpc::Status GetMaxHitPoint(::grpc::ServerContext* context, ::grpc::ServerReader< flatbuffers::grpc::Message<Monster>>* reader, flatbuffers::grpc::Message<Stat>* response);
+ virtual ::grpc::Status GetMinMaxHitPoints(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* stream);
+ };
+ template <class BaseClass>
+ class WithAsyncMethod_Store : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithAsyncMethod_Store() {
+ ::grpc::Service::MarkMethodAsync(0);
+ }
+ ~WithAsyncMethod_Store() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status Store(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Monster>* /*request*/, flatbuffers::grpc::Message<Stat>* /*response*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestStore(::grpc::ServerContext* context, flatbuffers::grpc::Message<Monster>* request, ::grpc::ServerAsyncResponseWriter< flatbuffers::grpc::Message<Stat>>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+ ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag);
+ }
+ };
+ template <class BaseClass>
+ class WithAsyncMethod_Retrieve : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithAsyncMethod_Retrieve() {
+ ::grpc::Service::MarkMethodAsync(1);
+ }
+ ~WithAsyncMethod_Retrieve() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status Retrieve(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Stat>* /*request*/, ::grpc::ServerWriter< flatbuffers::grpc::Message<Monster>>* /*writer*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestRetrieve(::grpc::ServerContext* context, flatbuffers::grpc::Message<Stat>* request, ::grpc::ServerAsyncWriter< flatbuffers::grpc::Message<Monster>>* writer, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+ ::grpc::Service::RequestAsyncServerStreaming(1, context, request, writer, new_call_cq, notification_cq, tag);
+ }
+ };
+ template <class BaseClass>
+ class WithAsyncMethod_GetMaxHitPoint : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithAsyncMethod_GetMaxHitPoint() {
+ ::grpc::Service::MarkMethodAsync(2);
+ }
+ ~WithAsyncMethod_GetMaxHitPoint() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status GetMaxHitPoint(::grpc::ServerContext* /*context*/, ::grpc::ServerReader< flatbuffers::grpc::Message<Monster>>* /*reader*/, flatbuffers::grpc::Message<Stat>* /*response*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestGetMaxHitPoint(::grpc::ServerContext* context, ::grpc::ServerAsyncReader< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* reader, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+ ::grpc::Service::RequestAsyncClientStreaming(2, context, reader, new_call_cq, notification_cq, tag);
+ }
+ };
+ template <class BaseClass>
+ class WithAsyncMethod_GetMinMaxHitPoints : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithAsyncMethod_GetMinMaxHitPoints() {
+ ::grpc::Service::MarkMethodAsync(3);
+ }
+ ~WithAsyncMethod_GetMinMaxHitPoints() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status GetMinMaxHitPoints(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* /*stream*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestGetMinMaxHitPoints(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+ ::grpc::Service::RequestAsyncBidiStreaming(3, context, stream, new_call_cq, notification_cq, tag);
+ }
+ };
+ typedef WithAsyncMethod_Store< WithAsyncMethod_Retrieve< WithAsyncMethod_GetMaxHitPoint< WithAsyncMethod_GetMinMaxHitPoints< Service > > > > AsyncService;
+ template <class BaseClass>
+ class WithGenericMethod_Store : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithGenericMethod_Store() {
+ ::grpc::Service::MarkMethodGeneric(0);
+ }
+ ~WithGenericMethod_Store() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status Store(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Monster>* /*request*/, flatbuffers::grpc::Message<Stat>* /*response*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ };
+ template <class BaseClass>
+ class WithGenericMethod_Retrieve : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithGenericMethod_Retrieve() {
+ ::grpc::Service::MarkMethodGeneric(1);
+ }
+ ~WithGenericMethod_Retrieve() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status Retrieve(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Stat>* /*request*/, ::grpc::ServerWriter< flatbuffers::grpc::Message<Monster>>* /*writer*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ };
+ template <class BaseClass>
+ class WithGenericMethod_GetMaxHitPoint : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithGenericMethod_GetMaxHitPoint() {
+ ::grpc::Service::MarkMethodGeneric(2);
+ }
+ ~WithGenericMethod_GetMaxHitPoint() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status GetMaxHitPoint(::grpc::ServerContext* /*context*/, ::grpc::ServerReader< flatbuffers::grpc::Message<Monster>>* /*reader*/, flatbuffers::grpc::Message<Stat>* /*response*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ };
+ template <class BaseClass>
+ class WithGenericMethod_GetMinMaxHitPoints : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithGenericMethod_GetMinMaxHitPoints() {
+ ::grpc::Service::MarkMethodGeneric(3);
+ }
+ ~WithGenericMethod_GetMinMaxHitPoints() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status GetMinMaxHitPoints(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* /*stream*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ };
+ template <class BaseClass>
+ class WithStreamedUnaryMethod_Store : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithStreamedUnaryMethod_Store() {
+ ::grpc::Service::MarkMethodStreamed(0,
+ new ::grpc::internal::StreamedUnaryHandler< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>(std::bind(&WithStreamedUnaryMethod_Store<BaseClass>::StreamedStore, this, std::placeholders::_1, std::placeholders::_2)));
+ }
+ ~WithStreamedUnaryMethod_Store() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable regular version of this method
+ ::grpc::Status Store(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Monster>* /*request*/, flatbuffers::grpc::Message<Stat>* /*response*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ // replace default version of method with streamed unary
+ virtual ::grpc::Status StreamedStore(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< flatbuffers::grpc::Message<Monster>,flatbuffers::grpc::Message<Stat>>* server_unary_streamer) = 0;
+ };
+ typedef WithStreamedUnaryMethod_Store< Service > StreamedUnaryService;
+ template <class BaseClass>
+ class WithSplitStreamingMethod_Retrieve : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) { }
+ public:
+ WithSplitStreamingMethod_Retrieve() {
+ ::grpc::Service::MarkMethodStreamed(1,
+ new ::grpc::internal::SplitServerStreamingHandler< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>(std::bind(&WithSplitStreamingMethod_Retrieve<BaseClass>::StreamedRetrieve, this, std::placeholders::_1, std::placeholders::_2)));
+ }
+ ~WithSplitStreamingMethod_Retrieve() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable regular version of this method
+ ::grpc::Status Retrieve(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Stat>* /*request*/, ::grpc::ServerWriter< flatbuffers::grpc::Message<Monster>>* /*writer*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ // replace default version of method with split streamed
+ virtual ::grpc::Status StreamedRetrieve(::grpc::ServerContext* context, ::grpc::ServerSplitStreamer< flatbuffers::grpc::Message<Stat>,flatbuffers::grpc::Message<Monster>>* server_split_streamer) = 0;
+ };
+ typedef WithSplitStreamingMethod_Retrieve< Service > SplitStreamedService;
+ typedef WithStreamedUnaryMethod_Store< WithSplitStreamingMethod_Retrieve< Service > > StreamedService;
+};
+
+} // namespace Example
+} // namespace MyGame
+
+
+#endif // GRPC_monster_5ftest__INCLUDED
diff --git a/tests/monster_test_suffix/ext_only/monster_test_generated.hpp b/tests/monster_test_suffix/ext_only/monster_test_generated.hpp
new file mode 100644
index 0000000..deab77b
--- /dev/null
+++ b/tests/monster_test_suffix/ext_only/monster_test_generated.hpp
@@ -0,0 +1,4034 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+
+#ifndef FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_H_
+#define FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_H_
+
+#include "flatbuffers/flatbuffers.h"
+#include "flatbuffers/flexbuffers.h"
+#include "flatbuffers/flex_flat_util.h"
+
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
+
+namespace MyGame {
+
+struct InParentNamespace;
+struct InParentNamespaceBuilder;
+struct InParentNamespaceT;
+
+namespace Example2 {
+
+struct Monster;
+struct MonsterBuilder;
+struct MonsterT;
+
+} // namespace Example2
+
+namespace Example {
+
+struct Test;
+
+struct TestSimpleTableWithEnum;
+struct TestSimpleTableWithEnumBuilder;
+struct TestSimpleTableWithEnumT;
+
+struct Vec3;
+
+struct Ability;
+
+struct StructOfStructs;
+
+struct StructOfStructsOfStructs;
+
+struct Stat;
+struct StatBuilder;
+struct StatT;
+
+struct Referrable;
+struct ReferrableBuilder;
+struct ReferrableT;
+
+struct Monster;
+struct MonsterBuilder;
+struct MonsterT;
+
+struct TypeAliases;
+struct TypeAliasesBuilder;
+struct TypeAliasesT;
+
+} // namespace Example
+
+bool operator==(const InParentNamespaceT &lhs, const InParentNamespaceT &rhs);
+bool operator!=(const InParentNamespaceT &lhs, const InParentNamespaceT &rhs);
+namespace Example2 {
+
+bool operator==(const MonsterT &lhs, const MonsterT &rhs);
+bool operator!=(const MonsterT &lhs, const MonsterT &rhs);
+} // namespace Example2
+
+namespace Example {
+
+bool operator==(const Test &lhs, const Test &rhs);
+bool operator!=(const Test &lhs, const Test &rhs);
+bool operator==(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs);
+bool operator!=(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs);
+bool operator==(const Vec3 &lhs, const Vec3 &rhs);
+bool operator!=(const Vec3 &lhs, const Vec3 &rhs);
+bool operator==(const Ability &lhs, const Ability &rhs);
+bool operator!=(const Ability &lhs, const Ability &rhs);
+bool operator==(const StructOfStructs &lhs, const StructOfStructs &rhs);
+bool operator!=(const StructOfStructs &lhs, const StructOfStructs &rhs);
+bool operator==(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs);
+bool operator!=(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs);
+bool operator==(const StatT &lhs, const StatT &rhs);
+bool operator!=(const StatT &lhs, const StatT &rhs);
+bool operator==(const ReferrableT &lhs, const ReferrableT &rhs);
+bool operator!=(const ReferrableT &lhs, const ReferrableT &rhs);
+bool operator==(const MonsterT &lhs, const MonsterT &rhs);
+bool operator!=(const MonsterT &lhs, const MonsterT &rhs);
+bool operator==(const TypeAliasesT &lhs, const TypeAliasesT &rhs);
+bool operator!=(const TypeAliasesT &lhs, const TypeAliasesT &rhs);
+
+} // namespace Example
+
+inline const flatbuffers::TypeTable *InParentNamespaceTypeTable();
+
+namespace Example2 {
+
+inline const flatbuffers::TypeTable *MonsterTypeTable();
+
+} // namespace Example2
+
+namespace Example {
+
+inline const flatbuffers::TypeTable *TestTypeTable();
+
+inline const flatbuffers::TypeTable *TestSimpleTableWithEnumTypeTable();
+
+inline const flatbuffers::TypeTable *Vec3TypeTable();
+
+inline const flatbuffers::TypeTable *AbilityTypeTable();
+
+inline const flatbuffers::TypeTable *StructOfStructsTypeTable();
+
+inline const flatbuffers::TypeTable *StructOfStructsOfStructsTypeTable();
+
+inline const flatbuffers::TypeTable *StatTypeTable();
+
+inline const flatbuffers::TypeTable *ReferrableTypeTable();
+
+inline const flatbuffers::TypeTable *MonsterTypeTable();
+
+inline const flatbuffers::TypeTable *TypeAliasesTypeTable();
+
+/// Composite components of Monster color.
+enum Color : uint8_t {
+ Color_Red = 1,
+ /// \brief color Green
+ /// Green is bit_flag with value (1u << 1)
+ Color_Green = 2,
+ /// \brief color Blue (1u << 3)
+ Color_Blue = 8,
+ Color_NONE = 0,
+ Color_ANY = 11
+};
+
+inline const Color (&EnumValuesColor())[3] {
+ static const Color values[] = {
+ Color_Red,
+ Color_Green,
+ Color_Blue
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesColor() {
+ static const char * const names[9] = {
+ "Red",
+ "Green",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "Blue",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameColor(Color e) {
+ if (flatbuffers::IsOutRange(e, Color_Red, Color_Blue)) return "";
+ const size_t index = static_cast<size_t>(e) - static_cast<size_t>(Color_Red);
+ return EnumNamesColor()[index];
+}
+
+enum Race : int8_t {
+ Race_None = -1,
+ Race_Human = 0,
+ Race_Dwarf = 1,
+ Race_Elf = 2,
+ Race_MIN = Race_None,
+ Race_MAX = Race_Elf
+};
+
+inline const Race (&EnumValuesRace())[4] {
+ static const Race values[] = {
+ Race_None,
+ Race_Human,
+ Race_Dwarf,
+ Race_Elf
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesRace() {
+ static const char * const names[5] = {
+ "None",
+ "Human",
+ "Dwarf",
+ "Elf",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameRace(Race e) {
+ if (flatbuffers::IsOutRange(e, Race_None, Race_Elf)) return "";
+ const size_t index = static_cast<size_t>(e) - static_cast<size_t>(Race_None);
+ return EnumNamesRace()[index];
+}
+
+enum LongEnum : uint64_t {
+ LongEnum_LongOne = 2ULL,
+ LongEnum_LongTwo = 4ULL,
+ LongEnum_LongBig = 1099511627776ULL,
+ LongEnum_NONE = 0,
+ LongEnum_ANY = 1099511627782ULL
+};
+
+inline const LongEnum (&EnumValuesLongEnum())[3] {
+ static const LongEnum values[] = {
+ LongEnum_LongOne,
+ LongEnum_LongTwo,
+ LongEnum_LongBig
+ };
+ return values;
+}
+
+inline const char *EnumNameLongEnum(LongEnum e) {
+ switch (e) {
+ case LongEnum_LongOne: return "LongOne";
+ case LongEnum_LongTwo: return "LongTwo";
+ case LongEnum_LongBig: return "LongBig";
+ default: return "";
+ }
+}
+
+enum Any : uint8_t {
+ Any_NONE = 0,
+ Any_Monster = 1,
+ Any_TestSimpleTableWithEnum = 2,
+ Any_MyGame_Example2_Monster = 3,
+ Any_MIN = Any_NONE,
+ Any_MAX = Any_MyGame_Example2_Monster
+};
+
+inline const Any (&EnumValuesAny())[4] {
+ static const Any values[] = {
+ Any_NONE,
+ Any_Monster,
+ Any_TestSimpleTableWithEnum,
+ Any_MyGame_Example2_Monster
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesAny() {
+ static const char * const names[5] = {
+ "NONE",
+ "Monster",
+ "TestSimpleTableWithEnum",
+ "MyGame_Example2_Monster",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameAny(Any e) {
+ if (flatbuffers::IsOutRange(e, Any_NONE, Any_MyGame_Example2_Monster)) return "";
+ const size_t index = static_cast<size_t>(e);
+ return EnumNamesAny()[index];
+}
+
+template<typename T> struct AnyTraits {
+ static const Any enum_value = Any_NONE;
+};
+
+template<> struct AnyTraits<MyGame::Example::Monster> {
+ static const Any enum_value = Any_Monster;
+};
+
+template<> struct AnyTraits<MyGame::Example::TestSimpleTableWithEnum> {
+ static const Any enum_value = Any_TestSimpleTableWithEnum;
+};
+
+template<> struct AnyTraits<MyGame::Example2::Monster> {
+ static const Any enum_value = Any_MyGame_Example2_Monster;
+};
+
+template<typename T> struct AnyUnionTraits {
+ static const Any enum_value = Any_NONE;
+};
+
+template<> struct AnyUnionTraits<MyGame::Example::MonsterT> {
+ static const Any enum_value = Any_Monster;
+};
+
+template<> struct AnyUnionTraits<MyGame::Example::TestSimpleTableWithEnumT> {
+ static const Any enum_value = Any_TestSimpleTableWithEnum;
+};
+
+template<> struct AnyUnionTraits<MyGame::Example2::MonsterT> {
+ static const Any enum_value = Any_MyGame_Example2_Monster;
+};
+
+struct AnyUnion {
+ Any type;
+ void *value;
+
+ AnyUnion() : type(Any_NONE), value(nullptr) {}
+ AnyUnion(AnyUnion&& u) FLATBUFFERS_NOEXCEPT :
+ type(Any_NONE), value(nullptr)
+ { std::swap(type, u.type); std::swap(value, u.value); }
+ AnyUnion(const AnyUnion &);
+ AnyUnion &operator=(const AnyUnion &u)
+ { AnyUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
+ AnyUnion &operator=(AnyUnion &&u) FLATBUFFERS_NOEXCEPT
+ { std::swap(type, u.type); std::swap(value, u.value); return *this; }
+ ~AnyUnion() { Reset(); }
+
+ void Reset();
+
+ template <typename T>
+ void Set(T&& val) {
+ typedef typename std::remove_reference<T>::type RT;
+ Reset();
+ type = AnyUnionTraits<RT>::enum_value;
+ if (type != Any_NONE) {
+ value = new RT(std::forward<T>(val));
+ }
+ }
+
+ static void *UnPack(const void *obj, Any type, const flatbuffers::resolver_function_t *resolver);
+ flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
+
+ MyGame::Example::MonsterT *AsMonster() {
+ return type == Any_Monster ?
+ reinterpret_cast<MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example::MonsterT *AsMonster() const {
+ return type == Any_Monster ?
+ reinterpret_cast<const MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ MyGame::Example::TestSimpleTableWithEnumT *AsTestSimpleTableWithEnum() {
+ return type == Any_TestSimpleTableWithEnum ?
+ reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(value) : nullptr;
+ }
+ const MyGame::Example::TestSimpleTableWithEnumT *AsTestSimpleTableWithEnum() const {
+ return type == Any_TestSimpleTableWithEnum ?
+ reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(value) : nullptr;
+ }
+ MyGame::Example2::MonsterT *AsMyGame_Example2_Monster() {
+ return type == Any_MyGame_Example2_Monster ?
+ reinterpret_cast<MyGame::Example2::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example2::MonsterT *AsMyGame_Example2_Monster() const {
+ return type == Any_MyGame_Example2_Monster ?
+ reinterpret_cast<const MyGame::Example2::MonsterT *>(value) : nullptr;
+ }
+};
+
+
+inline bool operator==(const AnyUnion &lhs, const AnyUnion &rhs) {
+ if (lhs.type != rhs.type) return false;
+ switch (lhs.type) {
+ case Any_NONE: {
+ return true;
+ }
+ case Any_Monster: {
+ return *(reinterpret_cast<const MyGame::Example::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::MonsterT *>(rhs.value));
+ }
+ case Any_TestSimpleTableWithEnum: {
+ return *(reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(rhs.value));
+ }
+ case Any_MyGame_Example2_Monster: {
+ return *(reinterpret_cast<const MyGame::Example2::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example2::MonsterT *>(rhs.value));
+ }
+ default: {
+ return false;
+ }
+ }
+}
+
+inline bool operator!=(const AnyUnion &lhs, const AnyUnion &rhs) {
+ return !(lhs == rhs);
+}
+
+bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type);
+bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
+
+enum AnyUniqueAliases : uint8_t {
+ AnyUniqueAliases_NONE = 0,
+ AnyUniqueAliases_M = 1,
+ AnyUniqueAliases_TS = 2,
+ AnyUniqueAliases_M2 = 3,
+ AnyUniqueAliases_MIN = AnyUniqueAliases_NONE,
+ AnyUniqueAliases_MAX = AnyUniqueAliases_M2
+};
+
+inline const AnyUniqueAliases (&EnumValuesAnyUniqueAliases())[4] {
+ static const AnyUniqueAliases values[] = {
+ AnyUniqueAliases_NONE,
+ AnyUniqueAliases_M,
+ AnyUniqueAliases_TS,
+ AnyUniqueAliases_M2
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesAnyUniqueAliases() {
+ static const char * const names[5] = {
+ "NONE",
+ "M",
+ "TS",
+ "M2",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameAnyUniqueAliases(AnyUniqueAliases e) {
+ if (flatbuffers::IsOutRange(e, AnyUniqueAliases_NONE, AnyUniqueAliases_M2)) return "";
+ const size_t index = static_cast<size_t>(e);
+ return EnumNamesAnyUniqueAliases()[index];
+}
+
+template<typename T> struct AnyUniqueAliasesTraits {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_NONE;
+};
+
+template<> struct AnyUniqueAliasesTraits<MyGame::Example::Monster> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_M;
+};
+
+template<> struct AnyUniqueAliasesTraits<MyGame::Example::TestSimpleTableWithEnum> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_TS;
+};
+
+template<> struct AnyUniqueAliasesTraits<MyGame::Example2::Monster> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_M2;
+};
+
+template<typename T> struct AnyUniqueAliasesUnionTraits {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_NONE;
+};
+
+template<> struct AnyUniqueAliasesUnionTraits<MyGame::Example::MonsterT> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_M;
+};
+
+template<> struct AnyUniqueAliasesUnionTraits<MyGame::Example::TestSimpleTableWithEnumT> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_TS;
+};
+
+template<> struct AnyUniqueAliasesUnionTraits<MyGame::Example2::MonsterT> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_M2;
+};
+
+struct AnyUniqueAliasesUnion {
+ AnyUniqueAliases type;
+ void *value;
+
+ AnyUniqueAliasesUnion() : type(AnyUniqueAliases_NONE), value(nullptr) {}
+ AnyUniqueAliasesUnion(AnyUniqueAliasesUnion&& u) FLATBUFFERS_NOEXCEPT :
+ type(AnyUniqueAliases_NONE), value(nullptr)
+ { std::swap(type, u.type); std::swap(value, u.value); }
+ AnyUniqueAliasesUnion(const AnyUniqueAliasesUnion &);
+ AnyUniqueAliasesUnion &operator=(const AnyUniqueAliasesUnion &u)
+ { AnyUniqueAliasesUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
+ AnyUniqueAliasesUnion &operator=(AnyUniqueAliasesUnion &&u) FLATBUFFERS_NOEXCEPT
+ { std::swap(type, u.type); std::swap(value, u.value); return *this; }
+ ~AnyUniqueAliasesUnion() { Reset(); }
+
+ void Reset();
+
+ template <typename T>
+ void Set(T&& val) {
+ typedef typename std::remove_reference<T>::type RT;
+ Reset();
+ type = AnyUniqueAliasesUnionTraits<RT>::enum_value;
+ if (type != AnyUniqueAliases_NONE) {
+ value = new RT(std::forward<T>(val));
+ }
+ }
+
+ static void *UnPack(const void *obj, AnyUniqueAliases type, const flatbuffers::resolver_function_t *resolver);
+ flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
+
+ MyGame::Example::MonsterT *AsM() {
+ return type == AnyUniqueAliases_M ?
+ reinterpret_cast<MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example::MonsterT *AsM() const {
+ return type == AnyUniqueAliases_M ?
+ reinterpret_cast<const MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ MyGame::Example::TestSimpleTableWithEnumT *AsTS() {
+ return type == AnyUniqueAliases_TS ?
+ reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(value) : nullptr;
+ }
+ const MyGame::Example::TestSimpleTableWithEnumT *AsTS() const {
+ return type == AnyUniqueAliases_TS ?
+ reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(value) : nullptr;
+ }
+ MyGame::Example2::MonsterT *AsM2() {
+ return type == AnyUniqueAliases_M2 ?
+ reinterpret_cast<MyGame::Example2::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example2::MonsterT *AsM2() const {
+ return type == AnyUniqueAliases_M2 ?
+ reinterpret_cast<const MyGame::Example2::MonsterT *>(value) : nullptr;
+ }
+};
+
+
+inline bool operator==(const AnyUniqueAliasesUnion &lhs, const AnyUniqueAliasesUnion &rhs) {
+ if (lhs.type != rhs.type) return false;
+ switch (lhs.type) {
+ case AnyUniqueAliases_NONE: {
+ return true;
+ }
+ case AnyUniqueAliases_M: {
+ return *(reinterpret_cast<const MyGame::Example::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::MonsterT *>(rhs.value));
+ }
+ case AnyUniqueAliases_TS: {
+ return *(reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(rhs.value));
+ }
+ case AnyUniqueAliases_M2: {
+ return *(reinterpret_cast<const MyGame::Example2::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example2::MonsterT *>(rhs.value));
+ }
+ default: {
+ return false;
+ }
+ }
+}
+
+inline bool operator!=(const AnyUniqueAliasesUnion &lhs, const AnyUniqueAliasesUnion &rhs) {
+ return !(lhs == rhs);
+}
+
+bool VerifyAnyUniqueAliases(flatbuffers::Verifier &verifier, const void *obj, AnyUniqueAliases type);
+bool VerifyAnyUniqueAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
+
+enum AnyAmbiguousAliases : uint8_t {
+ AnyAmbiguousAliases_NONE = 0,
+ AnyAmbiguousAliases_M1 = 1,
+ AnyAmbiguousAliases_M2 = 2,
+ AnyAmbiguousAliases_M3 = 3,
+ AnyAmbiguousAliases_MIN = AnyAmbiguousAliases_NONE,
+ AnyAmbiguousAliases_MAX = AnyAmbiguousAliases_M3
+};
+
+inline const AnyAmbiguousAliases (&EnumValuesAnyAmbiguousAliases())[4] {
+ static const AnyAmbiguousAliases values[] = {
+ AnyAmbiguousAliases_NONE,
+ AnyAmbiguousAliases_M1,
+ AnyAmbiguousAliases_M2,
+ AnyAmbiguousAliases_M3
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesAnyAmbiguousAliases() {
+ static const char * const names[5] = {
+ "NONE",
+ "M1",
+ "M2",
+ "M3",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameAnyAmbiguousAliases(AnyAmbiguousAliases e) {
+ if (flatbuffers::IsOutRange(e, AnyAmbiguousAliases_NONE, AnyAmbiguousAliases_M3)) return "";
+ const size_t index = static_cast<size_t>(e);
+ return EnumNamesAnyAmbiguousAliases()[index];
+}
+
+struct AnyAmbiguousAliasesUnion {
+ AnyAmbiguousAliases type;
+ void *value;
+
+ AnyAmbiguousAliasesUnion() : type(AnyAmbiguousAliases_NONE), value(nullptr) {}
+ AnyAmbiguousAliasesUnion(AnyAmbiguousAliasesUnion&& u) FLATBUFFERS_NOEXCEPT :
+ type(AnyAmbiguousAliases_NONE), value(nullptr)
+ { std::swap(type, u.type); std::swap(value, u.value); }
+ AnyAmbiguousAliasesUnion(const AnyAmbiguousAliasesUnion &);
+ AnyAmbiguousAliasesUnion &operator=(const AnyAmbiguousAliasesUnion &u)
+ { AnyAmbiguousAliasesUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
+ AnyAmbiguousAliasesUnion &operator=(AnyAmbiguousAliasesUnion &&u) FLATBUFFERS_NOEXCEPT
+ { std::swap(type, u.type); std::swap(value, u.value); return *this; }
+ ~AnyAmbiguousAliasesUnion() { Reset(); }
+
+ void Reset();
+
+ static void *UnPack(const void *obj, AnyAmbiguousAliases type, const flatbuffers::resolver_function_t *resolver);
+ flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
+
+ MyGame::Example::MonsterT *AsM1() {
+ return type == AnyAmbiguousAliases_M1 ?
+ reinterpret_cast<MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example::MonsterT *AsM1() const {
+ return type == AnyAmbiguousAliases_M1 ?
+ reinterpret_cast<const MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ MyGame::Example::MonsterT *AsM2() {
+ return type == AnyAmbiguousAliases_M2 ?
+ reinterpret_cast<MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example::MonsterT *AsM2() const {
+ return type == AnyAmbiguousAliases_M2 ?
+ reinterpret_cast<const MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ MyGame::Example::MonsterT *AsM3() {
+ return type == AnyAmbiguousAliases_M3 ?
+ reinterpret_cast<MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example::MonsterT *AsM3() const {
+ return type == AnyAmbiguousAliases_M3 ?
+ reinterpret_cast<const MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+};
+
+
+inline bool operator==(const AnyAmbiguousAliasesUnion &lhs, const AnyAmbiguousAliasesUnion &rhs) {
+ if (lhs.type != rhs.type) return false;
+ switch (lhs.type) {
+ case AnyAmbiguousAliases_NONE: {
+ return true;
+ }
+ case AnyAmbiguousAliases_M1: {
+ return *(reinterpret_cast<const MyGame::Example::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::MonsterT *>(rhs.value));
+ }
+ case AnyAmbiguousAliases_M2: {
+ return *(reinterpret_cast<const MyGame::Example::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::MonsterT *>(rhs.value));
+ }
+ case AnyAmbiguousAliases_M3: {
+ return *(reinterpret_cast<const MyGame::Example::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::MonsterT *>(rhs.value));
+ }
+ default: {
+ return false;
+ }
+ }
+}
+
+inline bool operator!=(const AnyAmbiguousAliasesUnion &lhs, const AnyAmbiguousAliasesUnion &rhs) {
+ return !(lhs == rhs);
+}
+
+bool VerifyAnyAmbiguousAliases(flatbuffers::Verifier &verifier, const void *obj, AnyAmbiguousAliases type);
+bool VerifyAnyAmbiguousAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
+
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(2) Test FLATBUFFERS_FINAL_CLASS {
+ private:
+ int16_t a_;
+ int8_t b_;
+ int8_t padding0__;
+
+ public:
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return TestTypeTable();
+ }
+ Test()
+ : a_(0),
+ b_(0),
+ padding0__(0) {
+ (void)padding0__;
+ }
+ Test(int16_t _a, int8_t _b)
+ : a_(flatbuffers::EndianScalar(_a)),
+ b_(flatbuffers::EndianScalar(_b)),
+ padding0__(0) {
+ (void)padding0__;
+ }
+ int16_t a() const {
+ return flatbuffers::EndianScalar(a_);
+ }
+ void mutate_a(int16_t _a) {
+ flatbuffers::WriteScalar(&a_, _a);
+ }
+ int8_t b() const {
+ return flatbuffers::EndianScalar(b_);
+ }
+ void mutate_b(int8_t _b) {
+ flatbuffers::WriteScalar(&b_, _b);
+ }
+};
+FLATBUFFERS_STRUCT_END(Test, 4);
+
+inline bool operator==(const Test &lhs, const Test &rhs) {
+ return
+ (lhs.a() == rhs.a()) &&
+ (lhs.b() == rhs.b());
+}
+
+inline bool operator!=(const Test &lhs, const Test &rhs) {
+ return !(lhs == rhs);
+}
+
+
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Vec3 FLATBUFFERS_FINAL_CLASS {
+ private:
+ float x_;
+ float y_;
+ float z_;
+ int32_t padding0__;
+ double test1_;
+ uint8_t test2_;
+ int8_t padding1__;
+ MyGame::Example::Test test3_;
+ int16_t padding2__;
+
+ public:
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return Vec3TypeTable();
+ }
+ Vec3()
+ : x_(0),
+ y_(0),
+ z_(0),
+ padding0__(0),
+ test1_(0),
+ test2_(0),
+ padding1__(0),
+ test3_(),
+ padding2__(0) {
+ (void)padding0__;
+ (void)padding1__;
+ (void)padding2__;
+ }
+ Vec3(float _x, float _y, float _z, double _test1, MyGame::Example::Color _test2, const MyGame::Example::Test &_test3)
+ : x_(flatbuffers::EndianScalar(_x)),
+ y_(flatbuffers::EndianScalar(_y)),
+ z_(flatbuffers::EndianScalar(_z)),
+ padding0__(0),
+ test1_(flatbuffers::EndianScalar(_test1)),
+ test2_(flatbuffers::EndianScalar(static_cast<uint8_t>(_test2))),
+ padding1__(0),
+ test3_(_test3),
+ padding2__(0) {
+ (void)padding0__;
+ (void)padding1__;
+ (void)padding2__;
+ }
+ float x() const {
+ return flatbuffers::EndianScalar(x_);
+ }
+ void mutate_x(float _x) {
+ flatbuffers::WriteScalar(&x_, _x);
+ }
+ float y() const {
+ return flatbuffers::EndianScalar(y_);
+ }
+ void mutate_y(float _y) {
+ flatbuffers::WriteScalar(&y_, _y);
+ }
+ float z() const {
+ return flatbuffers::EndianScalar(z_);
+ }
+ void mutate_z(float _z) {
+ flatbuffers::WriteScalar(&z_, _z);
+ }
+ double test1() const {
+ return flatbuffers::EndianScalar(test1_);
+ }
+ void mutate_test1(double _test1) {
+ flatbuffers::WriteScalar(&test1_, _test1);
+ }
+ MyGame::Example::Color test2() const {
+ return static_cast<MyGame::Example::Color>(flatbuffers::EndianScalar(test2_));
+ }
+ void mutate_test2(MyGame::Example::Color _test2) {
+ flatbuffers::WriteScalar(&test2_, static_cast<uint8_t>(_test2));
+ }
+ const MyGame::Example::Test &test3() const {
+ return test3_;
+ }
+ MyGame::Example::Test &mutable_test3() {
+ return test3_;
+ }
+};
+FLATBUFFERS_STRUCT_END(Vec3, 32);
+
+inline bool operator==(const Vec3 &lhs, const Vec3 &rhs) {
+ return
+ (lhs.x() == rhs.x()) &&
+ (lhs.y() == rhs.y()) &&
+ (lhs.z() == rhs.z()) &&
+ (lhs.test1() == rhs.test1()) &&
+ (lhs.test2() == rhs.test2()) &&
+ (lhs.test3() == rhs.test3());
+}
+
+inline bool operator!=(const Vec3 &lhs, const Vec3 &rhs) {
+ return !(lhs == rhs);
+}
+
+
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Ability FLATBUFFERS_FINAL_CLASS {
+ private:
+ uint32_t id_;
+ uint32_t distance_;
+
+ public:
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return AbilityTypeTable();
+ }
+ Ability()
+ : id_(0),
+ distance_(0) {
+ }
+ Ability(uint32_t _id, uint32_t _distance)
+ : id_(flatbuffers::EndianScalar(_id)),
+ distance_(flatbuffers::EndianScalar(_distance)) {
+ }
+ uint32_t id() const {
+ return flatbuffers::EndianScalar(id_);
+ }
+ void mutate_id(uint32_t _id) {
+ flatbuffers::WriteScalar(&id_, _id);
+ }
+ bool KeyCompareLessThan(const Ability *o) const {
+ return id() < o->id();
+ }
+ int KeyCompareWithValue(uint32_t _id) const {
+ return static_cast<int>(id() > _id) - static_cast<int>(id() < _id);
+ }
+ uint32_t distance() const {
+ return flatbuffers::EndianScalar(distance_);
+ }
+ void mutate_distance(uint32_t _distance) {
+ flatbuffers::WriteScalar(&distance_, _distance);
+ }
+};
+FLATBUFFERS_STRUCT_END(Ability, 8);
+
+inline bool operator==(const Ability &lhs, const Ability &rhs) {
+ return
+ (lhs.id() == rhs.id()) &&
+ (lhs.distance() == rhs.distance());
+}
+
+inline bool operator!=(const Ability &lhs, const Ability &rhs) {
+ return !(lhs == rhs);
+}
+
+
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructOfStructs FLATBUFFERS_FINAL_CLASS {
+ private:
+ MyGame::Example::Ability a_;
+ MyGame::Example::Test b_;
+ MyGame::Example::Ability c_;
+
+ public:
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return StructOfStructsTypeTable();
+ }
+ StructOfStructs()
+ : a_(),
+ b_(),
+ c_() {
+ }
+ StructOfStructs(const MyGame::Example::Ability &_a, const MyGame::Example::Test &_b, const MyGame::Example::Ability &_c)
+ : a_(_a),
+ b_(_b),
+ c_(_c) {
+ }
+ const MyGame::Example::Ability &a() const {
+ return a_;
+ }
+ MyGame::Example::Ability &mutable_a() {
+ return a_;
+ }
+ const MyGame::Example::Test &b() const {
+ return b_;
+ }
+ MyGame::Example::Test &mutable_b() {
+ return b_;
+ }
+ const MyGame::Example::Ability &c() const {
+ return c_;
+ }
+ MyGame::Example::Ability &mutable_c() {
+ return c_;
+ }
+};
+FLATBUFFERS_STRUCT_END(StructOfStructs, 20);
+
+inline bool operator==(const StructOfStructs &lhs, const StructOfStructs &rhs) {
+ return
+ (lhs.a() == rhs.a()) &&
+ (lhs.b() == rhs.b()) &&
+ (lhs.c() == rhs.c());
+}
+
+inline bool operator!=(const StructOfStructs &lhs, const StructOfStructs &rhs) {
+ return !(lhs == rhs);
+}
+
+
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructOfStructsOfStructs FLATBUFFERS_FINAL_CLASS {
+ private:
+ MyGame::Example::StructOfStructs a_;
+
+ public:
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return StructOfStructsOfStructsTypeTable();
+ }
+ StructOfStructsOfStructs()
+ : a_() {
+ }
+ StructOfStructsOfStructs(const MyGame::Example::StructOfStructs &_a)
+ : a_(_a) {
+ }
+ const MyGame::Example::StructOfStructs &a() const {
+ return a_;
+ }
+ MyGame::Example::StructOfStructs &mutable_a() {
+ return a_;
+ }
+};
+FLATBUFFERS_STRUCT_END(StructOfStructsOfStructs, 20);
+
+inline bool operator==(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs) {
+ return
+ (lhs.a() == rhs.a());
+}
+
+inline bool operator!=(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs) {
+ return !(lhs == rhs);
+}
+
+
+} // namespace Example
+
+struct InParentNamespaceT : public flatbuffers::NativeTable {
+ typedef InParentNamespace TableType;
+};
+
+struct InParentNamespace FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef InParentNamespaceT NativeTableType;
+ typedef InParentNamespaceBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return InParentNamespaceTypeTable();
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ verifier.EndTable();
+ }
+ InParentNamespaceT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(InParentNamespaceT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<InParentNamespace> Pack(flatbuffers::FlatBufferBuilder &_fbb, const InParentNamespaceT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct InParentNamespaceBuilder {
+ typedef InParentNamespace Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ explicit InParentNamespaceBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<InParentNamespace> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<InParentNamespace>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<InParentNamespace> CreateInParentNamespace(
+ flatbuffers::FlatBufferBuilder &_fbb) {
+ InParentNamespaceBuilder builder_(_fbb);
+ return builder_.Finish();
+}
+
+flatbuffers::Offset<InParentNamespace> CreateInParentNamespace(flatbuffers::FlatBufferBuilder &_fbb, const InParentNamespaceT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+namespace Example2 {
+
+struct MonsterT : public flatbuffers::NativeTable {
+ typedef Monster TableType;
+};
+
+struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef MonsterT NativeTableType;
+ typedef MonsterBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return MonsterTypeTable();
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ verifier.EndTable();
+ }
+ MonsterT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<Monster> Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct MonsterBuilder {
+ typedef Monster Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ explicit MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<Monster> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<Monster>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<Monster> CreateMonster(
+ flatbuffers::FlatBufferBuilder &_fbb) {
+ MonsterBuilder builder_(_fbb);
+ return builder_.Finish();
+}
+
+flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+} // namespace Example2
+
+namespace Example {
+
+struct TestSimpleTableWithEnumT : public flatbuffers::NativeTable {
+ typedef TestSimpleTableWithEnum TableType;
+ MyGame::Example::Color color = MyGame::Example::Color_Green;
+};
+
+struct TestSimpleTableWithEnum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef TestSimpleTableWithEnumT NativeTableType;
+ typedef TestSimpleTableWithEnumBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return TestSimpleTableWithEnumTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_COLOR = 4
+ };
+ MyGame::Example::Color color() const {
+ return static_cast<MyGame::Example::Color>(GetField<uint8_t>(VT_COLOR, 2));
+ }
+ bool mutate_color(MyGame::Example::Color _color = static_cast<MyGame::Example::Color>(2)) {
+ return SetField<uint8_t>(VT_COLOR, static_cast<uint8_t>(_color), 2);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyField<uint8_t>(verifier, VT_COLOR, 1) &&
+ verifier.EndTable();
+ }
+ TestSimpleTableWithEnumT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(TestSimpleTableWithEnumT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<TestSimpleTableWithEnum> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct TestSimpleTableWithEnumBuilder {
+ typedef TestSimpleTableWithEnum Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_color(MyGame::Example::Color color) {
+ fbb_.AddElement<uint8_t>(TestSimpleTableWithEnum::VT_COLOR, static_cast<uint8_t>(color), 2);
+ }
+ explicit TestSimpleTableWithEnumBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<TestSimpleTableWithEnum> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<TestSimpleTableWithEnum>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ MyGame::Example::Color color = MyGame::Example::Color_Green) {
+ TestSimpleTableWithEnumBuilder builder_(_fbb);
+ builder_.add_color(color);
+ return builder_.Finish();
+}
+
+flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+struct StatT : public flatbuffers::NativeTable {
+ typedef Stat TableType;
+ std::string id{};
+ int64_t val = 0;
+ uint16_t count = 0;
+};
+
+struct Stat FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef StatT NativeTableType;
+ typedef StatBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return StatTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_ID = 4,
+ VT_VAL = 6,
+ VT_COUNT = 8
+ };
+ const flatbuffers::String *id() const {
+ return GetPointer<const flatbuffers::String *>(VT_ID);
+ }
+ flatbuffers::String *mutable_id() {
+ return GetPointer<flatbuffers::String *>(VT_ID);
+ }
+ int64_t val() const {
+ return GetField<int64_t>(VT_VAL, 0);
+ }
+ bool mutate_val(int64_t _val = 0) {
+ return SetField<int64_t>(VT_VAL, _val, 0);
+ }
+ uint16_t count() const {
+ return GetField<uint16_t>(VT_COUNT, 0);
+ }
+ bool mutate_count(uint16_t _count = 0) {
+ return SetField<uint16_t>(VT_COUNT, _count, 0);
+ }
+ bool KeyCompareLessThan(const Stat *o) const {
+ return count() < o->count();
+ }
+ int KeyCompareWithValue(uint16_t _count) const {
+ return static_cast<int>(count() > _count) - static_cast<int>(count() < _count);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyOffset(verifier, VT_ID) &&
+ verifier.VerifyString(id()) &&
+ VerifyField<int64_t>(verifier, VT_VAL, 8) &&
+ VerifyField<uint16_t>(verifier, VT_COUNT, 2) &&
+ verifier.EndTable();
+ }
+ StatT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(StatT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<Stat> Pack(flatbuffers::FlatBufferBuilder &_fbb, const StatT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct StatBuilder {
+ typedef Stat Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_id(flatbuffers::Offset<flatbuffers::String> id) {
+ fbb_.AddOffset(Stat::VT_ID, id);
+ }
+ void add_val(int64_t val) {
+ fbb_.AddElement<int64_t>(Stat::VT_VAL, val, 0);
+ }
+ void add_count(uint16_t count) {
+ fbb_.AddElement<uint16_t>(Stat::VT_COUNT, count, 0);
+ }
+ explicit StatBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<Stat> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<Stat>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<Stat> CreateStat(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ flatbuffers::Offset<flatbuffers::String> id = 0,
+ int64_t val = 0,
+ uint16_t count = 0) {
+ StatBuilder builder_(_fbb);
+ builder_.add_val(val);
+ builder_.add_id(id);
+ builder_.add_count(count);
+ return builder_.Finish();
+}
+
+inline flatbuffers::Offset<Stat> CreateStatDirect(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ const char *id = nullptr,
+ int64_t val = 0,
+ uint16_t count = 0) {
+ auto id__ = id ? _fbb.CreateString(id) : 0;
+ return MyGame::Example::CreateStat(
+ _fbb,
+ id__,
+ val,
+ count);
+}
+
+flatbuffers::Offset<Stat> CreateStat(flatbuffers::FlatBufferBuilder &_fbb, const StatT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+struct ReferrableT : public flatbuffers::NativeTable {
+ typedef Referrable TableType;
+ uint64_t id = 0;
+};
+
+struct Referrable FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef ReferrableT NativeTableType;
+ typedef ReferrableBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return ReferrableTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_ID = 4
+ };
+ uint64_t id() const {
+ return GetField<uint64_t>(VT_ID, 0);
+ }
+ bool mutate_id(uint64_t _id = 0) {
+ return SetField<uint64_t>(VT_ID, _id, 0);
+ }
+ bool KeyCompareLessThan(const Referrable *o) const {
+ return id() < o->id();
+ }
+ int KeyCompareWithValue(uint64_t _id) const {
+ return static_cast<int>(id() > _id) - static_cast<int>(id() < _id);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyField<uint64_t>(verifier, VT_ID, 8) &&
+ verifier.EndTable();
+ }
+ ReferrableT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(ReferrableT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<Referrable> Pack(flatbuffers::FlatBufferBuilder &_fbb, const ReferrableT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct ReferrableBuilder {
+ typedef Referrable Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_id(uint64_t id) {
+ fbb_.AddElement<uint64_t>(Referrable::VT_ID, id, 0);
+ }
+ explicit ReferrableBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<Referrable> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<Referrable>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<Referrable> CreateReferrable(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ uint64_t id = 0) {
+ ReferrableBuilder builder_(_fbb);
+ builder_.add_id(id);
+ return builder_.Finish();
+}
+
+flatbuffers::Offset<Referrable> CreateReferrable(flatbuffers::FlatBufferBuilder &_fbb, const ReferrableT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+struct MonsterT : public flatbuffers::NativeTable {
+ typedef Monster TableType;
+ flatbuffers::unique_ptr<MyGame::Example::Vec3> pos{};
+ int16_t mana = 150;
+ int16_t hp = 100;
+ std::string name{};
+ std::vector<uint8_t> inventory{};
+ MyGame::Example::Color color = MyGame::Example::Color_Blue;
+ MyGame::Example::AnyUnion test{};
+ std::vector<MyGame::Example::Test> test4{};
+ std::vector<std::string> testarrayofstring{};
+ std::vector<flatbuffers::unique_ptr<MyGame::Example::MonsterT>> testarrayoftables{};
+ flatbuffers::unique_ptr<MyGame::Example::MonsterT> enemy{};
+ std::vector<uint8_t> testnestedflatbuffer{};
+ flatbuffers::unique_ptr<MyGame::Example::StatT> testempty{};
+ bool testbool = false;
+ int32_t testhashs32_fnv1 = 0;
+ uint32_t testhashu32_fnv1 = 0;
+ int64_t testhashs64_fnv1 = 0;
+ uint64_t testhashu64_fnv1 = 0;
+ int32_t testhashs32_fnv1a = 0;
+ Stat *testhashu32_fnv1a = nullptr;
+ int64_t testhashs64_fnv1a = 0;
+ uint64_t testhashu64_fnv1a = 0;
+ std::vector<bool> testarrayofbools{};
+ float testf = 3.14159f;
+ float testf2 = 3.0f;
+ float testf3 = 0.0f;
+ std::vector<std::string> testarrayofstring2{};
+ std::vector<MyGame::Example::Ability> testarrayofsortedstruct{};
+ std::vector<uint8_t> flex{};
+ std::vector<MyGame::Example::Test> test5{};
+ std::vector<int64_t> vector_of_longs{};
+ std::vector<double> vector_of_doubles{};
+ flatbuffers::unique_ptr<MyGame::InParentNamespaceT> parent_namespace_test{};
+ std::vector<flatbuffers::unique_ptr<MyGame::Example::ReferrableT>> vector_of_referrables{};
+ ReferrableT *single_weak_reference = nullptr;
+ std::vector<ReferrableT *> vector_of_weak_references{};
+ std::vector<flatbuffers::unique_ptr<MyGame::Example::ReferrableT>> vector_of_strong_referrables{};
+ ReferrableT *co_owning_reference = nullptr;
+ std::vector<flatbuffers::unique_ptr<ReferrableT>> vector_of_co_owning_references{};
+ ReferrableT *non_owning_reference = nullptr;
+ std::vector<ReferrableT *> vector_of_non_owning_references{};
+ MyGame::Example::AnyUniqueAliasesUnion any_unique{};
+ MyGame::Example::AnyAmbiguousAliasesUnion any_ambiguous{};
+ std::vector<MyGame::Example::Color> vector_of_enums{};
+ MyGame::Example::Race signed_enum = MyGame::Example::Race_None;
+ std::vector<uint8_t> testrequirednestedflatbuffer{};
+ std::vector<flatbuffers::unique_ptr<MyGame::Example::StatT>> scalar_key_sorted_tables{};
+ MyGame::Example::Test native_inline{};
+ MyGame::Example::LongEnum long_enum_non_enum_default = static_cast<MyGame::Example::LongEnum>(0);
+ MyGame::Example::LongEnum long_enum_normal_default = MyGame::Example::LongEnum_LongOne;
+ MonsterT() = default;
+ MonsterT(const MonsterT &o);
+ MonsterT(MonsterT&&) FLATBUFFERS_NOEXCEPT = default;
+ MonsterT &operator=(MonsterT o) FLATBUFFERS_NOEXCEPT;
+};
+
+/// an example documentation comment: "monster object"
+struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef MonsterT NativeTableType;
+ typedef MonsterBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return MonsterTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_POS = 4,
+ VT_MANA = 6,
+ VT_HP = 8,
+ VT_NAME = 10,
+ VT_INVENTORY = 14,
+ VT_COLOR = 16,
+ VT_TEST_TYPE = 18,
+ VT_TEST = 20,
+ VT_TEST4 = 22,
+ VT_TESTARRAYOFSTRING = 24,
+ VT_TESTARRAYOFTABLES = 26,
+ VT_ENEMY = 28,
+ VT_TESTNESTEDFLATBUFFER = 30,
+ VT_TESTEMPTY = 32,
+ VT_TESTBOOL = 34,
+ VT_TESTHASHS32_FNV1 = 36,
+ VT_TESTHASHU32_FNV1 = 38,
+ VT_TESTHASHS64_FNV1 = 40,
+ VT_TESTHASHU64_FNV1 = 42,
+ VT_TESTHASHS32_FNV1A = 44,
+ VT_TESTHASHU32_FNV1A = 46,
+ VT_TESTHASHS64_FNV1A = 48,
+ VT_TESTHASHU64_FNV1A = 50,
+ VT_TESTARRAYOFBOOLS = 52,
+ VT_TESTF = 54,
+ VT_TESTF2 = 56,
+ VT_TESTF3 = 58,
+ VT_TESTARRAYOFSTRING2 = 60,
+ VT_TESTARRAYOFSORTEDSTRUCT = 62,
+ VT_FLEX = 64,
+ VT_TEST5 = 66,
+ VT_VECTOR_OF_LONGS = 68,
+ VT_VECTOR_OF_DOUBLES = 70,
+ VT_PARENT_NAMESPACE_TEST = 72,
+ VT_VECTOR_OF_REFERRABLES = 74,
+ VT_SINGLE_WEAK_REFERENCE = 76,
+ VT_VECTOR_OF_WEAK_REFERENCES = 78,
+ VT_VECTOR_OF_STRONG_REFERRABLES = 80,
+ VT_CO_OWNING_REFERENCE = 82,
+ VT_VECTOR_OF_CO_OWNING_REFERENCES = 84,
+ VT_NON_OWNING_REFERENCE = 86,
+ VT_VECTOR_OF_NON_OWNING_REFERENCES = 88,
+ VT_ANY_UNIQUE_TYPE = 90,
+ VT_ANY_UNIQUE = 92,
+ VT_ANY_AMBIGUOUS_TYPE = 94,
+ VT_ANY_AMBIGUOUS = 96,
+ VT_VECTOR_OF_ENUMS = 98,
+ VT_SIGNED_ENUM = 100,
+ VT_TESTREQUIREDNESTEDFLATBUFFER = 102,
+ VT_SCALAR_KEY_SORTED_TABLES = 104,
+ VT_NATIVE_INLINE = 106,
+ VT_LONG_ENUM_NON_ENUM_DEFAULT = 108,
+ VT_LONG_ENUM_NORMAL_DEFAULT = 110
+ };
+ const MyGame::Example::Vec3 *pos() const {
+ return GetStruct<const MyGame::Example::Vec3 *>(VT_POS);
+ }
+ MyGame::Example::Vec3 *mutable_pos() {
+ return GetStruct<MyGame::Example::Vec3 *>(VT_POS);
+ }
+ int16_t mana() const {
+ return GetField<int16_t>(VT_MANA, 150);
+ }
+ bool mutate_mana(int16_t _mana = 150) {
+ return SetField<int16_t>(VT_MANA, _mana, 150);
+ }
+ int16_t hp() const {
+ return GetField<int16_t>(VT_HP, 100);
+ }
+ bool mutate_hp(int16_t _hp = 100) {
+ return SetField<int16_t>(VT_HP, _hp, 100);
+ }
+ const flatbuffers::String *name() const {
+ return GetPointer<const flatbuffers::String *>(VT_NAME);
+ }
+ flatbuffers::String *mutable_name() {
+ return GetPointer<flatbuffers::String *>(VT_NAME);
+ }
+ bool KeyCompareLessThan(const Monster *o) const {
+ return *name() < *o->name();
+ }
+ int KeyCompareWithValue(const char *_name) const {
+ return strcmp(name()->c_str(), _name);
+ }
+ const flatbuffers::Vector<uint8_t> *inventory() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_INVENTORY);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_inventory() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_INVENTORY);
+ }
+ MyGame::Example::Color color() const {
+ return static_cast<MyGame::Example::Color>(GetField<uint8_t>(VT_COLOR, 8));
+ }
+ bool mutate_color(MyGame::Example::Color _color = static_cast<MyGame::Example::Color>(8)) {
+ return SetField<uint8_t>(VT_COLOR, static_cast<uint8_t>(_color), 8);
+ }
+ MyGame::Example::Any test_type() const {
+ return static_cast<MyGame::Example::Any>(GetField<uint8_t>(VT_TEST_TYPE, 0));
+ }
+ const void *test() const {
+ return GetPointer<const void *>(VT_TEST);
+ }
+ template<typename T> const T *test_as() const;
+ const MyGame::Example::Monster *test_as_Monster() const {
+ return test_type() == MyGame::Example::Any_Monster ? static_cast<const MyGame::Example::Monster *>(test()) : nullptr;
+ }
+ const MyGame::Example::TestSimpleTableWithEnum *test_as_TestSimpleTableWithEnum() const {
+ return test_type() == MyGame::Example::Any_TestSimpleTableWithEnum ? static_cast<const MyGame::Example::TestSimpleTableWithEnum *>(test()) : nullptr;
+ }
+ const MyGame::Example2::Monster *test_as_MyGame_Example2_Monster() const {
+ return test_type() == MyGame::Example::Any_MyGame_Example2_Monster ? static_cast<const MyGame::Example2::Monster *>(test()) : nullptr;
+ }
+ void *mutable_test() {
+ return GetPointer<void *>(VT_TEST);
+ }
+ const flatbuffers::Vector<const MyGame::Example::Test *> *test4() const {
+ return GetPointer<const flatbuffers::Vector<const MyGame::Example::Test *> *>(VT_TEST4);
+ }
+ flatbuffers::Vector<const MyGame::Example::Test *> *mutable_test4() {
+ return GetPointer<flatbuffers::Vector<const MyGame::Example::Test *> *>(VT_TEST4);
+ }
+ const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *mutable_testarrayofstring() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING);
+ }
+ /// an example documentation comment: this will end up in the generated code
+ /// multiline too
+ const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>> *testarrayoftables() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>> *>(VT_TESTARRAYOFTABLES);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>> *mutable_testarrayoftables() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>> *>(VT_TESTARRAYOFTABLES);
+ }
+ const MyGame::Example::Monster *enemy() const {
+ return GetPointer<const MyGame::Example::Monster *>(VT_ENEMY);
+ }
+ MyGame::Example::Monster *mutable_enemy() {
+ return GetPointer<MyGame::Example::Monster *>(VT_ENEMY);
+ }
+ const flatbuffers::Vector<uint8_t> *testnestedflatbuffer() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_TESTNESTEDFLATBUFFER);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_testnestedflatbuffer() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_TESTNESTEDFLATBUFFER);
+ }
+ const MyGame::Example::Monster *testnestedflatbuffer_nested_root() const {
+ return flatbuffers::GetRoot<MyGame::Example::Monster>(testnestedflatbuffer()->Data());
+ }
+ const MyGame::Example::Stat *testempty() const {
+ return GetPointer<const MyGame::Example::Stat *>(VT_TESTEMPTY);
+ }
+ MyGame::Example::Stat *mutable_testempty() {
+ return GetPointer<MyGame::Example::Stat *>(VT_TESTEMPTY);
+ }
+ bool testbool() const {
+ return GetField<uint8_t>(VT_TESTBOOL, 0) != 0;
+ }
+ bool mutate_testbool(bool _testbool = 0) {
+ return SetField<uint8_t>(VT_TESTBOOL, static_cast<uint8_t>(_testbool), 0);
+ }
+ int32_t testhashs32_fnv1() const {
+ return GetField<int32_t>(VT_TESTHASHS32_FNV1, 0);
+ }
+ bool mutate_testhashs32_fnv1(int32_t _testhashs32_fnv1 = 0) {
+ return SetField<int32_t>(VT_TESTHASHS32_FNV1, _testhashs32_fnv1, 0);
+ }
+ uint32_t testhashu32_fnv1() const {
+ return GetField<uint32_t>(VT_TESTHASHU32_FNV1, 0);
+ }
+ bool mutate_testhashu32_fnv1(uint32_t _testhashu32_fnv1 = 0) {
+ return SetField<uint32_t>(VT_TESTHASHU32_FNV1, _testhashu32_fnv1, 0);
+ }
+ int64_t testhashs64_fnv1() const {
+ return GetField<int64_t>(VT_TESTHASHS64_FNV1, 0);
+ }
+ bool mutate_testhashs64_fnv1(int64_t _testhashs64_fnv1 = 0) {
+ return SetField<int64_t>(VT_TESTHASHS64_FNV1, _testhashs64_fnv1, 0);
+ }
+ uint64_t testhashu64_fnv1() const {
+ return GetField<uint64_t>(VT_TESTHASHU64_FNV1, 0);
+ }
+ bool mutate_testhashu64_fnv1(uint64_t _testhashu64_fnv1 = 0) {
+ return SetField<uint64_t>(VT_TESTHASHU64_FNV1, _testhashu64_fnv1, 0);
+ }
+ int32_t testhashs32_fnv1a() const {
+ return GetField<int32_t>(VT_TESTHASHS32_FNV1A, 0);
+ }
+ bool mutate_testhashs32_fnv1a(int32_t _testhashs32_fnv1a = 0) {
+ return SetField<int32_t>(VT_TESTHASHS32_FNV1A, _testhashs32_fnv1a, 0);
+ }
+ uint32_t testhashu32_fnv1a() const {
+ return GetField<uint32_t>(VT_TESTHASHU32_FNV1A, 0);
+ }
+ bool mutate_testhashu32_fnv1a(uint32_t _testhashu32_fnv1a = 0) {
+ return SetField<uint32_t>(VT_TESTHASHU32_FNV1A, _testhashu32_fnv1a, 0);
+ }
+ int64_t testhashs64_fnv1a() const {
+ return GetField<int64_t>(VT_TESTHASHS64_FNV1A, 0);
+ }
+ bool mutate_testhashs64_fnv1a(int64_t _testhashs64_fnv1a = 0) {
+ return SetField<int64_t>(VT_TESTHASHS64_FNV1A, _testhashs64_fnv1a, 0);
+ }
+ uint64_t testhashu64_fnv1a() const {
+ return GetField<uint64_t>(VT_TESTHASHU64_FNV1A, 0);
+ }
+ bool mutate_testhashu64_fnv1a(uint64_t _testhashu64_fnv1a = 0) {
+ return SetField<uint64_t>(VT_TESTHASHU64_FNV1A, _testhashu64_fnv1a, 0);
+ }
+ const flatbuffers::Vector<uint8_t> *testarrayofbools() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_TESTARRAYOFBOOLS);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_testarrayofbools() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_TESTARRAYOFBOOLS);
+ }
+ float testf() const {
+ return GetField<float>(VT_TESTF, 3.14159f);
+ }
+ bool mutate_testf(float _testf = 3.14159f) {
+ return SetField<float>(VT_TESTF, _testf, 3.14159f);
+ }
+ float testf2() const {
+ return GetField<float>(VT_TESTF2, 3.0f);
+ }
+ bool mutate_testf2(float _testf2 = 3.0f) {
+ return SetField<float>(VT_TESTF2, _testf2, 3.0f);
+ }
+ float testf3() const {
+ return GetField<float>(VT_TESTF3, 0.0f);
+ }
+ bool mutate_testf3(float _testf3 = 0.0f) {
+ return SetField<float>(VT_TESTF3, _testf3, 0.0f);
+ }
+ const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring2() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING2);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *mutable_testarrayofstring2() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING2);
+ }
+ const flatbuffers::Vector<const MyGame::Example::Ability *> *testarrayofsortedstruct() const {
+ return GetPointer<const flatbuffers::Vector<const MyGame::Example::Ability *> *>(VT_TESTARRAYOFSORTEDSTRUCT);
+ }
+ flatbuffers::Vector<const MyGame::Example::Ability *> *mutable_testarrayofsortedstruct() {
+ return GetPointer<flatbuffers::Vector<const MyGame::Example::Ability *> *>(VT_TESTARRAYOFSORTEDSTRUCT);
+ }
+ const flatbuffers::Vector<uint8_t> *flex() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_FLEX);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_flex() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_FLEX);
+ }
+ flexbuffers::Reference flex_flexbuffer_root() const {
+ return flexbuffers::GetRoot(flex()->Data(), flex()->size());
+ }
+ const flatbuffers::Vector<const MyGame::Example::Test *> *test5() const {
+ return GetPointer<const flatbuffers::Vector<const MyGame::Example::Test *> *>(VT_TEST5);
+ }
+ flatbuffers::Vector<const MyGame::Example::Test *> *mutable_test5() {
+ return GetPointer<flatbuffers::Vector<const MyGame::Example::Test *> *>(VT_TEST5);
+ }
+ const flatbuffers::Vector<int64_t> *vector_of_longs() const {
+ return GetPointer<const flatbuffers::Vector<int64_t> *>(VT_VECTOR_OF_LONGS);
+ }
+ flatbuffers::Vector<int64_t> *mutable_vector_of_longs() {
+ return GetPointer<flatbuffers::Vector<int64_t> *>(VT_VECTOR_OF_LONGS);
+ }
+ const flatbuffers::Vector<double> *vector_of_doubles() const {
+ return GetPointer<const flatbuffers::Vector<double> *>(VT_VECTOR_OF_DOUBLES);
+ }
+ flatbuffers::Vector<double> *mutable_vector_of_doubles() {
+ return GetPointer<flatbuffers::Vector<double> *>(VT_VECTOR_OF_DOUBLES);
+ }
+ const MyGame::InParentNamespace *parent_namespace_test() const {
+ return GetPointer<const MyGame::InParentNamespace *>(VT_PARENT_NAMESPACE_TEST);
+ }
+ MyGame::InParentNamespace *mutable_parent_namespace_test() {
+ return GetPointer<MyGame::InParentNamespace *>(VT_PARENT_NAMESPACE_TEST);
+ }
+ const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *vector_of_referrables() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *>(VT_VECTOR_OF_REFERRABLES);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *mutable_vector_of_referrables() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *>(VT_VECTOR_OF_REFERRABLES);
+ }
+ uint64_t single_weak_reference() const {
+ return GetField<uint64_t>(VT_SINGLE_WEAK_REFERENCE, 0);
+ }
+ bool mutate_single_weak_reference(uint64_t _single_weak_reference = 0) {
+ return SetField<uint64_t>(VT_SINGLE_WEAK_REFERENCE, _single_weak_reference, 0);
+ }
+ const flatbuffers::Vector<uint64_t> *vector_of_weak_references() const {
+ return GetPointer<const flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_WEAK_REFERENCES);
+ }
+ flatbuffers::Vector<uint64_t> *mutable_vector_of_weak_references() {
+ return GetPointer<flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_WEAK_REFERENCES);
+ }
+ const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *vector_of_strong_referrables() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *>(VT_VECTOR_OF_STRONG_REFERRABLES);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *mutable_vector_of_strong_referrables() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *>(VT_VECTOR_OF_STRONG_REFERRABLES);
+ }
+ uint64_t co_owning_reference() const {
+ return GetField<uint64_t>(VT_CO_OWNING_REFERENCE, 0);
+ }
+ bool mutate_co_owning_reference(uint64_t _co_owning_reference = 0) {
+ return SetField<uint64_t>(VT_CO_OWNING_REFERENCE, _co_owning_reference, 0);
+ }
+ const flatbuffers::Vector<uint64_t> *vector_of_co_owning_references() const {
+ return GetPointer<const flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_CO_OWNING_REFERENCES);
+ }
+ flatbuffers::Vector<uint64_t> *mutable_vector_of_co_owning_references() {
+ return GetPointer<flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_CO_OWNING_REFERENCES);
+ }
+ uint64_t non_owning_reference() const {
+ return GetField<uint64_t>(VT_NON_OWNING_REFERENCE, 0);
+ }
+ bool mutate_non_owning_reference(uint64_t _non_owning_reference = 0) {
+ return SetField<uint64_t>(VT_NON_OWNING_REFERENCE, _non_owning_reference, 0);
+ }
+ const flatbuffers::Vector<uint64_t> *vector_of_non_owning_references() const {
+ return GetPointer<const flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_NON_OWNING_REFERENCES);
+ }
+ flatbuffers::Vector<uint64_t> *mutable_vector_of_non_owning_references() {
+ return GetPointer<flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_NON_OWNING_REFERENCES);
+ }
+ MyGame::Example::AnyUniqueAliases any_unique_type() const {
+ return static_cast<MyGame::Example::AnyUniqueAliases>(GetField<uint8_t>(VT_ANY_UNIQUE_TYPE, 0));
+ }
+ const void *any_unique() const {
+ return GetPointer<const void *>(VT_ANY_UNIQUE);
+ }
+ template<typename T> const T *any_unique_as() const;
+ const MyGame::Example::Monster *any_unique_as_M() const {
+ return any_unique_type() == MyGame::Example::AnyUniqueAliases_M ? static_cast<const MyGame::Example::Monster *>(any_unique()) : nullptr;
+ }
+ const MyGame::Example::TestSimpleTableWithEnum *any_unique_as_TS() const {
+ return any_unique_type() == MyGame::Example::AnyUniqueAliases_TS ? static_cast<const MyGame::Example::TestSimpleTableWithEnum *>(any_unique()) : nullptr;
+ }
+ const MyGame::Example2::Monster *any_unique_as_M2() const {
+ return any_unique_type() == MyGame::Example::AnyUniqueAliases_M2 ? static_cast<const MyGame::Example2::Monster *>(any_unique()) : nullptr;
+ }
+ void *mutable_any_unique() {
+ return GetPointer<void *>(VT_ANY_UNIQUE);
+ }
+ MyGame::Example::AnyAmbiguousAliases any_ambiguous_type() const {
+ return static_cast<MyGame::Example::AnyAmbiguousAliases>(GetField<uint8_t>(VT_ANY_AMBIGUOUS_TYPE, 0));
+ }
+ const void *any_ambiguous() const {
+ return GetPointer<const void *>(VT_ANY_AMBIGUOUS);
+ }
+ const MyGame::Example::Monster *any_ambiguous_as_M1() const {
+ return any_ambiguous_type() == MyGame::Example::AnyAmbiguousAliases_M1 ? static_cast<const MyGame::Example::Monster *>(any_ambiguous()) : nullptr;
+ }
+ const MyGame::Example::Monster *any_ambiguous_as_M2() const {
+ return any_ambiguous_type() == MyGame::Example::AnyAmbiguousAliases_M2 ? static_cast<const MyGame::Example::Monster *>(any_ambiguous()) : nullptr;
+ }
+ const MyGame::Example::Monster *any_ambiguous_as_M3() const {
+ return any_ambiguous_type() == MyGame::Example::AnyAmbiguousAliases_M3 ? static_cast<const MyGame::Example::Monster *>(any_ambiguous()) : nullptr;
+ }
+ void *mutable_any_ambiguous() {
+ return GetPointer<void *>(VT_ANY_AMBIGUOUS);
+ }
+ const flatbuffers::Vector<uint8_t> *vector_of_enums() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_VECTOR_OF_ENUMS);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_vector_of_enums() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_VECTOR_OF_ENUMS);
+ }
+ MyGame::Example::Race signed_enum() const {
+ return static_cast<MyGame::Example::Race>(GetField<int8_t>(VT_SIGNED_ENUM, -1));
+ }
+ bool mutate_signed_enum(MyGame::Example::Race _signed_enum = static_cast<MyGame::Example::Race>(-1)) {
+ return SetField<int8_t>(VT_SIGNED_ENUM, static_cast<int8_t>(_signed_enum), -1);
+ }
+ const flatbuffers::Vector<uint8_t> *testrequirednestedflatbuffer() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_TESTREQUIREDNESTEDFLATBUFFER);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_testrequirednestedflatbuffer() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_TESTREQUIREDNESTEDFLATBUFFER);
+ }
+ const MyGame::Example::Monster *testrequirednestedflatbuffer_nested_root() const {
+ return flatbuffers::GetRoot<MyGame::Example::Monster>(testrequirednestedflatbuffer()->Data());
+ }
+ const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>> *scalar_key_sorted_tables() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>> *>(VT_SCALAR_KEY_SORTED_TABLES);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>> *mutable_scalar_key_sorted_tables() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>> *>(VT_SCALAR_KEY_SORTED_TABLES);
+ }
+ const MyGame::Example::Test *native_inline() const {
+ return GetStruct<const MyGame::Example::Test *>(VT_NATIVE_INLINE);
+ }
+ MyGame::Example::Test *mutable_native_inline() {
+ return GetStruct<MyGame::Example::Test *>(VT_NATIVE_INLINE);
+ }
+ MyGame::Example::LongEnum long_enum_non_enum_default() const {
+ return static_cast<MyGame::Example::LongEnum>(GetField<uint64_t>(VT_LONG_ENUM_NON_ENUM_DEFAULT, 0));
+ }
+ bool mutate_long_enum_non_enum_default(MyGame::Example::LongEnum _long_enum_non_enum_default = static_cast<MyGame::Example::LongEnum>(0)) {
+ return SetField<uint64_t>(VT_LONG_ENUM_NON_ENUM_DEFAULT, static_cast<uint64_t>(_long_enum_non_enum_default), 0);
+ }
+ MyGame::Example::LongEnum long_enum_normal_default() const {
+ return static_cast<MyGame::Example::LongEnum>(GetField<uint64_t>(VT_LONG_ENUM_NORMAL_DEFAULT, 2ULL));
+ }
+ bool mutate_long_enum_normal_default(MyGame::Example::LongEnum _long_enum_normal_default = static_cast<MyGame::Example::LongEnum>(2ULL)) {
+ return SetField<uint64_t>(VT_LONG_ENUM_NORMAL_DEFAULT, static_cast<uint64_t>(_long_enum_normal_default), 2ULL);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyField<MyGame::Example::Vec3>(verifier, VT_POS, 8) &&
+ VerifyField<int16_t>(verifier, VT_MANA, 2) &&
+ VerifyField<int16_t>(verifier, VT_HP, 2) &&
+ VerifyOffsetRequired(verifier, VT_NAME) &&
+ verifier.VerifyString(name()) &&
+ VerifyOffset(verifier, VT_INVENTORY) &&
+ verifier.VerifyVector(inventory()) &&
+ VerifyField<uint8_t>(verifier, VT_COLOR, 1) &&
+ VerifyField<uint8_t>(verifier, VT_TEST_TYPE, 1) &&
+ VerifyOffset(verifier, VT_TEST) &&
+ VerifyAny(verifier, test(), test_type()) &&
+ VerifyOffset(verifier, VT_TEST4) &&
+ verifier.VerifyVector(test4()) &&
+ VerifyOffset(verifier, VT_TESTARRAYOFSTRING) &&
+ verifier.VerifyVector(testarrayofstring()) &&
+ verifier.VerifyVectorOfStrings(testarrayofstring()) &&
+ VerifyOffset(verifier, VT_TESTARRAYOFTABLES) &&
+ verifier.VerifyVector(testarrayoftables()) &&
+ verifier.VerifyVectorOfTables(testarrayoftables()) &&
+ VerifyOffset(verifier, VT_ENEMY) &&
+ verifier.VerifyTable(enemy()) &&
+ VerifyOffset(verifier, VT_TESTNESTEDFLATBUFFER) &&
+ verifier.VerifyVector(testnestedflatbuffer()) &&
+ verifier.VerifyNestedFlatBuffer<MyGame::Example::Monster>(testnestedflatbuffer(), nullptr) &&
+ VerifyOffset(verifier, VT_TESTEMPTY) &&
+ verifier.VerifyTable(testempty()) &&
+ VerifyField<uint8_t>(verifier, VT_TESTBOOL, 1) &&
+ VerifyField<int32_t>(verifier, VT_TESTHASHS32_FNV1, 4) &&
+ VerifyField<uint32_t>(verifier, VT_TESTHASHU32_FNV1, 4) &&
+ VerifyField<int64_t>(verifier, VT_TESTHASHS64_FNV1, 8) &&
+ VerifyField<uint64_t>(verifier, VT_TESTHASHU64_FNV1, 8) &&
+ VerifyField<int32_t>(verifier, VT_TESTHASHS32_FNV1A, 4) &&
+ VerifyField<uint32_t>(verifier, VT_TESTHASHU32_FNV1A, 4) &&
+ VerifyField<int64_t>(verifier, VT_TESTHASHS64_FNV1A, 8) &&
+ VerifyField<uint64_t>(verifier, VT_TESTHASHU64_FNV1A, 8) &&
+ VerifyOffset(verifier, VT_TESTARRAYOFBOOLS) &&
+ verifier.VerifyVector(testarrayofbools()) &&
+ VerifyField<float>(verifier, VT_TESTF, 4) &&
+ VerifyField<float>(verifier, VT_TESTF2, 4) &&
+ VerifyField<float>(verifier, VT_TESTF3, 4) &&
+ VerifyOffset(verifier, VT_TESTARRAYOFSTRING2) &&
+ verifier.VerifyVector(testarrayofstring2()) &&
+ verifier.VerifyVectorOfStrings(testarrayofstring2()) &&
+ VerifyOffset(verifier, VT_TESTARRAYOFSORTEDSTRUCT) &&
+ verifier.VerifyVector(testarrayofsortedstruct()) &&
+ VerifyOffset(verifier, VT_FLEX) &&
+ verifier.VerifyVector(flex()) &&
+ flexbuffers::VerifyNestedFlexBuffer(flex(), verifier) &&
+ VerifyOffset(verifier, VT_TEST5) &&
+ verifier.VerifyVector(test5()) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_LONGS) &&
+ verifier.VerifyVector(vector_of_longs()) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_DOUBLES) &&
+ verifier.VerifyVector(vector_of_doubles()) &&
+ VerifyOffset(verifier, VT_PARENT_NAMESPACE_TEST) &&
+ verifier.VerifyTable(parent_namespace_test()) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_REFERRABLES) &&
+ verifier.VerifyVector(vector_of_referrables()) &&
+ verifier.VerifyVectorOfTables(vector_of_referrables()) &&
+ VerifyField<uint64_t>(verifier, VT_SINGLE_WEAK_REFERENCE, 8) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_WEAK_REFERENCES) &&
+ verifier.VerifyVector(vector_of_weak_references()) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_STRONG_REFERRABLES) &&
+ verifier.VerifyVector(vector_of_strong_referrables()) &&
+ verifier.VerifyVectorOfTables(vector_of_strong_referrables()) &&
+ VerifyField<uint64_t>(verifier, VT_CO_OWNING_REFERENCE, 8) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_CO_OWNING_REFERENCES) &&
+ verifier.VerifyVector(vector_of_co_owning_references()) &&
+ VerifyField<uint64_t>(verifier, VT_NON_OWNING_REFERENCE, 8) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_NON_OWNING_REFERENCES) &&
+ verifier.VerifyVector(vector_of_non_owning_references()) &&
+ VerifyField<uint8_t>(verifier, VT_ANY_UNIQUE_TYPE, 1) &&
+ VerifyOffset(verifier, VT_ANY_UNIQUE) &&
+ VerifyAnyUniqueAliases(verifier, any_unique(), any_unique_type()) &&
+ VerifyField<uint8_t>(verifier, VT_ANY_AMBIGUOUS_TYPE, 1) &&
+ VerifyOffset(verifier, VT_ANY_AMBIGUOUS) &&
+ VerifyAnyAmbiguousAliases(verifier, any_ambiguous(), any_ambiguous_type()) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_ENUMS) &&
+ verifier.VerifyVector(vector_of_enums()) &&
+ VerifyField<int8_t>(verifier, VT_SIGNED_ENUM, 1) &&
+ VerifyOffset(verifier, VT_TESTREQUIREDNESTEDFLATBUFFER) &&
+ verifier.VerifyVector(testrequirednestedflatbuffer()) &&
+ verifier.VerifyNestedFlatBuffer<MyGame::Example::Monster>(testrequirednestedflatbuffer(), nullptr) &&
+ VerifyOffset(verifier, VT_SCALAR_KEY_SORTED_TABLES) &&
+ verifier.VerifyVector(scalar_key_sorted_tables()) &&
+ verifier.VerifyVectorOfTables(scalar_key_sorted_tables()) &&
+ VerifyField<MyGame::Example::Test>(verifier, VT_NATIVE_INLINE, 2) &&
+ VerifyField<uint64_t>(verifier, VT_LONG_ENUM_NON_ENUM_DEFAULT, 8) &&
+ VerifyField<uint64_t>(verifier, VT_LONG_ENUM_NORMAL_DEFAULT, 8) &&
+ verifier.EndTable();
+ }
+ MonsterT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<Monster> Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+template<> inline const MyGame::Example::Monster *Monster::test_as<MyGame::Example::Monster>() const {
+ return test_as_Monster();
+}
+
+template<> inline const MyGame::Example::TestSimpleTableWithEnum *Monster::test_as<MyGame::Example::TestSimpleTableWithEnum>() const {
+ return test_as_TestSimpleTableWithEnum();
+}
+
+template<> inline const MyGame::Example2::Monster *Monster::test_as<MyGame::Example2::Monster>() const {
+ return test_as_MyGame_Example2_Monster();
+}
+
+template<> inline const MyGame::Example::Monster *Monster::any_unique_as<MyGame::Example::Monster>() const {
+ return any_unique_as_M();
+}
+
+template<> inline const MyGame::Example::TestSimpleTableWithEnum *Monster::any_unique_as<MyGame::Example::TestSimpleTableWithEnum>() const {
+ return any_unique_as_TS();
+}
+
+template<> inline const MyGame::Example2::Monster *Monster::any_unique_as<MyGame::Example2::Monster>() const {
+ return any_unique_as_M2();
+}
+
+struct MonsterBuilder {
+ typedef Monster Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_pos(const MyGame::Example::Vec3 *pos) {
+ fbb_.AddStruct(Monster::VT_POS, pos);
+ }
+ void add_mana(int16_t mana) {
+ fbb_.AddElement<int16_t>(Monster::VT_MANA, mana, 150);
+ }
+ void add_hp(int16_t hp) {
+ fbb_.AddElement<int16_t>(Monster::VT_HP, hp, 100);
+ }
+ void add_name(flatbuffers::Offset<flatbuffers::String> name) {
+ fbb_.AddOffset(Monster::VT_NAME, name);
+ }
+ void add_inventory(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> inventory) {
+ fbb_.AddOffset(Monster::VT_INVENTORY, inventory);
+ }
+ void add_color(MyGame::Example::Color color) {
+ fbb_.AddElement<uint8_t>(Monster::VT_COLOR, static_cast<uint8_t>(color), 8);
+ }
+ void add_test_type(MyGame::Example::Any test_type) {
+ fbb_.AddElement<uint8_t>(Monster::VT_TEST_TYPE, static_cast<uint8_t>(test_type), 0);
+ }
+ void add_test(flatbuffers::Offset<void> test) {
+ fbb_.AddOffset(Monster::VT_TEST, test);
+ }
+ void add_test4(flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Test *>> test4) {
+ fbb_.AddOffset(Monster::VT_TEST4, test4);
+ }
+ void add_testarrayofstring(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring) {
+ fbb_.AddOffset(Monster::VT_TESTARRAYOFSTRING, testarrayofstring);
+ }
+ void add_testarrayoftables(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>>> testarrayoftables) {
+ fbb_.AddOffset(Monster::VT_TESTARRAYOFTABLES, testarrayoftables);
+ }
+ void add_enemy(flatbuffers::Offset<MyGame::Example::Monster> enemy) {
+ fbb_.AddOffset(Monster::VT_ENEMY, enemy);
+ }
+ void add_testnestedflatbuffer(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testnestedflatbuffer) {
+ fbb_.AddOffset(Monster::VT_TESTNESTEDFLATBUFFER, testnestedflatbuffer);
+ }
+ void add_testempty(flatbuffers::Offset<MyGame::Example::Stat> testempty) {
+ fbb_.AddOffset(Monster::VT_TESTEMPTY, testempty);
+ }
+ void add_testbool(bool testbool) {
+ fbb_.AddElement<uint8_t>(Monster::VT_TESTBOOL, static_cast<uint8_t>(testbool), 0);
+ }
+ void add_testhashs32_fnv1(int32_t testhashs32_fnv1) {
+ fbb_.AddElement<int32_t>(Monster::VT_TESTHASHS32_FNV1, testhashs32_fnv1, 0);
+ }
+ void add_testhashu32_fnv1(uint32_t testhashu32_fnv1) {
+ fbb_.AddElement<uint32_t>(Monster::VT_TESTHASHU32_FNV1, testhashu32_fnv1, 0);
+ }
+ void add_testhashs64_fnv1(int64_t testhashs64_fnv1) {
+ fbb_.AddElement<int64_t>(Monster::VT_TESTHASHS64_FNV1, testhashs64_fnv1, 0);
+ }
+ void add_testhashu64_fnv1(uint64_t testhashu64_fnv1) {
+ fbb_.AddElement<uint64_t>(Monster::VT_TESTHASHU64_FNV1, testhashu64_fnv1, 0);
+ }
+ void add_testhashs32_fnv1a(int32_t testhashs32_fnv1a) {
+ fbb_.AddElement<int32_t>(Monster::VT_TESTHASHS32_FNV1A, testhashs32_fnv1a, 0);
+ }
+ void add_testhashu32_fnv1a(uint32_t testhashu32_fnv1a) {
+ fbb_.AddElement<uint32_t>(Monster::VT_TESTHASHU32_FNV1A, testhashu32_fnv1a, 0);
+ }
+ void add_testhashs64_fnv1a(int64_t testhashs64_fnv1a) {
+ fbb_.AddElement<int64_t>(Monster::VT_TESTHASHS64_FNV1A, testhashs64_fnv1a, 0);
+ }
+ void add_testhashu64_fnv1a(uint64_t testhashu64_fnv1a) {
+ fbb_.AddElement<uint64_t>(Monster::VT_TESTHASHU64_FNV1A, testhashu64_fnv1a, 0);
+ }
+ void add_testarrayofbools(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testarrayofbools) {
+ fbb_.AddOffset(Monster::VT_TESTARRAYOFBOOLS, testarrayofbools);
+ }
+ void add_testf(float testf) {
+ fbb_.AddElement<float>(Monster::VT_TESTF, testf, 3.14159f);
+ }
+ void add_testf2(float testf2) {
+ fbb_.AddElement<float>(Monster::VT_TESTF2, testf2, 3.0f);
+ }
+ void add_testf3(float testf3) {
+ fbb_.AddElement<float>(Monster::VT_TESTF3, testf3, 0.0f);
+ }
+ void add_testarrayofstring2(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring2) {
+ fbb_.AddOffset(Monster::VT_TESTARRAYOFSTRING2, testarrayofstring2);
+ }
+ void add_testarrayofsortedstruct(flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Ability *>> testarrayofsortedstruct) {
+ fbb_.AddOffset(Monster::VT_TESTARRAYOFSORTEDSTRUCT, testarrayofsortedstruct);
+ }
+ void add_flex(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> flex) {
+ fbb_.AddOffset(Monster::VT_FLEX, flex);
+ }
+ void add_test5(flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Test *>> test5) {
+ fbb_.AddOffset(Monster::VT_TEST5, test5);
+ }
+ void add_vector_of_longs(flatbuffers::Offset<flatbuffers::Vector<int64_t>> vector_of_longs) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_LONGS, vector_of_longs);
+ }
+ void add_vector_of_doubles(flatbuffers::Offset<flatbuffers::Vector<double>> vector_of_doubles) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_DOUBLES, vector_of_doubles);
+ }
+ void add_parent_namespace_test(flatbuffers::Offset<MyGame::InParentNamespace> parent_namespace_test) {
+ fbb_.AddOffset(Monster::VT_PARENT_NAMESPACE_TEST, parent_namespace_test);
+ }
+ void add_vector_of_referrables(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>>> vector_of_referrables) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_REFERRABLES, vector_of_referrables);
+ }
+ void add_single_weak_reference(uint64_t single_weak_reference) {
+ fbb_.AddElement<uint64_t>(Monster::VT_SINGLE_WEAK_REFERENCE, single_weak_reference, 0);
+ }
+ void add_vector_of_weak_references(flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_weak_references) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_WEAK_REFERENCES, vector_of_weak_references);
+ }
+ void add_vector_of_strong_referrables(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>>> vector_of_strong_referrables) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_STRONG_REFERRABLES, vector_of_strong_referrables);
+ }
+ void add_co_owning_reference(uint64_t co_owning_reference) {
+ fbb_.AddElement<uint64_t>(Monster::VT_CO_OWNING_REFERENCE, co_owning_reference, 0);
+ }
+ void add_vector_of_co_owning_references(flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_co_owning_references) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_CO_OWNING_REFERENCES, vector_of_co_owning_references);
+ }
+ void add_non_owning_reference(uint64_t non_owning_reference) {
+ fbb_.AddElement<uint64_t>(Monster::VT_NON_OWNING_REFERENCE, non_owning_reference, 0);
+ }
+ void add_vector_of_non_owning_references(flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_non_owning_references) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, vector_of_non_owning_references);
+ }
+ void add_any_unique_type(MyGame::Example::AnyUniqueAliases any_unique_type) {
+ fbb_.AddElement<uint8_t>(Monster::VT_ANY_UNIQUE_TYPE, static_cast<uint8_t>(any_unique_type), 0);
+ }
+ void add_any_unique(flatbuffers::Offset<void> any_unique) {
+ fbb_.AddOffset(Monster::VT_ANY_UNIQUE, any_unique);
+ }
+ void add_any_ambiguous_type(MyGame::Example::AnyAmbiguousAliases any_ambiguous_type) {
+ fbb_.AddElement<uint8_t>(Monster::VT_ANY_AMBIGUOUS_TYPE, static_cast<uint8_t>(any_ambiguous_type), 0);
+ }
+ void add_any_ambiguous(flatbuffers::Offset<void> any_ambiguous) {
+ fbb_.AddOffset(Monster::VT_ANY_AMBIGUOUS, any_ambiguous);
+ }
+ void add_vector_of_enums(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> vector_of_enums) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_ENUMS, vector_of_enums);
+ }
+ void add_signed_enum(MyGame::Example::Race signed_enum) {
+ fbb_.AddElement<int8_t>(Monster::VT_SIGNED_ENUM, static_cast<int8_t>(signed_enum), -1);
+ }
+ void add_testrequirednestedflatbuffer(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testrequirednestedflatbuffer) {
+ fbb_.AddOffset(Monster::VT_TESTREQUIREDNESTEDFLATBUFFER, testrequirednestedflatbuffer);
+ }
+ void add_scalar_key_sorted_tables(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>>> scalar_key_sorted_tables) {
+ fbb_.AddOffset(Monster::VT_SCALAR_KEY_SORTED_TABLES, scalar_key_sorted_tables);
+ }
+ void add_native_inline(const MyGame::Example::Test *native_inline) {
+ fbb_.AddStruct(Monster::VT_NATIVE_INLINE, native_inline);
+ }
+ void add_long_enum_non_enum_default(MyGame::Example::LongEnum long_enum_non_enum_default) {
+ fbb_.AddElement<uint64_t>(Monster::VT_LONG_ENUM_NON_ENUM_DEFAULT, static_cast<uint64_t>(long_enum_non_enum_default), 0);
+ }
+ void add_long_enum_normal_default(MyGame::Example::LongEnum long_enum_normal_default) {
+ fbb_.AddElement<uint64_t>(Monster::VT_LONG_ENUM_NORMAL_DEFAULT, static_cast<uint64_t>(long_enum_normal_default), 2ULL);
+ }
+ explicit MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<Monster> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<Monster>(end);
+ fbb_.Required(o, Monster::VT_NAME);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<Monster> CreateMonster(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ const MyGame::Example::Vec3 *pos = nullptr,
+ int16_t mana = 150,
+ int16_t hp = 100,
+ flatbuffers::Offset<flatbuffers::String> name = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> inventory = 0,
+ MyGame::Example::Color color = MyGame::Example::Color_Blue,
+ MyGame::Example::Any test_type = MyGame::Example::Any_NONE,
+ flatbuffers::Offset<void> test = 0,
+ flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Test *>> test4 = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>>> testarrayoftables = 0,
+ flatbuffers::Offset<MyGame::Example::Monster> enemy = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testnestedflatbuffer = 0,
+ flatbuffers::Offset<MyGame::Example::Stat> testempty = 0,
+ bool testbool = false,
+ int32_t testhashs32_fnv1 = 0,
+ uint32_t testhashu32_fnv1 = 0,
+ int64_t testhashs64_fnv1 = 0,
+ uint64_t testhashu64_fnv1 = 0,
+ int32_t testhashs32_fnv1a = 0,
+ uint32_t testhashu32_fnv1a = 0,
+ int64_t testhashs64_fnv1a = 0,
+ uint64_t testhashu64_fnv1a = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testarrayofbools = 0,
+ float testf = 3.14159f,
+ float testf2 = 3.0f,
+ float testf3 = 0.0f,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring2 = 0,
+ flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Ability *>> testarrayofsortedstruct = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> flex = 0,
+ flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Test *>> test5 = 0,
+ flatbuffers::Offset<flatbuffers::Vector<int64_t>> vector_of_longs = 0,
+ flatbuffers::Offset<flatbuffers::Vector<double>> vector_of_doubles = 0,
+ flatbuffers::Offset<MyGame::InParentNamespace> parent_namespace_test = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>>> vector_of_referrables = 0,
+ uint64_t single_weak_reference = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_weak_references = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>>> vector_of_strong_referrables = 0,
+ uint64_t co_owning_reference = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_co_owning_references = 0,
+ uint64_t non_owning_reference = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_non_owning_references = 0,
+ MyGame::Example::AnyUniqueAliases any_unique_type = MyGame::Example::AnyUniqueAliases_NONE,
+ flatbuffers::Offset<void> any_unique = 0,
+ MyGame::Example::AnyAmbiguousAliases any_ambiguous_type = MyGame::Example::AnyAmbiguousAliases_NONE,
+ flatbuffers::Offset<void> any_ambiguous = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> vector_of_enums = 0,
+ MyGame::Example::Race signed_enum = MyGame::Example::Race_None,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testrequirednestedflatbuffer = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>>> scalar_key_sorted_tables = 0,
+ const MyGame::Example::Test *native_inline = nullptr,
+ MyGame::Example::LongEnum long_enum_non_enum_default = static_cast<MyGame::Example::LongEnum>(0),
+ MyGame::Example::LongEnum long_enum_normal_default = MyGame::Example::LongEnum_LongOne) {
+ MonsterBuilder builder_(_fbb);
+ builder_.add_long_enum_normal_default(long_enum_normal_default);
+ builder_.add_long_enum_non_enum_default(long_enum_non_enum_default);
+ builder_.add_non_owning_reference(non_owning_reference);
+ builder_.add_co_owning_reference(co_owning_reference);
+ builder_.add_single_weak_reference(single_weak_reference);
+ builder_.add_testhashu64_fnv1a(testhashu64_fnv1a);
+ builder_.add_testhashs64_fnv1a(testhashs64_fnv1a);
+ builder_.add_testhashu64_fnv1(testhashu64_fnv1);
+ builder_.add_testhashs64_fnv1(testhashs64_fnv1);
+ builder_.add_native_inline(native_inline);
+ builder_.add_scalar_key_sorted_tables(scalar_key_sorted_tables);
+ builder_.add_testrequirednestedflatbuffer(testrequirednestedflatbuffer);
+ builder_.add_vector_of_enums(vector_of_enums);
+ builder_.add_any_ambiguous(any_ambiguous);
+ builder_.add_any_unique(any_unique);
+ builder_.add_vector_of_non_owning_references(vector_of_non_owning_references);
+ builder_.add_vector_of_co_owning_references(vector_of_co_owning_references);
+ builder_.add_vector_of_strong_referrables(vector_of_strong_referrables);
+ builder_.add_vector_of_weak_references(vector_of_weak_references);
+ builder_.add_vector_of_referrables(vector_of_referrables);
+ builder_.add_parent_namespace_test(parent_namespace_test);
+ builder_.add_vector_of_doubles(vector_of_doubles);
+ builder_.add_vector_of_longs(vector_of_longs);
+ builder_.add_test5(test5);
+ builder_.add_flex(flex);
+ builder_.add_testarrayofsortedstruct(testarrayofsortedstruct);
+ builder_.add_testarrayofstring2(testarrayofstring2);
+ builder_.add_testf3(testf3);
+ builder_.add_testf2(testf2);
+ builder_.add_testf(testf);
+ builder_.add_testarrayofbools(testarrayofbools);
+ builder_.add_testhashu32_fnv1a(testhashu32_fnv1a);
+ builder_.add_testhashs32_fnv1a(testhashs32_fnv1a);
+ builder_.add_testhashu32_fnv1(testhashu32_fnv1);
+ builder_.add_testhashs32_fnv1(testhashs32_fnv1);
+ builder_.add_testempty(testempty);
+ builder_.add_testnestedflatbuffer(testnestedflatbuffer);
+ builder_.add_enemy(enemy);
+ builder_.add_testarrayoftables(testarrayoftables);
+ builder_.add_testarrayofstring(testarrayofstring);
+ builder_.add_test4(test4);
+ builder_.add_test(test);
+ builder_.add_inventory(inventory);
+ builder_.add_name(name);
+ builder_.add_pos(pos);
+ builder_.add_hp(hp);
+ builder_.add_mana(mana);
+ builder_.add_signed_enum(signed_enum);
+ builder_.add_any_ambiguous_type(any_ambiguous_type);
+ builder_.add_any_unique_type(any_unique_type);
+ builder_.add_testbool(testbool);
+ builder_.add_test_type(test_type);
+ builder_.add_color(color);
+ return builder_.Finish();
+}
+
+inline flatbuffers::Offset<Monster> CreateMonsterDirect(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ const MyGame::Example::Vec3 *pos = nullptr,
+ int16_t mana = 150,
+ int16_t hp = 100,
+ const char *name = nullptr,
+ const std::vector<uint8_t> *inventory = nullptr,
+ MyGame::Example::Color color = MyGame::Example::Color_Blue,
+ MyGame::Example::Any test_type = MyGame::Example::Any_NONE,
+ flatbuffers::Offset<void> test = 0,
+ const std::vector<MyGame::Example::Test> *test4 = nullptr,
+ const std::vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring = nullptr,
+ std::vector<flatbuffers::Offset<MyGame::Example::Monster>> *testarrayoftables = nullptr,
+ flatbuffers::Offset<MyGame::Example::Monster> enemy = 0,
+ const std::vector<uint8_t> *testnestedflatbuffer = nullptr,
+ flatbuffers::Offset<MyGame::Example::Stat> testempty = 0,
+ bool testbool = false,
+ int32_t testhashs32_fnv1 = 0,
+ uint32_t testhashu32_fnv1 = 0,
+ int64_t testhashs64_fnv1 = 0,
+ uint64_t testhashu64_fnv1 = 0,
+ int32_t testhashs32_fnv1a = 0,
+ uint32_t testhashu32_fnv1a = 0,
+ int64_t testhashs64_fnv1a = 0,
+ uint64_t testhashu64_fnv1a = 0,
+ const std::vector<uint8_t> *testarrayofbools = nullptr,
+ float testf = 3.14159f,
+ float testf2 = 3.0f,
+ float testf3 = 0.0f,
+ const std::vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring2 = nullptr,
+ std::vector<MyGame::Example::Ability> *testarrayofsortedstruct = nullptr,
+ const std::vector<uint8_t> *flex = nullptr,
+ const std::vector<MyGame::Example::Test> *test5 = nullptr,
+ const std::vector<int64_t> *vector_of_longs = nullptr,
+ const std::vector<double> *vector_of_doubles = nullptr,
+ flatbuffers::Offset<MyGame::InParentNamespace> parent_namespace_test = 0,
+ std::vector<flatbuffers::Offset<MyGame::Example::Referrable>> *vector_of_referrables = nullptr,
+ uint64_t single_weak_reference = 0,
+ const std::vector<uint64_t> *vector_of_weak_references = nullptr,
+ std::vector<flatbuffers::Offset<MyGame::Example::Referrable>> *vector_of_strong_referrables = nullptr,
+ uint64_t co_owning_reference = 0,
+ const std::vector<uint64_t> *vector_of_co_owning_references = nullptr,
+ uint64_t non_owning_reference = 0,
+ const std::vector<uint64_t> *vector_of_non_owning_references = nullptr,
+ MyGame::Example::AnyUniqueAliases any_unique_type = MyGame::Example::AnyUniqueAliases_NONE,
+ flatbuffers::Offset<void> any_unique = 0,
+ MyGame::Example::AnyAmbiguousAliases any_ambiguous_type = MyGame::Example::AnyAmbiguousAliases_NONE,
+ flatbuffers::Offset<void> any_ambiguous = 0,
+ const std::vector<uint8_t> *vector_of_enums = nullptr,
+ MyGame::Example::Race signed_enum = MyGame::Example::Race_None,
+ const std::vector<uint8_t> *testrequirednestedflatbuffer = nullptr,
+ std::vector<flatbuffers::Offset<MyGame::Example::Stat>> *scalar_key_sorted_tables = nullptr,
+ const MyGame::Example::Test *native_inline = nullptr,
+ MyGame::Example::LongEnum long_enum_non_enum_default = static_cast<MyGame::Example::LongEnum>(0),
+ MyGame::Example::LongEnum long_enum_normal_default = MyGame::Example::LongEnum_LongOne) {
+ auto name__ = name ? _fbb.CreateString(name) : 0;
+ auto inventory__ = inventory ? _fbb.CreateVector<uint8_t>(*inventory) : 0;
+ auto test4__ = test4 ? _fbb.CreateVectorOfStructs<MyGame::Example::Test>(*test4) : 0;
+ auto testarrayofstring__ = testarrayofstring ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*testarrayofstring) : 0;
+ auto testarrayoftables__ = testarrayoftables ? _fbb.CreateVectorOfSortedTables<MyGame::Example::Monster>(testarrayoftables) : 0;
+ auto testnestedflatbuffer__ = testnestedflatbuffer ? _fbb.CreateVector<uint8_t>(*testnestedflatbuffer) : 0;
+ auto testarrayofbools__ = testarrayofbools ? _fbb.CreateVector<uint8_t>(*testarrayofbools) : 0;
+ auto testarrayofstring2__ = testarrayofstring2 ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*testarrayofstring2) : 0;
+ auto testarrayofsortedstruct__ = testarrayofsortedstruct ? _fbb.CreateVectorOfSortedStructs<MyGame::Example::Ability>(testarrayofsortedstruct) : 0;
+ auto flex__ = flex ? _fbb.CreateVector<uint8_t>(*flex) : 0;
+ auto test5__ = test5 ? _fbb.CreateVectorOfStructs<MyGame::Example::Test>(*test5) : 0;
+ auto vector_of_longs__ = vector_of_longs ? _fbb.CreateVector<int64_t>(*vector_of_longs) : 0;
+ auto vector_of_doubles__ = vector_of_doubles ? _fbb.CreateVector<double>(*vector_of_doubles) : 0;
+ auto vector_of_referrables__ = vector_of_referrables ? _fbb.CreateVectorOfSortedTables<MyGame::Example::Referrable>(vector_of_referrables) : 0;
+ auto vector_of_weak_references__ = vector_of_weak_references ? _fbb.CreateVector<uint64_t>(*vector_of_weak_references) : 0;
+ auto vector_of_strong_referrables__ = vector_of_strong_referrables ? _fbb.CreateVectorOfSortedTables<MyGame::Example::Referrable>(vector_of_strong_referrables) : 0;
+ auto vector_of_co_owning_references__ = vector_of_co_owning_references ? _fbb.CreateVector<uint64_t>(*vector_of_co_owning_references) : 0;
+ auto vector_of_non_owning_references__ = vector_of_non_owning_references ? _fbb.CreateVector<uint64_t>(*vector_of_non_owning_references) : 0;
+ auto vector_of_enums__ = vector_of_enums ? _fbb.CreateVector<uint8_t>(*vector_of_enums) : 0;
+ auto testrequirednestedflatbuffer__ = testrequirednestedflatbuffer ? _fbb.CreateVector<uint8_t>(*testrequirednestedflatbuffer) : 0;
+ auto scalar_key_sorted_tables__ = scalar_key_sorted_tables ? _fbb.CreateVectorOfSortedTables<MyGame::Example::Stat>(scalar_key_sorted_tables) : 0;
+ return MyGame::Example::CreateMonster(
+ _fbb,
+ pos,
+ mana,
+ hp,
+ name__,
+ inventory__,
+ color,
+ test_type,
+ test,
+ test4__,
+ testarrayofstring__,
+ testarrayoftables__,
+ enemy,
+ testnestedflatbuffer__,
+ testempty,
+ testbool,
+ testhashs32_fnv1,
+ testhashu32_fnv1,
+ testhashs64_fnv1,
+ testhashu64_fnv1,
+ testhashs32_fnv1a,
+ testhashu32_fnv1a,
+ testhashs64_fnv1a,
+ testhashu64_fnv1a,
+ testarrayofbools__,
+ testf,
+ testf2,
+ testf3,
+ testarrayofstring2__,
+ testarrayofsortedstruct__,
+ flex__,
+ test5__,
+ vector_of_longs__,
+ vector_of_doubles__,
+ parent_namespace_test,
+ vector_of_referrables__,
+ single_weak_reference,
+ vector_of_weak_references__,
+ vector_of_strong_referrables__,
+ co_owning_reference,
+ vector_of_co_owning_references__,
+ non_owning_reference,
+ vector_of_non_owning_references__,
+ any_unique_type,
+ any_unique,
+ any_ambiguous_type,
+ any_ambiguous,
+ vector_of_enums__,
+ signed_enum,
+ testrequirednestedflatbuffer__,
+ scalar_key_sorted_tables__,
+ native_inline,
+ long_enum_non_enum_default,
+ long_enum_normal_default);
+}
+
+flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+struct TypeAliasesT : public flatbuffers::NativeTable {
+ typedef TypeAliases TableType;
+ int8_t i8 = 0;
+ uint8_t u8 = 0;
+ int16_t i16 = 0;
+ uint16_t u16 = 0;
+ int32_t i32 = 0;
+ uint32_t u32 = 0;
+ int64_t i64 = 0;
+ uint64_t u64 = 0;
+ float f32 = 0.0f;
+ double f64 = 0.0;
+ std::vector<int8_t> v8{};
+ std::vector<double> vf64{};
+};
+
+struct TypeAliases FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef TypeAliasesT NativeTableType;
+ typedef TypeAliasesBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return TypeAliasesTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_I8 = 4,
+ VT_U8 = 6,
+ VT_I16 = 8,
+ VT_U16 = 10,
+ VT_I32 = 12,
+ VT_U32 = 14,
+ VT_I64 = 16,
+ VT_U64 = 18,
+ VT_F32 = 20,
+ VT_F64 = 22,
+ VT_V8 = 24,
+ VT_VF64 = 26
+ };
+ int8_t i8() const {
+ return GetField<int8_t>(VT_I8, 0);
+ }
+ bool mutate_i8(int8_t _i8 = 0) {
+ return SetField<int8_t>(VT_I8, _i8, 0);
+ }
+ uint8_t u8() const {
+ return GetField<uint8_t>(VT_U8, 0);
+ }
+ bool mutate_u8(uint8_t _u8 = 0) {
+ return SetField<uint8_t>(VT_U8, _u8, 0);
+ }
+ int16_t i16() const {
+ return GetField<int16_t>(VT_I16, 0);
+ }
+ bool mutate_i16(int16_t _i16 = 0) {
+ return SetField<int16_t>(VT_I16, _i16, 0);
+ }
+ uint16_t u16() const {
+ return GetField<uint16_t>(VT_U16, 0);
+ }
+ bool mutate_u16(uint16_t _u16 = 0) {
+ return SetField<uint16_t>(VT_U16, _u16, 0);
+ }
+ int32_t i32() const {
+ return GetField<int32_t>(VT_I32, 0);
+ }
+ bool mutate_i32(int32_t _i32 = 0) {
+ return SetField<int32_t>(VT_I32, _i32, 0);
+ }
+ uint32_t u32() const {
+ return GetField<uint32_t>(VT_U32, 0);
+ }
+ bool mutate_u32(uint32_t _u32 = 0) {
+ return SetField<uint32_t>(VT_U32, _u32, 0);
+ }
+ int64_t i64() const {
+ return GetField<int64_t>(VT_I64, 0);
+ }
+ bool mutate_i64(int64_t _i64 = 0) {
+ return SetField<int64_t>(VT_I64, _i64, 0);
+ }
+ uint64_t u64() const {
+ return GetField<uint64_t>(VT_U64, 0);
+ }
+ bool mutate_u64(uint64_t _u64 = 0) {
+ return SetField<uint64_t>(VT_U64, _u64, 0);
+ }
+ float f32() const {
+ return GetField<float>(VT_F32, 0.0f);
+ }
+ bool mutate_f32(float _f32 = 0.0f) {
+ return SetField<float>(VT_F32, _f32, 0.0f);
+ }
+ double f64() const {
+ return GetField<double>(VT_F64, 0.0);
+ }
+ bool mutate_f64(double _f64 = 0.0) {
+ return SetField<double>(VT_F64, _f64, 0.0);
+ }
+ const flatbuffers::Vector<int8_t> *v8() const {
+ return GetPointer<const flatbuffers::Vector<int8_t> *>(VT_V8);
+ }
+ flatbuffers::Vector<int8_t> *mutable_v8() {
+ return GetPointer<flatbuffers::Vector<int8_t> *>(VT_V8);
+ }
+ const flatbuffers::Vector<double> *vf64() const {
+ return GetPointer<const flatbuffers::Vector<double> *>(VT_VF64);
+ }
+ flatbuffers::Vector<double> *mutable_vf64() {
+ return GetPointer<flatbuffers::Vector<double> *>(VT_VF64);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyField<int8_t>(verifier, VT_I8, 1) &&
+ VerifyField<uint8_t>(verifier, VT_U8, 1) &&
+ VerifyField<int16_t>(verifier, VT_I16, 2) &&
+ VerifyField<uint16_t>(verifier, VT_U16, 2) &&
+ VerifyField<int32_t>(verifier, VT_I32, 4) &&
+ VerifyField<uint32_t>(verifier, VT_U32, 4) &&
+ VerifyField<int64_t>(verifier, VT_I64, 8) &&
+ VerifyField<uint64_t>(verifier, VT_U64, 8) &&
+ VerifyField<float>(verifier, VT_F32, 4) &&
+ VerifyField<double>(verifier, VT_F64, 8) &&
+ VerifyOffset(verifier, VT_V8) &&
+ verifier.VerifyVector(v8()) &&
+ VerifyOffset(verifier, VT_VF64) &&
+ verifier.VerifyVector(vf64()) &&
+ verifier.EndTable();
+ }
+ TypeAliasesT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(TypeAliasesT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<TypeAliases> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct TypeAliasesBuilder {
+ typedef TypeAliases Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_i8(int8_t i8) {
+ fbb_.AddElement<int8_t>(TypeAliases::VT_I8, i8, 0);
+ }
+ void add_u8(uint8_t u8) {
+ fbb_.AddElement<uint8_t>(TypeAliases::VT_U8, u8, 0);
+ }
+ void add_i16(int16_t i16) {
+ fbb_.AddElement<int16_t>(TypeAliases::VT_I16, i16, 0);
+ }
+ void add_u16(uint16_t u16) {
+ fbb_.AddElement<uint16_t>(TypeAliases::VT_U16, u16, 0);
+ }
+ void add_i32(int32_t i32) {
+ fbb_.AddElement<int32_t>(TypeAliases::VT_I32, i32, 0);
+ }
+ void add_u32(uint32_t u32) {
+ fbb_.AddElement<uint32_t>(TypeAliases::VT_U32, u32, 0);
+ }
+ void add_i64(int64_t i64) {
+ fbb_.AddElement<int64_t>(TypeAliases::VT_I64, i64, 0);
+ }
+ void add_u64(uint64_t u64) {
+ fbb_.AddElement<uint64_t>(TypeAliases::VT_U64, u64, 0);
+ }
+ void add_f32(float f32) {
+ fbb_.AddElement<float>(TypeAliases::VT_F32, f32, 0.0f);
+ }
+ void add_f64(double f64) {
+ fbb_.AddElement<double>(TypeAliases::VT_F64, f64, 0.0);
+ }
+ void add_v8(flatbuffers::Offset<flatbuffers::Vector<int8_t>> v8) {
+ fbb_.AddOffset(TypeAliases::VT_V8, v8);
+ }
+ void add_vf64(flatbuffers::Offset<flatbuffers::Vector<double>> vf64) {
+ fbb_.AddOffset(TypeAliases::VT_VF64, vf64);
+ }
+ explicit TypeAliasesBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<TypeAliases> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<TypeAliases>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<TypeAliases> CreateTypeAliases(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ int8_t i8 = 0,
+ uint8_t u8 = 0,
+ int16_t i16 = 0,
+ uint16_t u16 = 0,
+ int32_t i32 = 0,
+ uint32_t u32 = 0,
+ int64_t i64 = 0,
+ uint64_t u64 = 0,
+ float f32 = 0.0f,
+ double f64 = 0.0,
+ flatbuffers::Offset<flatbuffers::Vector<int8_t>> v8 = 0,
+ flatbuffers::Offset<flatbuffers::Vector<double>> vf64 = 0) {
+ TypeAliasesBuilder builder_(_fbb);
+ builder_.add_f64(f64);
+ builder_.add_u64(u64);
+ builder_.add_i64(i64);
+ builder_.add_vf64(vf64);
+ builder_.add_v8(v8);
+ builder_.add_f32(f32);
+ builder_.add_u32(u32);
+ builder_.add_i32(i32);
+ builder_.add_u16(u16);
+ builder_.add_i16(i16);
+ builder_.add_u8(u8);
+ builder_.add_i8(i8);
+ return builder_.Finish();
+}
+
+inline flatbuffers::Offset<TypeAliases> CreateTypeAliasesDirect(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ int8_t i8 = 0,
+ uint8_t u8 = 0,
+ int16_t i16 = 0,
+ uint16_t u16 = 0,
+ int32_t i32 = 0,
+ uint32_t u32 = 0,
+ int64_t i64 = 0,
+ uint64_t u64 = 0,
+ float f32 = 0.0f,
+ double f64 = 0.0,
+ const std::vector<int8_t> *v8 = nullptr,
+ const std::vector<double> *vf64 = nullptr) {
+ auto v8__ = v8 ? _fbb.CreateVector<int8_t>(*v8) : 0;
+ auto vf64__ = vf64 ? _fbb.CreateVector<double>(*vf64) : 0;
+ return MyGame::Example::CreateTypeAliases(
+ _fbb,
+ i8,
+ u8,
+ i16,
+ u16,
+ i32,
+ u32,
+ i64,
+ u64,
+ f32,
+ f64,
+ v8__,
+ vf64__);
+}
+
+flatbuffers::Offset<TypeAliases> CreateTypeAliases(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+} // namespace Example
+
+
+inline bool operator==(const InParentNamespaceT &, const InParentNamespaceT &) {
+ return true;
+}
+
+inline bool operator!=(const InParentNamespaceT &lhs, const InParentNamespaceT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline InParentNamespaceT *InParentNamespace::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<InParentNamespaceT>(new InParentNamespaceT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void InParentNamespace::UnPackTo(InParentNamespaceT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+}
+
+inline flatbuffers::Offset<InParentNamespace> InParentNamespace::Pack(flatbuffers::FlatBufferBuilder &_fbb, const InParentNamespaceT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateInParentNamespace(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<InParentNamespace> CreateInParentNamespace(flatbuffers::FlatBufferBuilder &_fbb, const InParentNamespaceT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const InParentNamespaceT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ return MyGame::CreateInParentNamespace(
+ _fbb);
+}
+
+namespace Example2 {
+
+
+inline bool operator==(const MonsterT &, const MonsterT &) {
+ return true;
+}
+
+inline bool operator!=(const MonsterT &lhs, const MonsterT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline MonsterT *Monster::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<MonsterT>(new MonsterT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void Monster::UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+}
+
+inline flatbuffers::Offset<Monster> Monster::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateMonster(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const MonsterT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ return MyGame::Example2::CreateMonster(
+ _fbb);
+}
+
+} // namespace Example2
+
+namespace Example {
+
+
+inline bool operator==(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs) {
+ return
+ (lhs.color == rhs.color);
+}
+
+inline bool operator!=(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline TestSimpleTableWithEnumT *TestSimpleTableWithEnum::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<TestSimpleTableWithEnumT>(new TestSimpleTableWithEnumT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void TestSimpleTableWithEnum::UnPackTo(TestSimpleTableWithEnumT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = color(); _o->color = _e; }
+}
+
+inline flatbuffers::Offset<TestSimpleTableWithEnum> TestSimpleTableWithEnum::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateTestSimpleTableWithEnum(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TestSimpleTableWithEnumT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _color = _o->color;
+ return MyGame::Example::CreateTestSimpleTableWithEnum(
+ _fbb,
+ _color);
+}
+
+
+inline bool operator==(const StatT &lhs, const StatT &rhs) {
+ return
+ (lhs.id == rhs.id) &&
+ (lhs.val == rhs.val) &&
+ (lhs.count == rhs.count);
+}
+
+inline bool operator!=(const StatT &lhs, const StatT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline StatT *Stat::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<StatT>(new StatT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void Stat::UnPackTo(StatT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = id(); if (_e) _o->id = _e->str(); }
+ { auto _e = val(); _o->val = _e; }
+ { auto _e = count(); _o->count = _e; }
+}
+
+inline flatbuffers::Offset<Stat> Stat::Pack(flatbuffers::FlatBufferBuilder &_fbb, const StatT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateStat(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<Stat> CreateStat(flatbuffers::FlatBufferBuilder &_fbb, const StatT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const StatT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _id = _o->id.empty() ? 0 : _fbb.CreateString(_o->id);
+ auto _val = _o->val;
+ auto _count = _o->count;
+ return MyGame::Example::CreateStat(
+ _fbb,
+ _id,
+ _val,
+ _count);
+}
+
+
+inline bool operator==(const ReferrableT &lhs, const ReferrableT &rhs) {
+ return
+ (lhs.id == rhs.id);
+}
+
+inline bool operator!=(const ReferrableT &lhs, const ReferrableT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline ReferrableT *Referrable::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<ReferrableT>(new ReferrableT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void Referrable::UnPackTo(ReferrableT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = id(); _o->id = _e; }
+}
+
+inline flatbuffers::Offset<Referrable> Referrable::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ReferrableT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateReferrable(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<Referrable> CreateReferrable(flatbuffers::FlatBufferBuilder &_fbb, const ReferrableT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ReferrableT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _id = _o->id;
+ return MyGame::Example::CreateReferrable(
+ _fbb,
+ _id);
+}
+
+
+inline bool operator==(const MonsterT &lhs, const MonsterT &rhs) {
+ return
+ ((lhs.pos == rhs.pos) || (lhs.pos && rhs.pos && *lhs.pos == *rhs.pos)) &&
+ (lhs.mana == rhs.mana) &&
+ (lhs.hp == rhs.hp) &&
+ (lhs.name == rhs.name) &&
+ (lhs.inventory == rhs.inventory) &&
+ (lhs.color == rhs.color) &&
+ (lhs.test == rhs.test) &&
+ (lhs.test4 == rhs.test4) &&
+ (lhs.testarrayofstring == rhs.testarrayofstring) &&
+ (lhs.testarrayoftables.size() == rhs.testarrayoftables.size() && std::equal(lhs.testarrayoftables.cbegin(), lhs.testarrayoftables.cend(), rhs.testarrayoftables.cbegin(), [](flatbuffers::unique_ptr<MyGame::Example::MonsterT> const &a, flatbuffers::unique_ptr<MyGame::Example::MonsterT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
+ ((lhs.enemy == rhs.enemy) || (lhs.enemy && rhs.enemy && *lhs.enemy == *rhs.enemy)) &&
+ (lhs.testnestedflatbuffer == rhs.testnestedflatbuffer) &&
+ ((lhs.testempty == rhs.testempty) || (lhs.testempty && rhs.testempty && *lhs.testempty == *rhs.testempty)) &&
+ (lhs.testbool == rhs.testbool) &&
+ (lhs.testhashs32_fnv1 == rhs.testhashs32_fnv1) &&
+ (lhs.testhashu32_fnv1 == rhs.testhashu32_fnv1) &&
+ (lhs.testhashs64_fnv1 == rhs.testhashs64_fnv1) &&
+ (lhs.testhashu64_fnv1 == rhs.testhashu64_fnv1) &&
+ (lhs.testhashs32_fnv1a == rhs.testhashs32_fnv1a) &&
+ (lhs.testhashu32_fnv1a == rhs.testhashu32_fnv1a) &&
+ (lhs.testhashs64_fnv1a == rhs.testhashs64_fnv1a) &&
+ (lhs.testhashu64_fnv1a == rhs.testhashu64_fnv1a) &&
+ (lhs.testarrayofbools == rhs.testarrayofbools) &&
+ (lhs.testf == rhs.testf) &&
+ (lhs.testf2 == rhs.testf2) &&
+ (lhs.testf3 == rhs.testf3) &&
+ (lhs.testarrayofstring2 == rhs.testarrayofstring2) &&
+ (lhs.testarrayofsortedstruct == rhs.testarrayofsortedstruct) &&
+ (lhs.flex == rhs.flex) &&
+ (lhs.test5 == rhs.test5) &&
+ (lhs.vector_of_longs == rhs.vector_of_longs) &&
+ (lhs.vector_of_doubles == rhs.vector_of_doubles) &&
+ ((lhs.parent_namespace_test == rhs.parent_namespace_test) || (lhs.parent_namespace_test && rhs.parent_namespace_test && *lhs.parent_namespace_test == *rhs.parent_namespace_test)) &&
+ (lhs.vector_of_referrables.size() == rhs.vector_of_referrables.size() && std::equal(lhs.vector_of_referrables.cbegin(), lhs.vector_of_referrables.cend(), rhs.vector_of_referrables.cbegin(), [](flatbuffers::unique_ptr<MyGame::Example::ReferrableT> const &a, flatbuffers::unique_ptr<MyGame::Example::ReferrableT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
+ (lhs.single_weak_reference == rhs.single_weak_reference) &&
+ (lhs.vector_of_weak_references == rhs.vector_of_weak_references) &&
+ (lhs.vector_of_strong_referrables.size() == rhs.vector_of_strong_referrables.size() && std::equal(lhs.vector_of_strong_referrables.cbegin(), lhs.vector_of_strong_referrables.cend(), rhs.vector_of_strong_referrables.cbegin(), [](flatbuffers::unique_ptr<MyGame::Example::ReferrableT> const &a, flatbuffers::unique_ptr<MyGame::Example::ReferrableT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
+ (lhs.co_owning_reference == rhs.co_owning_reference) &&
+ (lhs.vector_of_co_owning_references == rhs.vector_of_co_owning_references) &&
+ (lhs.non_owning_reference == rhs.non_owning_reference) &&
+ (lhs.vector_of_non_owning_references == rhs.vector_of_non_owning_references) &&
+ (lhs.any_unique == rhs.any_unique) &&
+ (lhs.any_ambiguous == rhs.any_ambiguous) &&
+ (lhs.vector_of_enums == rhs.vector_of_enums) &&
+ (lhs.signed_enum == rhs.signed_enum) &&
+ (lhs.testrequirednestedflatbuffer == rhs.testrequirednestedflatbuffer) &&
+ (lhs.scalar_key_sorted_tables.size() == rhs.scalar_key_sorted_tables.size() && std::equal(lhs.scalar_key_sorted_tables.cbegin(), lhs.scalar_key_sorted_tables.cend(), rhs.scalar_key_sorted_tables.cbegin(), [](flatbuffers::unique_ptr<MyGame::Example::StatT> const &a, flatbuffers::unique_ptr<MyGame::Example::StatT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
+ (lhs.native_inline == rhs.native_inline) &&
+ (lhs.long_enum_non_enum_default == rhs.long_enum_non_enum_default) &&
+ (lhs.long_enum_normal_default == rhs.long_enum_normal_default);
+}
+
+inline bool operator!=(const MonsterT &lhs, const MonsterT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline MonsterT::MonsterT(const MonsterT &o)
+ : pos((o.pos) ? new MyGame::Example::Vec3(*o.pos) : nullptr),
+ mana(o.mana),
+ hp(o.hp),
+ name(o.name),
+ inventory(o.inventory),
+ color(o.color),
+ test(o.test),
+ test4(o.test4),
+ testarrayofstring(o.testarrayofstring),
+ enemy((o.enemy) ? new MyGame::Example::MonsterT(*o.enemy) : nullptr),
+ testnestedflatbuffer(o.testnestedflatbuffer),
+ testempty((o.testempty) ? new MyGame::Example::StatT(*o.testempty) : nullptr),
+ testbool(o.testbool),
+ testhashs32_fnv1(o.testhashs32_fnv1),
+ testhashu32_fnv1(o.testhashu32_fnv1),
+ testhashs64_fnv1(o.testhashs64_fnv1),
+ testhashu64_fnv1(o.testhashu64_fnv1),
+ testhashs32_fnv1a(o.testhashs32_fnv1a),
+ testhashu32_fnv1a(o.testhashu32_fnv1a),
+ testhashs64_fnv1a(o.testhashs64_fnv1a),
+ testhashu64_fnv1a(o.testhashu64_fnv1a),
+ testarrayofbools(o.testarrayofbools),
+ testf(o.testf),
+ testf2(o.testf2),
+ testf3(o.testf3),
+ testarrayofstring2(o.testarrayofstring2),
+ testarrayofsortedstruct(o.testarrayofsortedstruct),
+ flex(o.flex),
+ test5(o.test5),
+ vector_of_longs(o.vector_of_longs),
+ vector_of_doubles(o.vector_of_doubles),
+ parent_namespace_test((o.parent_namespace_test) ? new MyGame::InParentNamespaceT(*o.parent_namespace_test) : nullptr),
+ single_weak_reference(o.single_weak_reference),
+ vector_of_weak_references(o.vector_of_weak_references),
+ co_owning_reference(o.co_owning_reference),
+ non_owning_reference(o.non_owning_reference),
+ vector_of_non_owning_references(o.vector_of_non_owning_references),
+ any_unique(o.any_unique),
+ any_ambiguous(o.any_ambiguous),
+ vector_of_enums(o.vector_of_enums),
+ signed_enum(o.signed_enum),
+ testrequirednestedflatbuffer(o.testrequirednestedflatbuffer),
+ native_inline(o.native_inline),
+ long_enum_non_enum_default(o.long_enum_non_enum_default),
+ long_enum_normal_default(o.long_enum_normal_default) {
+ testarrayoftables.reserve(o.testarrayoftables.size());
+ for (const auto &testarrayoftables_ : o.testarrayoftables) { testarrayoftables.emplace_back((testarrayoftables_) ? new MyGame::Example::MonsterT(*testarrayoftables_) : nullptr); }
+ vector_of_referrables.reserve(o.vector_of_referrables.size());
+ for (const auto &vector_of_referrables_ : o.vector_of_referrables) { vector_of_referrables.emplace_back((vector_of_referrables_) ? new MyGame::Example::ReferrableT(*vector_of_referrables_) : nullptr); }
+ vector_of_strong_referrables.reserve(o.vector_of_strong_referrables.size());
+ for (const auto &vector_of_strong_referrables_ : o.vector_of_strong_referrables) { vector_of_strong_referrables.emplace_back((vector_of_strong_referrables_) ? new MyGame::Example::ReferrableT(*vector_of_strong_referrables_) : nullptr); }
+ vector_of_co_owning_references.reserve(o.vector_of_co_owning_references.size());
+ for (const auto &vector_of_co_owning_references_ : o.vector_of_co_owning_references) { vector_of_co_owning_references.emplace_back((vector_of_co_owning_references_) ? new ReferrableT(*vector_of_co_owning_references_) : nullptr); }
+ scalar_key_sorted_tables.reserve(o.scalar_key_sorted_tables.size());
+ for (const auto &scalar_key_sorted_tables_ : o.scalar_key_sorted_tables) { scalar_key_sorted_tables.emplace_back((scalar_key_sorted_tables_) ? new MyGame::Example::StatT(*scalar_key_sorted_tables_) : nullptr); }
+}
+
+inline MonsterT &MonsterT::operator=(MonsterT o) FLATBUFFERS_NOEXCEPT {
+ std::swap(pos, o.pos);
+ std::swap(mana, o.mana);
+ std::swap(hp, o.hp);
+ std::swap(name, o.name);
+ std::swap(inventory, o.inventory);
+ std::swap(color, o.color);
+ std::swap(test, o.test);
+ std::swap(test4, o.test4);
+ std::swap(testarrayofstring, o.testarrayofstring);
+ std::swap(testarrayoftables, o.testarrayoftables);
+ std::swap(enemy, o.enemy);
+ std::swap(testnestedflatbuffer, o.testnestedflatbuffer);
+ std::swap(testempty, o.testempty);
+ std::swap(testbool, o.testbool);
+ std::swap(testhashs32_fnv1, o.testhashs32_fnv1);
+ std::swap(testhashu32_fnv1, o.testhashu32_fnv1);
+ std::swap(testhashs64_fnv1, o.testhashs64_fnv1);
+ std::swap(testhashu64_fnv1, o.testhashu64_fnv1);
+ std::swap(testhashs32_fnv1a, o.testhashs32_fnv1a);
+ std::swap(testhashu32_fnv1a, o.testhashu32_fnv1a);
+ std::swap(testhashs64_fnv1a, o.testhashs64_fnv1a);
+ std::swap(testhashu64_fnv1a, o.testhashu64_fnv1a);
+ std::swap(testarrayofbools, o.testarrayofbools);
+ std::swap(testf, o.testf);
+ std::swap(testf2, o.testf2);
+ std::swap(testf3, o.testf3);
+ std::swap(testarrayofstring2, o.testarrayofstring2);
+ std::swap(testarrayofsortedstruct, o.testarrayofsortedstruct);
+ std::swap(flex, o.flex);
+ std::swap(test5, o.test5);
+ std::swap(vector_of_longs, o.vector_of_longs);
+ std::swap(vector_of_doubles, o.vector_of_doubles);
+ std::swap(parent_namespace_test, o.parent_namespace_test);
+ std::swap(vector_of_referrables, o.vector_of_referrables);
+ std::swap(single_weak_reference, o.single_weak_reference);
+ std::swap(vector_of_weak_references, o.vector_of_weak_references);
+ std::swap(vector_of_strong_referrables, o.vector_of_strong_referrables);
+ std::swap(co_owning_reference, o.co_owning_reference);
+ std::swap(vector_of_co_owning_references, o.vector_of_co_owning_references);
+ std::swap(non_owning_reference, o.non_owning_reference);
+ std::swap(vector_of_non_owning_references, o.vector_of_non_owning_references);
+ std::swap(any_unique, o.any_unique);
+ std::swap(any_ambiguous, o.any_ambiguous);
+ std::swap(vector_of_enums, o.vector_of_enums);
+ std::swap(signed_enum, o.signed_enum);
+ std::swap(testrequirednestedflatbuffer, o.testrequirednestedflatbuffer);
+ std::swap(scalar_key_sorted_tables, o.scalar_key_sorted_tables);
+ std::swap(native_inline, o.native_inline);
+ std::swap(long_enum_non_enum_default, o.long_enum_non_enum_default);
+ std::swap(long_enum_normal_default, o.long_enum_normal_default);
+ return *this;
+}
+
+inline MonsterT *Monster::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<MonsterT>(new MonsterT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void Monster::UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = pos(); if (_e) _o->pos = flatbuffers::unique_ptr<MyGame::Example::Vec3>(new MyGame::Example::Vec3(*_e)); }
+ { auto _e = mana(); _o->mana = _e; }
+ { auto _e = hp(); _o->hp = _e; }
+ { auto _e = name(); if (_e) _o->name = _e->str(); }
+ { auto _e = inventory(); if (_e) { _o->inventory.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->inventory.begin()); } }
+ { auto _e = color(); _o->color = _e; }
+ { auto _e = test_type(); _o->test.type = _e; }
+ { auto _e = test(); if (_e) _o->test.value = MyGame::Example::AnyUnion::UnPack(_e, test_type(), _resolver); }
+ { auto _e = test4(); if (_e) { _o->test4.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test4[_i] = *_e->Get(_i); } } else { _o->test4.resize(0); } }
+ { auto _e = testarrayofstring(); if (_e) { _o->testarrayofstring.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring[_i] = _e->Get(_i)->str(); } } else { _o->testarrayofstring.resize(0); } }
+ { auto _e = testarrayoftables(); if (_e) { _o->testarrayoftables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->testarrayoftables[_i]) { _e->Get(_i)->UnPackTo(_o->testarrayoftables[_i].get(), _resolver); } else { _o->testarrayoftables[_i] = flatbuffers::unique_ptr<MyGame::Example::MonsterT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->testarrayoftables.resize(0); } }
+ { auto _e = enemy(); if (_e) { if(_o->enemy) { _e->UnPackTo(_o->enemy.get(), _resolver); } else { _o->enemy = flatbuffers::unique_ptr<MyGame::Example::MonsterT>(_e->UnPack(_resolver)); } } else if (_o->enemy) { _o->enemy.reset(); } }
+ { auto _e = testnestedflatbuffer(); if (_e) { _o->testnestedflatbuffer.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->testnestedflatbuffer.begin()); } }
+ { auto _e = testempty(); if (_e) { if(_o->testempty) { _e->UnPackTo(_o->testempty.get(), _resolver); } else { _o->testempty = flatbuffers::unique_ptr<MyGame::Example::StatT>(_e->UnPack(_resolver)); } } else if (_o->testempty) { _o->testempty.reset(); } }
+ { auto _e = testbool(); _o->testbool = _e; }
+ { auto _e = testhashs32_fnv1(); _o->testhashs32_fnv1 = _e; }
+ { auto _e = testhashu32_fnv1(); _o->testhashu32_fnv1 = _e; }
+ { auto _e = testhashs64_fnv1(); _o->testhashs64_fnv1 = _e; }
+ { auto _e = testhashu64_fnv1(); _o->testhashu64_fnv1 = _e; }
+ { auto _e = testhashs32_fnv1a(); _o->testhashs32_fnv1a = _e; }
+ { auto _e = testhashu32_fnv1a(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->testhashu32_fnv1a), static_cast<flatbuffers::hash_value_t>(_e)); else _o->testhashu32_fnv1a = nullptr; }
+ { auto _e = testhashs64_fnv1a(); _o->testhashs64_fnv1a = _e; }
+ { auto _e = testhashu64_fnv1a(); _o->testhashu64_fnv1a = _e; }
+ { auto _e = testarrayofbools(); if (_e) { _o->testarrayofbools.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofbools[_i] = _e->Get(_i) != 0; } } else { _o->testarrayofbools.resize(0); } }
+ { auto _e = testf(); _o->testf = _e; }
+ { auto _e = testf2(); _o->testf2 = _e; }
+ { auto _e = testf3(); _o->testf3 = _e; }
+ { auto _e = testarrayofstring2(); if (_e) { _o->testarrayofstring2.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring2[_i] = _e->Get(_i)->str(); } } else { _o->testarrayofstring2.resize(0); } }
+ { auto _e = testarrayofsortedstruct(); if (_e) { _o->testarrayofsortedstruct.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofsortedstruct[_i] = *_e->Get(_i); } } else { _o->testarrayofsortedstruct.resize(0); } }
+ { auto _e = flex(); if (_e) { _o->flex.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->flex.begin()); } }
+ { auto _e = test5(); if (_e) { _o->test5.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test5[_i] = *_e->Get(_i); } } else { _o->test5.resize(0); } }
+ { auto _e = vector_of_longs(); if (_e) { _o->vector_of_longs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_longs[_i] = _e->Get(_i); } } else { _o->vector_of_longs.resize(0); } }
+ { auto _e = vector_of_doubles(); if (_e) { _o->vector_of_doubles.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_doubles[_i] = _e->Get(_i); } } else { _o->vector_of_doubles.resize(0); } }
+ { auto _e = parent_namespace_test(); if (_e) { if(_o->parent_namespace_test) { _e->UnPackTo(_o->parent_namespace_test.get(), _resolver); } else { _o->parent_namespace_test = flatbuffers::unique_ptr<MyGame::InParentNamespaceT>(_e->UnPack(_resolver)); } } else if (_o->parent_namespace_test) { _o->parent_namespace_test.reset(); } }
+ { auto _e = vector_of_referrables(); if (_e) { _o->vector_of_referrables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->vector_of_referrables[_i]) { _e->Get(_i)->UnPackTo(_o->vector_of_referrables[_i].get(), _resolver); } else { _o->vector_of_referrables[_i] = flatbuffers::unique_ptr<MyGame::Example::ReferrableT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->vector_of_referrables.resize(0); } }
+ { auto _e = single_weak_reference(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->single_weak_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->single_weak_reference = nullptr; }
+ { auto _e = vector_of_weak_references(); if (_e) { _o->vector_of_weak_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { /*vector resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_weak_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i))); else _o->vector_of_weak_references[_i] = nullptr; } } else { _o->vector_of_weak_references.resize(0); } }
+ { auto _e = vector_of_strong_referrables(); if (_e) { _o->vector_of_strong_referrables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->vector_of_strong_referrables[_i]) { _e->Get(_i)->UnPackTo(_o->vector_of_strong_referrables[_i].get(), _resolver); } else { _o->vector_of_strong_referrables[_i] = flatbuffers::unique_ptr<MyGame::Example::ReferrableT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->vector_of_strong_referrables.resize(0); } }
+ { auto _e = co_owning_reference(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->co_owning_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->co_owning_reference = nullptr; }
+ { auto _e = vector_of_co_owning_references(); if (_e) { _o->vector_of_co_owning_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { /*vector resolver, default_ptr_type*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_co_owning_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i)));/* else do nothing */; } } else { _o->vector_of_co_owning_references.resize(0); } }
+ { auto _e = non_owning_reference(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->non_owning_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->non_owning_reference = nullptr; }
+ { auto _e = vector_of_non_owning_references(); if (_e) { _o->vector_of_non_owning_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { /*vector resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_non_owning_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i))); else _o->vector_of_non_owning_references[_i] = nullptr; } } else { _o->vector_of_non_owning_references.resize(0); } }
+ { auto _e = any_unique_type(); _o->any_unique.type = _e; }
+ { auto _e = any_unique(); if (_e) _o->any_unique.value = MyGame::Example::AnyUniqueAliasesUnion::UnPack(_e, any_unique_type(), _resolver); }
+ { auto _e = any_ambiguous_type(); _o->any_ambiguous.type = _e; }
+ { auto _e = any_ambiguous(); if (_e) _o->any_ambiguous.value = MyGame::Example::AnyAmbiguousAliasesUnion::UnPack(_e, any_ambiguous_type(), _resolver); }
+ { auto _e = vector_of_enums(); if (_e) { _o->vector_of_enums.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_enums[_i] = static_cast<MyGame::Example::Color>(_e->Get(_i)); } } else { _o->vector_of_enums.resize(0); } }
+ { auto _e = signed_enum(); _o->signed_enum = _e; }
+ { auto _e = testrequirednestedflatbuffer(); if (_e) { _o->testrequirednestedflatbuffer.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->testrequirednestedflatbuffer.begin()); } }
+ { auto _e = scalar_key_sorted_tables(); if (_e) { _o->scalar_key_sorted_tables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->scalar_key_sorted_tables[_i]) { _e->Get(_i)->UnPackTo(_o->scalar_key_sorted_tables[_i].get(), _resolver); } else { _o->scalar_key_sorted_tables[_i] = flatbuffers::unique_ptr<MyGame::Example::StatT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->scalar_key_sorted_tables.resize(0); } }
+ { auto _e = native_inline(); if (_e) _o->native_inline = *_e; }
+ { auto _e = long_enum_non_enum_default(); _o->long_enum_non_enum_default = _e; }
+ { auto _e = long_enum_normal_default(); _o->long_enum_normal_default = _e; }
+}
+
+inline flatbuffers::Offset<Monster> Monster::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateMonster(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const MonsterT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _pos = _o->pos ? _o->pos.get() : nullptr;
+ auto _mana = _o->mana;
+ auto _hp = _o->hp;
+ auto _name = _fbb.CreateString(_o->name);
+ auto _inventory = _o->inventory.size() ? _fbb.CreateVector(_o->inventory) : 0;
+ auto _color = _o->color;
+ auto _test_type = _o->test.type;
+ auto _test = _o->test.Pack(_fbb);
+ auto _test4 = _o->test4.size() ? _fbb.CreateVectorOfStructs(_o->test4) : 0;
+ auto _testarrayofstring = _o->testarrayofstring.size() ? _fbb.CreateVectorOfStrings(_o->testarrayofstring) : 0;
+ auto _testarrayoftables = _o->testarrayoftables.size() ? _fbb.CreateVector<flatbuffers::Offset<MyGame::Example::Monster>> (_o->testarrayoftables.size(), [](size_t i, _VectorArgs *__va) { return CreateMonster(*__va->__fbb, __va->__o->testarrayoftables[i].get(), __va->__rehasher); }, &_va ) : 0;
+ auto _enemy = _o->enemy ? CreateMonster(_fbb, _o->enemy.get(), _rehasher) : 0;
+ auto _testnestedflatbuffer = _o->testnestedflatbuffer.size() ? _fbb.CreateVector(_o->testnestedflatbuffer) : 0;
+ auto _testempty = _o->testempty ? CreateStat(_fbb, _o->testempty.get(), _rehasher) : 0;
+ auto _testbool = _o->testbool;
+ auto _testhashs32_fnv1 = _o->testhashs32_fnv1;
+ auto _testhashu32_fnv1 = _o->testhashu32_fnv1;
+ auto _testhashs64_fnv1 = _o->testhashs64_fnv1;
+ auto _testhashu64_fnv1 = _o->testhashu64_fnv1;
+ auto _testhashs32_fnv1a = _o->testhashs32_fnv1a;
+ auto _testhashu32_fnv1a = _rehasher ? static_cast<uint32_t>((*_rehasher)(_o->testhashu32_fnv1a)) : 0;
+ auto _testhashs64_fnv1a = _o->testhashs64_fnv1a;
+ auto _testhashu64_fnv1a = _o->testhashu64_fnv1a;
+ auto _testarrayofbools = _o->testarrayofbools.size() ? _fbb.CreateVector(_o->testarrayofbools) : 0;
+ auto _testf = _o->testf;
+ auto _testf2 = _o->testf2;
+ auto _testf3 = _o->testf3;
+ auto _testarrayofstring2 = _o->testarrayofstring2.size() ? _fbb.CreateVectorOfStrings(_o->testarrayofstring2) : 0;
+ auto _testarrayofsortedstruct = _o->testarrayofsortedstruct.size() ? _fbb.CreateVectorOfStructs(_o->testarrayofsortedstruct) : 0;
+ auto _flex = _o->flex.size() ? _fbb.CreateVector(_o->flex) : 0;
+ auto _test5 = _o->test5.size() ? _fbb.CreateVectorOfStructs(_o->test5) : 0;
+ auto _vector_of_longs = _o->vector_of_longs.size() ? _fbb.CreateVector(_o->vector_of_longs) : 0;
+ auto _vector_of_doubles = _o->vector_of_doubles.size() ? _fbb.CreateVector(_o->vector_of_doubles) : 0;
+ auto _parent_namespace_test = _o->parent_namespace_test ? CreateInParentNamespace(_fbb, _o->parent_namespace_test.get(), _rehasher) : 0;
+ auto _vector_of_referrables = _o->vector_of_referrables.size() ? _fbb.CreateVector<flatbuffers::Offset<MyGame::Example::Referrable>> (_o->vector_of_referrables.size(), [](size_t i, _VectorArgs *__va) { return CreateReferrable(*__va->__fbb, __va->__o->vector_of_referrables[i].get(), __va->__rehasher); }, &_va ) : 0;
+ auto _single_weak_reference = _rehasher ? static_cast<uint64_t>((*_rehasher)(_o->single_weak_reference)) : 0;
+ auto _vector_of_weak_references = _o->vector_of_weak_references.size() ? _fbb.CreateVector<uint64_t>(_o->vector_of_weak_references.size(), [](size_t i, _VectorArgs *__va) { return __va->__rehasher ? static_cast<uint64_t>((*__va->__rehasher)(__va->__o->vector_of_weak_references[i])) : 0; }, &_va ) : 0;
+ auto _vector_of_strong_referrables = _o->vector_of_strong_referrables.size() ? _fbb.CreateVector<flatbuffers::Offset<MyGame::Example::Referrable>> (_o->vector_of_strong_referrables.size(), [](size_t i, _VectorArgs *__va) { return CreateReferrable(*__va->__fbb, __va->__o->vector_of_strong_referrables[i].get(), __va->__rehasher); }, &_va ) : 0;
+ auto _co_owning_reference = _rehasher ? static_cast<uint64_t>((*_rehasher)(_o->co_owning_reference)) : 0;
+ auto _vector_of_co_owning_references = _o->vector_of_co_owning_references.size() ? _fbb.CreateVector<uint64_t>(_o->vector_of_co_owning_references.size(), [](size_t i, _VectorArgs *__va) { return __va->__rehasher ? static_cast<uint64_t>((*__va->__rehasher)(__va->__o->vector_of_co_owning_references[i].get())) : 0; }, &_va ) : 0;
+ auto _non_owning_reference = _rehasher ? static_cast<uint64_t>((*_rehasher)(_o->non_owning_reference)) : 0;
+ auto _vector_of_non_owning_references = _o->vector_of_non_owning_references.size() ? _fbb.CreateVector<uint64_t>(_o->vector_of_non_owning_references.size(), [](size_t i, _VectorArgs *__va) { return __va->__rehasher ? static_cast<uint64_t>((*__va->__rehasher)(__va->__o->vector_of_non_owning_references[i])) : 0; }, &_va ) : 0;
+ auto _any_unique_type = _o->any_unique.type;
+ auto _any_unique = _o->any_unique.Pack(_fbb);
+ auto _any_ambiguous_type = _o->any_ambiguous.type;
+ auto _any_ambiguous = _o->any_ambiguous.Pack(_fbb);
+ auto _vector_of_enums = _o->vector_of_enums.size() ? _fbb.CreateVectorScalarCast<uint8_t>(flatbuffers::data(_o->vector_of_enums), _o->vector_of_enums.size()) : 0;
+ auto _signed_enum = _o->signed_enum;
+ auto _testrequirednestedflatbuffer = _o->testrequirednestedflatbuffer.size() ? _fbb.CreateVector(_o->testrequirednestedflatbuffer) : 0;
+ auto _scalar_key_sorted_tables = _o->scalar_key_sorted_tables.size() ? _fbb.CreateVector<flatbuffers::Offset<MyGame::Example::Stat>> (_o->scalar_key_sorted_tables.size(), [](size_t i, _VectorArgs *__va) { return CreateStat(*__va->__fbb, __va->__o->scalar_key_sorted_tables[i].get(), __va->__rehasher); }, &_va ) : 0;
+ auto _native_inline = &_o->native_inline;
+ auto _long_enum_non_enum_default = _o->long_enum_non_enum_default;
+ auto _long_enum_normal_default = _o->long_enum_normal_default;
+ return MyGame::Example::CreateMonster(
+ _fbb,
+ _pos,
+ _mana,
+ _hp,
+ _name,
+ _inventory,
+ _color,
+ _test_type,
+ _test,
+ _test4,
+ _testarrayofstring,
+ _testarrayoftables,
+ _enemy,
+ _testnestedflatbuffer,
+ _testempty,
+ _testbool,
+ _testhashs32_fnv1,
+ _testhashu32_fnv1,
+ _testhashs64_fnv1,
+ _testhashu64_fnv1,
+ _testhashs32_fnv1a,
+ _testhashu32_fnv1a,
+ _testhashs64_fnv1a,
+ _testhashu64_fnv1a,
+ _testarrayofbools,
+ _testf,
+ _testf2,
+ _testf3,
+ _testarrayofstring2,
+ _testarrayofsortedstruct,
+ _flex,
+ _test5,
+ _vector_of_longs,
+ _vector_of_doubles,
+ _parent_namespace_test,
+ _vector_of_referrables,
+ _single_weak_reference,
+ _vector_of_weak_references,
+ _vector_of_strong_referrables,
+ _co_owning_reference,
+ _vector_of_co_owning_references,
+ _non_owning_reference,
+ _vector_of_non_owning_references,
+ _any_unique_type,
+ _any_unique,
+ _any_ambiguous_type,
+ _any_ambiguous,
+ _vector_of_enums,
+ _signed_enum,
+ _testrequirednestedflatbuffer,
+ _scalar_key_sorted_tables,
+ _native_inline,
+ _long_enum_non_enum_default,
+ _long_enum_normal_default);
+}
+
+
+inline bool operator==(const TypeAliasesT &lhs, const TypeAliasesT &rhs) {
+ return
+ (lhs.i8 == rhs.i8) &&
+ (lhs.u8 == rhs.u8) &&
+ (lhs.i16 == rhs.i16) &&
+ (lhs.u16 == rhs.u16) &&
+ (lhs.i32 == rhs.i32) &&
+ (lhs.u32 == rhs.u32) &&
+ (lhs.i64 == rhs.i64) &&
+ (lhs.u64 == rhs.u64) &&
+ (lhs.f32 == rhs.f32) &&
+ (lhs.f64 == rhs.f64) &&
+ (lhs.v8 == rhs.v8) &&
+ (lhs.vf64 == rhs.vf64);
+}
+
+inline bool operator!=(const TypeAliasesT &lhs, const TypeAliasesT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline TypeAliasesT *TypeAliases::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<TypeAliasesT>(new TypeAliasesT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void TypeAliases::UnPackTo(TypeAliasesT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = i8(); _o->i8 = _e; }
+ { auto _e = u8(); _o->u8 = _e; }
+ { auto _e = i16(); _o->i16 = _e; }
+ { auto _e = u16(); _o->u16 = _e; }
+ { auto _e = i32(); _o->i32 = _e; }
+ { auto _e = u32(); _o->u32 = _e; }
+ { auto _e = i64(); _o->i64 = _e; }
+ { auto _e = u64(); _o->u64 = _e; }
+ { auto _e = f32(); _o->f32 = _e; }
+ { auto _e = f64(); _o->f64 = _e; }
+ { auto _e = v8(); if (_e) { _o->v8.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->v8.begin()); } }
+ { auto _e = vf64(); if (_e) { _o->vf64.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vf64[_i] = _e->Get(_i); } } else { _o->vf64.resize(0); } }
+}
+
+inline flatbuffers::Offset<TypeAliases> TypeAliases::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateTypeAliases(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<TypeAliases> CreateTypeAliases(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TypeAliasesT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _i8 = _o->i8;
+ auto _u8 = _o->u8;
+ auto _i16 = _o->i16;
+ auto _u16 = _o->u16;
+ auto _i32 = _o->i32;
+ auto _u32 = _o->u32;
+ auto _i64 = _o->i64;
+ auto _u64 = _o->u64;
+ auto _f32 = _o->f32;
+ auto _f64 = _o->f64;
+ auto _v8 = _o->v8.size() ? _fbb.CreateVector(_o->v8) : 0;
+ auto _vf64 = _o->vf64.size() ? _fbb.CreateVector(_o->vf64) : 0;
+ return MyGame::Example::CreateTypeAliases(
+ _fbb,
+ _i8,
+ _u8,
+ _i16,
+ _u16,
+ _i32,
+ _u32,
+ _i64,
+ _u64,
+ _f32,
+ _f64,
+ _v8,
+ _vf64);
+}
+
+inline bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type) {
+ switch (type) {
+ case Any_NONE: {
+ return true;
+ }
+ case Any_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case Any_TestSimpleTableWithEnum: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnum *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case Any_MyGame_Example2_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ default: return true;
+ }
+}
+
+inline bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
+ if (!values || !types) return !values && !types;
+ if (values->size() != types->size()) return false;
+ for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
+ if (!VerifyAny(
+ verifier, values->Get(i), types->GetEnum<Any>(i))) {
+ return false;
+ }
+ }
+ return true;
+}
+
+inline void *AnyUnion::UnPack(const void *obj, Any type, const flatbuffers::resolver_function_t *resolver) {
+ (void)resolver;
+ switch (type) {
+ case Any_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case Any_TestSimpleTableWithEnum: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnum *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case Any_MyGame_Example2_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ default: return nullptr;
+ }
+}
+
+inline flatbuffers::Offset<void> AnyUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
+ (void)_rehasher;
+ switch (type) {
+ case Any_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ case Any_TestSimpleTableWithEnum: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(value);
+ return CreateTestSimpleTableWithEnum(_fbb, ptr, _rehasher).Union();
+ }
+ case Any_MyGame_Example2_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ default: return 0;
+ }
+}
+
+inline AnyUnion::AnyUnion(const AnyUnion &u) : type(u.type), value(nullptr) {
+ switch (type) {
+ case Any_Monster: {
+ value = new MyGame::Example::MonsterT(*reinterpret_cast<MyGame::Example::MonsterT *>(u.value));
+ break;
+ }
+ case Any_TestSimpleTableWithEnum: {
+ value = new MyGame::Example::TestSimpleTableWithEnumT(*reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(u.value));
+ break;
+ }
+ case Any_MyGame_Example2_Monster: {
+ value = new MyGame::Example2::MonsterT(*reinterpret_cast<MyGame::Example2::MonsterT *>(u.value));
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+inline void AnyUnion::Reset() {
+ switch (type) {
+ case Any_Monster: {
+ auto ptr = reinterpret_cast<MyGame::Example::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ case Any_TestSimpleTableWithEnum: {
+ auto ptr = reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(value);
+ delete ptr;
+ break;
+ }
+ case Any_MyGame_Example2_Monster: {
+ auto ptr = reinterpret_cast<MyGame::Example2::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ default: break;
+ }
+ value = nullptr;
+ type = Any_NONE;
+}
+
+inline bool VerifyAnyUniqueAliases(flatbuffers::Verifier &verifier, const void *obj, AnyUniqueAliases type) {
+ switch (type) {
+ case AnyUniqueAliases_NONE: {
+ return true;
+ }
+ case AnyUniqueAliases_M: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case AnyUniqueAliases_TS: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnum *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case AnyUniqueAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ default: return true;
+ }
+}
+
+inline bool VerifyAnyUniqueAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
+ if (!values || !types) return !values && !types;
+ if (values->size() != types->size()) return false;
+ for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
+ if (!VerifyAnyUniqueAliases(
+ verifier, values->Get(i), types->GetEnum<AnyUniqueAliases>(i))) {
+ return false;
+ }
+ }
+ return true;
+}
+
+inline void *AnyUniqueAliasesUnion::UnPack(const void *obj, AnyUniqueAliases type, const flatbuffers::resolver_function_t *resolver) {
+ (void)resolver;
+ switch (type) {
+ case AnyUniqueAliases_M: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case AnyUniqueAliases_TS: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnum *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case AnyUniqueAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ default: return nullptr;
+ }
+}
+
+inline flatbuffers::Offset<void> AnyUniqueAliasesUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
+ (void)_rehasher;
+ switch (type) {
+ case AnyUniqueAliases_M: {
+ auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ case AnyUniqueAliases_TS: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(value);
+ return CreateTestSimpleTableWithEnum(_fbb, ptr, _rehasher).Union();
+ }
+ case AnyUniqueAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ default: return 0;
+ }
+}
+
+inline AnyUniqueAliasesUnion::AnyUniqueAliasesUnion(const AnyUniqueAliasesUnion &u) : type(u.type), value(nullptr) {
+ switch (type) {
+ case AnyUniqueAliases_M: {
+ value = new MyGame::Example::MonsterT(*reinterpret_cast<MyGame::Example::MonsterT *>(u.value));
+ break;
+ }
+ case AnyUniqueAliases_TS: {
+ value = new MyGame::Example::TestSimpleTableWithEnumT(*reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(u.value));
+ break;
+ }
+ case AnyUniqueAliases_M2: {
+ value = new MyGame::Example2::MonsterT(*reinterpret_cast<MyGame::Example2::MonsterT *>(u.value));
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+inline void AnyUniqueAliasesUnion::Reset() {
+ switch (type) {
+ case AnyUniqueAliases_M: {
+ auto ptr = reinterpret_cast<MyGame::Example::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ case AnyUniqueAliases_TS: {
+ auto ptr = reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(value);
+ delete ptr;
+ break;
+ }
+ case AnyUniqueAliases_M2: {
+ auto ptr = reinterpret_cast<MyGame::Example2::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ default: break;
+ }
+ value = nullptr;
+ type = AnyUniqueAliases_NONE;
+}
+
+inline bool VerifyAnyAmbiguousAliases(flatbuffers::Verifier &verifier, const void *obj, AnyAmbiguousAliases type) {
+ switch (type) {
+ case AnyAmbiguousAliases_NONE: {
+ return true;
+ }
+ case AnyAmbiguousAliases_M1: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case AnyAmbiguousAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case AnyAmbiguousAliases_M3: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ default: return true;
+ }
+}
+
+inline bool VerifyAnyAmbiguousAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
+ if (!values || !types) return !values && !types;
+ if (values->size() != types->size()) return false;
+ for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
+ if (!VerifyAnyAmbiguousAliases(
+ verifier, values->Get(i), types->GetEnum<AnyAmbiguousAliases>(i))) {
+ return false;
+ }
+ }
+ return true;
+}
+
+inline void *AnyAmbiguousAliasesUnion::UnPack(const void *obj, AnyAmbiguousAliases type, const flatbuffers::resolver_function_t *resolver) {
+ (void)resolver;
+ switch (type) {
+ case AnyAmbiguousAliases_M1: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case AnyAmbiguousAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case AnyAmbiguousAliases_M3: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ default: return nullptr;
+ }
+}
+
+inline flatbuffers::Offset<void> AnyAmbiguousAliasesUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
+ (void)_rehasher;
+ switch (type) {
+ case AnyAmbiguousAliases_M1: {
+ auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ case AnyAmbiguousAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ case AnyAmbiguousAliases_M3: {
+ auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ default: return 0;
+ }
+}
+
+inline AnyAmbiguousAliasesUnion::AnyAmbiguousAliasesUnion(const AnyAmbiguousAliasesUnion &u) : type(u.type), value(nullptr) {
+ switch (type) {
+ case AnyAmbiguousAliases_M1: {
+ value = new MyGame::Example::MonsterT(*reinterpret_cast<MyGame::Example::MonsterT *>(u.value));
+ break;
+ }
+ case AnyAmbiguousAliases_M2: {
+ value = new MyGame::Example::MonsterT(*reinterpret_cast<MyGame::Example::MonsterT *>(u.value));
+ break;
+ }
+ case AnyAmbiguousAliases_M3: {
+ value = new MyGame::Example::MonsterT(*reinterpret_cast<MyGame::Example::MonsterT *>(u.value));
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+inline void AnyAmbiguousAliasesUnion::Reset() {
+ switch (type) {
+ case AnyAmbiguousAliases_M1: {
+ auto ptr = reinterpret_cast<MyGame::Example::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ case AnyAmbiguousAliases_M2: {
+ auto ptr = reinterpret_cast<MyGame::Example::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ case AnyAmbiguousAliases_M3: {
+ auto ptr = reinterpret_cast<MyGame::Example::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ default: break;
+ }
+ value = nullptr;
+ type = AnyAmbiguousAliases_NONE;
+}
+
+inline const flatbuffers::TypeTable *ColorTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_UCHAR, 0, 0 },
+ { flatbuffers::ET_UCHAR, 0, 0 },
+ { flatbuffers::ET_UCHAR, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::ColorTypeTable
+ };
+ static const int64_t values[] = { 1, 2, 8 };
+ static const char * const names[] = {
+ "Red",
+ "Green",
+ "Blue"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *RaceTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_CHAR, 0, 0 },
+ { flatbuffers::ET_CHAR, 0, 0 },
+ { flatbuffers::ET_CHAR, 0, 0 },
+ { flatbuffers::ET_CHAR, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::RaceTypeTable
+ };
+ static const int64_t values[] = { -1, 0, 1, 2 };
+ static const char * const names[] = {
+ "None",
+ "Human",
+ "Dwarf",
+ "Elf"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_ENUM, 4, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *LongEnumTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_ULONG, 0, 0 },
+ { flatbuffers::ET_ULONG, 0, 0 },
+ { flatbuffers::ET_ULONG, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::LongEnumTypeTable
+ };
+ static const int64_t values[] = { 2ULL, 4ULL, 1099511627776ULL };
+ static const char * const names[] = {
+ "LongOne",
+ "LongTwo",
+ "LongBig"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *AnyTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 1 },
+ { flatbuffers::ET_SEQUENCE, 0, 2 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::MonsterTypeTable,
+ MyGame::Example::TestSimpleTableWithEnumTypeTable,
+ MyGame::Example2::MonsterTypeTable
+ };
+ static const char * const names[] = {
+ "NONE",
+ "Monster",
+ "TestSimpleTableWithEnum",
+ "MyGame_Example2_Monster"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_UNION, 4, type_codes, type_refs, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *AnyUniqueAliasesTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 1 },
+ { flatbuffers::ET_SEQUENCE, 0, 2 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::MonsterTypeTable,
+ MyGame::Example::TestSimpleTableWithEnumTypeTable,
+ MyGame::Example2::MonsterTypeTable
+ };
+ static const char * const names[] = {
+ "NONE",
+ "M",
+ "TS",
+ "M2"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_UNION, 4, type_codes, type_refs, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *AnyAmbiguousAliasesTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::MonsterTypeTable
+ };
+ static const char * const names[] = {
+ "NONE",
+ "M1",
+ "M2",
+ "M3"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_UNION, 4, type_codes, type_refs, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+} // namespace Example
+
+inline const flatbuffers::TypeTable *InParentNamespaceTypeTable() {
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 0, nullptr, nullptr, nullptr, nullptr, nullptr
+ };
+ return &tt;
+}
+
+namespace Example2 {
+
+inline const flatbuffers::TypeTable *MonsterTypeTable() {
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 0, nullptr, nullptr, nullptr, nullptr, nullptr
+ };
+ return &tt;
+}
+
+} // namespace Example2
+
+namespace Example {
+
+inline const flatbuffers::TypeTable *TestTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SHORT, 0, -1 },
+ { flatbuffers::ET_CHAR, 0, -1 }
+ };
+ static const int64_t values[] = { 0, 2, 4 };
+ static const char * const names[] = {
+ "a",
+ "b"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 2, type_codes, nullptr, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *TestSimpleTableWithEnumTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_UCHAR, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::ColorTypeTable
+ };
+ static const char * const names[] = {
+ "color"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 1, type_codes, type_refs, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *Vec3TypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_DOUBLE, 0, -1 },
+ { flatbuffers::ET_UCHAR, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 1 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::ColorTypeTable,
+ MyGame::Example::TestTypeTable
+ };
+ static const int64_t values[] = { 0, 4, 8, 16, 24, 26, 32 };
+ static const char * const names[] = {
+ "x",
+ "y",
+ "z",
+ "test1",
+ "test2",
+ "test3"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 6, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *AbilityTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_UINT, 0, -1 },
+ { flatbuffers::ET_UINT, 0, -1 }
+ };
+ static const int64_t values[] = { 0, 4, 8 };
+ static const char * const names[] = {
+ "id",
+ "distance"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 2, type_codes, nullptr, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *StructOfStructsTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 1 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::AbilityTypeTable,
+ MyGame::Example::TestTypeTable
+ };
+ static const int64_t values[] = { 0, 8, 12, 20 };
+ static const char * const names[] = {
+ "a",
+ "b",
+ "c"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 3, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *StructOfStructsOfStructsTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::StructOfStructsTypeTable
+ };
+ static const int64_t values[] = { 0, 20 };
+ static const char * const names[] = {
+ "a"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 1, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *StatTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_STRING, 0, -1 },
+ { flatbuffers::ET_LONG, 0, -1 },
+ { flatbuffers::ET_USHORT, 0, -1 }
+ };
+ static const char * const names[] = {
+ "id",
+ "val",
+ "count"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 3, type_codes, nullptr, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *ReferrableTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_ULONG, 0, -1 }
+ };
+ static const char * const names[] = {
+ "id"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 1, type_codes, nullptr, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *MonsterTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SHORT, 0, -1 },
+ { flatbuffers::ET_SHORT, 0, -1 },
+ { flatbuffers::ET_STRING, 0, -1 },
+ { flatbuffers::ET_BOOL, 0, -1 },
+ { flatbuffers::ET_UCHAR, 1, -1 },
+ { flatbuffers::ET_UCHAR, 0, 1 },
+ { flatbuffers::ET_UTYPE, 0, 2 },
+ { flatbuffers::ET_SEQUENCE, 0, 2 },
+ { flatbuffers::ET_SEQUENCE, 1, 3 },
+ { flatbuffers::ET_STRING, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 1, 4 },
+ { flatbuffers::ET_SEQUENCE, 0, 4 },
+ { flatbuffers::ET_UCHAR, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 5 },
+ { flatbuffers::ET_BOOL, 0, -1 },
+ { flatbuffers::ET_INT, 0, -1 },
+ { flatbuffers::ET_UINT, 0, -1 },
+ { flatbuffers::ET_LONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_INT, 0, -1 },
+ { flatbuffers::ET_UINT, 0, -1 },
+ { flatbuffers::ET_LONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_BOOL, 1, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_STRING, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 1, 6 },
+ { flatbuffers::ET_UCHAR, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 1, 3 },
+ { flatbuffers::ET_LONG, 1, -1 },
+ { flatbuffers::ET_DOUBLE, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 7 },
+ { flatbuffers::ET_SEQUENCE, 1, 8 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 1, 8 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 1, -1 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 1, -1 },
+ { flatbuffers::ET_UTYPE, 0, 9 },
+ { flatbuffers::ET_SEQUENCE, 0, 9 },
+ { flatbuffers::ET_UTYPE, 0, 10 },
+ { flatbuffers::ET_SEQUENCE, 0, 10 },
+ { flatbuffers::ET_UCHAR, 1, 1 },
+ { flatbuffers::ET_CHAR, 0, 11 },
+ { flatbuffers::ET_UCHAR, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 1, 5 },
+ { flatbuffers::ET_SEQUENCE, 0, 3 },
+ { flatbuffers::ET_ULONG, 0, 12 },
+ { flatbuffers::ET_ULONG, 0, 12 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::Vec3TypeTable,
+ MyGame::Example::ColorTypeTable,
+ MyGame::Example::AnyTypeTable,
+ MyGame::Example::TestTypeTable,
+ MyGame::Example::MonsterTypeTable,
+ MyGame::Example::StatTypeTable,
+ MyGame::Example::AbilityTypeTable,
+ MyGame::InParentNamespaceTypeTable,
+ MyGame::Example::ReferrableTypeTable,
+ MyGame::Example::AnyUniqueAliasesTypeTable,
+ MyGame::Example::AnyAmbiguousAliasesTypeTable,
+ MyGame::Example::RaceTypeTable,
+ MyGame::Example::LongEnumTypeTable
+ };
+ static const char * const names[] = {
+ "pos",
+ "mana",
+ "hp",
+ "name",
+ "friendly",
+ "inventory",
+ "color",
+ "test_type",
+ "test",
+ "test4",
+ "testarrayofstring",
+ "testarrayoftables",
+ "enemy",
+ "testnestedflatbuffer",
+ "testempty",
+ "testbool",
+ "testhashs32_fnv1",
+ "testhashu32_fnv1",
+ "testhashs64_fnv1",
+ "testhashu64_fnv1",
+ "testhashs32_fnv1a",
+ "testhashu32_fnv1a",
+ "testhashs64_fnv1a",
+ "testhashu64_fnv1a",
+ "testarrayofbools",
+ "testf",
+ "testf2",
+ "testf3",
+ "testarrayofstring2",
+ "testarrayofsortedstruct",
+ "flex",
+ "test5",
+ "vector_of_longs",
+ "vector_of_doubles",
+ "parent_namespace_test",
+ "vector_of_referrables",
+ "single_weak_reference",
+ "vector_of_weak_references",
+ "vector_of_strong_referrables",
+ "co_owning_reference",
+ "vector_of_co_owning_references",
+ "non_owning_reference",
+ "vector_of_non_owning_references",
+ "any_unique_type",
+ "any_unique",
+ "any_ambiguous_type",
+ "any_ambiguous",
+ "vector_of_enums",
+ "signed_enum",
+ "testrequirednestedflatbuffer",
+ "scalar_key_sorted_tables",
+ "native_inline",
+ "long_enum_non_enum_default",
+ "long_enum_normal_default"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 54, type_codes, type_refs, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *TypeAliasesTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_CHAR, 0, -1 },
+ { flatbuffers::ET_UCHAR, 0, -1 },
+ { flatbuffers::ET_SHORT, 0, -1 },
+ { flatbuffers::ET_USHORT, 0, -1 },
+ { flatbuffers::ET_INT, 0, -1 },
+ { flatbuffers::ET_UINT, 0, -1 },
+ { flatbuffers::ET_LONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_DOUBLE, 0, -1 },
+ { flatbuffers::ET_CHAR, 1, -1 },
+ { flatbuffers::ET_DOUBLE, 1, -1 }
+ };
+ static const char * const names[] = {
+ "i8",
+ "u8",
+ "i16",
+ "u16",
+ "i32",
+ "u32",
+ "i64",
+ "u64",
+ "f32",
+ "f64",
+ "v8",
+ "vf64"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 12, type_codes, nullptr, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const MyGame::Example::Monster *GetMonster(const void *buf) {
+ return flatbuffers::GetRoot<MyGame::Example::Monster>(buf);
+}
+
+inline const MyGame::Example::Monster *GetSizePrefixedMonster(const void *buf) {
+ return flatbuffers::GetSizePrefixedRoot<MyGame::Example::Monster>(buf);
+}
+
+inline Monster *GetMutableMonster(void *buf) {
+ return flatbuffers::GetMutableRoot<Monster>(buf);
+}
+
+inline MyGame::Example::Monster *GetMutableSizePrefixedMonster(void *buf) {
+ return flatbuffers::GetMutableSizePrefixedRoot<MyGame::Example::Monster>(buf);
+}
+
+inline const char *MonsterIdentifier() {
+ return "MONS";
+}
+
+inline bool MonsterBufferHasIdentifier(const void *buf) {
+ return flatbuffers::BufferHasIdentifier(
+ buf, MonsterIdentifier());
+}
+
+inline bool SizePrefixedMonsterBufferHasIdentifier(const void *buf) {
+ return flatbuffers::BufferHasIdentifier(
+ buf, MonsterIdentifier(), true);
+}
+
+inline bool VerifyMonsterBuffer(
+ flatbuffers::Verifier &verifier) {
+ return verifier.VerifyBuffer<MyGame::Example::Monster>(MonsterIdentifier());
+}
+
+inline bool VerifySizePrefixedMonsterBuffer(
+ flatbuffers::Verifier &verifier) {
+ return verifier.VerifySizePrefixedBuffer<MyGame::Example::Monster>(MonsterIdentifier());
+}
+
+inline const char *MonsterExtension() {
+ return "mon";
+}
+
+inline void FinishMonsterBuffer(
+ flatbuffers::FlatBufferBuilder &fbb,
+ flatbuffers::Offset<MyGame::Example::Monster> root) {
+ fbb.Finish(root, MonsterIdentifier());
+}
+
+inline void FinishSizePrefixedMonsterBuffer(
+ flatbuffers::FlatBufferBuilder &fbb,
+ flatbuffers::Offset<MyGame::Example::Monster> root) {
+ fbb.FinishSizePrefixed(root, MonsterIdentifier());
+}
+
+inline flatbuffers::unique_ptr<MyGame::Example::MonsterT> UnPackMonster(
+ const void *buf,
+ const flatbuffers::resolver_function_t *res = nullptr) {
+ return flatbuffers::unique_ptr<MyGame::Example::MonsterT>(GetMonster(buf)->UnPack(res));
+}
+
+inline flatbuffers::unique_ptr<MyGame::Example::MonsterT> UnPackSizePrefixedMonster(
+ const void *buf,
+ const flatbuffers::resolver_function_t *res = nullptr) {
+ return flatbuffers::unique_ptr<MyGame::Example::MonsterT>(GetSizePrefixedMonster(buf)->UnPack(res));
+}
+
+} // namespace Example
+} // namespace MyGame
+
+#endif // FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_H_
diff --git a/tests/monster_test_suffix/filesuffix_only/monster_test.grpc.fb.cc b/tests/monster_test_suffix/filesuffix_only/monster_test.grpc.fb.cc
new file mode 100644
index 0000000..3ef89ce
--- /dev/null
+++ b/tests/monster_test_suffix/filesuffix_only/monster_test.grpc.fb.cc
@@ -0,0 +1,131 @@
+// Generated by the gRPC C++ plugin.
+// If you make any local change, they will be lost.
+// source: monster_test
+
+#include "monster_test_suffix.h"
+#include "monster_test.grpc.fb.h"
+
+#include <grpcpp/impl/codegen/async_stream.h>
+#include <grpcpp/impl/codegen/async_unary_call.h>
+#include <grpcpp/impl/codegen/channel_interface.h>
+#include <grpcpp/impl/codegen/client_unary_call.h>
+#include <grpcpp/impl/codegen/method_handler.h>
+#include <grpcpp/impl/codegen/rpc_service_method.h>
+#include <grpcpp/impl/codegen/service_type.h>
+#include <grpcpp/impl/codegen/sync_stream.h>
+namespace MyGame {
+namespace Example {
+
+static const char* MonsterStorage_method_names[] = {
+ "/MyGame.Example.MonsterStorage/Store",
+ "/MyGame.Example.MonsterStorage/Retrieve",
+ "/MyGame.Example.MonsterStorage/GetMaxHitPoint",
+ "/MyGame.Example.MonsterStorage/GetMinMaxHitPoints",
+};
+
+std::unique_ptr< MonsterStorage::Stub> MonsterStorage::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& /*options*/) {
+ std::unique_ptr< MonsterStorage::Stub> stub(new MonsterStorage::Stub(channel));
+ return stub;
+}
+
+MonsterStorage::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel)
+ : channel_(channel) , rpcmethod_Store_(MonsterStorage_method_names[0], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
+ , rpcmethod_Retrieve_(MonsterStorage_method_names[1], ::grpc::internal::RpcMethod::SERVER_STREAMING, channel)
+ , rpcmethod_GetMaxHitPoint_(MonsterStorage_method_names[2], ::grpc::internal::RpcMethod::CLIENT_STREAMING, channel)
+ , rpcmethod_GetMinMaxHitPoints_(MonsterStorage_method_names[3], ::grpc::internal::RpcMethod::BIDI_STREAMING, channel)
+ {}
+
+::grpc::Status MonsterStorage::Stub::Store(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, flatbuffers::grpc::Message<Stat>* response) {
+ return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_Store_, context, request, response);
+}
+
+::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::AsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return ::grpc::internal::ClientAsyncResponseReaderFactory< flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), cq, rpcmethod_Store_, context, request, true);
+}
+
+::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::PrepareAsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return ::grpc::internal::ClientAsyncResponseReaderFactory< flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), cq, rpcmethod_Store_, context, request, false);
+}
+
+::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::RetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) {
+ return ::grpc::internal::ClientReaderFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), rpcmethod_Retrieve_, context, request);
+}
+
+::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::AsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) {
+ return ::grpc::internal::ClientAsyncReaderFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), cq, rpcmethod_Retrieve_, context, request, true, tag);
+}
+
+::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::PrepareAsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) {
+ return ::grpc::internal::ClientAsyncReaderFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), cq, rpcmethod_Retrieve_, context, request, false, nullptr);
+}
+
+::grpc::ClientWriter< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::GetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response) {
+ return ::grpc::internal::ClientWriterFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), rpcmethod_GetMaxHitPoint_, context, response);
+}
+
+::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::AsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq, void* tag) {
+ return ::grpc::internal::ClientAsyncWriterFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), cq, rpcmethod_GetMaxHitPoint_, context, response, true, tag);
+}
+
+::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::PrepareAsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq) {
+ return ::grpc::internal::ClientAsyncWriterFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), cq, rpcmethod_GetMaxHitPoint_, context, response, false, nullptr);
+}
+
+::grpc::ClientReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::GetMinMaxHitPointsRaw(::grpc::ClientContext* context) {
+ return ::grpc::internal::ClientReaderWriterFactory< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), rpcmethod_GetMinMaxHitPoints_, context);
+}
+
+::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::AsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) {
+ return ::grpc::internal::ClientAsyncReaderWriterFactory< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), cq, rpcmethod_GetMinMaxHitPoints_, context, true, tag);
+}
+
+::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::PrepareAsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) {
+ return ::grpc::internal::ClientAsyncReaderWriterFactory< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), cq, rpcmethod_GetMinMaxHitPoints_, context, false, nullptr);
+}
+
+MonsterStorage::Service::Service() {
+ AddMethod(new ::grpc::internal::RpcServiceMethod(
+ MonsterStorage_method_names[0],
+ ::grpc::internal::RpcMethod::NORMAL_RPC,
+ new ::grpc::internal::RpcMethodHandler< MonsterStorage::Service, flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>(
+ std::mem_fn(&MonsterStorage::Service::Store), this)));
+ AddMethod(new ::grpc::internal::RpcServiceMethod(
+ MonsterStorage_method_names[1],
+ ::grpc::internal::RpcMethod::SERVER_STREAMING,
+ new ::grpc::internal::ServerStreamingHandler< MonsterStorage::Service, flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>(
+ std::mem_fn(&MonsterStorage::Service::Retrieve), this)));
+ AddMethod(new ::grpc::internal::RpcServiceMethod(
+ MonsterStorage_method_names[2],
+ ::grpc::internal::RpcMethod::CLIENT_STREAMING,
+ new ::grpc::internal::ClientStreamingHandler< MonsterStorage::Service, flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>(
+ std::mem_fn(&MonsterStorage::Service::GetMaxHitPoint), this)));
+ AddMethod(new ::grpc::internal::RpcServiceMethod(
+ MonsterStorage_method_names[3],
+ ::grpc::internal::RpcMethod::BIDI_STREAMING,
+ new ::grpc::internal::BidiStreamingHandler< MonsterStorage::Service, flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>(
+ std::mem_fn(&MonsterStorage::Service::GetMinMaxHitPoints), this)));
+}
+
+MonsterStorage::Service::~Service() {
+}
+
+::grpc::Status MonsterStorage::Service::Store(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Monster>* /*request*/, flatbuffers::grpc::Message<Stat>* /*response*/) {
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+}
+
+::grpc::Status MonsterStorage::Service::Retrieve(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Stat>* /*request*/, ::grpc::ServerWriter< flatbuffers::grpc::Message<Monster>>* /*writer*/) {
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+}
+
+::grpc::Status MonsterStorage::Service::GetMaxHitPoint(::grpc::ServerContext* /*context*/, ::grpc::ServerReader< flatbuffers::grpc::Message<Monster>>* /*reader*/, flatbuffers::grpc::Message<Stat>* /*response*/) {
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+}
+
+::grpc::Status MonsterStorage::Service::GetMinMaxHitPoints(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* /*stream*/) {
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+}
+
+
+} // namespace MyGame
+} // namespace Example
+
diff --git a/tests/monster_test_suffix/filesuffix_only/monster_test.grpc.fb.h b/tests/monster_test_suffix/filesuffix_only/monster_test.grpc.fb.h
new file mode 100644
index 0000000..a8f4b95
--- /dev/null
+++ b/tests/monster_test_suffix/filesuffix_only/monster_test.grpc.fb.h
@@ -0,0 +1,350 @@
+// Generated by the gRPC C++ plugin.
+// If you make any local change, they will be lost.
+// source: monster_test
+#ifndef GRPC_monster_5ftest__INCLUDED
+#define GRPC_monster_5ftest__INCLUDED
+
+#include "monster_test_suffix.h"
+#include "flatbuffers/grpc.h"
+
+#include <grpcpp/impl/codegen/async_stream.h>
+#include <grpcpp/impl/codegen/async_unary_call.h>
+#include <grpcpp/impl/codegen/method_handler.h>
+#include <grpcpp/impl/codegen/proto_utils.h>
+#include <grpcpp/impl/codegen/rpc_method.h>
+#include <grpcpp/impl/codegen/service_type.h>
+#include <grpcpp/impl/codegen/status.h>
+#include <grpcpp/impl/codegen/stub_options.h>
+#include <grpcpp/impl/codegen/sync_stream.h>
+
+namespace grpc {
+class CompletionQueue;
+class Channel;
+class ServerCompletionQueue;
+class ServerContext;
+} // namespace grpc
+
+namespace MyGame {
+namespace Example {
+
+class MonsterStorage final {
+ public:
+ static constexpr char const* service_full_name() {
+ return "MyGame.Example.MonsterStorage";
+ }
+ class StubInterface {
+ public:
+ virtual ~StubInterface() {}
+ virtual ::grpc::Status Store(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, flatbuffers::grpc::Message<Stat>* response) = 0;
+ std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>> AsyncStore(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>>(AsyncStoreRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>> PrepareAsyncStore(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>>(PrepareAsyncStoreRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientReaderInterface< flatbuffers::grpc::Message<Monster>>> Retrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) {
+ return std::unique_ptr< ::grpc::ClientReaderInterface< flatbuffers::grpc::Message<Monster>>>(RetrieveRaw(context, request));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>> AsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>>(AsyncRetrieveRaw(context, request, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>> PrepareAsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>>(PrepareAsyncRetrieveRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientWriterInterface< flatbuffers::grpc::Message<Monster>>> GetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response) {
+ return std::unique_ptr< ::grpc::ClientWriterInterface< flatbuffers::grpc::Message<Monster>>>(GetMaxHitPointRaw(context, response));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>> AsyncGetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>>(AsyncGetMaxHitPointRaw(context, response, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>> PrepareAsyncGetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>>(PrepareAsyncGetMaxHitPointRaw(context, response, cq));
+ }
+ std::unique_ptr< ::grpc::ClientReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> GetMinMaxHitPoints(::grpc::ClientContext* context) {
+ return std::unique_ptr< ::grpc::ClientReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(GetMinMaxHitPointsRaw(context));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> AsyncGetMinMaxHitPoints(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(AsyncGetMinMaxHitPointsRaw(context, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> PrepareAsyncGetMinMaxHitPoints(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(PrepareAsyncGetMinMaxHitPointsRaw(context, cq));
+ }
+ private:
+ virtual ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>* AsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>* PrepareAsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientReaderInterface< flatbuffers::grpc::Message<Monster>>* RetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) = 0;
+ virtual ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>* AsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) = 0;
+ virtual ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>* PrepareAsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientWriterInterface< flatbuffers::grpc::Message<Monster>>* GetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response) = 0;
+ virtual ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>* AsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq, void* tag) = 0;
+ virtual ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>* PrepareAsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* GetMinMaxHitPointsRaw(::grpc::ClientContext* context) = 0;
+ virtual ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* AsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) = 0;
+ virtual ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* PrepareAsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) = 0;
+ };
+ class Stub final : public StubInterface {
+ public:
+ Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);
+ ::grpc::Status Store(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, flatbuffers::grpc::Message<Stat>* response) override;
+ std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>> AsyncStore(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>>(AsyncStoreRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>> PrepareAsyncStore(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>>(PrepareAsyncStoreRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>> Retrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) {
+ return std::unique_ptr< ::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>>(RetrieveRaw(context, request));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>> AsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>>(AsyncRetrieveRaw(context, request, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>> PrepareAsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>>(PrepareAsyncRetrieveRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientWriter< flatbuffers::grpc::Message<Monster>>> GetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response) {
+ return std::unique_ptr< ::grpc::ClientWriter< flatbuffers::grpc::Message<Monster>>>(GetMaxHitPointRaw(context, response));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>> AsyncGetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>>(AsyncGetMaxHitPointRaw(context, response, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>> PrepareAsyncGetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>>(PrepareAsyncGetMaxHitPointRaw(context, response, cq));
+ }
+ std::unique_ptr< ::grpc::ClientReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> GetMinMaxHitPoints(::grpc::ClientContext* context) {
+ return std::unique_ptr< ::grpc::ClientReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(GetMinMaxHitPointsRaw(context));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> AsyncGetMinMaxHitPoints(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(AsyncGetMinMaxHitPointsRaw(context, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> PrepareAsyncGetMinMaxHitPoints(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(PrepareAsyncGetMinMaxHitPointsRaw(context, cq));
+ }
+
+ private:
+ std::shared_ptr< ::grpc::ChannelInterface> channel_;
+ ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>* AsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>* PrepareAsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>* RetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) override;
+ ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>* AsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) override;
+ ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>* PrepareAsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientWriter< flatbuffers::grpc::Message<Monster>>* GetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response) override;
+ ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>* AsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq, void* tag) override;
+ ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>* PrepareAsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* GetMinMaxHitPointsRaw(::grpc::ClientContext* context) override;
+ ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* AsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) override;
+ ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* PrepareAsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) override;
+ const ::grpc::internal::RpcMethod rpcmethod_Store_;
+ const ::grpc::internal::RpcMethod rpcmethod_Retrieve_;
+ const ::grpc::internal::RpcMethod rpcmethod_GetMaxHitPoint_;
+ const ::grpc::internal::RpcMethod rpcmethod_GetMinMaxHitPoints_;
+ };
+ static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
+
+ class Service : public ::grpc::Service {
+ public:
+ Service();
+ virtual ~Service();
+ virtual ::grpc::Status Store(::grpc::ServerContext* context, const flatbuffers::grpc::Message<Monster>* request, flatbuffers::grpc::Message<Stat>* response);
+ virtual ::grpc::Status Retrieve(::grpc::ServerContext* context, const flatbuffers::grpc::Message<Stat>* request, ::grpc::ServerWriter< flatbuffers::grpc::Message<Monster>>* writer);
+ virtual ::grpc::Status GetMaxHitPoint(::grpc::ServerContext* context, ::grpc::ServerReader< flatbuffers::grpc::Message<Monster>>* reader, flatbuffers::grpc::Message<Stat>* response);
+ virtual ::grpc::Status GetMinMaxHitPoints(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* stream);
+ };
+ template <class BaseClass>
+ class WithAsyncMethod_Store : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithAsyncMethod_Store() {
+ ::grpc::Service::MarkMethodAsync(0);
+ }
+ ~WithAsyncMethod_Store() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status Store(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Monster>* /*request*/, flatbuffers::grpc::Message<Stat>* /*response*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestStore(::grpc::ServerContext* context, flatbuffers::grpc::Message<Monster>* request, ::grpc::ServerAsyncResponseWriter< flatbuffers::grpc::Message<Stat>>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+ ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag);
+ }
+ };
+ template <class BaseClass>
+ class WithAsyncMethod_Retrieve : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithAsyncMethod_Retrieve() {
+ ::grpc::Service::MarkMethodAsync(1);
+ }
+ ~WithAsyncMethod_Retrieve() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status Retrieve(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Stat>* /*request*/, ::grpc::ServerWriter< flatbuffers::grpc::Message<Monster>>* /*writer*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestRetrieve(::grpc::ServerContext* context, flatbuffers::grpc::Message<Stat>* request, ::grpc::ServerAsyncWriter< flatbuffers::grpc::Message<Monster>>* writer, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+ ::grpc::Service::RequestAsyncServerStreaming(1, context, request, writer, new_call_cq, notification_cq, tag);
+ }
+ };
+ template <class BaseClass>
+ class WithAsyncMethod_GetMaxHitPoint : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithAsyncMethod_GetMaxHitPoint() {
+ ::grpc::Service::MarkMethodAsync(2);
+ }
+ ~WithAsyncMethod_GetMaxHitPoint() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status GetMaxHitPoint(::grpc::ServerContext* /*context*/, ::grpc::ServerReader< flatbuffers::grpc::Message<Monster>>* /*reader*/, flatbuffers::grpc::Message<Stat>* /*response*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestGetMaxHitPoint(::grpc::ServerContext* context, ::grpc::ServerAsyncReader< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* reader, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+ ::grpc::Service::RequestAsyncClientStreaming(2, context, reader, new_call_cq, notification_cq, tag);
+ }
+ };
+ template <class BaseClass>
+ class WithAsyncMethod_GetMinMaxHitPoints : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithAsyncMethod_GetMinMaxHitPoints() {
+ ::grpc::Service::MarkMethodAsync(3);
+ }
+ ~WithAsyncMethod_GetMinMaxHitPoints() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status GetMinMaxHitPoints(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* /*stream*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestGetMinMaxHitPoints(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+ ::grpc::Service::RequestAsyncBidiStreaming(3, context, stream, new_call_cq, notification_cq, tag);
+ }
+ };
+ typedef WithAsyncMethod_Store< WithAsyncMethod_Retrieve< WithAsyncMethod_GetMaxHitPoint< WithAsyncMethod_GetMinMaxHitPoints< Service > > > > AsyncService;
+ template <class BaseClass>
+ class WithGenericMethod_Store : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithGenericMethod_Store() {
+ ::grpc::Service::MarkMethodGeneric(0);
+ }
+ ~WithGenericMethod_Store() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status Store(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Monster>* /*request*/, flatbuffers::grpc::Message<Stat>* /*response*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ };
+ template <class BaseClass>
+ class WithGenericMethod_Retrieve : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithGenericMethod_Retrieve() {
+ ::grpc::Service::MarkMethodGeneric(1);
+ }
+ ~WithGenericMethod_Retrieve() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status Retrieve(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Stat>* /*request*/, ::grpc::ServerWriter< flatbuffers::grpc::Message<Monster>>* /*writer*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ };
+ template <class BaseClass>
+ class WithGenericMethod_GetMaxHitPoint : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithGenericMethod_GetMaxHitPoint() {
+ ::grpc::Service::MarkMethodGeneric(2);
+ }
+ ~WithGenericMethod_GetMaxHitPoint() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status GetMaxHitPoint(::grpc::ServerContext* /*context*/, ::grpc::ServerReader< flatbuffers::grpc::Message<Monster>>* /*reader*/, flatbuffers::grpc::Message<Stat>* /*response*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ };
+ template <class BaseClass>
+ class WithGenericMethod_GetMinMaxHitPoints : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithGenericMethod_GetMinMaxHitPoints() {
+ ::grpc::Service::MarkMethodGeneric(3);
+ }
+ ~WithGenericMethod_GetMinMaxHitPoints() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status GetMinMaxHitPoints(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* /*stream*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ };
+ template <class BaseClass>
+ class WithStreamedUnaryMethod_Store : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithStreamedUnaryMethod_Store() {
+ ::grpc::Service::MarkMethodStreamed(0,
+ new ::grpc::internal::StreamedUnaryHandler< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>(std::bind(&WithStreamedUnaryMethod_Store<BaseClass>::StreamedStore, this, std::placeholders::_1, std::placeholders::_2)));
+ }
+ ~WithStreamedUnaryMethod_Store() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable regular version of this method
+ ::grpc::Status Store(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Monster>* /*request*/, flatbuffers::grpc::Message<Stat>* /*response*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ // replace default version of method with streamed unary
+ virtual ::grpc::Status StreamedStore(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< flatbuffers::grpc::Message<Monster>,flatbuffers::grpc::Message<Stat>>* server_unary_streamer) = 0;
+ };
+ typedef WithStreamedUnaryMethod_Store< Service > StreamedUnaryService;
+ template <class BaseClass>
+ class WithSplitStreamingMethod_Retrieve : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) { }
+ public:
+ WithSplitStreamingMethod_Retrieve() {
+ ::grpc::Service::MarkMethodStreamed(1,
+ new ::grpc::internal::SplitServerStreamingHandler< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>(std::bind(&WithSplitStreamingMethod_Retrieve<BaseClass>::StreamedRetrieve, this, std::placeholders::_1, std::placeholders::_2)));
+ }
+ ~WithSplitStreamingMethod_Retrieve() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable regular version of this method
+ ::grpc::Status Retrieve(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Stat>* /*request*/, ::grpc::ServerWriter< flatbuffers::grpc::Message<Monster>>* /*writer*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ // replace default version of method with split streamed
+ virtual ::grpc::Status StreamedRetrieve(::grpc::ServerContext* context, ::grpc::ServerSplitStreamer< flatbuffers::grpc::Message<Stat>,flatbuffers::grpc::Message<Monster>>* server_split_streamer) = 0;
+ };
+ typedef WithSplitStreamingMethod_Retrieve< Service > SplitStreamedService;
+ typedef WithStreamedUnaryMethod_Store< WithSplitStreamingMethod_Retrieve< Service > > StreamedService;
+};
+
+} // namespace Example
+} // namespace MyGame
+
+
+#endif // GRPC_monster_5ftest__INCLUDED
diff --git a/tests/monster_test_suffix/filesuffix_only/monster_test_suffix.h b/tests/monster_test_suffix/filesuffix_only/monster_test_suffix.h
new file mode 100644
index 0000000..deab77b
--- /dev/null
+++ b/tests/monster_test_suffix/filesuffix_only/monster_test_suffix.h
@@ -0,0 +1,4034 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+
+#ifndef FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_H_
+#define FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_H_
+
+#include "flatbuffers/flatbuffers.h"
+#include "flatbuffers/flexbuffers.h"
+#include "flatbuffers/flex_flat_util.h"
+
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
+
+namespace MyGame {
+
+struct InParentNamespace;
+struct InParentNamespaceBuilder;
+struct InParentNamespaceT;
+
+namespace Example2 {
+
+struct Monster;
+struct MonsterBuilder;
+struct MonsterT;
+
+} // namespace Example2
+
+namespace Example {
+
+struct Test;
+
+struct TestSimpleTableWithEnum;
+struct TestSimpleTableWithEnumBuilder;
+struct TestSimpleTableWithEnumT;
+
+struct Vec3;
+
+struct Ability;
+
+struct StructOfStructs;
+
+struct StructOfStructsOfStructs;
+
+struct Stat;
+struct StatBuilder;
+struct StatT;
+
+struct Referrable;
+struct ReferrableBuilder;
+struct ReferrableT;
+
+struct Monster;
+struct MonsterBuilder;
+struct MonsterT;
+
+struct TypeAliases;
+struct TypeAliasesBuilder;
+struct TypeAliasesT;
+
+} // namespace Example
+
+bool operator==(const InParentNamespaceT &lhs, const InParentNamespaceT &rhs);
+bool operator!=(const InParentNamespaceT &lhs, const InParentNamespaceT &rhs);
+namespace Example2 {
+
+bool operator==(const MonsterT &lhs, const MonsterT &rhs);
+bool operator!=(const MonsterT &lhs, const MonsterT &rhs);
+} // namespace Example2
+
+namespace Example {
+
+bool operator==(const Test &lhs, const Test &rhs);
+bool operator!=(const Test &lhs, const Test &rhs);
+bool operator==(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs);
+bool operator!=(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs);
+bool operator==(const Vec3 &lhs, const Vec3 &rhs);
+bool operator!=(const Vec3 &lhs, const Vec3 &rhs);
+bool operator==(const Ability &lhs, const Ability &rhs);
+bool operator!=(const Ability &lhs, const Ability &rhs);
+bool operator==(const StructOfStructs &lhs, const StructOfStructs &rhs);
+bool operator!=(const StructOfStructs &lhs, const StructOfStructs &rhs);
+bool operator==(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs);
+bool operator!=(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs);
+bool operator==(const StatT &lhs, const StatT &rhs);
+bool operator!=(const StatT &lhs, const StatT &rhs);
+bool operator==(const ReferrableT &lhs, const ReferrableT &rhs);
+bool operator!=(const ReferrableT &lhs, const ReferrableT &rhs);
+bool operator==(const MonsterT &lhs, const MonsterT &rhs);
+bool operator!=(const MonsterT &lhs, const MonsterT &rhs);
+bool operator==(const TypeAliasesT &lhs, const TypeAliasesT &rhs);
+bool operator!=(const TypeAliasesT &lhs, const TypeAliasesT &rhs);
+
+} // namespace Example
+
+inline const flatbuffers::TypeTable *InParentNamespaceTypeTable();
+
+namespace Example2 {
+
+inline const flatbuffers::TypeTable *MonsterTypeTable();
+
+} // namespace Example2
+
+namespace Example {
+
+inline const flatbuffers::TypeTable *TestTypeTable();
+
+inline const flatbuffers::TypeTable *TestSimpleTableWithEnumTypeTable();
+
+inline const flatbuffers::TypeTable *Vec3TypeTable();
+
+inline const flatbuffers::TypeTable *AbilityTypeTable();
+
+inline const flatbuffers::TypeTable *StructOfStructsTypeTable();
+
+inline const flatbuffers::TypeTable *StructOfStructsOfStructsTypeTable();
+
+inline const flatbuffers::TypeTable *StatTypeTable();
+
+inline const flatbuffers::TypeTable *ReferrableTypeTable();
+
+inline const flatbuffers::TypeTable *MonsterTypeTable();
+
+inline const flatbuffers::TypeTable *TypeAliasesTypeTable();
+
+/// Composite components of Monster color.
+enum Color : uint8_t {
+ Color_Red = 1,
+ /// \brief color Green
+ /// Green is bit_flag with value (1u << 1)
+ Color_Green = 2,
+ /// \brief color Blue (1u << 3)
+ Color_Blue = 8,
+ Color_NONE = 0,
+ Color_ANY = 11
+};
+
+inline const Color (&EnumValuesColor())[3] {
+ static const Color values[] = {
+ Color_Red,
+ Color_Green,
+ Color_Blue
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesColor() {
+ static const char * const names[9] = {
+ "Red",
+ "Green",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "Blue",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameColor(Color e) {
+ if (flatbuffers::IsOutRange(e, Color_Red, Color_Blue)) return "";
+ const size_t index = static_cast<size_t>(e) - static_cast<size_t>(Color_Red);
+ return EnumNamesColor()[index];
+}
+
+enum Race : int8_t {
+ Race_None = -1,
+ Race_Human = 0,
+ Race_Dwarf = 1,
+ Race_Elf = 2,
+ Race_MIN = Race_None,
+ Race_MAX = Race_Elf
+};
+
+inline const Race (&EnumValuesRace())[4] {
+ static const Race values[] = {
+ Race_None,
+ Race_Human,
+ Race_Dwarf,
+ Race_Elf
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesRace() {
+ static const char * const names[5] = {
+ "None",
+ "Human",
+ "Dwarf",
+ "Elf",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameRace(Race e) {
+ if (flatbuffers::IsOutRange(e, Race_None, Race_Elf)) return "";
+ const size_t index = static_cast<size_t>(e) - static_cast<size_t>(Race_None);
+ return EnumNamesRace()[index];
+}
+
+enum LongEnum : uint64_t {
+ LongEnum_LongOne = 2ULL,
+ LongEnum_LongTwo = 4ULL,
+ LongEnum_LongBig = 1099511627776ULL,
+ LongEnum_NONE = 0,
+ LongEnum_ANY = 1099511627782ULL
+};
+
+inline const LongEnum (&EnumValuesLongEnum())[3] {
+ static const LongEnum values[] = {
+ LongEnum_LongOne,
+ LongEnum_LongTwo,
+ LongEnum_LongBig
+ };
+ return values;
+}
+
+inline const char *EnumNameLongEnum(LongEnum e) {
+ switch (e) {
+ case LongEnum_LongOne: return "LongOne";
+ case LongEnum_LongTwo: return "LongTwo";
+ case LongEnum_LongBig: return "LongBig";
+ default: return "";
+ }
+}
+
+enum Any : uint8_t {
+ Any_NONE = 0,
+ Any_Monster = 1,
+ Any_TestSimpleTableWithEnum = 2,
+ Any_MyGame_Example2_Monster = 3,
+ Any_MIN = Any_NONE,
+ Any_MAX = Any_MyGame_Example2_Monster
+};
+
+inline const Any (&EnumValuesAny())[4] {
+ static const Any values[] = {
+ Any_NONE,
+ Any_Monster,
+ Any_TestSimpleTableWithEnum,
+ Any_MyGame_Example2_Monster
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesAny() {
+ static const char * const names[5] = {
+ "NONE",
+ "Monster",
+ "TestSimpleTableWithEnum",
+ "MyGame_Example2_Monster",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameAny(Any e) {
+ if (flatbuffers::IsOutRange(e, Any_NONE, Any_MyGame_Example2_Monster)) return "";
+ const size_t index = static_cast<size_t>(e);
+ return EnumNamesAny()[index];
+}
+
+template<typename T> struct AnyTraits {
+ static const Any enum_value = Any_NONE;
+};
+
+template<> struct AnyTraits<MyGame::Example::Monster> {
+ static const Any enum_value = Any_Monster;
+};
+
+template<> struct AnyTraits<MyGame::Example::TestSimpleTableWithEnum> {
+ static const Any enum_value = Any_TestSimpleTableWithEnum;
+};
+
+template<> struct AnyTraits<MyGame::Example2::Monster> {
+ static const Any enum_value = Any_MyGame_Example2_Monster;
+};
+
+template<typename T> struct AnyUnionTraits {
+ static const Any enum_value = Any_NONE;
+};
+
+template<> struct AnyUnionTraits<MyGame::Example::MonsterT> {
+ static const Any enum_value = Any_Monster;
+};
+
+template<> struct AnyUnionTraits<MyGame::Example::TestSimpleTableWithEnumT> {
+ static const Any enum_value = Any_TestSimpleTableWithEnum;
+};
+
+template<> struct AnyUnionTraits<MyGame::Example2::MonsterT> {
+ static const Any enum_value = Any_MyGame_Example2_Monster;
+};
+
+struct AnyUnion {
+ Any type;
+ void *value;
+
+ AnyUnion() : type(Any_NONE), value(nullptr) {}
+ AnyUnion(AnyUnion&& u) FLATBUFFERS_NOEXCEPT :
+ type(Any_NONE), value(nullptr)
+ { std::swap(type, u.type); std::swap(value, u.value); }
+ AnyUnion(const AnyUnion &);
+ AnyUnion &operator=(const AnyUnion &u)
+ { AnyUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
+ AnyUnion &operator=(AnyUnion &&u) FLATBUFFERS_NOEXCEPT
+ { std::swap(type, u.type); std::swap(value, u.value); return *this; }
+ ~AnyUnion() { Reset(); }
+
+ void Reset();
+
+ template <typename T>
+ void Set(T&& val) {
+ typedef typename std::remove_reference<T>::type RT;
+ Reset();
+ type = AnyUnionTraits<RT>::enum_value;
+ if (type != Any_NONE) {
+ value = new RT(std::forward<T>(val));
+ }
+ }
+
+ static void *UnPack(const void *obj, Any type, const flatbuffers::resolver_function_t *resolver);
+ flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
+
+ MyGame::Example::MonsterT *AsMonster() {
+ return type == Any_Monster ?
+ reinterpret_cast<MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example::MonsterT *AsMonster() const {
+ return type == Any_Monster ?
+ reinterpret_cast<const MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ MyGame::Example::TestSimpleTableWithEnumT *AsTestSimpleTableWithEnum() {
+ return type == Any_TestSimpleTableWithEnum ?
+ reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(value) : nullptr;
+ }
+ const MyGame::Example::TestSimpleTableWithEnumT *AsTestSimpleTableWithEnum() const {
+ return type == Any_TestSimpleTableWithEnum ?
+ reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(value) : nullptr;
+ }
+ MyGame::Example2::MonsterT *AsMyGame_Example2_Monster() {
+ return type == Any_MyGame_Example2_Monster ?
+ reinterpret_cast<MyGame::Example2::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example2::MonsterT *AsMyGame_Example2_Monster() const {
+ return type == Any_MyGame_Example2_Monster ?
+ reinterpret_cast<const MyGame::Example2::MonsterT *>(value) : nullptr;
+ }
+};
+
+
+inline bool operator==(const AnyUnion &lhs, const AnyUnion &rhs) {
+ if (lhs.type != rhs.type) return false;
+ switch (lhs.type) {
+ case Any_NONE: {
+ return true;
+ }
+ case Any_Monster: {
+ return *(reinterpret_cast<const MyGame::Example::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::MonsterT *>(rhs.value));
+ }
+ case Any_TestSimpleTableWithEnum: {
+ return *(reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(rhs.value));
+ }
+ case Any_MyGame_Example2_Monster: {
+ return *(reinterpret_cast<const MyGame::Example2::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example2::MonsterT *>(rhs.value));
+ }
+ default: {
+ return false;
+ }
+ }
+}
+
+inline bool operator!=(const AnyUnion &lhs, const AnyUnion &rhs) {
+ return !(lhs == rhs);
+}
+
+bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type);
+bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
+
+enum AnyUniqueAliases : uint8_t {
+ AnyUniqueAliases_NONE = 0,
+ AnyUniqueAliases_M = 1,
+ AnyUniqueAliases_TS = 2,
+ AnyUniqueAliases_M2 = 3,
+ AnyUniqueAliases_MIN = AnyUniqueAliases_NONE,
+ AnyUniqueAliases_MAX = AnyUniqueAliases_M2
+};
+
+inline const AnyUniqueAliases (&EnumValuesAnyUniqueAliases())[4] {
+ static const AnyUniqueAliases values[] = {
+ AnyUniqueAliases_NONE,
+ AnyUniqueAliases_M,
+ AnyUniqueAliases_TS,
+ AnyUniqueAliases_M2
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesAnyUniqueAliases() {
+ static const char * const names[5] = {
+ "NONE",
+ "M",
+ "TS",
+ "M2",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameAnyUniqueAliases(AnyUniqueAliases e) {
+ if (flatbuffers::IsOutRange(e, AnyUniqueAliases_NONE, AnyUniqueAliases_M2)) return "";
+ const size_t index = static_cast<size_t>(e);
+ return EnumNamesAnyUniqueAliases()[index];
+}
+
+template<typename T> struct AnyUniqueAliasesTraits {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_NONE;
+};
+
+template<> struct AnyUniqueAliasesTraits<MyGame::Example::Monster> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_M;
+};
+
+template<> struct AnyUniqueAliasesTraits<MyGame::Example::TestSimpleTableWithEnum> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_TS;
+};
+
+template<> struct AnyUniqueAliasesTraits<MyGame::Example2::Monster> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_M2;
+};
+
+template<typename T> struct AnyUniqueAliasesUnionTraits {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_NONE;
+};
+
+template<> struct AnyUniqueAliasesUnionTraits<MyGame::Example::MonsterT> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_M;
+};
+
+template<> struct AnyUniqueAliasesUnionTraits<MyGame::Example::TestSimpleTableWithEnumT> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_TS;
+};
+
+template<> struct AnyUniqueAliasesUnionTraits<MyGame::Example2::MonsterT> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_M2;
+};
+
+struct AnyUniqueAliasesUnion {
+ AnyUniqueAliases type;
+ void *value;
+
+ AnyUniqueAliasesUnion() : type(AnyUniqueAliases_NONE), value(nullptr) {}
+ AnyUniqueAliasesUnion(AnyUniqueAliasesUnion&& u) FLATBUFFERS_NOEXCEPT :
+ type(AnyUniqueAliases_NONE), value(nullptr)
+ { std::swap(type, u.type); std::swap(value, u.value); }
+ AnyUniqueAliasesUnion(const AnyUniqueAliasesUnion &);
+ AnyUniqueAliasesUnion &operator=(const AnyUniqueAliasesUnion &u)
+ { AnyUniqueAliasesUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
+ AnyUniqueAliasesUnion &operator=(AnyUniqueAliasesUnion &&u) FLATBUFFERS_NOEXCEPT
+ { std::swap(type, u.type); std::swap(value, u.value); return *this; }
+ ~AnyUniqueAliasesUnion() { Reset(); }
+
+ void Reset();
+
+ template <typename T>
+ void Set(T&& val) {
+ typedef typename std::remove_reference<T>::type RT;
+ Reset();
+ type = AnyUniqueAliasesUnionTraits<RT>::enum_value;
+ if (type != AnyUniqueAliases_NONE) {
+ value = new RT(std::forward<T>(val));
+ }
+ }
+
+ static void *UnPack(const void *obj, AnyUniqueAliases type, const flatbuffers::resolver_function_t *resolver);
+ flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
+
+ MyGame::Example::MonsterT *AsM() {
+ return type == AnyUniqueAliases_M ?
+ reinterpret_cast<MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example::MonsterT *AsM() const {
+ return type == AnyUniqueAliases_M ?
+ reinterpret_cast<const MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ MyGame::Example::TestSimpleTableWithEnumT *AsTS() {
+ return type == AnyUniqueAliases_TS ?
+ reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(value) : nullptr;
+ }
+ const MyGame::Example::TestSimpleTableWithEnumT *AsTS() const {
+ return type == AnyUniqueAliases_TS ?
+ reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(value) : nullptr;
+ }
+ MyGame::Example2::MonsterT *AsM2() {
+ return type == AnyUniqueAliases_M2 ?
+ reinterpret_cast<MyGame::Example2::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example2::MonsterT *AsM2() const {
+ return type == AnyUniqueAliases_M2 ?
+ reinterpret_cast<const MyGame::Example2::MonsterT *>(value) : nullptr;
+ }
+};
+
+
+inline bool operator==(const AnyUniqueAliasesUnion &lhs, const AnyUniqueAliasesUnion &rhs) {
+ if (lhs.type != rhs.type) return false;
+ switch (lhs.type) {
+ case AnyUniqueAliases_NONE: {
+ return true;
+ }
+ case AnyUniqueAliases_M: {
+ return *(reinterpret_cast<const MyGame::Example::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::MonsterT *>(rhs.value));
+ }
+ case AnyUniqueAliases_TS: {
+ return *(reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(rhs.value));
+ }
+ case AnyUniqueAliases_M2: {
+ return *(reinterpret_cast<const MyGame::Example2::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example2::MonsterT *>(rhs.value));
+ }
+ default: {
+ return false;
+ }
+ }
+}
+
+inline bool operator!=(const AnyUniqueAliasesUnion &lhs, const AnyUniqueAliasesUnion &rhs) {
+ return !(lhs == rhs);
+}
+
+bool VerifyAnyUniqueAliases(flatbuffers::Verifier &verifier, const void *obj, AnyUniqueAliases type);
+bool VerifyAnyUniqueAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
+
+enum AnyAmbiguousAliases : uint8_t {
+ AnyAmbiguousAliases_NONE = 0,
+ AnyAmbiguousAliases_M1 = 1,
+ AnyAmbiguousAliases_M2 = 2,
+ AnyAmbiguousAliases_M3 = 3,
+ AnyAmbiguousAliases_MIN = AnyAmbiguousAliases_NONE,
+ AnyAmbiguousAliases_MAX = AnyAmbiguousAliases_M3
+};
+
+inline const AnyAmbiguousAliases (&EnumValuesAnyAmbiguousAliases())[4] {
+ static const AnyAmbiguousAliases values[] = {
+ AnyAmbiguousAliases_NONE,
+ AnyAmbiguousAliases_M1,
+ AnyAmbiguousAliases_M2,
+ AnyAmbiguousAliases_M3
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesAnyAmbiguousAliases() {
+ static const char * const names[5] = {
+ "NONE",
+ "M1",
+ "M2",
+ "M3",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameAnyAmbiguousAliases(AnyAmbiguousAliases e) {
+ if (flatbuffers::IsOutRange(e, AnyAmbiguousAliases_NONE, AnyAmbiguousAliases_M3)) return "";
+ const size_t index = static_cast<size_t>(e);
+ return EnumNamesAnyAmbiguousAliases()[index];
+}
+
+struct AnyAmbiguousAliasesUnion {
+ AnyAmbiguousAliases type;
+ void *value;
+
+ AnyAmbiguousAliasesUnion() : type(AnyAmbiguousAliases_NONE), value(nullptr) {}
+ AnyAmbiguousAliasesUnion(AnyAmbiguousAliasesUnion&& u) FLATBUFFERS_NOEXCEPT :
+ type(AnyAmbiguousAliases_NONE), value(nullptr)
+ { std::swap(type, u.type); std::swap(value, u.value); }
+ AnyAmbiguousAliasesUnion(const AnyAmbiguousAliasesUnion &);
+ AnyAmbiguousAliasesUnion &operator=(const AnyAmbiguousAliasesUnion &u)
+ { AnyAmbiguousAliasesUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
+ AnyAmbiguousAliasesUnion &operator=(AnyAmbiguousAliasesUnion &&u) FLATBUFFERS_NOEXCEPT
+ { std::swap(type, u.type); std::swap(value, u.value); return *this; }
+ ~AnyAmbiguousAliasesUnion() { Reset(); }
+
+ void Reset();
+
+ static void *UnPack(const void *obj, AnyAmbiguousAliases type, const flatbuffers::resolver_function_t *resolver);
+ flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
+
+ MyGame::Example::MonsterT *AsM1() {
+ return type == AnyAmbiguousAliases_M1 ?
+ reinterpret_cast<MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example::MonsterT *AsM1() const {
+ return type == AnyAmbiguousAliases_M1 ?
+ reinterpret_cast<const MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ MyGame::Example::MonsterT *AsM2() {
+ return type == AnyAmbiguousAliases_M2 ?
+ reinterpret_cast<MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example::MonsterT *AsM2() const {
+ return type == AnyAmbiguousAliases_M2 ?
+ reinterpret_cast<const MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ MyGame::Example::MonsterT *AsM3() {
+ return type == AnyAmbiguousAliases_M3 ?
+ reinterpret_cast<MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example::MonsterT *AsM3() const {
+ return type == AnyAmbiguousAliases_M3 ?
+ reinterpret_cast<const MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+};
+
+
+inline bool operator==(const AnyAmbiguousAliasesUnion &lhs, const AnyAmbiguousAliasesUnion &rhs) {
+ if (lhs.type != rhs.type) return false;
+ switch (lhs.type) {
+ case AnyAmbiguousAliases_NONE: {
+ return true;
+ }
+ case AnyAmbiguousAliases_M1: {
+ return *(reinterpret_cast<const MyGame::Example::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::MonsterT *>(rhs.value));
+ }
+ case AnyAmbiguousAliases_M2: {
+ return *(reinterpret_cast<const MyGame::Example::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::MonsterT *>(rhs.value));
+ }
+ case AnyAmbiguousAliases_M3: {
+ return *(reinterpret_cast<const MyGame::Example::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::MonsterT *>(rhs.value));
+ }
+ default: {
+ return false;
+ }
+ }
+}
+
+inline bool operator!=(const AnyAmbiguousAliasesUnion &lhs, const AnyAmbiguousAliasesUnion &rhs) {
+ return !(lhs == rhs);
+}
+
+bool VerifyAnyAmbiguousAliases(flatbuffers::Verifier &verifier, const void *obj, AnyAmbiguousAliases type);
+bool VerifyAnyAmbiguousAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
+
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(2) Test FLATBUFFERS_FINAL_CLASS {
+ private:
+ int16_t a_;
+ int8_t b_;
+ int8_t padding0__;
+
+ public:
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return TestTypeTable();
+ }
+ Test()
+ : a_(0),
+ b_(0),
+ padding0__(0) {
+ (void)padding0__;
+ }
+ Test(int16_t _a, int8_t _b)
+ : a_(flatbuffers::EndianScalar(_a)),
+ b_(flatbuffers::EndianScalar(_b)),
+ padding0__(0) {
+ (void)padding0__;
+ }
+ int16_t a() const {
+ return flatbuffers::EndianScalar(a_);
+ }
+ void mutate_a(int16_t _a) {
+ flatbuffers::WriteScalar(&a_, _a);
+ }
+ int8_t b() const {
+ return flatbuffers::EndianScalar(b_);
+ }
+ void mutate_b(int8_t _b) {
+ flatbuffers::WriteScalar(&b_, _b);
+ }
+};
+FLATBUFFERS_STRUCT_END(Test, 4);
+
+inline bool operator==(const Test &lhs, const Test &rhs) {
+ return
+ (lhs.a() == rhs.a()) &&
+ (lhs.b() == rhs.b());
+}
+
+inline bool operator!=(const Test &lhs, const Test &rhs) {
+ return !(lhs == rhs);
+}
+
+
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Vec3 FLATBUFFERS_FINAL_CLASS {
+ private:
+ float x_;
+ float y_;
+ float z_;
+ int32_t padding0__;
+ double test1_;
+ uint8_t test2_;
+ int8_t padding1__;
+ MyGame::Example::Test test3_;
+ int16_t padding2__;
+
+ public:
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return Vec3TypeTable();
+ }
+ Vec3()
+ : x_(0),
+ y_(0),
+ z_(0),
+ padding0__(0),
+ test1_(0),
+ test2_(0),
+ padding1__(0),
+ test3_(),
+ padding2__(0) {
+ (void)padding0__;
+ (void)padding1__;
+ (void)padding2__;
+ }
+ Vec3(float _x, float _y, float _z, double _test1, MyGame::Example::Color _test2, const MyGame::Example::Test &_test3)
+ : x_(flatbuffers::EndianScalar(_x)),
+ y_(flatbuffers::EndianScalar(_y)),
+ z_(flatbuffers::EndianScalar(_z)),
+ padding0__(0),
+ test1_(flatbuffers::EndianScalar(_test1)),
+ test2_(flatbuffers::EndianScalar(static_cast<uint8_t>(_test2))),
+ padding1__(0),
+ test3_(_test3),
+ padding2__(0) {
+ (void)padding0__;
+ (void)padding1__;
+ (void)padding2__;
+ }
+ float x() const {
+ return flatbuffers::EndianScalar(x_);
+ }
+ void mutate_x(float _x) {
+ flatbuffers::WriteScalar(&x_, _x);
+ }
+ float y() const {
+ return flatbuffers::EndianScalar(y_);
+ }
+ void mutate_y(float _y) {
+ flatbuffers::WriteScalar(&y_, _y);
+ }
+ float z() const {
+ return flatbuffers::EndianScalar(z_);
+ }
+ void mutate_z(float _z) {
+ flatbuffers::WriteScalar(&z_, _z);
+ }
+ double test1() const {
+ return flatbuffers::EndianScalar(test1_);
+ }
+ void mutate_test1(double _test1) {
+ flatbuffers::WriteScalar(&test1_, _test1);
+ }
+ MyGame::Example::Color test2() const {
+ return static_cast<MyGame::Example::Color>(flatbuffers::EndianScalar(test2_));
+ }
+ void mutate_test2(MyGame::Example::Color _test2) {
+ flatbuffers::WriteScalar(&test2_, static_cast<uint8_t>(_test2));
+ }
+ const MyGame::Example::Test &test3() const {
+ return test3_;
+ }
+ MyGame::Example::Test &mutable_test3() {
+ return test3_;
+ }
+};
+FLATBUFFERS_STRUCT_END(Vec3, 32);
+
+inline bool operator==(const Vec3 &lhs, const Vec3 &rhs) {
+ return
+ (lhs.x() == rhs.x()) &&
+ (lhs.y() == rhs.y()) &&
+ (lhs.z() == rhs.z()) &&
+ (lhs.test1() == rhs.test1()) &&
+ (lhs.test2() == rhs.test2()) &&
+ (lhs.test3() == rhs.test3());
+}
+
+inline bool operator!=(const Vec3 &lhs, const Vec3 &rhs) {
+ return !(lhs == rhs);
+}
+
+
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Ability FLATBUFFERS_FINAL_CLASS {
+ private:
+ uint32_t id_;
+ uint32_t distance_;
+
+ public:
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return AbilityTypeTable();
+ }
+ Ability()
+ : id_(0),
+ distance_(0) {
+ }
+ Ability(uint32_t _id, uint32_t _distance)
+ : id_(flatbuffers::EndianScalar(_id)),
+ distance_(flatbuffers::EndianScalar(_distance)) {
+ }
+ uint32_t id() const {
+ return flatbuffers::EndianScalar(id_);
+ }
+ void mutate_id(uint32_t _id) {
+ flatbuffers::WriteScalar(&id_, _id);
+ }
+ bool KeyCompareLessThan(const Ability *o) const {
+ return id() < o->id();
+ }
+ int KeyCompareWithValue(uint32_t _id) const {
+ return static_cast<int>(id() > _id) - static_cast<int>(id() < _id);
+ }
+ uint32_t distance() const {
+ return flatbuffers::EndianScalar(distance_);
+ }
+ void mutate_distance(uint32_t _distance) {
+ flatbuffers::WriteScalar(&distance_, _distance);
+ }
+};
+FLATBUFFERS_STRUCT_END(Ability, 8);
+
+inline bool operator==(const Ability &lhs, const Ability &rhs) {
+ return
+ (lhs.id() == rhs.id()) &&
+ (lhs.distance() == rhs.distance());
+}
+
+inline bool operator!=(const Ability &lhs, const Ability &rhs) {
+ return !(lhs == rhs);
+}
+
+
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructOfStructs FLATBUFFERS_FINAL_CLASS {
+ private:
+ MyGame::Example::Ability a_;
+ MyGame::Example::Test b_;
+ MyGame::Example::Ability c_;
+
+ public:
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return StructOfStructsTypeTable();
+ }
+ StructOfStructs()
+ : a_(),
+ b_(),
+ c_() {
+ }
+ StructOfStructs(const MyGame::Example::Ability &_a, const MyGame::Example::Test &_b, const MyGame::Example::Ability &_c)
+ : a_(_a),
+ b_(_b),
+ c_(_c) {
+ }
+ const MyGame::Example::Ability &a() const {
+ return a_;
+ }
+ MyGame::Example::Ability &mutable_a() {
+ return a_;
+ }
+ const MyGame::Example::Test &b() const {
+ return b_;
+ }
+ MyGame::Example::Test &mutable_b() {
+ return b_;
+ }
+ const MyGame::Example::Ability &c() const {
+ return c_;
+ }
+ MyGame::Example::Ability &mutable_c() {
+ return c_;
+ }
+};
+FLATBUFFERS_STRUCT_END(StructOfStructs, 20);
+
+inline bool operator==(const StructOfStructs &lhs, const StructOfStructs &rhs) {
+ return
+ (lhs.a() == rhs.a()) &&
+ (lhs.b() == rhs.b()) &&
+ (lhs.c() == rhs.c());
+}
+
+inline bool operator!=(const StructOfStructs &lhs, const StructOfStructs &rhs) {
+ return !(lhs == rhs);
+}
+
+
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructOfStructsOfStructs FLATBUFFERS_FINAL_CLASS {
+ private:
+ MyGame::Example::StructOfStructs a_;
+
+ public:
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return StructOfStructsOfStructsTypeTable();
+ }
+ StructOfStructsOfStructs()
+ : a_() {
+ }
+ StructOfStructsOfStructs(const MyGame::Example::StructOfStructs &_a)
+ : a_(_a) {
+ }
+ const MyGame::Example::StructOfStructs &a() const {
+ return a_;
+ }
+ MyGame::Example::StructOfStructs &mutable_a() {
+ return a_;
+ }
+};
+FLATBUFFERS_STRUCT_END(StructOfStructsOfStructs, 20);
+
+inline bool operator==(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs) {
+ return
+ (lhs.a() == rhs.a());
+}
+
+inline bool operator!=(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs) {
+ return !(lhs == rhs);
+}
+
+
+} // namespace Example
+
+struct InParentNamespaceT : public flatbuffers::NativeTable {
+ typedef InParentNamespace TableType;
+};
+
+struct InParentNamespace FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef InParentNamespaceT NativeTableType;
+ typedef InParentNamespaceBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return InParentNamespaceTypeTable();
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ verifier.EndTable();
+ }
+ InParentNamespaceT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(InParentNamespaceT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<InParentNamespace> Pack(flatbuffers::FlatBufferBuilder &_fbb, const InParentNamespaceT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct InParentNamespaceBuilder {
+ typedef InParentNamespace Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ explicit InParentNamespaceBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<InParentNamespace> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<InParentNamespace>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<InParentNamespace> CreateInParentNamespace(
+ flatbuffers::FlatBufferBuilder &_fbb) {
+ InParentNamespaceBuilder builder_(_fbb);
+ return builder_.Finish();
+}
+
+flatbuffers::Offset<InParentNamespace> CreateInParentNamespace(flatbuffers::FlatBufferBuilder &_fbb, const InParentNamespaceT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+namespace Example2 {
+
+struct MonsterT : public flatbuffers::NativeTable {
+ typedef Monster TableType;
+};
+
+struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef MonsterT NativeTableType;
+ typedef MonsterBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return MonsterTypeTable();
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ verifier.EndTable();
+ }
+ MonsterT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<Monster> Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct MonsterBuilder {
+ typedef Monster Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ explicit MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<Monster> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<Monster>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<Monster> CreateMonster(
+ flatbuffers::FlatBufferBuilder &_fbb) {
+ MonsterBuilder builder_(_fbb);
+ return builder_.Finish();
+}
+
+flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+} // namespace Example2
+
+namespace Example {
+
+struct TestSimpleTableWithEnumT : public flatbuffers::NativeTable {
+ typedef TestSimpleTableWithEnum TableType;
+ MyGame::Example::Color color = MyGame::Example::Color_Green;
+};
+
+struct TestSimpleTableWithEnum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef TestSimpleTableWithEnumT NativeTableType;
+ typedef TestSimpleTableWithEnumBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return TestSimpleTableWithEnumTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_COLOR = 4
+ };
+ MyGame::Example::Color color() const {
+ return static_cast<MyGame::Example::Color>(GetField<uint8_t>(VT_COLOR, 2));
+ }
+ bool mutate_color(MyGame::Example::Color _color = static_cast<MyGame::Example::Color>(2)) {
+ return SetField<uint8_t>(VT_COLOR, static_cast<uint8_t>(_color), 2);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyField<uint8_t>(verifier, VT_COLOR, 1) &&
+ verifier.EndTable();
+ }
+ TestSimpleTableWithEnumT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(TestSimpleTableWithEnumT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<TestSimpleTableWithEnum> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct TestSimpleTableWithEnumBuilder {
+ typedef TestSimpleTableWithEnum Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_color(MyGame::Example::Color color) {
+ fbb_.AddElement<uint8_t>(TestSimpleTableWithEnum::VT_COLOR, static_cast<uint8_t>(color), 2);
+ }
+ explicit TestSimpleTableWithEnumBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<TestSimpleTableWithEnum> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<TestSimpleTableWithEnum>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ MyGame::Example::Color color = MyGame::Example::Color_Green) {
+ TestSimpleTableWithEnumBuilder builder_(_fbb);
+ builder_.add_color(color);
+ return builder_.Finish();
+}
+
+flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+struct StatT : public flatbuffers::NativeTable {
+ typedef Stat TableType;
+ std::string id{};
+ int64_t val = 0;
+ uint16_t count = 0;
+};
+
+struct Stat FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef StatT NativeTableType;
+ typedef StatBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return StatTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_ID = 4,
+ VT_VAL = 6,
+ VT_COUNT = 8
+ };
+ const flatbuffers::String *id() const {
+ return GetPointer<const flatbuffers::String *>(VT_ID);
+ }
+ flatbuffers::String *mutable_id() {
+ return GetPointer<flatbuffers::String *>(VT_ID);
+ }
+ int64_t val() const {
+ return GetField<int64_t>(VT_VAL, 0);
+ }
+ bool mutate_val(int64_t _val = 0) {
+ return SetField<int64_t>(VT_VAL, _val, 0);
+ }
+ uint16_t count() const {
+ return GetField<uint16_t>(VT_COUNT, 0);
+ }
+ bool mutate_count(uint16_t _count = 0) {
+ return SetField<uint16_t>(VT_COUNT, _count, 0);
+ }
+ bool KeyCompareLessThan(const Stat *o) const {
+ return count() < o->count();
+ }
+ int KeyCompareWithValue(uint16_t _count) const {
+ return static_cast<int>(count() > _count) - static_cast<int>(count() < _count);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyOffset(verifier, VT_ID) &&
+ verifier.VerifyString(id()) &&
+ VerifyField<int64_t>(verifier, VT_VAL, 8) &&
+ VerifyField<uint16_t>(verifier, VT_COUNT, 2) &&
+ verifier.EndTable();
+ }
+ StatT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(StatT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<Stat> Pack(flatbuffers::FlatBufferBuilder &_fbb, const StatT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct StatBuilder {
+ typedef Stat Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_id(flatbuffers::Offset<flatbuffers::String> id) {
+ fbb_.AddOffset(Stat::VT_ID, id);
+ }
+ void add_val(int64_t val) {
+ fbb_.AddElement<int64_t>(Stat::VT_VAL, val, 0);
+ }
+ void add_count(uint16_t count) {
+ fbb_.AddElement<uint16_t>(Stat::VT_COUNT, count, 0);
+ }
+ explicit StatBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<Stat> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<Stat>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<Stat> CreateStat(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ flatbuffers::Offset<flatbuffers::String> id = 0,
+ int64_t val = 0,
+ uint16_t count = 0) {
+ StatBuilder builder_(_fbb);
+ builder_.add_val(val);
+ builder_.add_id(id);
+ builder_.add_count(count);
+ return builder_.Finish();
+}
+
+inline flatbuffers::Offset<Stat> CreateStatDirect(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ const char *id = nullptr,
+ int64_t val = 0,
+ uint16_t count = 0) {
+ auto id__ = id ? _fbb.CreateString(id) : 0;
+ return MyGame::Example::CreateStat(
+ _fbb,
+ id__,
+ val,
+ count);
+}
+
+flatbuffers::Offset<Stat> CreateStat(flatbuffers::FlatBufferBuilder &_fbb, const StatT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+struct ReferrableT : public flatbuffers::NativeTable {
+ typedef Referrable TableType;
+ uint64_t id = 0;
+};
+
+struct Referrable FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef ReferrableT NativeTableType;
+ typedef ReferrableBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return ReferrableTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_ID = 4
+ };
+ uint64_t id() const {
+ return GetField<uint64_t>(VT_ID, 0);
+ }
+ bool mutate_id(uint64_t _id = 0) {
+ return SetField<uint64_t>(VT_ID, _id, 0);
+ }
+ bool KeyCompareLessThan(const Referrable *o) const {
+ return id() < o->id();
+ }
+ int KeyCompareWithValue(uint64_t _id) const {
+ return static_cast<int>(id() > _id) - static_cast<int>(id() < _id);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyField<uint64_t>(verifier, VT_ID, 8) &&
+ verifier.EndTable();
+ }
+ ReferrableT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(ReferrableT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<Referrable> Pack(flatbuffers::FlatBufferBuilder &_fbb, const ReferrableT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct ReferrableBuilder {
+ typedef Referrable Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_id(uint64_t id) {
+ fbb_.AddElement<uint64_t>(Referrable::VT_ID, id, 0);
+ }
+ explicit ReferrableBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<Referrable> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<Referrable>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<Referrable> CreateReferrable(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ uint64_t id = 0) {
+ ReferrableBuilder builder_(_fbb);
+ builder_.add_id(id);
+ return builder_.Finish();
+}
+
+flatbuffers::Offset<Referrable> CreateReferrable(flatbuffers::FlatBufferBuilder &_fbb, const ReferrableT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+struct MonsterT : public flatbuffers::NativeTable {
+ typedef Monster TableType;
+ flatbuffers::unique_ptr<MyGame::Example::Vec3> pos{};
+ int16_t mana = 150;
+ int16_t hp = 100;
+ std::string name{};
+ std::vector<uint8_t> inventory{};
+ MyGame::Example::Color color = MyGame::Example::Color_Blue;
+ MyGame::Example::AnyUnion test{};
+ std::vector<MyGame::Example::Test> test4{};
+ std::vector<std::string> testarrayofstring{};
+ std::vector<flatbuffers::unique_ptr<MyGame::Example::MonsterT>> testarrayoftables{};
+ flatbuffers::unique_ptr<MyGame::Example::MonsterT> enemy{};
+ std::vector<uint8_t> testnestedflatbuffer{};
+ flatbuffers::unique_ptr<MyGame::Example::StatT> testempty{};
+ bool testbool = false;
+ int32_t testhashs32_fnv1 = 0;
+ uint32_t testhashu32_fnv1 = 0;
+ int64_t testhashs64_fnv1 = 0;
+ uint64_t testhashu64_fnv1 = 0;
+ int32_t testhashs32_fnv1a = 0;
+ Stat *testhashu32_fnv1a = nullptr;
+ int64_t testhashs64_fnv1a = 0;
+ uint64_t testhashu64_fnv1a = 0;
+ std::vector<bool> testarrayofbools{};
+ float testf = 3.14159f;
+ float testf2 = 3.0f;
+ float testf3 = 0.0f;
+ std::vector<std::string> testarrayofstring2{};
+ std::vector<MyGame::Example::Ability> testarrayofsortedstruct{};
+ std::vector<uint8_t> flex{};
+ std::vector<MyGame::Example::Test> test5{};
+ std::vector<int64_t> vector_of_longs{};
+ std::vector<double> vector_of_doubles{};
+ flatbuffers::unique_ptr<MyGame::InParentNamespaceT> parent_namespace_test{};
+ std::vector<flatbuffers::unique_ptr<MyGame::Example::ReferrableT>> vector_of_referrables{};
+ ReferrableT *single_weak_reference = nullptr;
+ std::vector<ReferrableT *> vector_of_weak_references{};
+ std::vector<flatbuffers::unique_ptr<MyGame::Example::ReferrableT>> vector_of_strong_referrables{};
+ ReferrableT *co_owning_reference = nullptr;
+ std::vector<flatbuffers::unique_ptr<ReferrableT>> vector_of_co_owning_references{};
+ ReferrableT *non_owning_reference = nullptr;
+ std::vector<ReferrableT *> vector_of_non_owning_references{};
+ MyGame::Example::AnyUniqueAliasesUnion any_unique{};
+ MyGame::Example::AnyAmbiguousAliasesUnion any_ambiguous{};
+ std::vector<MyGame::Example::Color> vector_of_enums{};
+ MyGame::Example::Race signed_enum = MyGame::Example::Race_None;
+ std::vector<uint8_t> testrequirednestedflatbuffer{};
+ std::vector<flatbuffers::unique_ptr<MyGame::Example::StatT>> scalar_key_sorted_tables{};
+ MyGame::Example::Test native_inline{};
+ MyGame::Example::LongEnum long_enum_non_enum_default = static_cast<MyGame::Example::LongEnum>(0);
+ MyGame::Example::LongEnum long_enum_normal_default = MyGame::Example::LongEnum_LongOne;
+ MonsterT() = default;
+ MonsterT(const MonsterT &o);
+ MonsterT(MonsterT&&) FLATBUFFERS_NOEXCEPT = default;
+ MonsterT &operator=(MonsterT o) FLATBUFFERS_NOEXCEPT;
+};
+
+/// an example documentation comment: "monster object"
+struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef MonsterT NativeTableType;
+ typedef MonsterBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return MonsterTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_POS = 4,
+ VT_MANA = 6,
+ VT_HP = 8,
+ VT_NAME = 10,
+ VT_INVENTORY = 14,
+ VT_COLOR = 16,
+ VT_TEST_TYPE = 18,
+ VT_TEST = 20,
+ VT_TEST4 = 22,
+ VT_TESTARRAYOFSTRING = 24,
+ VT_TESTARRAYOFTABLES = 26,
+ VT_ENEMY = 28,
+ VT_TESTNESTEDFLATBUFFER = 30,
+ VT_TESTEMPTY = 32,
+ VT_TESTBOOL = 34,
+ VT_TESTHASHS32_FNV1 = 36,
+ VT_TESTHASHU32_FNV1 = 38,
+ VT_TESTHASHS64_FNV1 = 40,
+ VT_TESTHASHU64_FNV1 = 42,
+ VT_TESTHASHS32_FNV1A = 44,
+ VT_TESTHASHU32_FNV1A = 46,
+ VT_TESTHASHS64_FNV1A = 48,
+ VT_TESTHASHU64_FNV1A = 50,
+ VT_TESTARRAYOFBOOLS = 52,
+ VT_TESTF = 54,
+ VT_TESTF2 = 56,
+ VT_TESTF3 = 58,
+ VT_TESTARRAYOFSTRING2 = 60,
+ VT_TESTARRAYOFSORTEDSTRUCT = 62,
+ VT_FLEX = 64,
+ VT_TEST5 = 66,
+ VT_VECTOR_OF_LONGS = 68,
+ VT_VECTOR_OF_DOUBLES = 70,
+ VT_PARENT_NAMESPACE_TEST = 72,
+ VT_VECTOR_OF_REFERRABLES = 74,
+ VT_SINGLE_WEAK_REFERENCE = 76,
+ VT_VECTOR_OF_WEAK_REFERENCES = 78,
+ VT_VECTOR_OF_STRONG_REFERRABLES = 80,
+ VT_CO_OWNING_REFERENCE = 82,
+ VT_VECTOR_OF_CO_OWNING_REFERENCES = 84,
+ VT_NON_OWNING_REFERENCE = 86,
+ VT_VECTOR_OF_NON_OWNING_REFERENCES = 88,
+ VT_ANY_UNIQUE_TYPE = 90,
+ VT_ANY_UNIQUE = 92,
+ VT_ANY_AMBIGUOUS_TYPE = 94,
+ VT_ANY_AMBIGUOUS = 96,
+ VT_VECTOR_OF_ENUMS = 98,
+ VT_SIGNED_ENUM = 100,
+ VT_TESTREQUIREDNESTEDFLATBUFFER = 102,
+ VT_SCALAR_KEY_SORTED_TABLES = 104,
+ VT_NATIVE_INLINE = 106,
+ VT_LONG_ENUM_NON_ENUM_DEFAULT = 108,
+ VT_LONG_ENUM_NORMAL_DEFAULT = 110
+ };
+ const MyGame::Example::Vec3 *pos() const {
+ return GetStruct<const MyGame::Example::Vec3 *>(VT_POS);
+ }
+ MyGame::Example::Vec3 *mutable_pos() {
+ return GetStruct<MyGame::Example::Vec3 *>(VT_POS);
+ }
+ int16_t mana() const {
+ return GetField<int16_t>(VT_MANA, 150);
+ }
+ bool mutate_mana(int16_t _mana = 150) {
+ return SetField<int16_t>(VT_MANA, _mana, 150);
+ }
+ int16_t hp() const {
+ return GetField<int16_t>(VT_HP, 100);
+ }
+ bool mutate_hp(int16_t _hp = 100) {
+ return SetField<int16_t>(VT_HP, _hp, 100);
+ }
+ const flatbuffers::String *name() const {
+ return GetPointer<const flatbuffers::String *>(VT_NAME);
+ }
+ flatbuffers::String *mutable_name() {
+ return GetPointer<flatbuffers::String *>(VT_NAME);
+ }
+ bool KeyCompareLessThan(const Monster *o) const {
+ return *name() < *o->name();
+ }
+ int KeyCompareWithValue(const char *_name) const {
+ return strcmp(name()->c_str(), _name);
+ }
+ const flatbuffers::Vector<uint8_t> *inventory() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_INVENTORY);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_inventory() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_INVENTORY);
+ }
+ MyGame::Example::Color color() const {
+ return static_cast<MyGame::Example::Color>(GetField<uint8_t>(VT_COLOR, 8));
+ }
+ bool mutate_color(MyGame::Example::Color _color = static_cast<MyGame::Example::Color>(8)) {
+ return SetField<uint8_t>(VT_COLOR, static_cast<uint8_t>(_color), 8);
+ }
+ MyGame::Example::Any test_type() const {
+ return static_cast<MyGame::Example::Any>(GetField<uint8_t>(VT_TEST_TYPE, 0));
+ }
+ const void *test() const {
+ return GetPointer<const void *>(VT_TEST);
+ }
+ template<typename T> const T *test_as() const;
+ const MyGame::Example::Monster *test_as_Monster() const {
+ return test_type() == MyGame::Example::Any_Monster ? static_cast<const MyGame::Example::Monster *>(test()) : nullptr;
+ }
+ const MyGame::Example::TestSimpleTableWithEnum *test_as_TestSimpleTableWithEnum() const {
+ return test_type() == MyGame::Example::Any_TestSimpleTableWithEnum ? static_cast<const MyGame::Example::TestSimpleTableWithEnum *>(test()) : nullptr;
+ }
+ const MyGame::Example2::Monster *test_as_MyGame_Example2_Monster() const {
+ return test_type() == MyGame::Example::Any_MyGame_Example2_Monster ? static_cast<const MyGame::Example2::Monster *>(test()) : nullptr;
+ }
+ void *mutable_test() {
+ return GetPointer<void *>(VT_TEST);
+ }
+ const flatbuffers::Vector<const MyGame::Example::Test *> *test4() const {
+ return GetPointer<const flatbuffers::Vector<const MyGame::Example::Test *> *>(VT_TEST4);
+ }
+ flatbuffers::Vector<const MyGame::Example::Test *> *mutable_test4() {
+ return GetPointer<flatbuffers::Vector<const MyGame::Example::Test *> *>(VT_TEST4);
+ }
+ const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *mutable_testarrayofstring() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING);
+ }
+ /// an example documentation comment: this will end up in the generated code
+ /// multiline too
+ const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>> *testarrayoftables() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>> *>(VT_TESTARRAYOFTABLES);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>> *mutable_testarrayoftables() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>> *>(VT_TESTARRAYOFTABLES);
+ }
+ const MyGame::Example::Monster *enemy() const {
+ return GetPointer<const MyGame::Example::Monster *>(VT_ENEMY);
+ }
+ MyGame::Example::Monster *mutable_enemy() {
+ return GetPointer<MyGame::Example::Monster *>(VT_ENEMY);
+ }
+ const flatbuffers::Vector<uint8_t> *testnestedflatbuffer() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_TESTNESTEDFLATBUFFER);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_testnestedflatbuffer() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_TESTNESTEDFLATBUFFER);
+ }
+ const MyGame::Example::Monster *testnestedflatbuffer_nested_root() const {
+ return flatbuffers::GetRoot<MyGame::Example::Monster>(testnestedflatbuffer()->Data());
+ }
+ const MyGame::Example::Stat *testempty() const {
+ return GetPointer<const MyGame::Example::Stat *>(VT_TESTEMPTY);
+ }
+ MyGame::Example::Stat *mutable_testempty() {
+ return GetPointer<MyGame::Example::Stat *>(VT_TESTEMPTY);
+ }
+ bool testbool() const {
+ return GetField<uint8_t>(VT_TESTBOOL, 0) != 0;
+ }
+ bool mutate_testbool(bool _testbool = 0) {
+ return SetField<uint8_t>(VT_TESTBOOL, static_cast<uint8_t>(_testbool), 0);
+ }
+ int32_t testhashs32_fnv1() const {
+ return GetField<int32_t>(VT_TESTHASHS32_FNV1, 0);
+ }
+ bool mutate_testhashs32_fnv1(int32_t _testhashs32_fnv1 = 0) {
+ return SetField<int32_t>(VT_TESTHASHS32_FNV1, _testhashs32_fnv1, 0);
+ }
+ uint32_t testhashu32_fnv1() const {
+ return GetField<uint32_t>(VT_TESTHASHU32_FNV1, 0);
+ }
+ bool mutate_testhashu32_fnv1(uint32_t _testhashu32_fnv1 = 0) {
+ return SetField<uint32_t>(VT_TESTHASHU32_FNV1, _testhashu32_fnv1, 0);
+ }
+ int64_t testhashs64_fnv1() const {
+ return GetField<int64_t>(VT_TESTHASHS64_FNV1, 0);
+ }
+ bool mutate_testhashs64_fnv1(int64_t _testhashs64_fnv1 = 0) {
+ return SetField<int64_t>(VT_TESTHASHS64_FNV1, _testhashs64_fnv1, 0);
+ }
+ uint64_t testhashu64_fnv1() const {
+ return GetField<uint64_t>(VT_TESTHASHU64_FNV1, 0);
+ }
+ bool mutate_testhashu64_fnv1(uint64_t _testhashu64_fnv1 = 0) {
+ return SetField<uint64_t>(VT_TESTHASHU64_FNV1, _testhashu64_fnv1, 0);
+ }
+ int32_t testhashs32_fnv1a() const {
+ return GetField<int32_t>(VT_TESTHASHS32_FNV1A, 0);
+ }
+ bool mutate_testhashs32_fnv1a(int32_t _testhashs32_fnv1a = 0) {
+ return SetField<int32_t>(VT_TESTHASHS32_FNV1A, _testhashs32_fnv1a, 0);
+ }
+ uint32_t testhashu32_fnv1a() const {
+ return GetField<uint32_t>(VT_TESTHASHU32_FNV1A, 0);
+ }
+ bool mutate_testhashu32_fnv1a(uint32_t _testhashu32_fnv1a = 0) {
+ return SetField<uint32_t>(VT_TESTHASHU32_FNV1A, _testhashu32_fnv1a, 0);
+ }
+ int64_t testhashs64_fnv1a() const {
+ return GetField<int64_t>(VT_TESTHASHS64_FNV1A, 0);
+ }
+ bool mutate_testhashs64_fnv1a(int64_t _testhashs64_fnv1a = 0) {
+ return SetField<int64_t>(VT_TESTHASHS64_FNV1A, _testhashs64_fnv1a, 0);
+ }
+ uint64_t testhashu64_fnv1a() const {
+ return GetField<uint64_t>(VT_TESTHASHU64_FNV1A, 0);
+ }
+ bool mutate_testhashu64_fnv1a(uint64_t _testhashu64_fnv1a = 0) {
+ return SetField<uint64_t>(VT_TESTHASHU64_FNV1A, _testhashu64_fnv1a, 0);
+ }
+ const flatbuffers::Vector<uint8_t> *testarrayofbools() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_TESTARRAYOFBOOLS);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_testarrayofbools() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_TESTARRAYOFBOOLS);
+ }
+ float testf() const {
+ return GetField<float>(VT_TESTF, 3.14159f);
+ }
+ bool mutate_testf(float _testf = 3.14159f) {
+ return SetField<float>(VT_TESTF, _testf, 3.14159f);
+ }
+ float testf2() const {
+ return GetField<float>(VT_TESTF2, 3.0f);
+ }
+ bool mutate_testf2(float _testf2 = 3.0f) {
+ return SetField<float>(VT_TESTF2, _testf2, 3.0f);
+ }
+ float testf3() const {
+ return GetField<float>(VT_TESTF3, 0.0f);
+ }
+ bool mutate_testf3(float _testf3 = 0.0f) {
+ return SetField<float>(VT_TESTF3, _testf3, 0.0f);
+ }
+ const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring2() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING2);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *mutable_testarrayofstring2() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING2);
+ }
+ const flatbuffers::Vector<const MyGame::Example::Ability *> *testarrayofsortedstruct() const {
+ return GetPointer<const flatbuffers::Vector<const MyGame::Example::Ability *> *>(VT_TESTARRAYOFSORTEDSTRUCT);
+ }
+ flatbuffers::Vector<const MyGame::Example::Ability *> *mutable_testarrayofsortedstruct() {
+ return GetPointer<flatbuffers::Vector<const MyGame::Example::Ability *> *>(VT_TESTARRAYOFSORTEDSTRUCT);
+ }
+ const flatbuffers::Vector<uint8_t> *flex() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_FLEX);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_flex() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_FLEX);
+ }
+ flexbuffers::Reference flex_flexbuffer_root() const {
+ return flexbuffers::GetRoot(flex()->Data(), flex()->size());
+ }
+ const flatbuffers::Vector<const MyGame::Example::Test *> *test5() const {
+ return GetPointer<const flatbuffers::Vector<const MyGame::Example::Test *> *>(VT_TEST5);
+ }
+ flatbuffers::Vector<const MyGame::Example::Test *> *mutable_test5() {
+ return GetPointer<flatbuffers::Vector<const MyGame::Example::Test *> *>(VT_TEST5);
+ }
+ const flatbuffers::Vector<int64_t> *vector_of_longs() const {
+ return GetPointer<const flatbuffers::Vector<int64_t> *>(VT_VECTOR_OF_LONGS);
+ }
+ flatbuffers::Vector<int64_t> *mutable_vector_of_longs() {
+ return GetPointer<flatbuffers::Vector<int64_t> *>(VT_VECTOR_OF_LONGS);
+ }
+ const flatbuffers::Vector<double> *vector_of_doubles() const {
+ return GetPointer<const flatbuffers::Vector<double> *>(VT_VECTOR_OF_DOUBLES);
+ }
+ flatbuffers::Vector<double> *mutable_vector_of_doubles() {
+ return GetPointer<flatbuffers::Vector<double> *>(VT_VECTOR_OF_DOUBLES);
+ }
+ const MyGame::InParentNamespace *parent_namespace_test() const {
+ return GetPointer<const MyGame::InParentNamespace *>(VT_PARENT_NAMESPACE_TEST);
+ }
+ MyGame::InParentNamespace *mutable_parent_namespace_test() {
+ return GetPointer<MyGame::InParentNamespace *>(VT_PARENT_NAMESPACE_TEST);
+ }
+ const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *vector_of_referrables() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *>(VT_VECTOR_OF_REFERRABLES);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *mutable_vector_of_referrables() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *>(VT_VECTOR_OF_REFERRABLES);
+ }
+ uint64_t single_weak_reference() const {
+ return GetField<uint64_t>(VT_SINGLE_WEAK_REFERENCE, 0);
+ }
+ bool mutate_single_weak_reference(uint64_t _single_weak_reference = 0) {
+ return SetField<uint64_t>(VT_SINGLE_WEAK_REFERENCE, _single_weak_reference, 0);
+ }
+ const flatbuffers::Vector<uint64_t> *vector_of_weak_references() const {
+ return GetPointer<const flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_WEAK_REFERENCES);
+ }
+ flatbuffers::Vector<uint64_t> *mutable_vector_of_weak_references() {
+ return GetPointer<flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_WEAK_REFERENCES);
+ }
+ const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *vector_of_strong_referrables() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *>(VT_VECTOR_OF_STRONG_REFERRABLES);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *mutable_vector_of_strong_referrables() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *>(VT_VECTOR_OF_STRONG_REFERRABLES);
+ }
+ uint64_t co_owning_reference() const {
+ return GetField<uint64_t>(VT_CO_OWNING_REFERENCE, 0);
+ }
+ bool mutate_co_owning_reference(uint64_t _co_owning_reference = 0) {
+ return SetField<uint64_t>(VT_CO_OWNING_REFERENCE, _co_owning_reference, 0);
+ }
+ const flatbuffers::Vector<uint64_t> *vector_of_co_owning_references() const {
+ return GetPointer<const flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_CO_OWNING_REFERENCES);
+ }
+ flatbuffers::Vector<uint64_t> *mutable_vector_of_co_owning_references() {
+ return GetPointer<flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_CO_OWNING_REFERENCES);
+ }
+ uint64_t non_owning_reference() const {
+ return GetField<uint64_t>(VT_NON_OWNING_REFERENCE, 0);
+ }
+ bool mutate_non_owning_reference(uint64_t _non_owning_reference = 0) {
+ return SetField<uint64_t>(VT_NON_OWNING_REFERENCE, _non_owning_reference, 0);
+ }
+ const flatbuffers::Vector<uint64_t> *vector_of_non_owning_references() const {
+ return GetPointer<const flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_NON_OWNING_REFERENCES);
+ }
+ flatbuffers::Vector<uint64_t> *mutable_vector_of_non_owning_references() {
+ return GetPointer<flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_NON_OWNING_REFERENCES);
+ }
+ MyGame::Example::AnyUniqueAliases any_unique_type() const {
+ return static_cast<MyGame::Example::AnyUniqueAliases>(GetField<uint8_t>(VT_ANY_UNIQUE_TYPE, 0));
+ }
+ const void *any_unique() const {
+ return GetPointer<const void *>(VT_ANY_UNIQUE);
+ }
+ template<typename T> const T *any_unique_as() const;
+ const MyGame::Example::Monster *any_unique_as_M() const {
+ return any_unique_type() == MyGame::Example::AnyUniqueAliases_M ? static_cast<const MyGame::Example::Monster *>(any_unique()) : nullptr;
+ }
+ const MyGame::Example::TestSimpleTableWithEnum *any_unique_as_TS() const {
+ return any_unique_type() == MyGame::Example::AnyUniqueAliases_TS ? static_cast<const MyGame::Example::TestSimpleTableWithEnum *>(any_unique()) : nullptr;
+ }
+ const MyGame::Example2::Monster *any_unique_as_M2() const {
+ return any_unique_type() == MyGame::Example::AnyUniqueAliases_M2 ? static_cast<const MyGame::Example2::Monster *>(any_unique()) : nullptr;
+ }
+ void *mutable_any_unique() {
+ return GetPointer<void *>(VT_ANY_UNIQUE);
+ }
+ MyGame::Example::AnyAmbiguousAliases any_ambiguous_type() const {
+ return static_cast<MyGame::Example::AnyAmbiguousAliases>(GetField<uint8_t>(VT_ANY_AMBIGUOUS_TYPE, 0));
+ }
+ const void *any_ambiguous() const {
+ return GetPointer<const void *>(VT_ANY_AMBIGUOUS);
+ }
+ const MyGame::Example::Monster *any_ambiguous_as_M1() const {
+ return any_ambiguous_type() == MyGame::Example::AnyAmbiguousAliases_M1 ? static_cast<const MyGame::Example::Monster *>(any_ambiguous()) : nullptr;
+ }
+ const MyGame::Example::Monster *any_ambiguous_as_M2() const {
+ return any_ambiguous_type() == MyGame::Example::AnyAmbiguousAliases_M2 ? static_cast<const MyGame::Example::Monster *>(any_ambiguous()) : nullptr;
+ }
+ const MyGame::Example::Monster *any_ambiguous_as_M3() const {
+ return any_ambiguous_type() == MyGame::Example::AnyAmbiguousAliases_M3 ? static_cast<const MyGame::Example::Monster *>(any_ambiguous()) : nullptr;
+ }
+ void *mutable_any_ambiguous() {
+ return GetPointer<void *>(VT_ANY_AMBIGUOUS);
+ }
+ const flatbuffers::Vector<uint8_t> *vector_of_enums() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_VECTOR_OF_ENUMS);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_vector_of_enums() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_VECTOR_OF_ENUMS);
+ }
+ MyGame::Example::Race signed_enum() const {
+ return static_cast<MyGame::Example::Race>(GetField<int8_t>(VT_SIGNED_ENUM, -1));
+ }
+ bool mutate_signed_enum(MyGame::Example::Race _signed_enum = static_cast<MyGame::Example::Race>(-1)) {
+ return SetField<int8_t>(VT_SIGNED_ENUM, static_cast<int8_t>(_signed_enum), -1);
+ }
+ const flatbuffers::Vector<uint8_t> *testrequirednestedflatbuffer() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_TESTREQUIREDNESTEDFLATBUFFER);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_testrequirednestedflatbuffer() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_TESTREQUIREDNESTEDFLATBUFFER);
+ }
+ const MyGame::Example::Monster *testrequirednestedflatbuffer_nested_root() const {
+ return flatbuffers::GetRoot<MyGame::Example::Monster>(testrequirednestedflatbuffer()->Data());
+ }
+ const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>> *scalar_key_sorted_tables() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>> *>(VT_SCALAR_KEY_SORTED_TABLES);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>> *mutable_scalar_key_sorted_tables() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>> *>(VT_SCALAR_KEY_SORTED_TABLES);
+ }
+ const MyGame::Example::Test *native_inline() const {
+ return GetStruct<const MyGame::Example::Test *>(VT_NATIVE_INLINE);
+ }
+ MyGame::Example::Test *mutable_native_inline() {
+ return GetStruct<MyGame::Example::Test *>(VT_NATIVE_INLINE);
+ }
+ MyGame::Example::LongEnum long_enum_non_enum_default() const {
+ return static_cast<MyGame::Example::LongEnum>(GetField<uint64_t>(VT_LONG_ENUM_NON_ENUM_DEFAULT, 0));
+ }
+ bool mutate_long_enum_non_enum_default(MyGame::Example::LongEnum _long_enum_non_enum_default = static_cast<MyGame::Example::LongEnum>(0)) {
+ return SetField<uint64_t>(VT_LONG_ENUM_NON_ENUM_DEFAULT, static_cast<uint64_t>(_long_enum_non_enum_default), 0);
+ }
+ MyGame::Example::LongEnum long_enum_normal_default() const {
+ return static_cast<MyGame::Example::LongEnum>(GetField<uint64_t>(VT_LONG_ENUM_NORMAL_DEFAULT, 2ULL));
+ }
+ bool mutate_long_enum_normal_default(MyGame::Example::LongEnum _long_enum_normal_default = static_cast<MyGame::Example::LongEnum>(2ULL)) {
+ return SetField<uint64_t>(VT_LONG_ENUM_NORMAL_DEFAULT, static_cast<uint64_t>(_long_enum_normal_default), 2ULL);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyField<MyGame::Example::Vec3>(verifier, VT_POS, 8) &&
+ VerifyField<int16_t>(verifier, VT_MANA, 2) &&
+ VerifyField<int16_t>(verifier, VT_HP, 2) &&
+ VerifyOffsetRequired(verifier, VT_NAME) &&
+ verifier.VerifyString(name()) &&
+ VerifyOffset(verifier, VT_INVENTORY) &&
+ verifier.VerifyVector(inventory()) &&
+ VerifyField<uint8_t>(verifier, VT_COLOR, 1) &&
+ VerifyField<uint8_t>(verifier, VT_TEST_TYPE, 1) &&
+ VerifyOffset(verifier, VT_TEST) &&
+ VerifyAny(verifier, test(), test_type()) &&
+ VerifyOffset(verifier, VT_TEST4) &&
+ verifier.VerifyVector(test4()) &&
+ VerifyOffset(verifier, VT_TESTARRAYOFSTRING) &&
+ verifier.VerifyVector(testarrayofstring()) &&
+ verifier.VerifyVectorOfStrings(testarrayofstring()) &&
+ VerifyOffset(verifier, VT_TESTARRAYOFTABLES) &&
+ verifier.VerifyVector(testarrayoftables()) &&
+ verifier.VerifyVectorOfTables(testarrayoftables()) &&
+ VerifyOffset(verifier, VT_ENEMY) &&
+ verifier.VerifyTable(enemy()) &&
+ VerifyOffset(verifier, VT_TESTNESTEDFLATBUFFER) &&
+ verifier.VerifyVector(testnestedflatbuffer()) &&
+ verifier.VerifyNestedFlatBuffer<MyGame::Example::Monster>(testnestedflatbuffer(), nullptr) &&
+ VerifyOffset(verifier, VT_TESTEMPTY) &&
+ verifier.VerifyTable(testempty()) &&
+ VerifyField<uint8_t>(verifier, VT_TESTBOOL, 1) &&
+ VerifyField<int32_t>(verifier, VT_TESTHASHS32_FNV1, 4) &&
+ VerifyField<uint32_t>(verifier, VT_TESTHASHU32_FNV1, 4) &&
+ VerifyField<int64_t>(verifier, VT_TESTHASHS64_FNV1, 8) &&
+ VerifyField<uint64_t>(verifier, VT_TESTHASHU64_FNV1, 8) &&
+ VerifyField<int32_t>(verifier, VT_TESTHASHS32_FNV1A, 4) &&
+ VerifyField<uint32_t>(verifier, VT_TESTHASHU32_FNV1A, 4) &&
+ VerifyField<int64_t>(verifier, VT_TESTHASHS64_FNV1A, 8) &&
+ VerifyField<uint64_t>(verifier, VT_TESTHASHU64_FNV1A, 8) &&
+ VerifyOffset(verifier, VT_TESTARRAYOFBOOLS) &&
+ verifier.VerifyVector(testarrayofbools()) &&
+ VerifyField<float>(verifier, VT_TESTF, 4) &&
+ VerifyField<float>(verifier, VT_TESTF2, 4) &&
+ VerifyField<float>(verifier, VT_TESTF3, 4) &&
+ VerifyOffset(verifier, VT_TESTARRAYOFSTRING2) &&
+ verifier.VerifyVector(testarrayofstring2()) &&
+ verifier.VerifyVectorOfStrings(testarrayofstring2()) &&
+ VerifyOffset(verifier, VT_TESTARRAYOFSORTEDSTRUCT) &&
+ verifier.VerifyVector(testarrayofsortedstruct()) &&
+ VerifyOffset(verifier, VT_FLEX) &&
+ verifier.VerifyVector(flex()) &&
+ flexbuffers::VerifyNestedFlexBuffer(flex(), verifier) &&
+ VerifyOffset(verifier, VT_TEST5) &&
+ verifier.VerifyVector(test5()) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_LONGS) &&
+ verifier.VerifyVector(vector_of_longs()) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_DOUBLES) &&
+ verifier.VerifyVector(vector_of_doubles()) &&
+ VerifyOffset(verifier, VT_PARENT_NAMESPACE_TEST) &&
+ verifier.VerifyTable(parent_namespace_test()) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_REFERRABLES) &&
+ verifier.VerifyVector(vector_of_referrables()) &&
+ verifier.VerifyVectorOfTables(vector_of_referrables()) &&
+ VerifyField<uint64_t>(verifier, VT_SINGLE_WEAK_REFERENCE, 8) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_WEAK_REFERENCES) &&
+ verifier.VerifyVector(vector_of_weak_references()) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_STRONG_REFERRABLES) &&
+ verifier.VerifyVector(vector_of_strong_referrables()) &&
+ verifier.VerifyVectorOfTables(vector_of_strong_referrables()) &&
+ VerifyField<uint64_t>(verifier, VT_CO_OWNING_REFERENCE, 8) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_CO_OWNING_REFERENCES) &&
+ verifier.VerifyVector(vector_of_co_owning_references()) &&
+ VerifyField<uint64_t>(verifier, VT_NON_OWNING_REFERENCE, 8) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_NON_OWNING_REFERENCES) &&
+ verifier.VerifyVector(vector_of_non_owning_references()) &&
+ VerifyField<uint8_t>(verifier, VT_ANY_UNIQUE_TYPE, 1) &&
+ VerifyOffset(verifier, VT_ANY_UNIQUE) &&
+ VerifyAnyUniqueAliases(verifier, any_unique(), any_unique_type()) &&
+ VerifyField<uint8_t>(verifier, VT_ANY_AMBIGUOUS_TYPE, 1) &&
+ VerifyOffset(verifier, VT_ANY_AMBIGUOUS) &&
+ VerifyAnyAmbiguousAliases(verifier, any_ambiguous(), any_ambiguous_type()) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_ENUMS) &&
+ verifier.VerifyVector(vector_of_enums()) &&
+ VerifyField<int8_t>(verifier, VT_SIGNED_ENUM, 1) &&
+ VerifyOffset(verifier, VT_TESTREQUIREDNESTEDFLATBUFFER) &&
+ verifier.VerifyVector(testrequirednestedflatbuffer()) &&
+ verifier.VerifyNestedFlatBuffer<MyGame::Example::Monster>(testrequirednestedflatbuffer(), nullptr) &&
+ VerifyOffset(verifier, VT_SCALAR_KEY_SORTED_TABLES) &&
+ verifier.VerifyVector(scalar_key_sorted_tables()) &&
+ verifier.VerifyVectorOfTables(scalar_key_sorted_tables()) &&
+ VerifyField<MyGame::Example::Test>(verifier, VT_NATIVE_INLINE, 2) &&
+ VerifyField<uint64_t>(verifier, VT_LONG_ENUM_NON_ENUM_DEFAULT, 8) &&
+ VerifyField<uint64_t>(verifier, VT_LONG_ENUM_NORMAL_DEFAULT, 8) &&
+ verifier.EndTable();
+ }
+ MonsterT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<Monster> Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+template<> inline const MyGame::Example::Monster *Monster::test_as<MyGame::Example::Monster>() const {
+ return test_as_Monster();
+}
+
+template<> inline const MyGame::Example::TestSimpleTableWithEnum *Monster::test_as<MyGame::Example::TestSimpleTableWithEnum>() const {
+ return test_as_TestSimpleTableWithEnum();
+}
+
+template<> inline const MyGame::Example2::Monster *Monster::test_as<MyGame::Example2::Monster>() const {
+ return test_as_MyGame_Example2_Monster();
+}
+
+template<> inline const MyGame::Example::Monster *Monster::any_unique_as<MyGame::Example::Monster>() const {
+ return any_unique_as_M();
+}
+
+template<> inline const MyGame::Example::TestSimpleTableWithEnum *Monster::any_unique_as<MyGame::Example::TestSimpleTableWithEnum>() const {
+ return any_unique_as_TS();
+}
+
+template<> inline const MyGame::Example2::Monster *Monster::any_unique_as<MyGame::Example2::Monster>() const {
+ return any_unique_as_M2();
+}
+
+struct MonsterBuilder {
+ typedef Monster Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_pos(const MyGame::Example::Vec3 *pos) {
+ fbb_.AddStruct(Monster::VT_POS, pos);
+ }
+ void add_mana(int16_t mana) {
+ fbb_.AddElement<int16_t>(Monster::VT_MANA, mana, 150);
+ }
+ void add_hp(int16_t hp) {
+ fbb_.AddElement<int16_t>(Monster::VT_HP, hp, 100);
+ }
+ void add_name(flatbuffers::Offset<flatbuffers::String> name) {
+ fbb_.AddOffset(Monster::VT_NAME, name);
+ }
+ void add_inventory(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> inventory) {
+ fbb_.AddOffset(Monster::VT_INVENTORY, inventory);
+ }
+ void add_color(MyGame::Example::Color color) {
+ fbb_.AddElement<uint8_t>(Monster::VT_COLOR, static_cast<uint8_t>(color), 8);
+ }
+ void add_test_type(MyGame::Example::Any test_type) {
+ fbb_.AddElement<uint8_t>(Monster::VT_TEST_TYPE, static_cast<uint8_t>(test_type), 0);
+ }
+ void add_test(flatbuffers::Offset<void> test) {
+ fbb_.AddOffset(Monster::VT_TEST, test);
+ }
+ void add_test4(flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Test *>> test4) {
+ fbb_.AddOffset(Monster::VT_TEST4, test4);
+ }
+ void add_testarrayofstring(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring) {
+ fbb_.AddOffset(Monster::VT_TESTARRAYOFSTRING, testarrayofstring);
+ }
+ void add_testarrayoftables(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>>> testarrayoftables) {
+ fbb_.AddOffset(Monster::VT_TESTARRAYOFTABLES, testarrayoftables);
+ }
+ void add_enemy(flatbuffers::Offset<MyGame::Example::Monster> enemy) {
+ fbb_.AddOffset(Monster::VT_ENEMY, enemy);
+ }
+ void add_testnestedflatbuffer(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testnestedflatbuffer) {
+ fbb_.AddOffset(Monster::VT_TESTNESTEDFLATBUFFER, testnestedflatbuffer);
+ }
+ void add_testempty(flatbuffers::Offset<MyGame::Example::Stat> testempty) {
+ fbb_.AddOffset(Monster::VT_TESTEMPTY, testempty);
+ }
+ void add_testbool(bool testbool) {
+ fbb_.AddElement<uint8_t>(Monster::VT_TESTBOOL, static_cast<uint8_t>(testbool), 0);
+ }
+ void add_testhashs32_fnv1(int32_t testhashs32_fnv1) {
+ fbb_.AddElement<int32_t>(Monster::VT_TESTHASHS32_FNV1, testhashs32_fnv1, 0);
+ }
+ void add_testhashu32_fnv1(uint32_t testhashu32_fnv1) {
+ fbb_.AddElement<uint32_t>(Monster::VT_TESTHASHU32_FNV1, testhashu32_fnv1, 0);
+ }
+ void add_testhashs64_fnv1(int64_t testhashs64_fnv1) {
+ fbb_.AddElement<int64_t>(Monster::VT_TESTHASHS64_FNV1, testhashs64_fnv1, 0);
+ }
+ void add_testhashu64_fnv1(uint64_t testhashu64_fnv1) {
+ fbb_.AddElement<uint64_t>(Monster::VT_TESTHASHU64_FNV1, testhashu64_fnv1, 0);
+ }
+ void add_testhashs32_fnv1a(int32_t testhashs32_fnv1a) {
+ fbb_.AddElement<int32_t>(Monster::VT_TESTHASHS32_FNV1A, testhashs32_fnv1a, 0);
+ }
+ void add_testhashu32_fnv1a(uint32_t testhashu32_fnv1a) {
+ fbb_.AddElement<uint32_t>(Monster::VT_TESTHASHU32_FNV1A, testhashu32_fnv1a, 0);
+ }
+ void add_testhashs64_fnv1a(int64_t testhashs64_fnv1a) {
+ fbb_.AddElement<int64_t>(Monster::VT_TESTHASHS64_FNV1A, testhashs64_fnv1a, 0);
+ }
+ void add_testhashu64_fnv1a(uint64_t testhashu64_fnv1a) {
+ fbb_.AddElement<uint64_t>(Monster::VT_TESTHASHU64_FNV1A, testhashu64_fnv1a, 0);
+ }
+ void add_testarrayofbools(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testarrayofbools) {
+ fbb_.AddOffset(Monster::VT_TESTARRAYOFBOOLS, testarrayofbools);
+ }
+ void add_testf(float testf) {
+ fbb_.AddElement<float>(Monster::VT_TESTF, testf, 3.14159f);
+ }
+ void add_testf2(float testf2) {
+ fbb_.AddElement<float>(Monster::VT_TESTF2, testf2, 3.0f);
+ }
+ void add_testf3(float testf3) {
+ fbb_.AddElement<float>(Monster::VT_TESTF3, testf3, 0.0f);
+ }
+ void add_testarrayofstring2(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring2) {
+ fbb_.AddOffset(Monster::VT_TESTARRAYOFSTRING2, testarrayofstring2);
+ }
+ void add_testarrayofsortedstruct(flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Ability *>> testarrayofsortedstruct) {
+ fbb_.AddOffset(Monster::VT_TESTARRAYOFSORTEDSTRUCT, testarrayofsortedstruct);
+ }
+ void add_flex(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> flex) {
+ fbb_.AddOffset(Monster::VT_FLEX, flex);
+ }
+ void add_test5(flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Test *>> test5) {
+ fbb_.AddOffset(Monster::VT_TEST5, test5);
+ }
+ void add_vector_of_longs(flatbuffers::Offset<flatbuffers::Vector<int64_t>> vector_of_longs) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_LONGS, vector_of_longs);
+ }
+ void add_vector_of_doubles(flatbuffers::Offset<flatbuffers::Vector<double>> vector_of_doubles) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_DOUBLES, vector_of_doubles);
+ }
+ void add_parent_namespace_test(flatbuffers::Offset<MyGame::InParentNamespace> parent_namespace_test) {
+ fbb_.AddOffset(Monster::VT_PARENT_NAMESPACE_TEST, parent_namespace_test);
+ }
+ void add_vector_of_referrables(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>>> vector_of_referrables) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_REFERRABLES, vector_of_referrables);
+ }
+ void add_single_weak_reference(uint64_t single_weak_reference) {
+ fbb_.AddElement<uint64_t>(Monster::VT_SINGLE_WEAK_REFERENCE, single_weak_reference, 0);
+ }
+ void add_vector_of_weak_references(flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_weak_references) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_WEAK_REFERENCES, vector_of_weak_references);
+ }
+ void add_vector_of_strong_referrables(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>>> vector_of_strong_referrables) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_STRONG_REFERRABLES, vector_of_strong_referrables);
+ }
+ void add_co_owning_reference(uint64_t co_owning_reference) {
+ fbb_.AddElement<uint64_t>(Monster::VT_CO_OWNING_REFERENCE, co_owning_reference, 0);
+ }
+ void add_vector_of_co_owning_references(flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_co_owning_references) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_CO_OWNING_REFERENCES, vector_of_co_owning_references);
+ }
+ void add_non_owning_reference(uint64_t non_owning_reference) {
+ fbb_.AddElement<uint64_t>(Monster::VT_NON_OWNING_REFERENCE, non_owning_reference, 0);
+ }
+ void add_vector_of_non_owning_references(flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_non_owning_references) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, vector_of_non_owning_references);
+ }
+ void add_any_unique_type(MyGame::Example::AnyUniqueAliases any_unique_type) {
+ fbb_.AddElement<uint8_t>(Monster::VT_ANY_UNIQUE_TYPE, static_cast<uint8_t>(any_unique_type), 0);
+ }
+ void add_any_unique(flatbuffers::Offset<void> any_unique) {
+ fbb_.AddOffset(Monster::VT_ANY_UNIQUE, any_unique);
+ }
+ void add_any_ambiguous_type(MyGame::Example::AnyAmbiguousAliases any_ambiguous_type) {
+ fbb_.AddElement<uint8_t>(Monster::VT_ANY_AMBIGUOUS_TYPE, static_cast<uint8_t>(any_ambiguous_type), 0);
+ }
+ void add_any_ambiguous(flatbuffers::Offset<void> any_ambiguous) {
+ fbb_.AddOffset(Monster::VT_ANY_AMBIGUOUS, any_ambiguous);
+ }
+ void add_vector_of_enums(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> vector_of_enums) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_ENUMS, vector_of_enums);
+ }
+ void add_signed_enum(MyGame::Example::Race signed_enum) {
+ fbb_.AddElement<int8_t>(Monster::VT_SIGNED_ENUM, static_cast<int8_t>(signed_enum), -1);
+ }
+ void add_testrequirednestedflatbuffer(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testrequirednestedflatbuffer) {
+ fbb_.AddOffset(Monster::VT_TESTREQUIREDNESTEDFLATBUFFER, testrequirednestedflatbuffer);
+ }
+ void add_scalar_key_sorted_tables(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>>> scalar_key_sorted_tables) {
+ fbb_.AddOffset(Monster::VT_SCALAR_KEY_SORTED_TABLES, scalar_key_sorted_tables);
+ }
+ void add_native_inline(const MyGame::Example::Test *native_inline) {
+ fbb_.AddStruct(Monster::VT_NATIVE_INLINE, native_inline);
+ }
+ void add_long_enum_non_enum_default(MyGame::Example::LongEnum long_enum_non_enum_default) {
+ fbb_.AddElement<uint64_t>(Monster::VT_LONG_ENUM_NON_ENUM_DEFAULT, static_cast<uint64_t>(long_enum_non_enum_default), 0);
+ }
+ void add_long_enum_normal_default(MyGame::Example::LongEnum long_enum_normal_default) {
+ fbb_.AddElement<uint64_t>(Monster::VT_LONG_ENUM_NORMAL_DEFAULT, static_cast<uint64_t>(long_enum_normal_default), 2ULL);
+ }
+ explicit MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<Monster> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<Monster>(end);
+ fbb_.Required(o, Monster::VT_NAME);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<Monster> CreateMonster(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ const MyGame::Example::Vec3 *pos = nullptr,
+ int16_t mana = 150,
+ int16_t hp = 100,
+ flatbuffers::Offset<flatbuffers::String> name = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> inventory = 0,
+ MyGame::Example::Color color = MyGame::Example::Color_Blue,
+ MyGame::Example::Any test_type = MyGame::Example::Any_NONE,
+ flatbuffers::Offset<void> test = 0,
+ flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Test *>> test4 = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>>> testarrayoftables = 0,
+ flatbuffers::Offset<MyGame::Example::Monster> enemy = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testnestedflatbuffer = 0,
+ flatbuffers::Offset<MyGame::Example::Stat> testempty = 0,
+ bool testbool = false,
+ int32_t testhashs32_fnv1 = 0,
+ uint32_t testhashu32_fnv1 = 0,
+ int64_t testhashs64_fnv1 = 0,
+ uint64_t testhashu64_fnv1 = 0,
+ int32_t testhashs32_fnv1a = 0,
+ uint32_t testhashu32_fnv1a = 0,
+ int64_t testhashs64_fnv1a = 0,
+ uint64_t testhashu64_fnv1a = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testarrayofbools = 0,
+ float testf = 3.14159f,
+ float testf2 = 3.0f,
+ float testf3 = 0.0f,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring2 = 0,
+ flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Ability *>> testarrayofsortedstruct = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> flex = 0,
+ flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Test *>> test5 = 0,
+ flatbuffers::Offset<flatbuffers::Vector<int64_t>> vector_of_longs = 0,
+ flatbuffers::Offset<flatbuffers::Vector<double>> vector_of_doubles = 0,
+ flatbuffers::Offset<MyGame::InParentNamespace> parent_namespace_test = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>>> vector_of_referrables = 0,
+ uint64_t single_weak_reference = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_weak_references = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>>> vector_of_strong_referrables = 0,
+ uint64_t co_owning_reference = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_co_owning_references = 0,
+ uint64_t non_owning_reference = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_non_owning_references = 0,
+ MyGame::Example::AnyUniqueAliases any_unique_type = MyGame::Example::AnyUniqueAliases_NONE,
+ flatbuffers::Offset<void> any_unique = 0,
+ MyGame::Example::AnyAmbiguousAliases any_ambiguous_type = MyGame::Example::AnyAmbiguousAliases_NONE,
+ flatbuffers::Offset<void> any_ambiguous = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> vector_of_enums = 0,
+ MyGame::Example::Race signed_enum = MyGame::Example::Race_None,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testrequirednestedflatbuffer = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>>> scalar_key_sorted_tables = 0,
+ const MyGame::Example::Test *native_inline = nullptr,
+ MyGame::Example::LongEnum long_enum_non_enum_default = static_cast<MyGame::Example::LongEnum>(0),
+ MyGame::Example::LongEnum long_enum_normal_default = MyGame::Example::LongEnum_LongOne) {
+ MonsterBuilder builder_(_fbb);
+ builder_.add_long_enum_normal_default(long_enum_normal_default);
+ builder_.add_long_enum_non_enum_default(long_enum_non_enum_default);
+ builder_.add_non_owning_reference(non_owning_reference);
+ builder_.add_co_owning_reference(co_owning_reference);
+ builder_.add_single_weak_reference(single_weak_reference);
+ builder_.add_testhashu64_fnv1a(testhashu64_fnv1a);
+ builder_.add_testhashs64_fnv1a(testhashs64_fnv1a);
+ builder_.add_testhashu64_fnv1(testhashu64_fnv1);
+ builder_.add_testhashs64_fnv1(testhashs64_fnv1);
+ builder_.add_native_inline(native_inline);
+ builder_.add_scalar_key_sorted_tables(scalar_key_sorted_tables);
+ builder_.add_testrequirednestedflatbuffer(testrequirednestedflatbuffer);
+ builder_.add_vector_of_enums(vector_of_enums);
+ builder_.add_any_ambiguous(any_ambiguous);
+ builder_.add_any_unique(any_unique);
+ builder_.add_vector_of_non_owning_references(vector_of_non_owning_references);
+ builder_.add_vector_of_co_owning_references(vector_of_co_owning_references);
+ builder_.add_vector_of_strong_referrables(vector_of_strong_referrables);
+ builder_.add_vector_of_weak_references(vector_of_weak_references);
+ builder_.add_vector_of_referrables(vector_of_referrables);
+ builder_.add_parent_namespace_test(parent_namespace_test);
+ builder_.add_vector_of_doubles(vector_of_doubles);
+ builder_.add_vector_of_longs(vector_of_longs);
+ builder_.add_test5(test5);
+ builder_.add_flex(flex);
+ builder_.add_testarrayofsortedstruct(testarrayofsortedstruct);
+ builder_.add_testarrayofstring2(testarrayofstring2);
+ builder_.add_testf3(testf3);
+ builder_.add_testf2(testf2);
+ builder_.add_testf(testf);
+ builder_.add_testarrayofbools(testarrayofbools);
+ builder_.add_testhashu32_fnv1a(testhashu32_fnv1a);
+ builder_.add_testhashs32_fnv1a(testhashs32_fnv1a);
+ builder_.add_testhashu32_fnv1(testhashu32_fnv1);
+ builder_.add_testhashs32_fnv1(testhashs32_fnv1);
+ builder_.add_testempty(testempty);
+ builder_.add_testnestedflatbuffer(testnestedflatbuffer);
+ builder_.add_enemy(enemy);
+ builder_.add_testarrayoftables(testarrayoftables);
+ builder_.add_testarrayofstring(testarrayofstring);
+ builder_.add_test4(test4);
+ builder_.add_test(test);
+ builder_.add_inventory(inventory);
+ builder_.add_name(name);
+ builder_.add_pos(pos);
+ builder_.add_hp(hp);
+ builder_.add_mana(mana);
+ builder_.add_signed_enum(signed_enum);
+ builder_.add_any_ambiguous_type(any_ambiguous_type);
+ builder_.add_any_unique_type(any_unique_type);
+ builder_.add_testbool(testbool);
+ builder_.add_test_type(test_type);
+ builder_.add_color(color);
+ return builder_.Finish();
+}
+
+inline flatbuffers::Offset<Monster> CreateMonsterDirect(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ const MyGame::Example::Vec3 *pos = nullptr,
+ int16_t mana = 150,
+ int16_t hp = 100,
+ const char *name = nullptr,
+ const std::vector<uint8_t> *inventory = nullptr,
+ MyGame::Example::Color color = MyGame::Example::Color_Blue,
+ MyGame::Example::Any test_type = MyGame::Example::Any_NONE,
+ flatbuffers::Offset<void> test = 0,
+ const std::vector<MyGame::Example::Test> *test4 = nullptr,
+ const std::vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring = nullptr,
+ std::vector<flatbuffers::Offset<MyGame::Example::Monster>> *testarrayoftables = nullptr,
+ flatbuffers::Offset<MyGame::Example::Monster> enemy = 0,
+ const std::vector<uint8_t> *testnestedflatbuffer = nullptr,
+ flatbuffers::Offset<MyGame::Example::Stat> testempty = 0,
+ bool testbool = false,
+ int32_t testhashs32_fnv1 = 0,
+ uint32_t testhashu32_fnv1 = 0,
+ int64_t testhashs64_fnv1 = 0,
+ uint64_t testhashu64_fnv1 = 0,
+ int32_t testhashs32_fnv1a = 0,
+ uint32_t testhashu32_fnv1a = 0,
+ int64_t testhashs64_fnv1a = 0,
+ uint64_t testhashu64_fnv1a = 0,
+ const std::vector<uint8_t> *testarrayofbools = nullptr,
+ float testf = 3.14159f,
+ float testf2 = 3.0f,
+ float testf3 = 0.0f,
+ const std::vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring2 = nullptr,
+ std::vector<MyGame::Example::Ability> *testarrayofsortedstruct = nullptr,
+ const std::vector<uint8_t> *flex = nullptr,
+ const std::vector<MyGame::Example::Test> *test5 = nullptr,
+ const std::vector<int64_t> *vector_of_longs = nullptr,
+ const std::vector<double> *vector_of_doubles = nullptr,
+ flatbuffers::Offset<MyGame::InParentNamespace> parent_namespace_test = 0,
+ std::vector<flatbuffers::Offset<MyGame::Example::Referrable>> *vector_of_referrables = nullptr,
+ uint64_t single_weak_reference = 0,
+ const std::vector<uint64_t> *vector_of_weak_references = nullptr,
+ std::vector<flatbuffers::Offset<MyGame::Example::Referrable>> *vector_of_strong_referrables = nullptr,
+ uint64_t co_owning_reference = 0,
+ const std::vector<uint64_t> *vector_of_co_owning_references = nullptr,
+ uint64_t non_owning_reference = 0,
+ const std::vector<uint64_t> *vector_of_non_owning_references = nullptr,
+ MyGame::Example::AnyUniqueAliases any_unique_type = MyGame::Example::AnyUniqueAliases_NONE,
+ flatbuffers::Offset<void> any_unique = 0,
+ MyGame::Example::AnyAmbiguousAliases any_ambiguous_type = MyGame::Example::AnyAmbiguousAliases_NONE,
+ flatbuffers::Offset<void> any_ambiguous = 0,
+ const std::vector<uint8_t> *vector_of_enums = nullptr,
+ MyGame::Example::Race signed_enum = MyGame::Example::Race_None,
+ const std::vector<uint8_t> *testrequirednestedflatbuffer = nullptr,
+ std::vector<flatbuffers::Offset<MyGame::Example::Stat>> *scalar_key_sorted_tables = nullptr,
+ const MyGame::Example::Test *native_inline = nullptr,
+ MyGame::Example::LongEnum long_enum_non_enum_default = static_cast<MyGame::Example::LongEnum>(0),
+ MyGame::Example::LongEnum long_enum_normal_default = MyGame::Example::LongEnum_LongOne) {
+ auto name__ = name ? _fbb.CreateString(name) : 0;
+ auto inventory__ = inventory ? _fbb.CreateVector<uint8_t>(*inventory) : 0;
+ auto test4__ = test4 ? _fbb.CreateVectorOfStructs<MyGame::Example::Test>(*test4) : 0;
+ auto testarrayofstring__ = testarrayofstring ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*testarrayofstring) : 0;
+ auto testarrayoftables__ = testarrayoftables ? _fbb.CreateVectorOfSortedTables<MyGame::Example::Monster>(testarrayoftables) : 0;
+ auto testnestedflatbuffer__ = testnestedflatbuffer ? _fbb.CreateVector<uint8_t>(*testnestedflatbuffer) : 0;
+ auto testarrayofbools__ = testarrayofbools ? _fbb.CreateVector<uint8_t>(*testarrayofbools) : 0;
+ auto testarrayofstring2__ = testarrayofstring2 ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*testarrayofstring2) : 0;
+ auto testarrayofsortedstruct__ = testarrayofsortedstruct ? _fbb.CreateVectorOfSortedStructs<MyGame::Example::Ability>(testarrayofsortedstruct) : 0;
+ auto flex__ = flex ? _fbb.CreateVector<uint8_t>(*flex) : 0;
+ auto test5__ = test5 ? _fbb.CreateVectorOfStructs<MyGame::Example::Test>(*test5) : 0;
+ auto vector_of_longs__ = vector_of_longs ? _fbb.CreateVector<int64_t>(*vector_of_longs) : 0;
+ auto vector_of_doubles__ = vector_of_doubles ? _fbb.CreateVector<double>(*vector_of_doubles) : 0;
+ auto vector_of_referrables__ = vector_of_referrables ? _fbb.CreateVectorOfSortedTables<MyGame::Example::Referrable>(vector_of_referrables) : 0;
+ auto vector_of_weak_references__ = vector_of_weak_references ? _fbb.CreateVector<uint64_t>(*vector_of_weak_references) : 0;
+ auto vector_of_strong_referrables__ = vector_of_strong_referrables ? _fbb.CreateVectorOfSortedTables<MyGame::Example::Referrable>(vector_of_strong_referrables) : 0;
+ auto vector_of_co_owning_references__ = vector_of_co_owning_references ? _fbb.CreateVector<uint64_t>(*vector_of_co_owning_references) : 0;
+ auto vector_of_non_owning_references__ = vector_of_non_owning_references ? _fbb.CreateVector<uint64_t>(*vector_of_non_owning_references) : 0;
+ auto vector_of_enums__ = vector_of_enums ? _fbb.CreateVector<uint8_t>(*vector_of_enums) : 0;
+ auto testrequirednestedflatbuffer__ = testrequirednestedflatbuffer ? _fbb.CreateVector<uint8_t>(*testrequirednestedflatbuffer) : 0;
+ auto scalar_key_sorted_tables__ = scalar_key_sorted_tables ? _fbb.CreateVectorOfSortedTables<MyGame::Example::Stat>(scalar_key_sorted_tables) : 0;
+ return MyGame::Example::CreateMonster(
+ _fbb,
+ pos,
+ mana,
+ hp,
+ name__,
+ inventory__,
+ color,
+ test_type,
+ test,
+ test4__,
+ testarrayofstring__,
+ testarrayoftables__,
+ enemy,
+ testnestedflatbuffer__,
+ testempty,
+ testbool,
+ testhashs32_fnv1,
+ testhashu32_fnv1,
+ testhashs64_fnv1,
+ testhashu64_fnv1,
+ testhashs32_fnv1a,
+ testhashu32_fnv1a,
+ testhashs64_fnv1a,
+ testhashu64_fnv1a,
+ testarrayofbools__,
+ testf,
+ testf2,
+ testf3,
+ testarrayofstring2__,
+ testarrayofsortedstruct__,
+ flex__,
+ test5__,
+ vector_of_longs__,
+ vector_of_doubles__,
+ parent_namespace_test,
+ vector_of_referrables__,
+ single_weak_reference,
+ vector_of_weak_references__,
+ vector_of_strong_referrables__,
+ co_owning_reference,
+ vector_of_co_owning_references__,
+ non_owning_reference,
+ vector_of_non_owning_references__,
+ any_unique_type,
+ any_unique,
+ any_ambiguous_type,
+ any_ambiguous,
+ vector_of_enums__,
+ signed_enum,
+ testrequirednestedflatbuffer__,
+ scalar_key_sorted_tables__,
+ native_inline,
+ long_enum_non_enum_default,
+ long_enum_normal_default);
+}
+
+flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+struct TypeAliasesT : public flatbuffers::NativeTable {
+ typedef TypeAliases TableType;
+ int8_t i8 = 0;
+ uint8_t u8 = 0;
+ int16_t i16 = 0;
+ uint16_t u16 = 0;
+ int32_t i32 = 0;
+ uint32_t u32 = 0;
+ int64_t i64 = 0;
+ uint64_t u64 = 0;
+ float f32 = 0.0f;
+ double f64 = 0.0;
+ std::vector<int8_t> v8{};
+ std::vector<double> vf64{};
+};
+
+struct TypeAliases FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef TypeAliasesT NativeTableType;
+ typedef TypeAliasesBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return TypeAliasesTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_I8 = 4,
+ VT_U8 = 6,
+ VT_I16 = 8,
+ VT_U16 = 10,
+ VT_I32 = 12,
+ VT_U32 = 14,
+ VT_I64 = 16,
+ VT_U64 = 18,
+ VT_F32 = 20,
+ VT_F64 = 22,
+ VT_V8 = 24,
+ VT_VF64 = 26
+ };
+ int8_t i8() const {
+ return GetField<int8_t>(VT_I8, 0);
+ }
+ bool mutate_i8(int8_t _i8 = 0) {
+ return SetField<int8_t>(VT_I8, _i8, 0);
+ }
+ uint8_t u8() const {
+ return GetField<uint8_t>(VT_U8, 0);
+ }
+ bool mutate_u8(uint8_t _u8 = 0) {
+ return SetField<uint8_t>(VT_U8, _u8, 0);
+ }
+ int16_t i16() const {
+ return GetField<int16_t>(VT_I16, 0);
+ }
+ bool mutate_i16(int16_t _i16 = 0) {
+ return SetField<int16_t>(VT_I16, _i16, 0);
+ }
+ uint16_t u16() const {
+ return GetField<uint16_t>(VT_U16, 0);
+ }
+ bool mutate_u16(uint16_t _u16 = 0) {
+ return SetField<uint16_t>(VT_U16, _u16, 0);
+ }
+ int32_t i32() const {
+ return GetField<int32_t>(VT_I32, 0);
+ }
+ bool mutate_i32(int32_t _i32 = 0) {
+ return SetField<int32_t>(VT_I32, _i32, 0);
+ }
+ uint32_t u32() const {
+ return GetField<uint32_t>(VT_U32, 0);
+ }
+ bool mutate_u32(uint32_t _u32 = 0) {
+ return SetField<uint32_t>(VT_U32, _u32, 0);
+ }
+ int64_t i64() const {
+ return GetField<int64_t>(VT_I64, 0);
+ }
+ bool mutate_i64(int64_t _i64 = 0) {
+ return SetField<int64_t>(VT_I64, _i64, 0);
+ }
+ uint64_t u64() const {
+ return GetField<uint64_t>(VT_U64, 0);
+ }
+ bool mutate_u64(uint64_t _u64 = 0) {
+ return SetField<uint64_t>(VT_U64, _u64, 0);
+ }
+ float f32() const {
+ return GetField<float>(VT_F32, 0.0f);
+ }
+ bool mutate_f32(float _f32 = 0.0f) {
+ return SetField<float>(VT_F32, _f32, 0.0f);
+ }
+ double f64() const {
+ return GetField<double>(VT_F64, 0.0);
+ }
+ bool mutate_f64(double _f64 = 0.0) {
+ return SetField<double>(VT_F64, _f64, 0.0);
+ }
+ const flatbuffers::Vector<int8_t> *v8() const {
+ return GetPointer<const flatbuffers::Vector<int8_t> *>(VT_V8);
+ }
+ flatbuffers::Vector<int8_t> *mutable_v8() {
+ return GetPointer<flatbuffers::Vector<int8_t> *>(VT_V8);
+ }
+ const flatbuffers::Vector<double> *vf64() const {
+ return GetPointer<const flatbuffers::Vector<double> *>(VT_VF64);
+ }
+ flatbuffers::Vector<double> *mutable_vf64() {
+ return GetPointer<flatbuffers::Vector<double> *>(VT_VF64);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyField<int8_t>(verifier, VT_I8, 1) &&
+ VerifyField<uint8_t>(verifier, VT_U8, 1) &&
+ VerifyField<int16_t>(verifier, VT_I16, 2) &&
+ VerifyField<uint16_t>(verifier, VT_U16, 2) &&
+ VerifyField<int32_t>(verifier, VT_I32, 4) &&
+ VerifyField<uint32_t>(verifier, VT_U32, 4) &&
+ VerifyField<int64_t>(verifier, VT_I64, 8) &&
+ VerifyField<uint64_t>(verifier, VT_U64, 8) &&
+ VerifyField<float>(verifier, VT_F32, 4) &&
+ VerifyField<double>(verifier, VT_F64, 8) &&
+ VerifyOffset(verifier, VT_V8) &&
+ verifier.VerifyVector(v8()) &&
+ VerifyOffset(verifier, VT_VF64) &&
+ verifier.VerifyVector(vf64()) &&
+ verifier.EndTable();
+ }
+ TypeAliasesT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(TypeAliasesT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<TypeAliases> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct TypeAliasesBuilder {
+ typedef TypeAliases Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_i8(int8_t i8) {
+ fbb_.AddElement<int8_t>(TypeAliases::VT_I8, i8, 0);
+ }
+ void add_u8(uint8_t u8) {
+ fbb_.AddElement<uint8_t>(TypeAliases::VT_U8, u8, 0);
+ }
+ void add_i16(int16_t i16) {
+ fbb_.AddElement<int16_t>(TypeAliases::VT_I16, i16, 0);
+ }
+ void add_u16(uint16_t u16) {
+ fbb_.AddElement<uint16_t>(TypeAliases::VT_U16, u16, 0);
+ }
+ void add_i32(int32_t i32) {
+ fbb_.AddElement<int32_t>(TypeAliases::VT_I32, i32, 0);
+ }
+ void add_u32(uint32_t u32) {
+ fbb_.AddElement<uint32_t>(TypeAliases::VT_U32, u32, 0);
+ }
+ void add_i64(int64_t i64) {
+ fbb_.AddElement<int64_t>(TypeAliases::VT_I64, i64, 0);
+ }
+ void add_u64(uint64_t u64) {
+ fbb_.AddElement<uint64_t>(TypeAliases::VT_U64, u64, 0);
+ }
+ void add_f32(float f32) {
+ fbb_.AddElement<float>(TypeAliases::VT_F32, f32, 0.0f);
+ }
+ void add_f64(double f64) {
+ fbb_.AddElement<double>(TypeAliases::VT_F64, f64, 0.0);
+ }
+ void add_v8(flatbuffers::Offset<flatbuffers::Vector<int8_t>> v8) {
+ fbb_.AddOffset(TypeAliases::VT_V8, v8);
+ }
+ void add_vf64(flatbuffers::Offset<flatbuffers::Vector<double>> vf64) {
+ fbb_.AddOffset(TypeAliases::VT_VF64, vf64);
+ }
+ explicit TypeAliasesBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<TypeAliases> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<TypeAliases>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<TypeAliases> CreateTypeAliases(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ int8_t i8 = 0,
+ uint8_t u8 = 0,
+ int16_t i16 = 0,
+ uint16_t u16 = 0,
+ int32_t i32 = 0,
+ uint32_t u32 = 0,
+ int64_t i64 = 0,
+ uint64_t u64 = 0,
+ float f32 = 0.0f,
+ double f64 = 0.0,
+ flatbuffers::Offset<flatbuffers::Vector<int8_t>> v8 = 0,
+ flatbuffers::Offset<flatbuffers::Vector<double>> vf64 = 0) {
+ TypeAliasesBuilder builder_(_fbb);
+ builder_.add_f64(f64);
+ builder_.add_u64(u64);
+ builder_.add_i64(i64);
+ builder_.add_vf64(vf64);
+ builder_.add_v8(v8);
+ builder_.add_f32(f32);
+ builder_.add_u32(u32);
+ builder_.add_i32(i32);
+ builder_.add_u16(u16);
+ builder_.add_i16(i16);
+ builder_.add_u8(u8);
+ builder_.add_i8(i8);
+ return builder_.Finish();
+}
+
+inline flatbuffers::Offset<TypeAliases> CreateTypeAliasesDirect(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ int8_t i8 = 0,
+ uint8_t u8 = 0,
+ int16_t i16 = 0,
+ uint16_t u16 = 0,
+ int32_t i32 = 0,
+ uint32_t u32 = 0,
+ int64_t i64 = 0,
+ uint64_t u64 = 0,
+ float f32 = 0.0f,
+ double f64 = 0.0,
+ const std::vector<int8_t> *v8 = nullptr,
+ const std::vector<double> *vf64 = nullptr) {
+ auto v8__ = v8 ? _fbb.CreateVector<int8_t>(*v8) : 0;
+ auto vf64__ = vf64 ? _fbb.CreateVector<double>(*vf64) : 0;
+ return MyGame::Example::CreateTypeAliases(
+ _fbb,
+ i8,
+ u8,
+ i16,
+ u16,
+ i32,
+ u32,
+ i64,
+ u64,
+ f32,
+ f64,
+ v8__,
+ vf64__);
+}
+
+flatbuffers::Offset<TypeAliases> CreateTypeAliases(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+} // namespace Example
+
+
+inline bool operator==(const InParentNamespaceT &, const InParentNamespaceT &) {
+ return true;
+}
+
+inline bool operator!=(const InParentNamespaceT &lhs, const InParentNamespaceT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline InParentNamespaceT *InParentNamespace::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<InParentNamespaceT>(new InParentNamespaceT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void InParentNamespace::UnPackTo(InParentNamespaceT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+}
+
+inline flatbuffers::Offset<InParentNamespace> InParentNamespace::Pack(flatbuffers::FlatBufferBuilder &_fbb, const InParentNamespaceT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateInParentNamespace(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<InParentNamespace> CreateInParentNamespace(flatbuffers::FlatBufferBuilder &_fbb, const InParentNamespaceT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const InParentNamespaceT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ return MyGame::CreateInParentNamespace(
+ _fbb);
+}
+
+namespace Example2 {
+
+
+inline bool operator==(const MonsterT &, const MonsterT &) {
+ return true;
+}
+
+inline bool operator!=(const MonsterT &lhs, const MonsterT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline MonsterT *Monster::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<MonsterT>(new MonsterT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void Monster::UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+}
+
+inline flatbuffers::Offset<Monster> Monster::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateMonster(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const MonsterT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ return MyGame::Example2::CreateMonster(
+ _fbb);
+}
+
+} // namespace Example2
+
+namespace Example {
+
+
+inline bool operator==(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs) {
+ return
+ (lhs.color == rhs.color);
+}
+
+inline bool operator!=(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline TestSimpleTableWithEnumT *TestSimpleTableWithEnum::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<TestSimpleTableWithEnumT>(new TestSimpleTableWithEnumT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void TestSimpleTableWithEnum::UnPackTo(TestSimpleTableWithEnumT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = color(); _o->color = _e; }
+}
+
+inline flatbuffers::Offset<TestSimpleTableWithEnum> TestSimpleTableWithEnum::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateTestSimpleTableWithEnum(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TestSimpleTableWithEnumT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _color = _o->color;
+ return MyGame::Example::CreateTestSimpleTableWithEnum(
+ _fbb,
+ _color);
+}
+
+
+inline bool operator==(const StatT &lhs, const StatT &rhs) {
+ return
+ (lhs.id == rhs.id) &&
+ (lhs.val == rhs.val) &&
+ (lhs.count == rhs.count);
+}
+
+inline bool operator!=(const StatT &lhs, const StatT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline StatT *Stat::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<StatT>(new StatT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void Stat::UnPackTo(StatT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = id(); if (_e) _o->id = _e->str(); }
+ { auto _e = val(); _o->val = _e; }
+ { auto _e = count(); _o->count = _e; }
+}
+
+inline flatbuffers::Offset<Stat> Stat::Pack(flatbuffers::FlatBufferBuilder &_fbb, const StatT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateStat(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<Stat> CreateStat(flatbuffers::FlatBufferBuilder &_fbb, const StatT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const StatT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _id = _o->id.empty() ? 0 : _fbb.CreateString(_o->id);
+ auto _val = _o->val;
+ auto _count = _o->count;
+ return MyGame::Example::CreateStat(
+ _fbb,
+ _id,
+ _val,
+ _count);
+}
+
+
+inline bool operator==(const ReferrableT &lhs, const ReferrableT &rhs) {
+ return
+ (lhs.id == rhs.id);
+}
+
+inline bool operator!=(const ReferrableT &lhs, const ReferrableT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline ReferrableT *Referrable::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<ReferrableT>(new ReferrableT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void Referrable::UnPackTo(ReferrableT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = id(); _o->id = _e; }
+}
+
+inline flatbuffers::Offset<Referrable> Referrable::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ReferrableT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateReferrable(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<Referrable> CreateReferrable(flatbuffers::FlatBufferBuilder &_fbb, const ReferrableT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ReferrableT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _id = _o->id;
+ return MyGame::Example::CreateReferrable(
+ _fbb,
+ _id);
+}
+
+
+inline bool operator==(const MonsterT &lhs, const MonsterT &rhs) {
+ return
+ ((lhs.pos == rhs.pos) || (lhs.pos && rhs.pos && *lhs.pos == *rhs.pos)) &&
+ (lhs.mana == rhs.mana) &&
+ (lhs.hp == rhs.hp) &&
+ (lhs.name == rhs.name) &&
+ (lhs.inventory == rhs.inventory) &&
+ (lhs.color == rhs.color) &&
+ (lhs.test == rhs.test) &&
+ (lhs.test4 == rhs.test4) &&
+ (lhs.testarrayofstring == rhs.testarrayofstring) &&
+ (lhs.testarrayoftables.size() == rhs.testarrayoftables.size() && std::equal(lhs.testarrayoftables.cbegin(), lhs.testarrayoftables.cend(), rhs.testarrayoftables.cbegin(), [](flatbuffers::unique_ptr<MyGame::Example::MonsterT> const &a, flatbuffers::unique_ptr<MyGame::Example::MonsterT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
+ ((lhs.enemy == rhs.enemy) || (lhs.enemy && rhs.enemy && *lhs.enemy == *rhs.enemy)) &&
+ (lhs.testnestedflatbuffer == rhs.testnestedflatbuffer) &&
+ ((lhs.testempty == rhs.testempty) || (lhs.testempty && rhs.testempty && *lhs.testempty == *rhs.testempty)) &&
+ (lhs.testbool == rhs.testbool) &&
+ (lhs.testhashs32_fnv1 == rhs.testhashs32_fnv1) &&
+ (lhs.testhashu32_fnv1 == rhs.testhashu32_fnv1) &&
+ (lhs.testhashs64_fnv1 == rhs.testhashs64_fnv1) &&
+ (lhs.testhashu64_fnv1 == rhs.testhashu64_fnv1) &&
+ (lhs.testhashs32_fnv1a == rhs.testhashs32_fnv1a) &&
+ (lhs.testhashu32_fnv1a == rhs.testhashu32_fnv1a) &&
+ (lhs.testhashs64_fnv1a == rhs.testhashs64_fnv1a) &&
+ (lhs.testhashu64_fnv1a == rhs.testhashu64_fnv1a) &&
+ (lhs.testarrayofbools == rhs.testarrayofbools) &&
+ (lhs.testf == rhs.testf) &&
+ (lhs.testf2 == rhs.testf2) &&
+ (lhs.testf3 == rhs.testf3) &&
+ (lhs.testarrayofstring2 == rhs.testarrayofstring2) &&
+ (lhs.testarrayofsortedstruct == rhs.testarrayofsortedstruct) &&
+ (lhs.flex == rhs.flex) &&
+ (lhs.test5 == rhs.test5) &&
+ (lhs.vector_of_longs == rhs.vector_of_longs) &&
+ (lhs.vector_of_doubles == rhs.vector_of_doubles) &&
+ ((lhs.parent_namespace_test == rhs.parent_namespace_test) || (lhs.parent_namespace_test && rhs.parent_namespace_test && *lhs.parent_namespace_test == *rhs.parent_namespace_test)) &&
+ (lhs.vector_of_referrables.size() == rhs.vector_of_referrables.size() && std::equal(lhs.vector_of_referrables.cbegin(), lhs.vector_of_referrables.cend(), rhs.vector_of_referrables.cbegin(), [](flatbuffers::unique_ptr<MyGame::Example::ReferrableT> const &a, flatbuffers::unique_ptr<MyGame::Example::ReferrableT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
+ (lhs.single_weak_reference == rhs.single_weak_reference) &&
+ (lhs.vector_of_weak_references == rhs.vector_of_weak_references) &&
+ (lhs.vector_of_strong_referrables.size() == rhs.vector_of_strong_referrables.size() && std::equal(lhs.vector_of_strong_referrables.cbegin(), lhs.vector_of_strong_referrables.cend(), rhs.vector_of_strong_referrables.cbegin(), [](flatbuffers::unique_ptr<MyGame::Example::ReferrableT> const &a, flatbuffers::unique_ptr<MyGame::Example::ReferrableT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
+ (lhs.co_owning_reference == rhs.co_owning_reference) &&
+ (lhs.vector_of_co_owning_references == rhs.vector_of_co_owning_references) &&
+ (lhs.non_owning_reference == rhs.non_owning_reference) &&
+ (lhs.vector_of_non_owning_references == rhs.vector_of_non_owning_references) &&
+ (lhs.any_unique == rhs.any_unique) &&
+ (lhs.any_ambiguous == rhs.any_ambiguous) &&
+ (lhs.vector_of_enums == rhs.vector_of_enums) &&
+ (lhs.signed_enum == rhs.signed_enum) &&
+ (lhs.testrequirednestedflatbuffer == rhs.testrequirednestedflatbuffer) &&
+ (lhs.scalar_key_sorted_tables.size() == rhs.scalar_key_sorted_tables.size() && std::equal(lhs.scalar_key_sorted_tables.cbegin(), lhs.scalar_key_sorted_tables.cend(), rhs.scalar_key_sorted_tables.cbegin(), [](flatbuffers::unique_ptr<MyGame::Example::StatT> const &a, flatbuffers::unique_ptr<MyGame::Example::StatT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
+ (lhs.native_inline == rhs.native_inline) &&
+ (lhs.long_enum_non_enum_default == rhs.long_enum_non_enum_default) &&
+ (lhs.long_enum_normal_default == rhs.long_enum_normal_default);
+}
+
+inline bool operator!=(const MonsterT &lhs, const MonsterT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline MonsterT::MonsterT(const MonsterT &o)
+ : pos((o.pos) ? new MyGame::Example::Vec3(*o.pos) : nullptr),
+ mana(o.mana),
+ hp(o.hp),
+ name(o.name),
+ inventory(o.inventory),
+ color(o.color),
+ test(o.test),
+ test4(o.test4),
+ testarrayofstring(o.testarrayofstring),
+ enemy((o.enemy) ? new MyGame::Example::MonsterT(*o.enemy) : nullptr),
+ testnestedflatbuffer(o.testnestedflatbuffer),
+ testempty((o.testempty) ? new MyGame::Example::StatT(*o.testempty) : nullptr),
+ testbool(o.testbool),
+ testhashs32_fnv1(o.testhashs32_fnv1),
+ testhashu32_fnv1(o.testhashu32_fnv1),
+ testhashs64_fnv1(o.testhashs64_fnv1),
+ testhashu64_fnv1(o.testhashu64_fnv1),
+ testhashs32_fnv1a(o.testhashs32_fnv1a),
+ testhashu32_fnv1a(o.testhashu32_fnv1a),
+ testhashs64_fnv1a(o.testhashs64_fnv1a),
+ testhashu64_fnv1a(o.testhashu64_fnv1a),
+ testarrayofbools(o.testarrayofbools),
+ testf(o.testf),
+ testf2(o.testf2),
+ testf3(o.testf3),
+ testarrayofstring2(o.testarrayofstring2),
+ testarrayofsortedstruct(o.testarrayofsortedstruct),
+ flex(o.flex),
+ test5(o.test5),
+ vector_of_longs(o.vector_of_longs),
+ vector_of_doubles(o.vector_of_doubles),
+ parent_namespace_test((o.parent_namespace_test) ? new MyGame::InParentNamespaceT(*o.parent_namespace_test) : nullptr),
+ single_weak_reference(o.single_weak_reference),
+ vector_of_weak_references(o.vector_of_weak_references),
+ co_owning_reference(o.co_owning_reference),
+ non_owning_reference(o.non_owning_reference),
+ vector_of_non_owning_references(o.vector_of_non_owning_references),
+ any_unique(o.any_unique),
+ any_ambiguous(o.any_ambiguous),
+ vector_of_enums(o.vector_of_enums),
+ signed_enum(o.signed_enum),
+ testrequirednestedflatbuffer(o.testrequirednestedflatbuffer),
+ native_inline(o.native_inline),
+ long_enum_non_enum_default(o.long_enum_non_enum_default),
+ long_enum_normal_default(o.long_enum_normal_default) {
+ testarrayoftables.reserve(o.testarrayoftables.size());
+ for (const auto &testarrayoftables_ : o.testarrayoftables) { testarrayoftables.emplace_back((testarrayoftables_) ? new MyGame::Example::MonsterT(*testarrayoftables_) : nullptr); }
+ vector_of_referrables.reserve(o.vector_of_referrables.size());
+ for (const auto &vector_of_referrables_ : o.vector_of_referrables) { vector_of_referrables.emplace_back((vector_of_referrables_) ? new MyGame::Example::ReferrableT(*vector_of_referrables_) : nullptr); }
+ vector_of_strong_referrables.reserve(o.vector_of_strong_referrables.size());
+ for (const auto &vector_of_strong_referrables_ : o.vector_of_strong_referrables) { vector_of_strong_referrables.emplace_back((vector_of_strong_referrables_) ? new MyGame::Example::ReferrableT(*vector_of_strong_referrables_) : nullptr); }
+ vector_of_co_owning_references.reserve(o.vector_of_co_owning_references.size());
+ for (const auto &vector_of_co_owning_references_ : o.vector_of_co_owning_references) { vector_of_co_owning_references.emplace_back((vector_of_co_owning_references_) ? new ReferrableT(*vector_of_co_owning_references_) : nullptr); }
+ scalar_key_sorted_tables.reserve(o.scalar_key_sorted_tables.size());
+ for (const auto &scalar_key_sorted_tables_ : o.scalar_key_sorted_tables) { scalar_key_sorted_tables.emplace_back((scalar_key_sorted_tables_) ? new MyGame::Example::StatT(*scalar_key_sorted_tables_) : nullptr); }
+}
+
+inline MonsterT &MonsterT::operator=(MonsterT o) FLATBUFFERS_NOEXCEPT {
+ std::swap(pos, o.pos);
+ std::swap(mana, o.mana);
+ std::swap(hp, o.hp);
+ std::swap(name, o.name);
+ std::swap(inventory, o.inventory);
+ std::swap(color, o.color);
+ std::swap(test, o.test);
+ std::swap(test4, o.test4);
+ std::swap(testarrayofstring, o.testarrayofstring);
+ std::swap(testarrayoftables, o.testarrayoftables);
+ std::swap(enemy, o.enemy);
+ std::swap(testnestedflatbuffer, o.testnestedflatbuffer);
+ std::swap(testempty, o.testempty);
+ std::swap(testbool, o.testbool);
+ std::swap(testhashs32_fnv1, o.testhashs32_fnv1);
+ std::swap(testhashu32_fnv1, o.testhashu32_fnv1);
+ std::swap(testhashs64_fnv1, o.testhashs64_fnv1);
+ std::swap(testhashu64_fnv1, o.testhashu64_fnv1);
+ std::swap(testhashs32_fnv1a, o.testhashs32_fnv1a);
+ std::swap(testhashu32_fnv1a, o.testhashu32_fnv1a);
+ std::swap(testhashs64_fnv1a, o.testhashs64_fnv1a);
+ std::swap(testhashu64_fnv1a, o.testhashu64_fnv1a);
+ std::swap(testarrayofbools, o.testarrayofbools);
+ std::swap(testf, o.testf);
+ std::swap(testf2, o.testf2);
+ std::swap(testf3, o.testf3);
+ std::swap(testarrayofstring2, o.testarrayofstring2);
+ std::swap(testarrayofsortedstruct, o.testarrayofsortedstruct);
+ std::swap(flex, o.flex);
+ std::swap(test5, o.test5);
+ std::swap(vector_of_longs, o.vector_of_longs);
+ std::swap(vector_of_doubles, o.vector_of_doubles);
+ std::swap(parent_namespace_test, o.parent_namespace_test);
+ std::swap(vector_of_referrables, o.vector_of_referrables);
+ std::swap(single_weak_reference, o.single_weak_reference);
+ std::swap(vector_of_weak_references, o.vector_of_weak_references);
+ std::swap(vector_of_strong_referrables, o.vector_of_strong_referrables);
+ std::swap(co_owning_reference, o.co_owning_reference);
+ std::swap(vector_of_co_owning_references, o.vector_of_co_owning_references);
+ std::swap(non_owning_reference, o.non_owning_reference);
+ std::swap(vector_of_non_owning_references, o.vector_of_non_owning_references);
+ std::swap(any_unique, o.any_unique);
+ std::swap(any_ambiguous, o.any_ambiguous);
+ std::swap(vector_of_enums, o.vector_of_enums);
+ std::swap(signed_enum, o.signed_enum);
+ std::swap(testrequirednestedflatbuffer, o.testrequirednestedflatbuffer);
+ std::swap(scalar_key_sorted_tables, o.scalar_key_sorted_tables);
+ std::swap(native_inline, o.native_inline);
+ std::swap(long_enum_non_enum_default, o.long_enum_non_enum_default);
+ std::swap(long_enum_normal_default, o.long_enum_normal_default);
+ return *this;
+}
+
+inline MonsterT *Monster::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<MonsterT>(new MonsterT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void Monster::UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = pos(); if (_e) _o->pos = flatbuffers::unique_ptr<MyGame::Example::Vec3>(new MyGame::Example::Vec3(*_e)); }
+ { auto _e = mana(); _o->mana = _e; }
+ { auto _e = hp(); _o->hp = _e; }
+ { auto _e = name(); if (_e) _o->name = _e->str(); }
+ { auto _e = inventory(); if (_e) { _o->inventory.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->inventory.begin()); } }
+ { auto _e = color(); _o->color = _e; }
+ { auto _e = test_type(); _o->test.type = _e; }
+ { auto _e = test(); if (_e) _o->test.value = MyGame::Example::AnyUnion::UnPack(_e, test_type(), _resolver); }
+ { auto _e = test4(); if (_e) { _o->test4.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test4[_i] = *_e->Get(_i); } } else { _o->test4.resize(0); } }
+ { auto _e = testarrayofstring(); if (_e) { _o->testarrayofstring.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring[_i] = _e->Get(_i)->str(); } } else { _o->testarrayofstring.resize(0); } }
+ { auto _e = testarrayoftables(); if (_e) { _o->testarrayoftables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->testarrayoftables[_i]) { _e->Get(_i)->UnPackTo(_o->testarrayoftables[_i].get(), _resolver); } else { _o->testarrayoftables[_i] = flatbuffers::unique_ptr<MyGame::Example::MonsterT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->testarrayoftables.resize(0); } }
+ { auto _e = enemy(); if (_e) { if(_o->enemy) { _e->UnPackTo(_o->enemy.get(), _resolver); } else { _o->enemy = flatbuffers::unique_ptr<MyGame::Example::MonsterT>(_e->UnPack(_resolver)); } } else if (_o->enemy) { _o->enemy.reset(); } }
+ { auto _e = testnestedflatbuffer(); if (_e) { _o->testnestedflatbuffer.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->testnestedflatbuffer.begin()); } }
+ { auto _e = testempty(); if (_e) { if(_o->testempty) { _e->UnPackTo(_o->testempty.get(), _resolver); } else { _o->testempty = flatbuffers::unique_ptr<MyGame::Example::StatT>(_e->UnPack(_resolver)); } } else if (_o->testempty) { _o->testempty.reset(); } }
+ { auto _e = testbool(); _o->testbool = _e; }
+ { auto _e = testhashs32_fnv1(); _o->testhashs32_fnv1 = _e; }
+ { auto _e = testhashu32_fnv1(); _o->testhashu32_fnv1 = _e; }
+ { auto _e = testhashs64_fnv1(); _o->testhashs64_fnv1 = _e; }
+ { auto _e = testhashu64_fnv1(); _o->testhashu64_fnv1 = _e; }
+ { auto _e = testhashs32_fnv1a(); _o->testhashs32_fnv1a = _e; }
+ { auto _e = testhashu32_fnv1a(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->testhashu32_fnv1a), static_cast<flatbuffers::hash_value_t>(_e)); else _o->testhashu32_fnv1a = nullptr; }
+ { auto _e = testhashs64_fnv1a(); _o->testhashs64_fnv1a = _e; }
+ { auto _e = testhashu64_fnv1a(); _o->testhashu64_fnv1a = _e; }
+ { auto _e = testarrayofbools(); if (_e) { _o->testarrayofbools.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofbools[_i] = _e->Get(_i) != 0; } } else { _o->testarrayofbools.resize(0); } }
+ { auto _e = testf(); _o->testf = _e; }
+ { auto _e = testf2(); _o->testf2 = _e; }
+ { auto _e = testf3(); _o->testf3 = _e; }
+ { auto _e = testarrayofstring2(); if (_e) { _o->testarrayofstring2.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring2[_i] = _e->Get(_i)->str(); } } else { _o->testarrayofstring2.resize(0); } }
+ { auto _e = testarrayofsortedstruct(); if (_e) { _o->testarrayofsortedstruct.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofsortedstruct[_i] = *_e->Get(_i); } } else { _o->testarrayofsortedstruct.resize(0); } }
+ { auto _e = flex(); if (_e) { _o->flex.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->flex.begin()); } }
+ { auto _e = test5(); if (_e) { _o->test5.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test5[_i] = *_e->Get(_i); } } else { _o->test5.resize(0); } }
+ { auto _e = vector_of_longs(); if (_e) { _o->vector_of_longs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_longs[_i] = _e->Get(_i); } } else { _o->vector_of_longs.resize(0); } }
+ { auto _e = vector_of_doubles(); if (_e) { _o->vector_of_doubles.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_doubles[_i] = _e->Get(_i); } } else { _o->vector_of_doubles.resize(0); } }
+ { auto _e = parent_namespace_test(); if (_e) { if(_o->parent_namespace_test) { _e->UnPackTo(_o->parent_namespace_test.get(), _resolver); } else { _o->parent_namespace_test = flatbuffers::unique_ptr<MyGame::InParentNamespaceT>(_e->UnPack(_resolver)); } } else if (_o->parent_namespace_test) { _o->parent_namespace_test.reset(); } }
+ { auto _e = vector_of_referrables(); if (_e) { _o->vector_of_referrables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->vector_of_referrables[_i]) { _e->Get(_i)->UnPackTo(_o->vector_of_referrables[_i].get(), _resolver); } else { _o->vector_of_referrables[_i] = flatbuffers::unique_ptr<MyGame::Example::ReferrableT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->vector_of_referrables.resize(0); } }
+ { auto _e = single_weak_reference(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->single_weak_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->single_weak_reference = nullptr; }
+ { auto _e = vector_of_weak_references(); if (_e) { _o->vector_of_weak_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { /*vector resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_weak_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i))); else _o->vector_of_weak_references[_i] = nullptr; } } else { _o->vector_of_weak_references.resize(0); } }
+ { auto _e = vector_of_strong_referrables(); if (_e) { _o->vector_of_strong_referrables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->vector_of_strong_referrables[_i]) { _e->Get(_i)->UnPackTo(_o->vector_of_strong_referrables[_i].get(), _resolver); } else { _o->vector_of_strong_referrables[_i] = flatbuffers::unique_ptr<MyGame::Example::ReferrableT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->vector_of_strong_referrables.resize(0); } }
+ { auto _e = co_owning_reference(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->co_owning_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->co_owning_reference = nullptr; }
+ { auto _e = vector_of_co_owning_references(); if (_e) { _o->vector_of_co_owning_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { /*vector resolver, default_ptr_type*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_co_owning_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i)));/* else do nothing */; } } else { _o->vector_of_co_owning_references.resize(0); } }
+ { auto _e = non_owning_reference(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->non_owning_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->non_owning_reference = nullptr; }
+ { auto _e = vector_of_non_owning_references(); if (_e) { _o->vector_of_non_owning_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { /*vector resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_non_owning_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i))); else _o->vector_of_non_owning_references[_i] = nullptr; } } else { _o->vector_of_non_owning_references.resize(0); } }
+ { auto _e = any_unique_type(); _o->any_unique.type = _e; }
+ { auto _e = any_unique(); if (_e) _o->any_unique.value = MyGame::Example::AnyUniqueAliasesUnion::UnPack(_e, any_unique_type(), _resolver); }
+ { auto _e = any_ambiguous_type(); _o->any_ambiguous.type = _e; }
+ { auto _e = any_ambiguous(); if (_e) _o->any_ambiguous.value = MyGame::Example::AnyAmbiguousAliasesUnion::UnPack(_e, any_ambiguous_type(), _resolver); }
+ { auto _e = vector_of_enums(); if (_e) { _o->vector_of_enums.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_enums[_i] = static_cast<MyGame::Example::Color>(_e->Get(_i)); } } else { _o->vector_of_enums.resize(0); } }
+ { auto _e = signed_enum(); _o->signed_enum = _e; }
+ { auto _e = testrequirednestedflatbuffer(); if (_e) { _o->testrequirednestedflatbuffer.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->testrequirednestedflatbuffer.begin()); } }
+ { auto _e = scalar_key_sorted_tables(); if (_e) { _o->scalar_key_sorted_tables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->scalar_key_sorted_tables[_i]) { _e->Get(_i)->UnPackTo(_o->scalar_key_sorted_tables[_i].get(), _resolver); } else { _o->scalar_key_sorted_tables[_i] = flatbuffers::unique_ptr<MyGame::Example::StatT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->scalar_key_sorted_tables.resize(0); } }
+ { auto _e = native_inline(); if (_e) _o->native_inline = *_e; }
+ { auto _e = long_enum_non_enum_default(); _o->long_enum_non_enum_default = _e; }
+ { auto _e = long_enum_normal_default(); _o->long_enum_normal_default = _e; }
+}
+
+inline flatbuffers::Offset<Monster> Monster::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateMonster(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const MonsterT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _pos = _o->pos ? _o->pos.get() : nullptr;
+ auto _mana = _o->mana;
+ auto _hp = _o->hp;
+ auto _name = _fbb.CreateString(_o->name);
+ auto _inventory = _o->inventory.size() ? _fbb.CreateVector(_o->inventory) : 0;
+ auto _color = _o->color;
+ auto _test_type = _o->test.type;
+ auto _test = _o->test.Pack(_fbb);
+ auto _test4 = _o->test4.size() ? _fbb.CreateVectorOfStructs(_o->test4) : 0;
+ auto _testarrayofstring = _o->testarrayofstring.size() ? _fbb.CreateVectorOfStrings(_o->testarrayofstring) : 0;
+ auto _testarrayoftables = _o->testarrayoftables.size() ? _fbb.CreateVector<flatbuffers::Offset<MyGame::Example::Monster>> (_o->testarrayoftables.size(), [](size_t i, _VectorArgs *__va) { return CreateMonster(*__va->__fbb, __va->__o->testarrayoftables[i].get(), __va->__rehasher); }, &_va ) : 0;
+ auto _enemy = _o->enemy ? CreateMonster(_fbb, _o->enemy.get(), _rehasher) : 0;
+ auto _testnestedflatbuffer = _o->testnestedflatbuffer.size() ? _fbb.CreateVector(_o->testnestedflatbuffer) : 0;
+ auto _testempty = _o->testempty ? CreateStat(_fbb, _o->testempty.get(), _rehasher) : 0;
+ auto _testbool = _o->testbool;
+ auto _testhashs32_fnv1 = _o->testhashs32_fnv1;
+ auto _testhashu32_fnv1 = _o->testhashu32_fnv1;
+ auto _testhashs64_fnv1 = _o->testhashs64_fnv1;
+ auto _testhashu64_fnv1 = _o->testhashu64_fnv1;
+ auto _testhashs32_fnv1a = _o->testhashs32_fnv1a;
+ auto _testhashu32_fnv1a = _rehasher ? static_cast<uint32_t>((*_rehasher)(_o->testhashu32_fnv1a)) : 0;
+ auto _testhashs64_fnv1a = _o->testhashs64_fnv1a;
+ auto _testhashu64_fnv1a = _o->testhashu64_fnv1a;
+ auto _testarrayofbools = _o->testarrayofbools.size() ? _fbb.CreateVector(_o->testarrayofbools) : 0;
+ auto _testf = _o->testf;
+ auto _testf2 = _o->testf2;
+ auto _testf3 = _o->testf3;
+ auto _testarrayofstring2 = _o->testarrayofstring2.size() ? _fbb.CreateVectorOfStrings(_o->testarrayofstring2) : 0;
+ auto _testarrayofsortedstruct = _o->testarrayofsortedstruct.size() ? _fbb.CreateVectorOfStructs(_o->testarrayofsortedstruct) : 0;
+ auto _flex = _o->flex.size() ? _fbb.CreateVector(_o->flex) : 0;
+ auto _test5 = _o->test5.size() ? _fbb.CreateVectorOfStructs(_o->test5) : 0;
+ auto _vector_of_longs = _o->vector_of_longs.size() ? _fbb.CreateVector(_o->vector_of_longs) : 0;
+ auto _vector_of_doubles = _o->vector_of_doubles.size() ? _fbb.CreateVector(_o->vector_of_doubles) : 0;
+ auto _parent_namespace_test = _o->parent_namespace_test ? CreateInParentNamespace(_fbb, _o->parent_namespace_test.get(), _rehasher) : 0;
+ auto _vector_of_referrables = _o->vector_of_referrables.size() ? _fbb.CreateVector<flatbuffers::Offset<MyGame::Example::Referrable>> (_o->vector_of_referrables.size(), [](size_t i, _VectorArgs *__va) { return CreateReferrable(*__va->__fbb, __va->__o->vector_of_referrables[i].get(), __va->__rehasher); }, &_va ) : 0;
+ auto _single_weak_reference = _rehasher ? static_cast<uint64_t>((*_rehasher)(_o->single_weak_reference)) : 0;
+ auto _vector_of_weak_references = _o->vector_of_weak_references.size() ? _fbb.CreateVector<uint64_t>(_o->vector_of_weak_references.size(), [](size_t i, _VectorArgs *__va) { return __va->__rehasher ? static_cast<uint64_t>((*__va->__rehasher)(__va->__o->vector_of_weak_references[i])) : 0; }, &_va ) : 0;
+ auto _vector_of_strong_referrables = _o->vector_of_strong_referrables.size() ? _fbb.CreateVector<flatbuffers::Offset<MyGame::Example::Referrable>> (_o->vector_of_strong_referrables.size(), [](size_t i, _VectorArgs *__va) { return CreateReferrable(*__va->__fbb, __va->__o->vector_of_strong_referrables[i].get(), __va->__rehasher); }, &_va ) : 0;
+ auto _co_owning_reference = _rehasher ? static_cast<uint64_t>((*_rehasher)(_o->co_owning_reference)) : 0;
+ auto _vector_of_co_owning_references = _o->vector_of_co_owning_references.size() ? _fbb.CreateVector<uint64_t>(_o->vector_of_co_owning_references.size(), [](size_t i, _VectorArgs *__va) { return __va->__rehasher ? static_cast<uint64_t>((*__va->__rehasher)(__va->__o->vector_of_co_owning_references[i].get())) : 0; }, &_va ) : 0;
+ auto _non_owning_reference = _rehasher ? static_cast<uint64_t>((*_rehasher)(_o->non_owning_reference)) : 0;
+ auto _vector_of_non_owning_references = _o->vector_of_non_owning_references.size() ? _fbb.CreateVector<uint64_t>(_o->vector_of_non_owning_references.size(), [](size_t i, _VectorArgs *__va) { return __va->__rehasher ? static_cast<uint64_t>((*__va->__rehasher)(__va->__o->vector_of_non_owning_references[i])) : 0; }, &_va ) : 0;
+ auto _any_unique_type = _o->any_unique.type;
+ auto _any_unique = _o->any_unique.Pack(_fbb);
+ auto _any_ambiguous_type = _o->any_ambiguous.type;
+ auto _any_ambiguous = _o->any_ambiguous.Pack(_fbb);
+ auto _vector_of_enums = _o->vector_of_enums.size() ? _fbb.CreateVectorScalarCast<uint8_t>(flatbuffers::data(_o->vector_of_enums), _o->vector_of_enums.size()) : 0;
+ auto _signed_enum = _o->signed_enum;
+ auto _testrequirednestedflatbuffer = _o->testrequirednestedflatbuffer.size() ? _fbb.CreateVector(_o->testrequirednestedflatbuffer) : 0;
+ auto _scalar_key_sorted_tables = _o->scalar_key_sorted_tables.size() ? _fbb.CreateVector<flatbuffers::Offset<MyGame::Example::Stat>> (_o->scalar_key_sorted_tables.size(), [](size_t i, _VectorArgs *__va) { return CreateStat(*__va->__fbb, __va->__o->scalar_key_sorted_tables[i].get(), __va->__rehasher); }, &_va ) : 0;
+ auto _native_inline = &_o->native_inline;
+ auto _long_enum_non_enum_default = _o->long_enum_non_enum_default;
+ auto _long_enum_normal_default = _o->long_enum_normal_default;
+ return MyGame::Example::CreateMonster(
+ _fbb,
+ _pos,
+ _mana,
+ _hp,
+ _name,
+ _inventory,
+ _color,
+ _test_type,
+ _test,
+ _test4,
+ _testarrayofstring,
+ _testarrayoftables,
+ _enemy,
+ _testnestedflatbuffer,
+ _testempty,
+ _testbool,
+ _testhashs32_fnv1,
+ _testhashu32_fnv1,
+ _testhashs64_fnv1,
+ _testhashu64_fnv1,
+ _testhashs32_fnv1a,
+ _testhashu32_fnv1a,
+ _testhashs64_fnv1a,
+ _testhashu64_fnv1a,
+ _testarrayofbools,
+ _testf,
+ _testf2,
+ _testf3,
+ _testarrayofstring2,
+ _testarrayofsortedstruct,
+ _flex,
+ _test5,
+ _vector_of_longs,
+ _vector_of_doubles,
+ _parent_namespace_test,
+ _vector_of_referrables,
+ _single_weak_reference,
+ _vector_of_weak_references,
+ _vector_of_strong_referrables,
+ _co_owning_reference,
+ _vector_of_co_owning_references,
+ _non_owning_reference,
+ _vector_of_non_owning_references,
+ _any_unique_type,
+ _any_unique,
+ _any_ambiguous_type,
+ _any_ambiguous,
+ _vector_of_enums,
+ _signed_enum,
+ _testrequirednestedflatbuffer,
+ _scalar_key_sorted_tables,
+ _native_inline,
+ _long_enum_non_enum_default,
+ _long_enum_normal_default);
+}
+
+
+inline bool operator==(const TypeAliasesT &lhs, const TypeAliasesT &rhs) {
+ return
+ (lhs.i8 == rhs.i8) &&
+ (lhs.u8 == rhs.u8) &&
+ (lhs.i16 == rhs.i16) &&
+ (lhs.u16 == rhs.u16) &&
+ (lhs.i32 == rhs.i32) &&
+ (lhs.u32 == rhs.u32) &&
+ (lhs.i64 == rhs.i64) &&
+ (lhs.u64 == rhs.u64) &&
+ (lhs.f32 == rhs.f32) &&
+ (lhs.f64 == rhs.f64) &&
+ (lhs.v8 == rhs.v8) &&
+ (lhs.vf64 == rhs.vf64);
+}
+
+inline bool operator!=(const TypeAliasesT &lhs, const TypeAliasesT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline TypeAliasesT *TypeAliases::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<TypeAliasesT>(new TypeAliasesT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void TypeAliases::UnPackTo(TypeAliasesT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = i8(); _o->i8 = _e; }
+ { auto _e = u8(); _o->u8 = _e; }
+ { auto _e = i16(); _o->i16 = _e; }
+ { auto _e = u16(); _o->u16 = _e; }
+ { auto _e = i32(); _o->i32 = _e; }
+ { auto _e = u32(); _o->u32 = _e; }
+ { auto _e = i64(); _o->i64 = _e; }
+ { auto _e = u64(); _o->u64 = _e; }
+ { auto _e = f32(); _o->f32 = _e; }
+ { auto _e = f64(); _o->f64 = _e; }
+ { auto _e = v8(); if (_e) { _o->v8.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->v8.begin()); } }
+ { auto _e = vf64(); if (_e) { _o->vf64.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vf64[_i] = _e->Get(_i); } } else { _o->vf64.resize(0); } }
+}
+
+inline flatbuffers::Offset<TypeAliases> TypeAliases::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateTypeAliases(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<TypeAliases> CreateTypeAliases(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TypeAliasesT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _i8 = _o->i8;
+ auto _u8 = _o->u8;
+ auto _i16 = _o->i16;
+ auto _u16 = _o->u16;
+ auto _i32 = _o->i32;
+ auto _u32 = _o->u32;
+ auto _i64 = _o->i64;
+ auto _u64 = _o->u64;
+ auto _f32 = _o->f32;
+ auto _f64 = _o->f64;
+ auto _v8 = _o->v8.size() ? _fbb.CreateVector(_o->v8) : 0;
+ auto _vf64 = _o->vf64.size() ? _fbb.CreateVector(_o->vf64) : 0;
+ return MyGame::Example::CreateTypeAliases(
+ _fbb,
+ _i8,
+ _u8,
+ _i16,
+ _u16,
+ _i32,
+ _u32,
+ _i64,
+ _u64,
+ _f32,
+ _f64,
+ _v8,
+ _vf64);
+}
+
+inline bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type) {
+ switch (type) {
+ case Any_NONE: {
+ return true;
+ }
+ case Any_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case Any_TestSimpleTableWithEnum: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnum *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case Any_MyGame_Example2_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ default: return true;
+ }
+}
+
+inline bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
+ if (!values || !types) return !values && !types;
+ if (values->size() != types->size()) return false;
+ for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
+ if (!VerifyAny(
+ verifier, values->Get(i), types->GetEnum<Any>(i))) {
+ return false;
+ }
+ }
+ return true;
+}
+
+inline void *AnyUnion::UnPack(const void *obj, Any type, const flatbuffers::resolver_function_t *resolver) {
+ (void)resolver;
+ switch (type) {
+ case Any_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case Any_TestSimpleTableWithEnum: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnum *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case Any_MyGame_Example2_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ default: return nullptr;
+ }
+}
+
+inline flatbuffers::Offset<void> AnyUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
+ (void)_rehasher;
+ switch (type) {
+ case Any_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ case Any_TestSimpleTableWithEnum: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(value);
+ return CreateTestSimpleTableWithEnum(_fbb, ptr, _rehasher).Union();
+ }
+ case Any_MyGame_Example2_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ default: return 0;
+ }
+}
+
+inline AnyUnion::AnyUnion(const AnyUnion &u) : type(u.type), value(nullptr) {
+ switch (type) {
+ case Any_Monster: {
+ value = new MyGame::Example::MonsterT(*reinterpret_cast<MyGame::Example::MonsterT *>(u.value));
+ break;
+ }
+ case Any_TestSimpleTableWithEnum: {
+ value = new MyGame::Example::TestSimpleTableWithEnumT(*reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(u.value));
+ break;
+ }
+ case Any_MyGame_Example2_Monster: {
+ value = new MyGame::Example2::MonsterT(*reinterpret_cast<MyGame::Example2::MonsterT *>(u.value));
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+inline void AnyUnion::Reset() {
+ switch (type) {
+ case Any_Monster: {
+ auto ptr = reinterpret_cast<MyGame::Example::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ case Any_TestSimpleTableWithEnum: {
+ auto ptr = reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(value);
+ delete ptr;
+ break;
+ }
+ case Any_MyGame_Example2_Monster: {
+ auto ptr = reinterpret_cast<MyGame::Example2::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ default: break;
+ }
+ value = nullptr;
+ type = Any_NONE;
+}
+
+inline bool VerifyAnyUniqueAliases(flatbuffers::Verifier &verifier, const void *obj, AnyUniqueAliases type) {
+ switch (type) {
+ case AnyUniqueAliases_NONE: {
+ return true;
+ }
+ case AnyUniqueAliases_M: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case AnyUniqueAliases_TS: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnum *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case AnyUniqueAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ default: return true;
+ }
+}
+
+inline bool VerifyAnyUniqueAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
+ if (!values || !types) return !values && !types;
+ if (values->size() != types->size()) return false;
+ for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
+ if (!VerifyAnyUniqueAliases(
+ verifier, values->Get(i), types->GetEnum<AnyUniqueAliases>(i))) {
+ return false;
+ }
+ }
+ return true;
+}
+
+inline void *AnyUniqueAliasesUnion::UnPack(const void *obj, AnyUniqueAliases type, const flatbuffers::resolver_function_t *resolver) {
+ (void)resolver;
+ switch (type) {
+ case AnyUniqueAliases_M: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case AnyUniqueAliases_TS: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnum *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case AnyUniqueAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ default: return nullptr;
+ }
+}
+
+inline flatbuffers::Offset<void> AnyUniqueAliasesUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
+ (void)_rehasher;
+ switch (type) {
+ case AnyUniqueAliases_M: {
+ auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ case AnyUniqueAliases_TS: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(value);
+ return CreateTestSimpleTableWithEnum(_fbb, ptr, _rehasher).Union();
+ }
+ case AnyUniqueAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ default: return 0;
+ }
+}
+
+inline AnyUniqueAliasesUnion::AnyUniqueAliasesUnion(const AnyUniqueAliasesUnion &u) : type(u.type), value(nullptr) {
+ switch (type) {
+ case AnyUniqueAliases_M: {
+ value = new MyGame::Example::MonsterT(*reinterpret_cast<MyGame::Example::MonsterT *>(u.value));
+ break;
+ }
+ case AnyUniqueAliases_TS: {
+ value = new MyGame::Example::TestSimpleTableWithEnumT(*reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(u.value));
+ break;
+ }
+ case AnyUniqueAliases_M2: {
+ value = new MyGame::Example2::MonsterT(*reinterpret_cast<MyGame::Example2::MonsterT *>(u.value));
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+inline void AnyUniqueAliasesUnion::Reset() {
+ switch (type) {
+ case AnyUniqueAliases_M: {
+ auto ptr = reinterpret_cast<MyGame::Example::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ case AnyUniqueAliases_TS: {
+ auto ptr = reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(value);
+ delete ptr;
+ break;
+ }
+ case AnyUniqueAliases_M2: {
+ auto ptr = reinterpret_cast<MyGame::Example2::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ default: break;
+ }
+ value = nullptr;
+ type = AnyUniqueAliases_NONE;
+}
+
+inline bool VerifyAnyAmbiguousAliases(flatbuffers::Verifier &verifier, const void *obj, AnyAmbiguousAliases type) {
+ switch (type) {
+ case AnyAmbiguousAliases_NONE: {
+ return true;
+ }
+ case AnyAmbiguousAliases_M1: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case AnyAmbiguousAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case AnyAmbiguousAliases_M3: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ default: return true;
+ }
+}
+
+inline bool VerifyAnyAmbiguousAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
+ if (!values || !types) return !values && !types;
+ if (values->size() != types->size()) return false;
+ for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
+ if (!VerifyAnyAmbiguousAliases(
+ verifier, values->Get(i), types->GetEnum<AnyAmbiguousAliases>(i))) {
+ return false;
+ }
+ }
+ return true;
+}
+
+inline void *AnyAmbiguousAliasesUnion::UnPack(const void *obj, AnyAmbiguousAliases type, const flatbuffers::resolver_function_t *resolver) {
+ (void)resolver;
+ switch (type) {
+ case AnyAmbiguousAliases_M1: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case AnyAmbiguousAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case AnyAmbiguousAliases_M3: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ default: return nullptr;
+ }
+}
+
+inline flatbuffers::Offset<void> AnyAmbiguousAliasesUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
+ (void)_rehasher;
+ switch (type) {
+ case AnyAmbiguousAliases_M1: {
+ auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ case AnyAmbiguousAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ case AnyAmbiguousAliases_M3: {
+ auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ default: return 0;
+ }
+}
+
+inline AnyAmbiguousAliasesUnion::AnyAmbiguousAliasesUnion(const AnyAmbiguousAliasesUnion &u) : type(u.type), value(nullptr) {
+ switch (type) {
+ case AnyAmbiguousAliases_M1: {
+ value = new MyGame::Example::MonsterT(*reinterpret_cast<MyGame::Example::MonsterT *>(u.value));
+ break;
+ }
+ case AnyAmbiguousAliases_M2: {
+ value = new MyGame::Example::MonsterT(*reinterpret_cast<MyGame::Example::MonsterT *>(u.value));
+ break;
+ }
+ case AnyAmbiguousAliases_M3: {
+ value = new MyGame::Example::MonsterT(*reinterpret_cast<MyGame::Example::MonsterT *>(u.value));
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+inline void AnyAmbiguousAliasesUnion::Reset() {
+ switch (type) {
+ case AnyAmbiguousAliases_M1: {
+ auto ptr = reinterpret_cast<MyGame::Example::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ case AnyAmbiguousAliases_M2: {
+ auto ptr = reinterpret_cast<MyGame::Example::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ case AnyAmbiguousAliases_M3: {
+ auto ptr = reinterpret_cast<MyGame::Example::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ default: break;
+ }
+ value = nullptr;
+ type = AnyAmbiguousAliases_NONE;
+}
+
+inline const flatbuffers::TypeTable *ColorTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_UCHAR, 0, 0 },
+ { flatbuffers::ET_UCHAR, 0, 0 },
+ { flatbuffers::ET_UCHAR, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::ColorTypeTable
+ };
+ static const int64_t values[] = { 1, 2, 8 };
+ static const char * const names[] = {
+ "Red",
+ "Green",
+ "Blue"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *RaceTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_CHAR, 0, 0 },
+ { flatbuffers::ET_CHAR, 0, 0 },
+ { flatbuffers::ET_CHAR, 0, 0 },
+ { flatbuffers::ET_CHAR, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::RaceTypeTable
+ };
+ static const int64_t values[] = { -1, 0, 1, 2 };
+ static const char * const names[] = {
+ "None",
+ "Human",
+ "Dwarf",
+ "Elf"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_ENUM, 4, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *LongEnumTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_ULONG, 0, 0 },
+ { flatbuffers::ET_ULONG, 0, 0 },
+ { flatbuffers::ET_ULONG, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::LongEnumTypeTable
+ };
+ static const int64_t values[] = { 2ULL, 4ULL, 1099511627776ULL };
+ static const char * const names[] = {
+ "LongOne",
+ "LongTwo",
+ "LongBig"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *AnyTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 1 },
+ { flatbuffers::ET_SEQUENCE, 0, 2 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::MonsterTypeTable,
+ MyGame::Example::TestSimpleTableWithEnumTypeTable,
+ MyGame::Example2::MonsterTypeTable
+ };
+ static const char * const names[] = {
+ "NONE",
+ "Monster",
+ "TestSimpleTableWithEnum",
+ "MyGame_Example2_Monster"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_UNION, 4, type_codes, type_refs, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *AnyUniqueAliasesTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 1 },
+ { flatbuffers::ET_SEQUENCE, 0, 2 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::MonsterTypeTable,
+ MyGame::Example::TestSimpleTableWithEnumTypeTable,
+ MyGame::Example2::MonsterTypeTable
+ };
+ static const char * const names[] = {
+ "NONE",
+ "M",
+ "TS",
+ "M2"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_UNION, 4, type_codes, type_refs, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *AnyAmbiguousAliasesTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::MonsterTypeTable
+ };
+ static const char * const names[] = {
+ "NONE",
+ "M1",
+ "M2",
+ "M3"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_UNION, 4, type_codes, type_refs, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+} // namespace Example
+
+inline const flatbuffers::TypeTable *InParentNamespaceTypeTable() {
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 0, nullptr, nullptr, nullptr, nullptr, nullptr
+ };
+ return &tt;
+}
+
+namespace Example2 {
+
+inline const flatbuffers::TypeTable *MonsterTypeTable() {
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 0, nullptr, nullptr, nullptr, nullptr, nullptr
+ };
+ return &tt;
+}
+
+} // namespace Example2
+
+namespace Example {
+
+inline const flatbuffers::TypeTable *TestTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SHORT, 0, -1 },
+ { flatbuffers::ET_CHAR, 0, -1 }
+ };
+ static const int64_t values[] = { 0, 2, 4 };
+ static const char * const names[] = {
+ "a",
+ "b"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 2, type_codes, nullptr, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *TestSimpleTableWithEnumTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_UCHAR, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::ColorTypeTable
+ };
+ static const char * const names[] = {
+ "color"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 1, type_codes, type_refs, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *Vec3TypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_DOUBLE, 0, -1 },
+ { flatbuffers::ET_UCHAR, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 1 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::ColorTypeTable,
+ MyGame::Example::TestTypeTable
+ };
+ static const int64_t values[] = { 0, 4, 8, 16, 24, 26, 32 };
+ static const char * const names[] = {
+ "x",
+ "y",
+ "z",
+ "test1",
+ "test2",
+ "test3"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 6, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *AbilityTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_UINT, 0, -1 },
+ { flatbuffers::ET_UINT, 0, -1 }
+ };
+ static const int64_t values[] = { 0, 4, 8 };
+ static const char * const names[] = {
+ "id",
+ "distance"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 2, type_codes, nullptr, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *StructOfStructsTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 1 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::AbilityTypeTable,
+ MyGame::Example::TestTypeTable
+ };
+ static const int64_t values[] = { 0, 8, 12, 20 };
+ static const char * const names[] = {
+ "a",
+ "b",
+ "c"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 3, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *StructOfStructsOfStructsTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::StructOfStructsTypeTable
+ };
+ static const int64_t values[] = { 0, 20 };
+ static const char * const names[] = {
+ "a"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 1, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *StatTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_STRING, 0, -1 },
+ { flatbuffers::ET_LONG, 0, -1 },
+ { flatbuffers::ET_USHORT, 0, -1 }
+ };
+ static const char * const names[] = {
+ "id",
+ "val",
+ "count"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 3, type_codes, nullptr, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *ReferrableTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_ULONG, 0, -1 }
+ };
+ static const char * const names[] = {
+ "id"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 1, type_codes, nullptr, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *MonsterTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SHORT, 0, -1 },
+ { flatbuffers::ET_SHORT, 0, -1 },
+ { flatbuffers::ET_STRING, 0, -1 },
+ { flatbuffers::ET_BOOL, 0, -1 },
+ { flatbuffers::ET_UCHAR, 1, -1 },
+ { flatbuffers::ET_UCHAR, 0, 1 },
+ { flatbuffers::ET_UTYPE, 0, 2 },
+ { flatbuffers::ET_SEQUENCE, 0, 2 },
+ { flatbuffers::ET_SEQUENCE, 1, 3 },
+ { flatbuffers::ET_STRING, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 1, 4 },
+ { flatbuffers::ET_SEQUENCE, 0, 4 },
+ { flatbuffers::ET_UCHAR, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 5 },
+ { flatbuffers::ET_BOOL, 0, -1 },
+ { flatbuffers::ET_INT, 0, -1 },
+ { flatbuffers::ET_UINT, 0, -1 },
+ { flatbuffers::ET_LONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_INT, 0, -1 },
+ { flatbuffers::ET_UINT, 0, -1 },
+ { flatbuffers::ET_LONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_BOOL, 1, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_STRING, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 1, 6 },
+ { flatbuffers::ET_UCHAR, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 1, 3 },
+ { flatbuffers::ET_LONG, 1, -1 },
+ { flatbuffers::ET_DOUBLE, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 7 },
+ { flatbuffers::ET_SEQUENCE, 1, 8 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 1, 8 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 1, -1 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 1, -1 },
+ { flatbuffers::ET_UTYPE, 0, 9 },
+ { flatbuffers::ET_SEQUENCE, 0, 9 },
+ { flatbuffers::ET_UTYPE, 0, 10 },
+ { flatbuffers::ET_SEQUENCE, 0, 10 },
+ { flatbuffers::ET_UCHAR, 1, 1 },
+ { flatbuffers::ET_CHAR, 0, 11 },
+ { flatbuffers::ET_UCHAR, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 1, 5 },
+ { flatbuffers::ET_SEQUENCE, 0, 3 },
+ { flatbuffers::ET_ULONG, 0, 12 },
+ { flatbuffers::ET_ULONG, 0, 12 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::Vec3TypeTable,
+ MyGame::Example::ColorTypeTable,
+ MyGame::Example::AnyTypeTable,
+ MyGame::Example::TestTypeTable,
+ MyGame::Example::MonsterTypeTable,
+ MyGame::Example::StatTypeTable,
+ MyGame::Example::AbilityTypeTable,
+ MyGame::InParentNamespaceTypeTable,
+ MyGame::Example::ReferrableTypeTable,
+ MyGame::Example::AnyUniqueAliasesTypeTable,
+ MyGame::Example::AnyAmbiguousAliasesTypeTable,
+ MyGame::Example::RaceTypeTable,
+ MyGame::Example::LongEnumTypeTable
+ };
+ static const char * const names[] = {
+ "pos",
+ "mana",
+ "hp",
+ "name",
+ "friendly",
+ "inventory",
+ "color",
+ "test_type",
+ "test",
+ "test4",
+ "testarrayofstring",
+ "testarrayoftables",
+ "enemy",
+ "testnestedflatbuffer",
+ "testempty",
+ "testbool",
+ "testhashs32_fnv1",
+ "testhashu32_fnv1",
+ "testhashs64_fnv1",
+ "testhashu64_fnv1",
+ "testhashs32_fnv1a",
+ "testhashu32_fnv1a",
+ "testhashs64_fnv1a",
+ "testhashu64_fnv1a",
+ "testarrayofbools",
+ "testf",
+ "testf2",
+ "testf3",
+ "testarrayofstring2",
+ "testarrayofsortedstruct",
+ "flex",
+ "test5",
+ "vector_of_longs",
+ "vector_of_doubles",
+ "parent_namespace_test",
+ "vector_of_referrables",
+ "single_weak_reference",
+ "vector_of_weak_references",
+ "vector_of_strong_referrables",
+ "co_owning_reference",
+ "vector_of_co_owning_references",
+ "non_owning_reference",
+ "vector_of_non_owning_references",
+ "any_unique_type",
+ "any_unique",
+ "any_ambiguous_type",
+ "any_ambiguous",
+ "vector_of_enums",
+ "signed_enum",
+ "testrequirednestedflatbuffer",
+ "scalar_key_sorted_tables",
+ "native_inline",
+ "long_enum_non_enum_default",
+ "long_enum_normal_default"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 54, type_codes, type_refs, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *TypeAliasesTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_CHAR, 0, -1 },
+ { flatbuffers::ET_UCHAR, 0, -1 },
+ { flatbuffers::ET_SHORT, 0, -1 },
+ { flatbuffers::ET_USHORT, 0, -1 },
+ { flatbuffers::ET_INT, 0, -1 },
+ { flatbuffers::ET_UINT, 0, -1 },
+ { flatbuffers::ET_LONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_DOUBLE, 0, -1 },
+ { flatbuffers::ET_CHAR, 1, -1 },
+ { flatbuffers::ET_DOUBLE, 1, -1 }
+ };
+ static const char * const names[] = {
+ "i8",
+ "u8",
+ "i16",
+ "u16",
+ "i32",
+ "u32",
+ "i64",
+ "u64",
+ "f32",
+ "f64",
+ "v8",
+ "vf64"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 12, type_codes, nullptr, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const MyGame::Example::Monster *GetMonster(const void *buf) {
+ return flatbuffers::GetRoot<MyGame::Example::Monster>(buf);
+}
+
+inline const MyGame::Example::Monster *GetSizePrefixedMonster(const void *buf) {
+ return flatbuffers::GetSizePrefixedRoot<MyGame::Example::Monster>(buf);
+}
+
+inline Monster *GetMutableMonster(void *buf) {
+ return flatbuffers::GetMutableRoot<Monster>(buf);
+}
+
+inline MyGame::Example::Monster *GetMutableSizePrefixedMonster(void *buf) {
+ return flatbuffers::GetMutableSizePrefixedRoot<MyGame::Example::Monster>(buf);
+}
+
+inline const char *MonsterIdentifier() {
+ return "MONS";
+}
+
+inline bool MonsterBufferHasIdentifier(const void *buf) {
+ return flatbuffers::BufferHasIdentifier(
+ buf, MonsterIdentifier());
+}
+
+inline bool SizePrefixedMonsterBufferHasIdentifier(const void *buf) {
+ return flatbuffers::BufferHasIdentifier(
+ buf, MonsterIdentifier(), true);
+}
+
+inline bool VerifyMonsterBuffer(
+ flatbuffers::Verifier &verifier) {
+ return verifier.VerifyBuffer<MyGame::Example::Monster>(MonsterIdentifier());
+}
+
+inline bool VerifySizePrefixedMonsterBuffer(
+ flatbuffers::Verifier &verifier) {
+ return verifier.VerifySizePrefixedBuffer<MyGame::Example::Monster>(MonsterIdentifier());
+}
+
+inline const char *MonsterExtension() {
+ return "mon";
+}
+
+inline void FinishMonsterBuffer(
+ flatbuffers::FlatBufferBuilder &fbb,
+ flatbuffers::Offset<MyGame::Example::Monster> root) {
+ fbb.Finish(root, MonsterIdentifier());
+}
+
+inline void FinishSizePrefixedMonsterBuffer(
+ flatbuffers::FlatBufferBuilder &fbb,
+ flatbuffers::Offset<MyGame::Example::Monster> root) {
+ fbb.FinishSizePrefixed(root, MonsterIdentifier());
+}
+
+inline flatbuffers::unique_ptr<MyGame::Example::MonsterT> UnPackMonster(
+ const void *buf,
+ const flatbuffers::resolver_function_t *res = nullptr) {
+ return flatbuffers::unique_ptr<MyGame::Example::MonsterT>(GetMonster(buf)->UnPack(res));
+}
+
+inline flatbuffers::unique_ptr<MyGame::Example::MonsterT> UnPackSizePrefixedMonster(
+ const void *buf,
+ const flatbuffers::resolver_function_t *res = nullptr) {
+ return flatbuffers::unique_ptr<MyGame::Example::MonsterT>(GetSizePrefixedMonster(buf)->UnPack(res));
+}
+
+} // namespace Example
+} // namespace MyGame
+
+#endif // FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_H_
diff --git a/tests/monster_test_suffix/monster_test.grpc.fb.cc b/tests/monster_test_suffix/monster_test.grpc.fb.cc
new file mode 100644
index 0000000..6680f4f
--- /dev/null
+++ b/tests/monster_test_suffix/monster_test.grpc.fb.cc
@@ -0,0 +1,131 @@
+// Generated by the gRPC C++ plugin.
+// If you make any local change, they will be lost.
+// source: monster_test
+
+#include "monster_test_suffix.hpp"
+#include "monster_test.grpc.fb.h"
+
+#include <grpcpp/impl/codegen/async_stream.h>
+#include <grpcpp/impl/codegen/async_unary_call.h>
+#include <grpcpp/impl/codegen/channel_interface.h>
+#include <grpcpp/impl/codegen/client_unary_call.h>
+#include <grpcpp/impl/codegen/method_handler.h>
+#include <grpcpp/impl/codegen/rpc_service_method.h>
+#include <grpcpp/impl/codegen/service_type.h>
+#include <grpcpp/impl/codegen/sync_stream.h>
+namespace MyGame {
+namespace Example {
+
+static const char* MonsterStorage_method_names[] = {
+ "/MyGame.Example.MonsterStorage/Store",
+ "/MyGame.Example.MonsterStorage/Retrieve",
+ "/MyGame.Example.MonsterStorage/GetMaxHitPoint",
+ "/MyGame.Example.MonsterStorage/GetMinMaxHitPoints",
+};
+
+std::unique_ptr< MonsterStorage::Stub> MonsterStorage::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& /*options*/) {
+ std::unique_ptr< MonsterStorage::Stub> stub(new MonsterStorage::Stub(channel));
+ return stub;
+}
+
+MonsterStorage::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel)
+ : channel_(channel) , rpcmethod_Store_(MonsterStorage_method_names[0], ::grpc::internal::RpcMethod::NORMAL_RPC, channel)
+ , rpcmethod_Retrieve_(MonsterStorage_method_names[1], ::grpc::internal::RpcMethod::SERVER_STREAMING, channel)
+ , rpcmethod_GetMaxHitPoint_(MonsterStorage_method_names[2], ::grpc::internal::RpcMethod::CLIENT_STREAMING, channel)
+ , rpcmethod_GetMinMaxHitPoints_(MonsterStorage_method_names[3], ::grpc::internal::RpcMethod::BIDI_STREAMING, channel)
+ {}
+
+::grpc::Status MonsterStorage::Stub::Store(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, flatbuffers::grpc::Message<Stat>* response) {
+ return ::grpc::internal::BlockingUnaryCall(channel_.get(), rpcmethod_Store_, context, request, response);
+}
+
+::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::AsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return ::grpc::internal::ClientAsyncResponseReaderFactory< flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), cq, rpcmethod_Store_, context, request, true);
+}
+
+::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::PrepareAsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return ::grpc::internal::ClientAsyncResponseReaderFactory< flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), cq, rpcmethod_Store_, context, request, false);
+}
+
+::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::RetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) {
+ return ::grpc::internal::ClientReaderFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), rpcmethod_Retrieve_, context, request);
+}
+
+::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::AsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) {
+ return ::grpc::internal::ClientAsyncReaderFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), cq, rpcmethod_Retrieve_, context, request, true, tag);
+}
+
+::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::PrepareAsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) {
+ return ::grpc::internal::ClientAsyncReaderFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), cq, rpcmethod_Retrieve_, context, request, false, nullptr);
+}
+
+::grpc::ClientWriter< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::GetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response) {
+ return ::grpc::internal::ClientWriterFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), rpcmethod_GetMaxHitPoint_, context, response);
+}
+
+::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::AsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq, void* tag) {
+ return ::grpc::internal::ClientAsyncWriterFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), cq, rpcmethod_GetMaxHitPoint_, context, response, true, tag);
+}
+
+::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>* MonsterStorage::Stub::PrepareAsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq) {
+ return ::grpc::internal::ClientAsyncWriterFactory< flatbuffers::grpc::Message<Monster>>::Create(channel_.get(), cq, rpcmethod_GetMaxHitPoint_, context, response, false, nullptr);
+}
+
+::grpc::ClientReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::GetMinMaxHitPointsRaw(::grpc::ClientContext* context) {
+ return ::grpc::internal::ClientReaderWriterFactory< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), rpcmethod_GetMinMaxHitPoints_, context);
+}
+
+::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::AsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) {
+ return ::grpc::internal::ClientAsyncReaderWriterFactory< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), cq, rpcmethod_GetMinMaxHitPoints_, context, true, tag);
+}
+
+::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* MonsterStorage::Stub::PrepareAsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) {
+ return ::grpc::internal::ClientAsyncReaderWriterFactory< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>::Create(channel_.get(), cq, rpcmethod_GetMinMaxHitPoints_, context, false, nullptr);
+}
+
+MonsterStorage::Service::Service() {
+ AddMethod(new ::grpc::internal::RpcServiceMethod(
+ MonsterStorage_method_names[0],
+ ::grpc::internal::RpcMethod::NORMAL_RPC,
+ new ::grpc::internal::RpcMethodHandler< MonsterStorage::Service, flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>(
+ std::mem_fn(&MonsterStorage::Service::Store), this)));
+ AddMethod(new ::grpc::internal::RpcServiceMethod(
+ MonsterStorage_method_names[1],
+ ::grpc::internal::RpcMethod::SERVER_STREAMING,
+ new ::grpc::internal::ServerStreamingHandler< MonsterStorage::Service, flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>(
+ std::mem_fn(&MonsterStorage::Service::Retrieve), this)));
+ AddMethod(new ::grpc::internal::RpcServiceMethod(
+ MonsterStorage_method_names[2],
+ ::grpc::internal::RpcMethod::CLIENT_STREAMING,
+ new ::grpc::internal::ClientStreamingHandler< MonsterStorage::Service, flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>(
+ std::mem_fn(&MonsterStorage::Service::GetMaxHitPoint), this)));
+ AddMethod(new ::grpc::internal::RpcServiceMethod(
+ MonsterStorage_method_names[3],
+ ::grpc::internal::RpcMethod::BIDI_STREAMING,
+ new ::grpc::internal::BidiStreamingHandler< MonsterStorage::Service, flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>(
+ std::mem_fn(&MonsterStorage::Service::GetMinMaxHitPoints), this)));
+}
+
+MonsterStorage::Service::~Service() {
+}
+
+::grpc::Status MonsterStorage::Service::Store(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Monster>* /*request*/, flatbuffers::grpc::Message<Stat>* /*response*/) {
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+}
+
+::grpc::Status MonsterStorage::Service::Retrieve(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Stat>* /*request*/, ::grpc::ServerWriter< flatbuffers::grpc::Message<Monster>>* /*writer*/) {
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+}
+
+::grpc::Status MonsterStorage::Service::GetMaxHitPoint(::grpc::ServerContext* /*context*/, ::grpc::ServerReader< flatbuffers::grpc::Message<Monster>>* /*reader*/, flatbuffers::grpc::Message<Stat>* /*response*/) {
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+}
+
+::grpc::Status MonsterStorage::Service::GetMinMaxHitPoints(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* /*stream*/) {
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+}
+
+
+} // namespace MyGame
+} // namespace Example
+
diff --git a/tests/monster_test_suffix/monster_test.grpc.fb.h b/tests/monster_test_suffix/monster_test.grpc.fb.h
new file mode 100644
index 0000000..1b6ab6f
--- /dev/null
+++ b/tests/monster_test_suffix/monster_test.grpc.fb.h
@@ -0,0 +1,350 @@
+// Generated by the gRPC C++ plugin.
+// If you make any local change, they will be lost.
+// source: monster_test
+#ifndef GRPC_monster_5ftest__INCLUDED
+#define GRPC_monster_5ftest__INCLUDED
+
+#include "monster_test_suffix.hpp"
+#include "flatbuffers/grpc.h"
+
+#include <grpcpp/impl/codegen/async_stream.h>
+#include <grpcpp/impl/codegen/async_unary_call.h>
+#include <grpcpp/impl/codegen/method_handler.h>
+#include <grpcpp/impl/codegen/proto_utils.h>
+#include <grpcpp/impl/codegen/rpc_method.h>
+#include <grpcpp/impl/codegen/service_type.h>
+#include <grpcpp/impl/codegen/status.h>
+#include <grpcpp/impl/codegen/stub_options.h>
+#include <grpcpp/impl/codegen/sync_stream.h>
+
+namespace grpc {
+class CompletionQueue;
+class Channel;
+class ServerCompletionQueue;
+class ServerContext;
+} // namespace grpc
+
+namespace MyGame {
+namespace Example {
+
+class MonsterStorage final {
+ public:
+ static constexpr char const* service_full_name() {
+ return "MyGame.Example.MonsterStorage";
+ }
+ class StubInterface {
+ public:
+ virtual ~StubInterface() {}
+ virtual ::grpc::Status Store(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, flatbuffers::grpc::Message<Stat>* response) = 0;
+ std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>> AsyncStore(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>>(AsyncStoreRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>> PrepareAsyncStore(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>>(PrepareAsyncStoreRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientReaderInterface< flatbuffers::grpc::Message<Monster>>> Retrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) {
+ return std::unique_ptr< ::grpc::ClientReaderInterface< flatbuffers::grpc::Message<Monster>>>(RetrieveRaw(context, request));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>> AsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>>(AsyncRetrieveRaw(context, request, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>> PrepareAsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>>(PrepareAsyncRetrieveRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientWriterInterface< flatbuffers::grpc::Message<Monster>>> GetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response) {
+ return std::unique_ptr< ::grpc::ClientWriterInterface< flatbuffers::grpc::Message<Monster>>>(GetMaxHitPointRaw(context, response));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>> AsyncGetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>>(AsyncGetMaxHitPointRaw(context, response, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>> PrepareAsyncGetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>>(PrepareAsyncGetMaxHitPointRaw(context, response, cq));
+ }
+ std::unique_ptr< ::grpc::ClientReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> GetMinMaxHitPoints(::grpc::ClientContext* context) {
+ return std::unique_ptr< ::grpc::ClientReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(GetMinMaxHitPointsRaw(context));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> AsyncGetMinMaxHitPoints(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(AsyncGetMinMaxHitPointsRaw(context, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> PrepareAsyncGetMinMaxHitPoints(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(PrepareAsyncGetMinMaxHitPointsRaw(context, cq));
+ }
+ private:
+ virtual ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>* AsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientAsyncResponseReaderInterface< flatbuffers::grpc::Message<Stat>>* PrepareAsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientReaderInterface< flatbuffers::grpc::Message<Monster>>* RetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) = 0;
+ virtual ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>* AsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) = 0;
+ virtual ::grpc::ClientAsyncReaderInterface< flatbuffers::grpc::Message<Monster>>* PrepareAsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientWriterInterface< flatbuffers::grpc::Message<Monster>>* GetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response) = 0;
+ virtual ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>* AsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq, void* tag) = 0;
+ virtual ::grpc::ClientAsyncWriterInterface< flatbuffers::grpc::Message<Monster>>* PrepareAsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* GetMinMaxHitPointsRaw(::grpc::ClientContext* context) = 0;
+ virtual ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* AsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) = 0;
+ virtual ::grpc::ClientAsyncReaderWriterInterface< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* PrepareAsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) = 0;
+ };
+ class Stub final : public StubInterface {
+ public:
+ Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);
+ ::grpc::Status Store(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, flatbuffers::grpc::Message<Stat>* response) override;
+ std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>> AsyncStore(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>>(AsyncStoreRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>> PrepareAsyncStore(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>>(PrepareAsyncStoreRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>> Retrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) {
+ return std::unique_ptr< ::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>>(RetrieveRaw(context, request));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>> AsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>>(AsyncRetrieveRaw(context, request, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>> PrepareAsyncRetrieve(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>>(PrepareAsyncRetrieveRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientWriter< flatbuffers::grpc::Message<Monster>>> GetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response) {
+ return std::unique_ptr< ::grpc::ClientWriter< flatbuffers::grpc::Message<Monster>>>(GetMaxHitPointRaw(context, response));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>> AsyncGetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>>(AsyncGetMaxHitPointRaw(context, response, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>> PrepareAsyncGetMaxHitPoint(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>>(PrepareAsyncGetMaxHitPointRaw(context, response, cq));
+ }
+ std::unique_ptr< ::grpc::ClientReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> GetMinMaxHitPoints(::grpc::ClientContext* context) {
+ return std::unique_ptr< ::grpc::ClientReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(GetMinMaxHitPointsRaw(context));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> AsyncGetMinMaxHitPoints(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(AsyncGetMinMaxHitPointsRaw(context, cq, tag));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>> PrepareAsyncGetMinMaxHitPoints(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>>(PrepareAsyncGetMinMaxHitPointsRaw(context, cq));
+ }
+
+ private:
+ std::shared_ptr< ::grpc::ChannelInterface> channel_;
+ ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>* AsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientAsyncResponseReader< flatbuffers::grpc::Message<Stat>>* PrepareAsyncStoreRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Monster>& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientReader< flatbuffers::grpc::Message<Monster>>* RetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request) override;
+ ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>* AsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq, void* tag) override;
+ ::grpc::ClientAsyncReader< flatbuffers::grpc::Message<Monster>>* PrepareAsyncRetrieveRaw(::grpc::ClientContext* context, const flatbuffers::grpc::Message<Stat>& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientWriter< flatbuffers::grpc::Message<Monster>>* GetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response) override;
+ ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>* AsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq, void* tag) override;
+ ::grpc::ClientAsyncWriter< flatbuffers::grpc::Message<Monster>>* PrepareAsyncGetMaxHitPointRaw(::grpc::ClientContext* context, flatbuffers::grpc::Message<Stat>* response, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* GetMinMaxHitPointsRaw(::grpc::ClientContext* context) override;
+ ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* AsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq, void* tag) override;
+ ::grpc::ClientAsyncReaderWriter< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>* PrepareAsyncGetMinMaxHitPointsRaw(::grpc::ClientContext* context, ::grpc::CompletionQueue* cq) override;
+ const ::grpc::internal::RpcMethod rpcmethod_Store_;
+ const ::grpc::internal::RpcMethod rpcmethod_Retrieve_;
+ const ::grpc::internal::RpcMethod rpcmethod_GetMaxHitPoint_;
+ const ::grpc::internal::RpcMethod rpcmethod_GetMinMaxHitPoints_;
+ };
+ static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
+
+ class Service : public ::grpc::Service {
+ public:
+ Service();
+ virtual ~Service();
+ virtual ::grpc::Status Store(::grpc::ServerContext* context, const flatbuffers::grpc::Message<Monster>* request, flatbuffers::grpc::Message<Stat>* response);
+ virtual ::grpc::Status Retrieve(::grpc::ServerContext* context, const flatbuffers::grpc::Message<Stat>* request, ::grpc::ServerWriter< flatbuffers::grpc::Message<Monster>>* writer);
+ virtual ::grpc::Status GetMaxHitPoint(::grpc::ServerContext* context, ::grpc::ServerReader< flatbuffers::grpc::Message<Monster>>* reader, flatbuffers::grpc::Message<Stat>* response);
+ virtual ::grpc::Status GetMinMaxHitPoints(::grpc::ServerContext* context, ::grpc::ServerReaderWriter< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* stream);
+ };
+ template <class BaseClass>
+ class WithAsyncMethod_Store : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithAsyncMethod_Store() {
+ ::grpc::Service::MarkMethodAsync(0);
+ }
+ ~WithAsyncMethod_Store() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status Store(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Monster>* /*request*/, flatbuffers::grpc::Message<Stat>* /*response*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestStore(::grpc::ServerContext* context, flatbuffers::grpc::Message<Monster>* request, ::grpc::ServerAsyncResponseWriter< flatbuffers::grpc::Message<Stat>>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+ ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag);
+ }
+ };
+ template <class BaseClass>
+ class WithAsyncMethod_Retrieve : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithAsyncMethod_Retrieve() {
+ ::grpc::Service::MarkMethodAsync(1);
+ }
+ ~WithAsyncMethod_Retrieve() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status Retrieve(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Stat>* /*request*/, ::grpc::ServerWriter< flatbuffers::grpc::Message<Monster>>* /*writer*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestRetrieve(::grpc::ServerContext* context, flatbuffers::grpc::Message<Stat>* request, ::grpc::ServerAsyncWriter< flatbuffers::grpc::Message<Monster>>* writer, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+ ::grpc::Service::RequestAsyncServerStreaming(1, context, request, writer, new_call_cq, notification_cq, tag);
+ }
+ };
+ template <class BaseClass>
+ class WithAsyncMethod_GetMaxHitPoint : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithAsyncMethod_GetMaxHitPoint() {
+ ::grpc::Service::MarkMethodAsync(2);
+ }
+ ~WithAsyncMethod_GetMaxHitPoint() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status GetMaxHitPoint(::grpc::ServerContext* /*context*/, ::grpc::ServerReader< flatbuffers::grpc::Message<Monster>>* /*reader*/, flatbuffers::grpc::Message<Stat>* /*response*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestGetMaxHitPoint(::grpc::ServerContext* context, ::grpc::ServerAsyncReader< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* reader, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+ ::grpc::Service::RequestAsyncClientStreaming(2, context, reader, new_call_cq, notification_cq, tag);
+ }
+ };
+ template <class BaseClass>
+ class WithAsyncMethod_GetMinMaxHitPoints : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithAsyncMethod_GetMinMaxHitPoints() {
+ ::grpc::Service::MarkMethodAsync(3);
+ }
+ ~WithAsyncMethod_GetMinMaxHitPoints() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status GetMinMaxHitPoints(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* /*stream*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestGetMinMaxHitPoints(::grpc::ServerContext* context, ::grpc::ServerAsyncReaderWriter< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* stream, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+ ::grpc::Service::RequestAsyncBidiStreaming(3, context, stream, new_call_cq, notification_cq, tag);
+ }
+ };
+ typedef WithAsyncMethod_Store< WithAsyncMethod_Retrieve< WithAsyncMethod_GetMaxHitPoint< WithAsyncMethod_GetMinMaxHitPoints< Service > > > > AsyncService;
+ template <class BaseClass>
+ class WithGenericMethod_Store : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithGenericMethod_Store() {
+ ::grpc::Service::MarkMethodGeneric(0);
+ }
+ ~WithGenericMethod_Store() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status Store(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Monster>* /*request*/, flatbuffers::grpc::Message<Stat>* /*response*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ };
+ template <class BaseClass>
+ class WithGenericMethod_Retrieve : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithGenericMethod_Retrieve() {
+ ::grpc::Service::MarkMethodGeneric(1);
+ }
+ ~WithGenericMethod_Retrieve() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status Retrieve(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Stat>* /*request*/, ::grpc::ServerWriter< flatbuffers::grpc::Message<Monster>>* /*writer*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ };
+ template <class BaseClass>
+ class WithGenericMethod_GetMaxHitPoint : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithGenericMethod_GetMaxHitPoint() {
+ ::grpc::Service::MarkMethodGeneric(2);
+ }
+ ~WithGenericMethod_GetMaxHitPoint() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status GetMaxHitPoint(::grpc::ServerContext* /*context*/, ::grpc::ServerReader< flatbuffers::grpc::Message<Monster>>* /*reader*/, flatbuffers::grpc::Message<Stat>* /*response*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ };
+ template <class BaseClass>
+ class WithGenericMethod_GetMinMaxHitPoints : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithGenericMethod_GetMinMaxHitPoints() {
+ ::grpc::Service::MarkMethodGeneric(3);
+ }
+ ~WithGenericMethod_GetMinMaxHitPoints() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status GetMinMaxHitPoints(::grpc::ServerContext* /*context*/, ::grpc::ServerReaderWriter< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>* /*stream*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ };
+ template <class BaseClass>
+ class WithStreamedUnaryMethod_Store : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) {}
+ public:
+ WithStreamedUnaryMethod_Store() {
+ ::grpc::Service::MarkMethodStreamed(0,
+ new ::grpc::internal::StreamedUnaryHandler< flatbuffers::grpc::Message<Monster>, flatbuffers::grpc::Message<Stat>>(std::bind(&WithStreamedUnaryMethod_Store<BaseClass>::StreamedStore, this, std::placeholders::_1, std::placeholders::_2)));
+ }
+ ~WithStreamedUnaryMethod_Store() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable regular version of this method
+ ::grpc::Status Store(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Monster>* /*request*/, flatbuffers::grpc::Message<Stat>* /*response*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ // replace default version of method with streamed unary
+ virtual ::grpc::Status StreamedStore(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< flatbuffers::grpc::Message<Monster>,flatbuffers::grpc::Message<Stat>>* server_unary_streamer) = 0;
+ };
+ typedef WithStreamedUnaryMethod_Store< Service > StreamedUnaryService;
+ template <class BaseClass>
+ class WithSplitStreamingMethod_Retrieve : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service */*service*/) { }
+ public:
+ WithSplitStreamingMethod_Retrieve() {
+ ::grpc::Service::MarkMethodStreamed(1,
+ new ::grpc::internal::SplitServerStreamingHandler< flatbuffers::grpc::Message<Stat>, flatbuffers::grpc::Message<Monster>>(std::bind(&WithSplitStreamingMethod_Retrieve<BaseClass>::StreamedRetrieve, this, std::placeholders::_1, std::placeholders::_2)));
+ }
+ ~WithSplitStreamingMethod_Retrieve() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable regular version of this method
+ ::grpc::Status Retrieve(::grpc::ServerContext* /*context*/, const flatbuffers::grpc::Message<Stat>* /*request*/, ::grpc::ServerWriter< flatbuffers::grpc::Message<Monster>>* /*writer*/) final override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ // replace default version of method with split streamed
+ virtual ::grpc::Status StreamedRetrieve(::grpc::ServerContext* context, ::grpc::ServerSplitStreamer< flatbuffers::grpc::Message<Stat>,flatbuffers::grpc::Message<Monster>>* server_split_streamer) = 0;
+ };
+ typedef WithSplitStreamingMethod_Retrieve< Service > SplitStreamedService;
+ typedef WithStreamedUnaryMethod_Store< WithSplitStreamingMethod_Retrieve< Service > > StreamedService;
+};
+
+} // namespace Example
+} // namespace MyGame
+
+
+#endif // GRPC_monster_5ftest__INCLUDED
diff --git a/tests/monster_test_suffix/monster_test_suffix.hpp b/tests/monster_test_suffix/monster_test_suffix.hpp
new file mode 100644
index 0000000..deab77b
--- /dev/null
+++ b/tests/monster_test_suffix/monster_test_suffix.hpp
@@ -0,0 +1,4034 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+
+#ifndef FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_H_
+#define FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_H_
+
+#include "flatbuffers/flatbuffers.h"
+#include "flatbuffers/flexbuffers.h"
+#include "flatbuffers/flex_flat_util.h"
+
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
+
+namespace MyGame {
+
+struct InParentNamespace;
+struct InParentNamespaceBuilder;
+struct InParentNamespaceT;
+
+namespace Example2 {
+
+struct Monster;
+struct MonsterBuilder;
+struct MonsterT;
+
+} // namespace Example2
+
+namespace Example {
+
+struct Test;
+
+struct TestSimpleTableWithEnum;
+struct TestSimpleTableWithEnumBuilder;
+struct TestSimpleTableWithEnumT;
+
+struct Vec3;
+
+struct Ability;
+
+struct StructOfStructs;
+
+struct StructOfStructsOfStructs;
+
+struct Stat;
+struct StatBuilder;
+struct StatT;
+
+struct Referrable;
+struct ReferrableBuilder;
+struct ReferrableT;
+
+struct Monster;
+struct MonsterBuilder;
+struct MonsterT;
+
+struct TypeAliases;
+struct TypeAliasesBuilder;
+struct TypeAliasesT;
+
+} // namespace Example
+
+bool operator==(const InParentNamespaceT &lhs, const InParentNamespaceT &rhs);
+bool operator!=(const InParentNamespaceT &lhs, const InParentNamespaceT &rhs);
+namespace Example2 {
+
+bool operator==(const MonsterT &lhs, const MonsterT &rhs);
+bool operator!=(const MonsterT &lhs, const MonsterT &rhs);
+} // namespace Example2
+
+namespace Example {
+
+bool operator==(const Test &lhs, const Test &rhs);
+bool operator!=(const Test &lhs, const Test &rhs);
+bool operator==(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs);
+bool operator!=(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs);
+bool operator==(const Vec3 &lhs, const Vec3 &rhs);
+bool operator!=(const Vec3 &lhs, const Vec3 &rhs);
+bool operator==(const Ability &lhs, const Ability &rhs);
+bool operator!=(const Ability &lhs, const Ability &rhs);
+bool operator==(const StructOfStructs &lhs, const StructOfStructs &rhs);
+bool operator!=(const StructOfStructs &lhs, const StructOfStructs &rhs);
+bool operator==(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs);
+bool operator!=(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs);
+bool operator==(const StatT &lhs, const StatT &rhs);
+bool operator!=(const StatT &lhs, const StatT &rhs);
+bool operator==(const ReferrableT &lhs, const ReferrableT &rhs);
+bool operator!=(const ReferrableT &lhs, const ReferrableT &rhs);
+bool operator==(const MonsterT &lhs, const MonsterT &rhs);
+bool operator!=(const MonsterT &lhs, const MonsterT &rhs);
+bool operator==(const TypeAliasesT &lhs, const TypeAliasesT &rhs);
+bool operator!=(const TypeAliasesT &lhs, const TypeAliasesT &rhs);
+
+} // namespace Example
+
+inline const flatbuffers::TypeTable *InParentNamespaceTypeTable();
+
+namespace Example2 {
+
+inline const flatbuffers::TypeTable *MonsterTypeTable();
+
+} // namespace Example2
+
+namespace Example {
+
+inline const flatbuffers::TypeTable *TestTypeTable();
+
+inline const flatbuffers::TypeTable *TestSimpleTableWithEnumTypeTable();
+
+inline const flatbuffers::TypeTable *Vec3TypeTable();
+
+inline const flatbuffers::TypeTable *AbilityTypeTable();
+
+inline const flatbuffers::TypeTable *StructOfStructsTypeTable();
+
+inline const flatbuffers::TypeTable *StructOfStructsOfStructsTypeTable();
+
+inline const flatbuffers::TypeTable *StatTypeTable();
+
+inline const flatbuffers::TypeTable *ReferrableTypeTable();
+
+inline const flatbuffers::TypeTable *MonsterTypeTable();
+
+inline const flatbuffers::TypeTable *TypeAliasesTypeTable();
+
+/// Composite components of Monster color.
+enum Color : uint8_t {
+ Color_Red = 1,
+ /// \brief color Green
+ /// Green is bit_flag with value (1u << 1)
+ Color_Green = 2,
+ /// \brief color Blue (1u << 3)
+ Color_Blue = 8,
+ Color_NONE = 0,
+ Color_ANY = 11
+};
+
+inline const Color (&EnumValuesColor())[3] {
+ static const Color values[] = {
+ Color_Red,
+ Color_Green,
+ Color_Blue
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesColor() {
+ static const char * const names[9] = {
+ "Red",
+ "Green",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "Blue",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameColor(Color e) {
+ if (flatbuffers::IsOutRange(e, Color_Red, Color_Blue)) return "";
+ const size_t index = static_cast<size_t>(e) - static_cast<size_t>(Color_Red);
+ return EnumNamesColor()[index];
+}
+
+enum Race : int8_t {
+ Race_None = -1,
+ Race_Human = 0,
+ Race_Dwarf = 1,
+ Race_Elf = 2,
+ Race_MIN = Race_None,
+ Race_MAX = Race_Elf
+};
+
+inline const Race (&EnumValuesRace())[4] {
+ static const Race values[] = {
+ Race_None,
+ Race_Human,
+ Race_Dwarf,
+ Race_Elf
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesRace() {
+ static const char * const names[5] = {
+ "None",
+ "Human",
+ "Dwarf",
+ "Elf",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameRace(Race e) {
+ if (flatbuffers::IsOutRange(e, Race_None, Race_Elf)) return "";
+ const size_t index = static_cast<size_t>(e) - static_cast<size_t>(Race_None);
+ return EnumNamesRace()[index];
+}
+
+enum LongEnum : uint64_t {
+ LongEnum_LongOne = 2ULL,
+ LongEnum_LongTwo = 4ULL,
+ LongEnum_LongBig = 1099511627776ULL,
+ LongEnum_NONE = 0,
+ LongEnum_ANY = 1099511627782ULL
+};
+
+inline const LongEnum (&EnumValuesLongEnum())[3] {
+ static const LongEnum values[] = {
+ LongEnum_LongOne,
+ LongEnum_LongTwo,
+ LongEnum_LongBig
+ };
+ return values;
+}
+
+inline const char *EnumNameLongEnum(LongEnum e) {
+ switch (e) {
+ case LongEnum_LongOne: return "LongOne";
+ case LongEnum_LongTwo: return "LongTwo";
+ case LongEnum_LongBig: return "LongBig";
+ default: return "";
+ }
+}
+
+enum Any : uint8_t {
+ Any_NONE = 0,
+ Any_Monster = 1,
+ Any_TestSimpleTableWithEnum = 2,
+ Any_MyGame_Example2_Monster = 3,
+ Any_MIN = Any_NONE,
+ Any_MAX = Any_MyGame_Example2_Monster
+};
+
+inline const Any (&EnumValuesAny())[4] {
+ static const Any values[] = {
+ Any_NONE,
+ Any_Monster,
+ Any_TestSimpleTableWithEnum,
+ Any_MyGame_Example2_Monster
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesAny() {
+ static const char * const names[5] = {
+ "NONE",
+ "Monster",
+ "TestSimpleTableWithEnum",
+ "MyGame_Example2_Monster",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameAny(Any e) {
+ if (flatbuffers::IsOutRange(e, Any_NONE, Any_MyGame_Example2_Monster)) return "";
+ const size_t index = static_cast<size_t>(e);
+ return EnumNamesAny()[index];
+}
+
+template<typename T> struct AnyTraits {
+ static const Any enum_value = Any_NONE;
+};
+
+template<> struct AnyTraits<MyGame::Example::Monster> {
+ static const Any enum_value = Any_Monster;
+};
+
+template<> struct AnyTraits<MyGame::Example::TestSimpleTableWithEnum> {
+ static const Any enum_value = Any_TestSimpleTableWithEnum;
+};
+
+template<> struct AnyTraits<MyGame::Example2::Monster> {
+ static const Any enum_value = Any_MyGame_Example2_Monster;
+};
+
+template<typename T> struct AnyUnionTraits {
+ static const Any enum_value = Any_NONE;
+};
+
+template<> struct AnyUnionTraits<MyGame::Example::MonsterT> {
+ static const Any enum_value = Any_Monster;
+};
+
+template<> struct AnyUnionTraits<MyGame::Example::TestSimpleTableWithEnumT> {
+ static const Any enum_value = Any_TestSimpleTableWithEnum;
+};
+
+template<> struct AnyUnionTraits<MyGame::Example2::MonsterT> {
+ static const Any enum_value = Any_MyGame_Example2_Monster;
+};
+
+struct AnyUnion {
+ Any type;
+ void *value;
+
+ AnyUnion() : type(Any_NONE), value(nullptr) {}
+ AnyUnion(AnyUnion&& u) FLATBUFFERS_NOEXCEPT :
+ type(Any_NONE), value(nullptr)
+ { std::swap(type, u.type); std::swap(value, u.value); }
+ AnyUnion(const AnyUnion &);
+ AnyUnion &operator=(const AnyUnion &u)
+ { AnyUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
+ AnyUnion &operator=(AnyUnion &&u) FLATBUFFERS_NOEXCEPT
+ { std::swap(type, u.type); std::swap(value, u.value); return *this; }
+ ~AnyUnion() { Reset(); }
+
+ void Reset();
+
+ template <typename T>
+ void Set(T&& val) {
+ typedef typename std::remove_reference<T>::type RT;
+ Reset();
+ type = AnyUnionTraits<RT>::enum_value;
+ if (type != Any_NONE) {
+ value = new RT(std::forward<T>(val));
+ }
+ }
+
+ static void *UnPack(const void *obj, Any type, const flatbuffers::resolver_function_t *resolver);
+ flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
+
+ MyGame::Example::MonsterT *AsMonster() {
+ return type == Any_Monster ?
+ reinterpret_cast<MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example::MonsterT *AsMonster() const {
+ return type == Any_Monster ?
+ reinterpret_cast<const MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ MyGame::Example::TestSimpleTableWithEnumT *AsTestSimpleTableWithEnum() {
+ return type == Any_TestSimpleTableWithEnum ?
+ reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(value) : nullptr;
+ }
+ const MyGame::Example::TestSimpleTableWithEnumT *AsTestSimpleTableWithEnum() const {
+ return type == Any_TestSimpleTableWithEnum ?
+ reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(value) : nullptr;
+ }
+ MyGame::Example2::MonsterT *AsMyGame_Example2_Monster() {
+ return type == Any_MyGame_Example2_Monster ?
+ reinterpret_cast<MyGame::Example2::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example2::MonsterT *AsMyGame_Example2_Monster() const {
+ return type == Any_MyGame_Example2_Monster ?
+ reinterpret_cast<const MyGame::Example2::MonsterT *>(value) : nullptr;
+ }
+};
+
+
+inline bool operator==(const AnyUnion &lhs, const AnyUnion &rhs) {
+ if (lhs.type != rhs.type) return false;
+ switch (lhs.type) {
+ case Any_NONE: {
+ return true;
+ }
+ case Any_Monster: {
+ return *(reinterpret_cast<const MyGame::Example::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::MonsterT *>(rhs.value));
+ }
+ case Any_TestSimpleTableWithEnum: {
+ return *(reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(rhs.value));
+ }
+ case Any_MyGame_Example2_Monster: {
+ return *(reinterpret_cast<const MyGame::Example2::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example2::MonsterT *>(rhs.value));
+ }
+ default: {
+ return false;
+ }
+ }
+}
+
+inline bool operator!=(const AnyUnion &lhs, const AnyUnion &rhs) {
+ return !(lhs == rhs);
+}
+
+bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type);
+bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
+
+enum AnyUniqueAliases : uint8_t {
+ AnyUniqueAliases_NONE = 0,
+ AnyUniqueAliases_M = 1,
+ AnyUniqueAliases_TS = 2,
+ AnyUniqueAliases_M2 = 3,
+ AnyUniqueAliases_MIN = AnyUniqueAliases_NONE,
+ AnyUniqueAliases_MAX = AnyUniqueAliases_M2
+};
+
+inline const AnyUniqueAliases (&EnumValuesAnyUniqueAliases())[4] {
+ static const AnyUniqueAliases values[] = {
+ AnyUniqueAliases_NONE,
+ AnyUniqueAliases_M,
+ AnyUniqueAliases_TS,
+ AnyUniqueAliases_M2
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesAnyUniqueAliases() {
+ static const char * const names[5] = {
+ "NONE",
+ "M",
+ "TS",
+ "M2",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameAnyUniqueAliases(AnyUniqueAliases e) {
+ if (flatbuffers::IsOutRange(e, AnyUniqueAliases_NONE, AnyUniqueAliases_M2)) return "";
+ const size_t index = static_cast<size_t>(e);
+ return EnumNamesAnyUniqueAliases()[index];
+}
+
+template<typename T> struct AnyUniqueAliasesTraits {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_NONE;
+};
+
+template<> struct AnyUniqueAliasesTraits<MyGame::Example::Monster> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_M;
+};
+
+template<> struct AnyUniqueAliasesTraits<MyGame::Example::TestSimpleTableWithEnum> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_TS;
+};
+
+template<> struct AnyUniqueAliasesTraits<MyGame::Example2::Monster> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_M2;
+};
+
+template<typename T> struct AnyUniqueAliasesUnionTraits {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_NONE;
+};
+
+template<> struct AnyUniqueAliasesUnionTraits<MyGame::Example::MonsterT> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_M;
+};
+
+template<> struct AnyUniqueAliasesUnionTraits<MyGame::Example::TestSimpleTableWithEnumT> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_TS;
+};
+
+template<> struct AnyUniqueAliasesUnionTraits<MyGame::Example2::MonsterT> {
+ static const AnyUniqueAliases enum_value = AnyUniqueAliases_M2;
+};
+
+struct AnyUniqueAliasesUnion {
+ AnyUniqueAliases type;
+ void *value;
+
+ AnyUniqueAliasesUnion() : type(AnyUniqueAliases_NONE), value(nullptr) {}
+ AnyUniqueAliasesUnion(AnyUniqueAliasesUnion&& u) FLATBUFFERS_NOEXCEPT :
+ type(AnyUniqueAliases_NONE), value(nullptr)
+ { std::swap(type, u.type); std::swap(value, u.value); }
+ AnyUniqueAliasesUnion(const AnyUniqueAliasesUnion &);
+ AnyUniqueAliasesUnion &operator=(const AnyUniqueAliasesUnion &u)
+ { AnyUniqueAliasesUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
+ AnyUniqueAliasesUnion &operator=(AnyUniqueAliasesUnion &&u) FLATBUFFERS_NOEXCEPT
+ { std::swap(type, u.type); std::swap(value, u.value); return *this; }
+ ~AnyUniqueAliasesUnion() { Reset(); }
+
+ void Reset();
+
+ template <typename T>
+ void Set(T&& val) {
+ typedef typename std::remove_reference<T>::type RT;
+ Reset();
+ type = AnyUniqueAliasesUnionTraits<RT>::enum_value;
+ if (type != AnyUniqueAliases_NONE) {
+ value = new RT(std::forward<T>(val));
+ }
+ }
+
+ static void *UnPack(const void *obj, AnyUniqueAliases type, const flatbuffers::resolver_function_t *resolver);
+ flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
+
+ MyGame::Example::MonsterT *AsM() {
+ return type == AnyUniqueAliases_M ?
+ reinterpret_cast<MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example::MonsterT *AsM() const {
+ return type == AnyUniqueAliases_M ?
+ reinterpret_cast<const MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ MyGame::Example::TestSimpleTableWithEnumT *AsTS() {
+ return type == AnyUniqueAliases_TS ?
+ reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(value) : nullptr;
+ }
+ const MyGame::Example::TestSimpleTableWithEnumT *AsTS() const {
+ return type == AnyUniqueAliases_TS ?
+ reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(value) : nullptr;
+ }
+ MyGame::Example2::MonsterT *AsM2() {
+ return type == AnyUniqueAliases_M2 ?
+ reinterpret_cast<MyGame::Example2::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example2::MonsterT *AsM2() const {
+ return type == AnyUniqueAliases_M2 ?
+ reinterpret_cast<const MyGame::Example2::MonsterT *>(value) : nullptr;
+ }
+};
+
+
+inline bool operator==(const AnyUniqueAliasesUnion &lhs, const AnyUniqueAliasesUnion &rhs) {
+ if (lhs.type != rhs.type) return false;
+ switch (lhs.type) {
+ case AnyUniqueAliases_NONE: {
+ return true;
+ }
+ case AnyUniqueAliases_M: {
+ return *(reinterpret_cast<const MyGame::Example::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::MonsterT *>(rhs.value));
+ }
+ case AnyUniqueAliases_TS: {
+ return *(reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(rhs.value));
+ }
+ case AnyUniqueAliases_M2: {
+ return *(reinterpret_cast<const MyGame::Example2::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example2::MonsterT *>(rhs.value));
+ }
+ default: {
+ return false;
+ }
+ }
+}
+
+inline bool operator!=(const AnyUniqueAliasesUnion &lhs, const AnyUniqueAliasesUnion &rhs) {
+ return !(lhs == rhs);
+}
+
+bool VerifyAnyUniqueAliases(flatbuffers::Verifier &verifier, const void *obj, AnyUniqueAliases type);
+bool VerifyAnyUniqueAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
+
+enum AnyAmbiguousAliases : uint8_t {
+ AnyAmbiguousAliases_NONE = 0,
+ AnyAmbiguousAliases_M1 = 1,
+ AnyAmbiguousAliases_M2 = 2,
+ AnyAmbiguousAliases_M3 = 3,
+ AnyAmbiguousAliases_MIN = AnyAmbiguousAliases_NONE,
+ AnyAmbiguousAliases_MAX = AnyAmbiguousAliases_M3
+};
+
+inline const AnyAmbiguousAliases (&EnumValuesAnyAmbiguousAliases())[4] {
+ static const AnyAmbiguousAliases values[] = {
+ AnyAmbiguousAliases_NONE,
+ AnyAmbiguousAliases_M1,
+ AnyAmbiguousAliases_M2,
+ AnyAmbiguousAliases_M3
+ };
+ return values;
+}
+
+inline const char * const *EnumNamesAnyAmbiguousAliases() {
+ static const char * const names[5] = {
+ "NONE",
+ "M1",
+ "M2",
+ "M3",
+ nullptr
+ };
+ return names;
+}
+
+inline const char *EnumNameAnyAmbiguousAliases(AnyAmbiguousAliases e) {
+ if (flatbuffers::IsOutRange(e, AnyAmbiguousAliases_NONE, AnyAmbiguousAliases_M3)) return "";
+ const size_t index = static_cast<size_t>(e);
+ return EnumNamesAnyAmbiguousAliases()[index];
+}
+
+struct AnyAmbiguousAliasesUnion {
+ AnyAmbiguousAliases type;
+ void *value;
+
+ AnyAmbiguousAliasesUnion() : type(AnyAmbiguousAliases_NONE), value(nullptr) {}
+ AnyAmbiguousAliasesUnion(AnyAmbiguousAliasesUnion&& u) FLATBUFFERS_NOEXCEPT :
+ type(AnyAmbiguousAliases_NONE), value(nullptr)
+ { std::swap(type, u.type); std::swap(value, u.value); }
+ AnyAmbiguousAliasesUnion(const AnyAmbiguousAliasesUnion &);
+ AnyAmbiguousAliasesUnion &operator=(const AnyAmbiguousAliasesUnion &u)
+ { AnyAmbiguousAliasesUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; }
+ AnyAmbiguousAliasesUnion &operator=(AnyAmbiguousAliasesUnion &&u) FLATBUFFERS_NOEXCEPT
+ { std::swap(type, u.type); std::swap(value, u.value); return *this; }
+ ~AnyAmbiguousAliasesUnion() { Reset(); }
+
+ void Reset();
+
+ static void *UnPack(const void *obj, AnyAmbiguousAliases type, const flatbuffers::resolver_function_t *resolver);
+ flatbuffers::Offset<void> Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const;
+
+ MyGame::Example::MonsterT *AsM1() {
+ return type == AnyAmbiguousAliases_M1 ?
+ reinterpret_cast<MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example::MonsterT *AsM1() const {
+ return type == AnyAmbiguousAliases_M1 ?
+ reinterpret_cast<const MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ MyGame::Example::MonsterT *AsM2() {
+ return type == AnyAmbiguousAliases_M2 ?
+ reinterpret_cast<MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example::MonsterT *AsM2() const {
+ return type == AnyAmbiguousAliases_M2 ?
+ reinterpret_cast<const MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ MyGame::Example::MonsterT *AsM3() {
+ return type == AnyAmbiguousAliases_M3 ?
+ reinterpret_cast<MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+ const MyGame::Example::MonsterT *AsM3() const {
+ return type == AnyAmbiguousAliases_M3 ?
+ reinterpret_cast<const MyGame::Example::MonsterT *>(value) : nullptr;
+ }
+};
+
+
+inline bool operator==(const AnyAmbiguousAliasesUnion &lhs, const AnyAmbiguousAliasesUnion &rhs) {
+ if (lhs.type != rhs.type) return false;
+ switch (lhs.type) {
+ case AnyAmbiguousAliases_NONE: {
+ return true;
+ }
+ case AnyAmbiguousAliases_M1: {
+ return *(reinterpret_cast<const MyGame::Example::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::MonsterT *>(rhs.value));
+ }
+ case AnyAmbiguousAliases_M2: {
+ return *(reinterpret_cast<const MyGame::Example::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::MonsterT *>(rhs.value));
+ }
+ case AnyAmbiguousAliases_M3: {
+ return *(reinterpret_cast<const MyGame::Example::MonsterT *>(lhs.value)) ==
+ *(reinterpret_cast<const MyGame::Example::MonsterT *>(rhs.value));
+ }
+ default: {
+ return false;
+ }
+ }
+}
+
+inline bool operator!=(const AnyAmbiguousAliasesUnion &lhs, const AnyAmbiguousAliasesUnion &rhs) {
+ return !(lhs == rhs);
+}
+
+bool VerifyAnyAmbiguousAliases(flatbuffers::Verifier &verifier, const void *obj, AnyAmbiguousAliases type);
+bool VerifyAnyAmbiguousAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types);
+
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(2) Test FLATBUFFERS_FINAL_CLASS {
+ private:
+ int16_t a_;
+ int8_t b_;
+ int8_t padding0__;
+
+ public:
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return TestTypeTable();
+ }
+ Test()
+ : a_(0),
+ b_(0),
+ padding0__(0) {
+ (void)padding0__;
+ }
+ Test(int16_t _a, int8_t _b)
+ : a_(flatbuffers::EndianScalar(_a)),
+ b_(flatbuffers::EndianScalar(_b)),
+ padding0__(0) {
+ (void)padding0__;
+ }
+ int16_t a() const {
+ return flatbuffers::EndianScalar(a_);
+ }
+ void mutate_a(int16_t _a) {
+ flatbuffers::WriteScalar(&a_, _a);
+ }
+ int8_t b() const {
+ return flatbuffers::EndianScalar(b_);
+ }
+ void mutate_b(int8_t _b) {
+ flatbuffers::WriteScalar(&b_, _b);
+ }
+};
+FLATBUFFERS_STRUCT_END(Test, 4);
+
+inline bool operator==(const Test &lhs, const Test &rhs) {
+ return
+ (lhs.a() == rhs.a()) &&
+ (lhs.b() == rhs.b());
+}
+
+inline bool operator!=(const Test &lhs, const Test &rhs) {
+ return !(lhs == rhs);
+}
+
+
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Vec3 FLATBUFFERS_FINAL_CLASS {
+ private:
+ float x_;
+ float y_;
+ float z_;
+ int32_t padding0__;
+ double test1_;
+ uint8_t test2_;
+ int8_t padding1__;
+ MyGame::Example::Test test3_;
+ int16_t padding2__;
+
+ public:
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return Vec3TypeTable();
+ }
+ Vec3()
+ : x_(0),
+ y_(0),
+ z_(0),
+ padding0__(0),
+ test1_(0),
+ test2_(0),
+ padding1__(0),
+ test3_(),
+ padding2__(0) {
+ (void)padding0__;
+ (void)padding1__;
+ (void)padding2__;
+ }
+ Vec3(float _x, float _y, float _z, double _test1, MyGame::Example::Color _test2, const MyGame::Example::Test &_test3)
+ : x_(flatbuffers::EndianScalar(_x)),
+ y_(flatbuffers::EndianScalar(_y)),
+ z_(flatbuffers::EndianScalar(_z)),
+ padding0__(0),
+ test1_(flatbuffers::EndianScalar(_test1)),
+ test2_(flatbuffers::EndianScalar(static_cast<uint8_t>(_test2))),
+ padding1__(0),
+ test3_(_test3),
+ padding2__(0) {
+ (void)padding0__;
+ (void)padding1__;
+ (void)padding2__;
+ }
+ float x() const {
+ return flatbuffers::EndianScalar(x_);
+ }
+ void mutate_x(float _x) {
+ flatbuffers::WriteScalar(&x_, _x);
+ }
+ float y() const {
+ return flatbuffers::EndianScalar(y_);
+ }
+ void mutate_y(float _y) {
+ flatbuffers::WriteScalar(&y_, _y);
+ }
+ float z() const {
+ return flatbuffers::EndianScalar(z_);
+ }
+ void mutate_z(float _z) {
+ flatbuffers::WriteScalar(&z_, _z);
+ }
+ double test1() const {
+ return flatbuffers::EndianScalar(test1_);
+ }
+ void mutate_test1(double _test1) {
+ flatbuffers::WriteScalar(&test1_, _test1);
+ }
+ MyGame::Example::Color test2() const {
+ return static_cast<MyGame::Example::Color>(flatbuffers::EndianScalar(test2_));
+ }
+ void mutate_test2(MyGame::Example::Color _test2) {
+ flatbuffers::WriteScalar(&test2_, static_cast<uint8_t>(_test2));
+ }
+ const MyGame::Example::Test &test3() const {
+ return test3_;
+ }
+ MyGame::Example::Test &mutable_test3() {
+ return test3_;
+ }
+};
+FLATBUFFERS_STRUCT_END(Vec3, 32);
+
+inline bool operator==(const Vec3 &lhs, const Vec3 &rhs) {
+ return
+ (lhs.x() == rhs.x()) &&
+ (lhs.y() == rhs.y()) &&
+ (lhs.z() == rhs.z()) &&
+ (lhs.test1() == rhs.test1()) &&
+ (lhs.test2() == rhs.test2()) &&
+ (lhs.test3() == rhs.test3());
+}
+
+inline bool operator!=(const Vec3 &lhs, const Vec3 &rhs) {
+ return !(lhs == rhs);
+}
+
+
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Ability FLATBUFFERS_FINAL_CLASS {
+ private:
+ uint32_t id_;
+ uint32_t distance_;
+
+ public:
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return AbilityTypeTable();
+ }
+ Ability()
+ : id_(0),
+ distance_(0) {
+ }
+ Ability(uint32_t _id, uint32_t _distance)
+ : id_(flatbuffers::EndianScalar(_id)),
+ distance_(flatbuffers::EndianScalar(_distance)) {
+ }
+ uint32_t id() const {
+ return flatbuffers::EndianScalar(id_);
+ }
+ void mutate_id(uint32_t _id) {
+ flatbuffers::WriteScalar(&id_, _id);
+ }
+ bool KeyCompareLessThan(const Ability *o) const {
+ return id() < o->id();
+ }
+ int KeyCompareWithValue(uint32_t _id) const {
+ return static_cast<int>(id() > _id) - static_cast<int>(id() < _id);
+ }
+ uint32_t distance() const {
+ return flatbuffers::EndianScalar(distance_);
+ }
+ void mutate_distance(uint32_t _distance) {
+ flatbuffers::WriteScalar(&distance_, _distance);
+ }
+};
+FLATBUFFERS_STRUCT_END(Ability, 8);
+
+inline bool operator==(const Ability &lhs, const Ability &rhs) {
+ return
+ (lhs.id() == rhs.id()) &&
+ (lhs.distance() == rhs.distance());
+}
+
+inline bool operator!=(const Ability &lhs, const Ability &rhs) {
+ return !(lhs == rhs);
+}
+
+
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructOfStructs FLATBUFFERS_FINAL_CLASS {
+ private:
+ MyGame::Example::Ability a_;
+ MyGame::Example::Test b_;
+ MyGame::Example::Ability c_;
+
+ public:
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return StructOfStructsTypeTable();
+ }
+ StructOfStructs()
+ : a_(),
+ b_(),
+ c_() {
+ }
+ StructOfStructs(const MyGame::Example::Ability &_a, const MyGame::Example::Test &_b, const MyGame::Example::Ability &_c)
+ : a_(_a),
+ b_(_b),
+ c_(_c) {
+ }
+ const MyGame::Example::Ability &a() const {
+ return a_;
+ }
+ MyGame::Example::Ability &mutable_a() {
+ return a_;
+ }
+ const MyGame::Example::Test &b() const {
+ return b_;
+ }
+ MyGame::Example::Test &mutable_b() {
+ return b_;
+ }
+ const MyGame::Example::Ability &c() const {
+ return c_;
+ }
+ MyGame::Example::Ability &mutable_c() {
+ return c_;
+ }
+};
+FLATBUFFERS_STRUCT_END(StructOfStructs, 20);
+
+inline bool operator==(const StructOfStructs &lhs, const StructOfStructs &rhs) {
+ return
+ (lhs.a() == rhs.a()) &&
+ (lhs.b() == rhs.b()) &&
+ (lhs.c() == rhs.c());
+}
+
+inline bool operator!=(const StructOfStructs &lhs, const StructOfStructs &rhs) {
+ return !(lhs == rhs);
+}
+
+
+FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructOfStructsOfStructs FLATBUFFERS_FINAL_CLASS {
+ private:
+ MyGame::Example::StructOfStructs a_;
+
+ public:
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return StructOfStructsOfStructsTypeTable();
+ }
+ StructOfStructsOfStructs()
+ : a_() {
+ }
+ StructOfStructsOfStructs(const MyGame::Example::StructOfStructs &_a)
+ : a_(_a) {
+ }
+ const MyGame::Example::StructOfStructs &a() const {
+ return a_;
+ }
+ MyGame::Example::StructOfStructs &mutable_a() {
+ return a_;
+ }
+};
+FLATBUFFERS_STRUCT_END(StructOfStructsOfStructs, 20);
+
+inline bool operator==(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs) {
+ return
+ (lhs.a() == rhs.a());
+}
+
+inline bool operator!=(const StructOfStructsOfStructs &lhs, const StructOfStructsOfStructs &rhs) {
+ return !(lhs == rhs);
+}
+
+
+} // namespace Example
+
+struct InParentNamespaceT : public flatbuffers::NativeTable {
+ typedef InParentNamespace TableType;
+};
+
+struct InParentNamespace FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef InParentNamespaceT NativeTableType;
+ typedef InParentNamespaceBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return InParentNamespaceTypeTable();
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ verifier.EndTable();
+ }
+ InParentNamespaceT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(InParentNamespaceT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<InParentNamespace> Pack(flatbuffers::FlatBufferBuilder &_fbb, const InParentNamespaceT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct InParentNamespaceBuilder {
+ typedef InParentNamespace Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ explicit InParentNamespaceBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<InParentNamespace> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<InParentNamespace>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<InParentNamespace> CreateInParentNamespace(
+ flatbuffers::FlatBufferBuilder &_fbb) {
+ InParentNamespaceBuilder builder_(_fbb);
+ return builder_.Finish();
+}
+
+flatbuffers::Offset<InParentNamespace> CreateInParentNamespace(flatbuffers::FlatBufferBuilder &_fbb, const InParentNamespaceT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+namespace Example2 {
+
+struct MonsterT : public flatbuffers::NativeTable {
+ typedef Monster TableType;
+};
+
+struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef MonsterT NativeTableType;
+ typedef MonsterBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return MonsterTypeTable();
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ verifier.EndTable();
+ }
+ MonsterT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<Monster> Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct MonsterBuilder {
+ typedef Monster Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ explicit MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<Monster> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<Monster>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<Monster> CreateMonster(
+ flatbuffers::FlatBufferBuilder &_fbb) {
+ MonsterBuilder builder_(_fbb);
+ return builder_.Finish();
+}
+
+flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+} // namespace Example2
+
+namespace Example {
+
+struct TestSimpleTableWithEnumT : public flatbuffers::NativeTable {
+ typedef TestSimpleTableWithEnum TableType;
+ MyGame::Example::Color color = MyGame::Example::Color_Green;
+};
+
+struct TestSimpleTableWithEnum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef TestSimpleTableWithEnumT NativeTableType;
+ typedef TestSimpleTableWithEnumBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return TestSimpleTableWithEnumTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_COLOR = 4
+ };
+ MyGame::Example::Color color() const {
+ return static_cast<MyGame::Example::Color>(GetField<uint8_t>(VT_COLOR, 2));
+ }
+ bool mutate_color(MyGame::Example::Color _color = static_cast<MyGame::Example::Color>(2)) {
+ return SetField<uint8_t>(VT_COLOR, static_cast<uint8_t>(_color), 2);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyField<uint8_t>(verifier, VT_COLOR, 1) &&
+ verifier.EndTable();
+ }
+ TestSimpleTableWithEnumT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(TestSimpleTableWithEnumT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<TestSimpleTableWithEnum> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct TestSimpleTableWithEnumBuilder {
+ typedef TestSimpleTableWithEnum Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_color(MyGame::Example::Color color) {
+ fbb_.AddElement<uint8_t>(TestSimpleTableWithEnum::VT_COLOR, static_cast<uint8_t>(color), 2);
+ }
+ explicit TestSimpleTableWithEnumBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<TestSimpleTableWithEnum> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<TestSimpleTableWithEnum>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ MyGame::Example::Color color = MyGame::Example::Color_Green) {
+ TestSimpleTableWithEnumBuilder builder_(_fbb);
+ builder_.add_color(color);
+ return builder_.Finish();
+}
+
+flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+struct StatT : public flatbuffers::NativeTable {
+ typedef Stat TableType;
+ std::string id{};
+ int64_t val = 0;
+ uint16_t count = 0;
+};
+
+struct Stat FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef StatT NativeTableType;
+ typedef StatBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return StatTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_ID = 4,
+ VT_VAL = 6,
+ VT_COUNT = 8
+ };
+ const flatbuffers::String *id() const {
+ return GetPointer<const flatbuffers::String *>(VT_ID);
+ }
+ flatbuffers::String *mutable_id() {
+ return GetPointer<flatbuffers::String *>(VT_ID);
+ }
+ int64_t val() const {
+ return GetField<int64_t>(VT_VAL, 0);
+ }
+ bool mutate_val(int64_t _val = 0) {
+ return SetField<int64_t>(VT_VAL, _val, 0);
+ }
+ uint16_t count() const {
+ return GetField<uint16_t>(VT_COUNT, 0);
+ }
+ bool mutate_count(uint16_t _count = 0) {
+ return SetField<uint16_t>(VT_COUNT, _count, 0);
+ }
+ bool KeyCompareLessThan(const Stat *o) const {
+ return count() < o->count();
+ }
+ int KeyCompareWithValue(uint16_t _count) const {
+ return static_cast<int>(count() > _count) - static_cast<int>(count() < _count);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyOffset(verifier, VT_ID) &&
+ verifier.VerifyString(id()) &&
+ VerifyField<int64_t>(verifier, VT_VAL, 8) &&
+ VerifyField<uint16_t>(verifier, VT_COUNT, 2) &&
+ verifier.EndTable();
+ }
+ StatT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(StatT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<Stat> Pack(flatbuffers::FlatBufferBuilder &_fbb, const StatT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct StatBuilder {
+ typedef Stat Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_id(flatbuffers::Offset<flatbuffers::String> id) {
+ fbb_.AddOffset(Stat::VT_ID, id);
+ }
+ void add_val(int64_t val) {
+ fbb_.AddElement<int64_t>(Stat::VT_VAL, val, 0);
+ }
+ void add_count(uint16_t count) {
+ fbb_.AddElement<uint16_t>(Stat::VT_COUNT, count, 0);
+ }
+ explicit StatBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<Stat> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<Stat>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<Stat> CreateStat(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ flatbuffers::Offset<flatbuffers::String> id = 0,
+ int64_t val = 0,
+ uint16_t count = 0) {
+ StatBuilder builder_(_fbb);
+ builder_.add_val(val);
+ builder_.add_id(id);
+ builder_.add_count(count);
+ return builder_.Finish();
+}
+
+inline flatbuffers::Offset<Stat> CreateStatDirect(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ const char *id = nullptr,
+ int64_t val = 0,
+ uint16_t count = 0) {
+ auto id__ = id ? _fbb.CreateString(id) : 0;
+ return MyGame::Example::CreateStat(
+ _fbb,
+ id__,
+ val,
+ count);
+}
+
+flatbuffers::Offset<Stat> CreateStat(flatbuffers::FlatBufferBuilder &_fbb, const StatT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+struct ReferrableT : public flatbuffers::NativeTable {
+ typedef Referrable TableType;
+ uint64_t id = 0;
+};
+
+struct Referrable FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef ReferrableT NativeTableType;
+ typedef ReferrableBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return ReferrableTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_ID = 4
+ };
+ uint64_t id() const {
+ return GetField<uint64_t>(VT_ID, 0);
+ }
+ bool mutate_id(uint64_t _id = 0) {
+ return SetField<uint64_t>(VT_ID, _id, 0);
+ }
+ bool KeyCompareLessThan(const Referrable *o) const {
+ return id() < o->id();
+ }
+ int KeyCompareWithValue(uint64_t _id) const {
+ return static_cast<int>(id() > _id) - static_cast<int>(id() < _id);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyField<uint64_t>(verifier, VT_ID, 8) &&
+ verifier.EndTable();
+ }
+ ReferrableT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(ReferrableT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<Referrable> Pack(flatbuffers::FlatBufferBuilder &_fbb, const ReferrableT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct ReferrableBuilder {
+ typedef Referrable Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_id(uint64_t id) {
+ fbb_.AddElement<uint64_t>(Referrable::VT_ID, id, 0);
+ }
+ explicit ReferrableBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<Referrable> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<Referrable>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<Referrable> CreateReferrable(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ uint64_t id = 0) {
+ ReferrableBuilder builder_(_fbb);
+ builder_.add_id(id);
+ return builder_.Finish();
+}
+
+flatbuffers::Offset<Referrable> CreateReferrable(flatbuffers::FlatBufferBuilder &_fbb, const ReferrableT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+struct MonsterT : public flatbuffers::NativeTable {
+ typedef Monster TableType;
+ flatbuffers::unique_ptr<MyGame::Example::Vec3> pos{};
+ int16_t mana = 150;
+ int16_t hp = 100;
+ std::string name{};
+ std::vector<uint8_t> inventory{};
+ MyGame::Example::Color color = MyGame::Example::Color_Blue;
+ MyGame::Example::AnyUnion test{};
+ std::vector<MyGame::Example::Test> test4{};
+ std::vector<std::string> testarrayofstring{};
+ std::vector<flatbuffers::unique_ptr<MyGame::Example::MonsterT>> testarrayoftables{};
+ flatbuffers::unique_ptr<MyGame::Example::MonsterT> enemy{};
+ std::vector<uint8_t> testnestedflatbuffer{};
+ flatbuffers::unique_ptr<MyGame::Example::StatT> testempty{};
+ bool testbool = false;
+ int32_t testhashs32_fnv1 = 0;
+ uint32_t testhashu32_fnv1 = 0;
+ int64_t testhashs64_fnv1 = 0;
+ uint64_t testhashu64_fnv1 = 0;
+ int32_t testhashs32_fnv1a = 0;
+ Stat *testhashu32_fnv1a = nullptr;
+ int64_t testhashs64_fnv1a = 0;
+ uint64_t testhashu64_fnv1a = 0;
+ std::vector<bool> testarrayofbools{};
+ float testf = 3.14159f;
+ float testf2 = 3.0f;
+ float testf3 = 0.0f;
+ std::vector<std::string> testarrayofstring2{};
+ std::vector<MyGame::Example::Ability> testarrayofsortedstruct{};
+ std::vector<uint8_t> flex{};
+ std::vector<MyGame::Example::Test> test5{};
+ std::vector<int64_t> vector_of_longs{};
+ std::vector<double> vector_of_doubles{};
+ flatbuffers::unique_ptr<MyGame::InParentNamespaceT> parent_namespace_test{};
+ std::vector<flatbuffers::unique_ptr<MyGame::Example::ReferrableT>> vector_of_referrables{};
+ ReferrableT *single_weak_reference = nullptr;
+ std::vector<ReferrableT *> vector_of_weak_references{};
+ std::vector<flatbuffers::unique_ptr<MyGame::Example::ReferrableT>> vector_of_strong_referrables{};
+ ReferrableT *co_owning_reference = nullptr;
+ std::vector<flatbuffers::unique_ptr<ReferrableT>> vector_of_co_owning_references{};
+ ReferrableT *non_owning_reference = nullptr;
+ std::vector<ReferrableT *> vector_of_non_owning_references{};
+ MyGame::Example::AnyUniqueAliasesUnion any_unique{};
+ MyGame::Example::AnyAmbiguousAliasesUnion any_ambiguous{};
+ std::vector<MyGame::Example::Color> vector_of_enums{};
+ MyGame::Example::Race signed_enum = MyGame::Example::Race_None;
+ std::vector<uint8_t> testrequirednestedflatbuffer{};
+ std::vector<flatbuffers::unique_ptr<MyGame::Example::StatT>> scalar_key_sorted_tables{};
+ MyGame::Example::Test native_inline{};
+ MyGame::Example::LongEnum long_enum_non_enum_default = static_cast<MyGame::Example::LongEnum>(0);
+ MyGame::Example::LongEnum long_enum_normal_default = MyGame::Example::LongEnum_LongOne;
+ MonsterT() = default;
+ MonsterT(const MonsterT &o);
+ MonsterT(MonsterT&&) FLATBUFFERS_NOEXCEPT = default;
+ MonsterT &operator=(MonsterT o) FLATBUFFERS_NOEXCEPT;
+};
+
+/// an example documentation comment: "monster object"
+struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef MonsterT NativeTableType;
+ typedef MonsterBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return MonsterTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_POS = 4,
+ VT_MANA = 6,
+ VT_HP = 8,
+ VT_NAME = 10,
+ VT_INVENTORY = 14,
+ VT_COLOR = 16,
+ VT_TEST_TYPE = 18,
+ VT_TEST = 20,
+ VT_TEST4 = 22,
+ VT_TESTARRAYOFSTRING = 24,
+ VT_TESTARRAYOFTABLES = 26,
+ VT_ENEMY = 28,
+ VT_TESTNESTEDFLATBUFFER = 30,
+ VT_TESTEMPTY = 32,
+ VT_TESTBOOL = 34,
+ VT_TESTHASHS32_FNV1 = 36,
+ VT_TESTHASHU32_FNV1 = 38,
+ VT_TESTHASHS64_FNV1 = 40,
+ VT_TESTHASHU64_FNV1 = 42,
+ VT_TESTHASHS32_FNV1A = 44,
+ VT_TESTHASHU32_FNV1A = 46,
+ VT_TESTHASHS64_FNV1A = 48,
+ VT_TESTHASHU64_FNV1A = 50,
+ VT_TESTARRAYOFBOOLS = 52,
+ VT_TESTF = 54,
+ VT_TESTF2 = 56,
+ VT_TESTF3 = 58,
+ VT_TESTARRAYOFSTRING2 = 60,
+ VT_TESTARRAYOFSORTEDSTRUCT = 62,
+ VT_FLEX = 64,
+ VT_TEST5 = 66,
+ VT_VECTOR_OF_LONGS = 68,
+ VT_VECTOR_OF_DOUBLES = 70,
+ VT_PARENT_NAMESPACE_TEST = 72,
+ VT_VECTOR_OF_REFERRABLES = 74,
+ VT_SINGLE_WEAK_REFERENCE = 76,
+ VT_VECTOR_OF_WEAK_REFERENCES = 78,
+ VT_VECTOR_OF_STRONG_REFERRABLES = 80,
+ VT_CO_OWNING_REFERENCE = 82,
+ VT_VECTOR_OF_CO_OWNING_REFERENCES = 84,
+ VT_NON_OWNING_REFERENCE = 86,
+ VT_VECTOR_OF_NON_OWNING_REFERENCES = 88,
+ VT_ANY_UNIQUE_TYPE = 90,
+ VT_ANY_UNIQUE = 92,
+ VT_ANY_AMBIGUOUS_TYPE = 94,
+ VT_ANY_AMBIGUOUS = 96,
+ VT_VECTOR_OF_ENUMS = 98,
+ VT_SIGNED_ENUM = 100,
+ VT_TESTREQUIREDNESTEDFLATBUFFER = 102,
+ VT_SCALAR_KEY_SORTED_TABLES = 104,
+ VT_NATIVE_INLINE = 106,
+ VT_LONG_ENUM_NON_ENUM_DEFAULT = 108,
+ VT_LONG_ENUM_NORMAL_DEFAULT = 110
+ };
+ const MyGame::Example::Vec3 *pos() const {
+ return GetStruct<const MyGame::Example::Vec3 *>(VT_POS);
+ }
+ MyGame::Example::Vec3 *mutable_pos() {
+ return GetStruct<MyGame::Example::Vec3 *>(VT_POS);
+ }
+ int16_t mana() const {
+ return GetField<int16_t>(VT_MANA, 150);
+ }
+ bool mutate_mana(int16_t _mana = 150) {
+ return SetField<int16_t>(VT_MANA, _mana, 150);
+ }
+ int16_t hp() const {
+ return GetField<int16_t>(VT_HP, 100);
+ }
+ bool mutate_hp(int16_t _hp = 100) {
+ return SetField<int16_t>(VT_HP, _hp, 100);
+ }
+ const flatbuffers::String *name() const {
+ return GetPointer<const flatbuffers::String *>(VT_NAME);
+ }
+ flatbuffers::String *mutable_name() {
+ return GetPointer<flatbuffers::String *>(VT_NAME);
+ }
+ bool KeyCompareLessThan(const Monster *o) const {
+ return *name() < *o->name();
+ }
+ int KeyCompareWithValue(const char *_name) const {
+ return strcmp(name()->c_str(), _name);
+ }
+ const flatbuffers::Vector<uint8_t> *inventory() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_INVENTORY);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_inventory() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_INVENTORY);
+ }
+ MyGame::Example::Color color() const {
+ return static_cast<MyGame::Example::Color>(GetField<uint8_t>(VT_COLOR, 8));
+ }
+ bool mutate_color(MyGame::Example::Color _color = static_cast<MyGame::Example::Color>(8)) {
+ return SetField<uint8_t>(VT_COLOR, static_cast<uint8_t>(_color), 8);
+ }
+ MyGame::Example::Any test_type() const {
+ return static_cast<MyGame::Example::Any>(GetField<uint8_t>(VT_TEST_TYPE, 0));
+ }
+ const void *test() const {
+ return GetPointer<const void *>(VT_TEST);
+ }
+ template<typename T> const T *test_as() const;
+ const MyGame::Example::Monster *test_as_Monster() const {
+ return test_type() == MyGame::Example::Any_Monster ? static_cast<const MyGame::Example::Monster *>(test()) : nullptr;
+ }
+ const MyGame::Example::TestSimpleTableWithEnum *test_as_TestSimpleTableWithEnum() const {
+ return test_type() == MyGame::Example::Any_TestSimpleTableWithEnum ? static_cast<const MyGame::Example::TestSimpleTableWithEnum *>(test()) : nullptr;
+ }
+ const MyGame::Example2::Monster *test_as_MyGame_Example2_Monster() const {
+ return test_type() == MyGame::Example::Any_MyGame_Example2_Monster ? static_cast<const MyGame::Example2::Monster *>(test()) : nullptr;
+ }
+ void *mutable_test() {
+ return GetPointer<void *>(VT_TEST);
+ }
+ const flatbuffers::Vector<const MyGame::Example::Test *> *test4() const {
+ return GetPointer<const flatbuffers::Vector<const MyGame::Example::Test *> *>(VT_TEST4);
+ }
+ flatbuffers::Vector<const MyGame::Example::Test *> *mutable_test4() {
+ return GetPointer<flatbuffers::Vector<const MyGame::Example::Test *> *>(VT_TEST4);
+ }
+ const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *mutable_testarrayofstring() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING);
+ }
+ /// an example documentation comment: this will end up in the generated code
+ /// multiline too
+ const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>> *testarrayoftables() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>> *>(VT_TESTARRAYOFTABLES);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>> *mutable_testarrayoftables() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>> *>(VT_TESTARRAYOFTABLES);
+ }
+ const MyGame::Example::Monster *enemy() const {
+ return GetPointer<const MyGame::Example::Monster *>(VT_ENEMY);
+ }
+ MyGame::Example::Monster *mutable_enemy() {
+ return GetPointer<MyGame::Example::Monster *>(VT_ENEMY);
+ }
+ const flatbuffers::Vector<uint8_t> *testnestedflatbuffer() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_TESTNESTEDFLATBUFFER);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_testnestedflatbuffer() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_TESTNESTEDFLATBUFFER);
+ }
+ const MyGame::Example::Monster *testnestedflatbuffer_nested_root() const {
+ return flatbuffers::GetRoot<MyGame::Example::Monster>(testnestedflatbuffer()->Data());
+ }
+ const MyGame::Example::Stat *testempty() const {
+ return GetPointer<const MyGame::Example::Stat *>(VT_TESTEMPTY);
+ }
+ MyGame::Example::Stat *mutable_testempty() {
+ return GetPointer<MyGame::Example::Stat *>(VT_TESTEMPTY);
+ }
+ bool testbool() const {
+ return GetField<uint8_t>(VT_TESTBOOL, 0) != 0;
+ }
+ bool mutate_testbool(bool _testbool = 0) {
+ return SetField<uint8_t>(VT_TESTBOOL, static_cast<uint8_t>(_testbool), 0);
+ }
+ int32_t testhashs32_fnv1() const {
+ return GetField<int32_t>(VT_TESTHASHS32_FNV1, 0);
+ }
+ bool mutate_testhashs32_fnv1(int32_t _testhashs32_fnv1 = 0) {
+ return SetField<int32_t>(VT_TESTHASHS32_FNV1, _testhashs32_fnv1, 0);
+ }
+ uint32_t testhashu32_fnv1() const {
+ return GetField<uint32_t>(VT_TESTHASHU32_FNV1, 0);
+ }
+ bool mutate_testhashu32_fnv1(uint32_t _testhashu32_fnv1 = 0) {
+ return SetField<uint32_t>(VT_TESTHASHU32_FNV1, _testhashu32_fnv1, 0);
+ }
+ int64_t testhashs64_fnv1() const {
+ return GetField<int64_t>(VT_TESTHASHS64_FNV1, 0);
+ }
+ bool mutate_testhashs64_fnv1(int64_t _testhashs64_fnv1 = 0) {
+ return SetField<int64_t>(VT_TESTHASHS64_FNV1, _testhashs64_fnv1, 0);
+ }
+ uint64_t testhashu64_fnv1() const {
+ return GetField<uint64_t>(VT_TESTHASHU64_FNV1, 0);
+ }
+ bool mutate_testhashu64_fnv1(uint64_t _testhashu64_fnv1 = 0) {
+ return SetField<uint64_t>(VT_TESTHASHU64_FNV1, _testhashu64_fnv1, 0);
+ }
+ int32_t testhashs32_fnv1a() const {
+ return GetField<int32_t>(VT_TESTHASHS32_FNV1A, 0);
+ }
+ bool mutate_testhashs32_fnv1a(int32_t _testhashs32_fnv1a = 0) {
+ return SetField<int32_t>(VT_TESTHASHS32_FNV1A, _testhashs32_fnv1a, 0);
+ }
+ uint32_t testhashu32_fnv1a() const {
+ return GetField<uint32_t>(VT_TESTHASHU32_FNV1A, 0);
+ }
+ bool mutate_testhashu32_fnv1a(uint32_t _testhashu32_fnv1a = 0) {
+ return SetField<uint32_t>(VT_TESTHASHU32_FNV1A, _testhashu32_fnv1a, 0);
+ }
+ int64_t testhashs64_fnv1a() const {
+ return GetField<int64_t>(VT_TESTHASHS64_FNV1A, 0);
+ }
+ bool mutate_testhashs64_fnv1a(int64_t _testhashs64_fnv1a = 0) {
+ return SetField<int64_t>(VT_TESTHASHS64_FNV1A, _testhashs64_fnv1a, 0);
+ }
+ uint64_t testhashu64_fnv1a() const {
+ return GetField<uint64_t>(VT_TESTHASHU64_FNV1A, 0);
+ }
+ bool mutate_testhashu64_fnv1a(uint64_t _testhashu64_fnv1a = 0) {
+ return SetField<uint64_t>(VT_TESTHASHU64_FNV1A, _testhashu64_fnv1a, 0);
+ }
+ const flatbuffers::Vector<uint8_t> *testarrayofbools() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_TESTARRAYOFBOOLS);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_testarrayofbools() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_TESTARRAYOFBOOLS);
+ }
+ float testf() const {
+ return GetField<float>(VT_TESTF, 3.14159f);
+ }
+ bool mutate_testf(float _testf = 3.14159f) {
+ return SetField<float>(VT_TESTF, _testf, 3.14159f);
+ }
+ float testf2() const {
+ return GetField<float>(VT_TESTF2, 3.0f);
+ }
+ bool mutate_testf2(float _testf2 = 3.0f) {
+ return SetField<float>(VT_TESTF2, _testf2, 3.0f);
+ }
+ float testf3() const {
+ return GetField<float>(VT_TESTF3, 0.0f);
+ }
+ bool mutate_testf3(float _testf3 = 0.0f) {
+ return SetField<float>(VT_TESTF3, _testf3, 0.0f);
+ }
+ const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring2() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING2);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *mutable_testarrayofstring2() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING2);
+ }
+ const flatbuffers::Vector<const MyGame::Example::Ability *> *testarrayofsortedstruct() const {
+ return GetPointer<const flatbuffers::Vector<const MyGame::Example::Ability *> *>(VT_TESTARRAYOFSORTEDSTRUCT);
+ }
+ flatbuffers::Vector<const MyGame::Example::Ability *> *mutable_testarrayofsortedstruct() {
+ return GetPointer<flatbuffers::Vector<const MyGame::Example::Ability *> *>(VT_TESTARRAYOFSORTEDSTRUCT);
+ }
+ const flatbuffers::Vector<uint8_t> *flex() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_FLEX);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_flex() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_FLEX);
+ }
+ flexbuffers::Reference flex_flexbuffer_root() const {
+ return flexbuffers::GetRoot(flex()->Data(), flex()->size());
+ }
+ const flatbuffers::Vector<const MyGame::Example::Test *> *test5() const {
+ return GetPointer<const flatbuffers::Vector<const MyGame::Example::Test *> *>(VT_TEST5);
+ }
+ flatbuffers::Vector<const MyGame::Example::Test *> *mutable_test5() {
+ return GetPointer<flatbuffers::Vector<const MyGame::Example::Test *> *>(VT_TEST5);
+ }
+ const flatbuffers::Vector<int64_t> *vector_of_longs() const {
+ return GetPointer<const flatbuffers::Vector<int64_t> *>(VT_VECTOR_OF_LONGS);
+ }
+ flatbuffers::Vector<int64_t> *mutable_vector_of_longs() {
+ return GetPointer<flatbuffers::Vector<int64_t> *>(VT_VECTOR_OF_LONGS);
+ }
+ const flatbuffers::Vector<double> *vector_of_doubles() const {
+ return GetPointer<const flatbuffers::Vector<double> *>(VT_VECTOR_OF_DOUBLES);
+ }
+ flatbuffers::Vector<double> *mutable_vector_of_doubles() {
+ return GetPointer<flatbuffers::Vector<double> *>(VT_VECTOR_OF_DOUBLES);
+ }
+ const MyGame::InParentNamespace *parent_namespace_test() const {
+ return GetPointer<const MyGame::InParentNamespace *>(VT_PARENT_NAMESPACE_TEST);
+ }
+ MyGame::InParentNamespace *mutable_parent_namespace_test() {
+ return GetPointer<MyGame::InParentNamespace *>(VT_PARENT_NAMESPACE_TEST);
+ }
+ const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *vector_of_referrables() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *>(VT_VECTOR_OF_REFERRABLES);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *mutable_vector_of_referrables() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *>(VT_VECTOR_OF_REFERRABLES);
+ }
+ uint64_t single_weak_reference() const {
+ return GetField<uint64_t>(VT_SINGLE_WEAK_REFERENCE, 0);
+ }
+ bool mutate_single_weak_reference(uint64_t _single_weak_reference = 0) {
+ return SetField<uint64_t>(VT_SINGLE_WEAK_REFERENCE, _single_weak_reference, 0);
+ }
+ const flatbuffers::Vector<uint64_t> *vector_of_weak_references() const {
+ return GetPointer<const flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_WEAK_REFERENCES);
+ }
+ flatbuffers::Vector<uint64_t> *mutable_vector_of_weak_references() {
+ return GetPointer<flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_WEAK_REFERENCES);
+ }
+ const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *vector_of_strong_referrables() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *>(VT_VECTOR_OF_STRONG_REFERRABLES);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *mutable_vector_of_strong_referrables() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>> *>(VT_VECTOR_OF_STRONG_REFERRABLES);
+ }
+ uint64_t co_owning_reference() const {
+ return GetField<uint64_t>(VT_CO_OWNING_REFERENCE, 0);
+ }
+ bool mutate_co_owning_reference(uint64_t _co_owning_reference = 0) {
+ return SetField<uint64_t>(VT_CO_OWNING_REFERENCE, _co_owning_reference, 0);
+ }
+ const flatbuffers::Vector<uint64_t> *vector_of_co_owning_references() const {
+ return GetPointer<const flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_CO_OWNING_REFERENCES);
+ }
+ flatbuffers::Vector<uint64_t> *mutable_vector_of_co_owning_references() {
+ return GetPointer<flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_CO_OWNING_REFERENCES);
+ }
+ uint64_t non_owning_reference() const {
+ return GetField<uint64_t>(VT_NON_OWNING_REFERENCE, 0);
+ }
+ bool mutate_non_owning_reference(uint64_t _non_owning_reference = 0) {
+ return SetField<uint64_t>(VT_NON_OWNING_REFERENCE, _non_owning_reference, 0);
+ }
+ const flatbuffers::Vector<uint64_t> *vector_of_non_owning_references() const {
+ return GetPointer<const flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_NON_OWNING_REFERENCES);
+ }
+ flatbuffers::Vector<uint64_t> *mutable_vector_of_non_owning_references() {
+ return GetPointer<flatbuffers::Vector<uint64_t> *>(VT_VECTOR_OF_NON_OWNING_REFERENCES);
+ }
+ MyGame::Example::AnyUniqueAliases any_unique_type() const {
+ return static_cast<MyGame::Example::AnyUniqueAliases>(GetField<uint8_t>(VT_ANY_UNIQUE_TYPE, 0));
+ }
+ const void *any_unique() const {
+ return GetPointer<const void *>(VT_ANY_UNIQUE);
+ }
+ template<typename T> const T *any_unique_as() const;
+ const MyGame::Example::Monster *any_unique_as_M() const {
+ return any_unique_type() == MyGame::Example::AnyUniqueAliases_M ? static_cast<const MyGame::Example::Monster *>(any_unique()) : nullptr;
+ }
+ const MyGame::Example::TestSimpleTableWithEnum *any_unique_as_TS() const {
+ return any_unique_type() == MyGame::Example::AnyUniqueAliases_TS ? static_cast<const MyGame::Example::TestSimpleTableWithEnum *>(any_unique()) : nullptr;
+ }
+ const MyGame::Example2::Monster *any_unique_as_M2() const {
+ return any_unique_type() == MyGame::Example::AnyUniqueAliases_M2 ? static_cast<const MyGame::Example2::Monster *>(any_unique()) : nullptr;
+ }
+ void *mutable_any_unique() {
+ return GetPointer<void *>(VT_ANY_UNIQUE);
+ }
+ MyGame::Example::AnyAmbiguousAliases any_ambiguous_type() const {
+ return static_cast<MyGame::Example::AnyAmbiguousAliases>(GetField<uint8_t>(VT_ANY_AMBIGUOUS_TYPE, 0));
+ }
+ const void *any_ambiguous() const {
+ return GetPointer<const void *>(VT_ANY_AMBIGUOUS);
+ }
+ const MyGame::Example::Monster *any_ambiguous_as_M1() const {
+ return any_ambiguous_type() == MyGame::Example::AnyAmbiguousAliases_M1 ? static_cast<const MyGame::Example::Monster *>(any_ambiguous()) : nullptr;
+ }
+ const MyGame::Example::Monster *any_ambiguous_as_M2() const {
+ return any_ambiguous_type() == MyGame::Example::AnyAmbiguousAliases_M2 ? static_cast<const MyGame::Example::Monster *>(any_ambiguous()) : nullptr;
+ }
+ const MyGame::Example::Monster *any_ambiguous_as_M3() const {
+ return any_ambiguous_type() == MyGame::Example::AnyAmbiguousAliases_M3 ? static_cast<const MyGame::Example::Monster *>(any_ambiguous()) : nullptr;
+ }
+ void *mutable_any_ambiguous() {
+ return GetPointer<void *>(VT_ANY_AMBIGUOUS);
+ }
+ const flatbuffers::Vector<uint8_t> *vector_of_enums() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_VECTOR_OF_ENUMS);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_vector_of_enums() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_VECTOR_OF_ENUMS);
+ }
+ MyGame::Example::Race signed_enum() const {
+ return static_cast<MyGame::Example::Race>(GetField<int8_t>(VT_SIGNED_ENUM, -1));
+ }
+ bool mutate_signed_enum(MyGame::Example::Race _signed_enum = static_cast<MyGame::Example::Race>(-1)) {
+ return SetField<int8_t>(VT_SIGNED_ENUM, static_cast<int8_t>(_signed_enum), -1);
+ }
+ const flatbuffers::Vector<uint8_t> *testrequirednestedflatbuffer() const {
+ return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_TESTREQUIREDNESTEDFLATBUFFER);
+ }
+ flatbuffers::Vector<uint8_t> *mutable_testrequirednestedflatbuffer() {
+ return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_TESTREQUIREDNESTEDFLATBUFFER);
+ }
+ const MyGame::Example::Monster *testrequirednestedflatbuffer_nested_root() const {
+ return flatbuffers::GetRoot<MyGame::Example::Monster>(testrequirednestedflatbuffer()->Data());
+ }
+ const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>> *scalar_key_sorted_tables() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>> *>(VT_SCALAR_KEY_SORTED_TABLES);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>> *mutable_scalar_key_sorted_tables() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>> *>(VT_SCALAR_KEY_SORTED_TABLES);
+ }
+ const MyGame::Example::Test *native_inline() const {
+ return GetStruct<const MyGame::Example::Test *>(VT_NATIVE_INLINE);
+ }
+ MyGame::Example::Test *mutable_native_inline() {
+ return GetStruct<MyGame::Example::Test *>(VT_NATIVE_INLINE);
+ }
+ MyGame::Example::LongEnum long_enum_non_enum_default() const {
+ return static_cast<MyGame::Example::LongEnum>(GetField<uint64_t>(VT_LONG_ENUM_NON_ENUM_DEFAULT, 0));
+ }
+ bool mutate_long_enum_non_enum_default(MyGame::Example::LongEnum _long_enum_non_enum_default = static_cast<MyGame::Example::LongEnum>(0)) {
+ return SetField<uint64_t>(VT_LONG_ENUM_NON_ENUM_DEFAULT, static_cast<uint64_t>(_long_enum_non_enum_default), 0);
+ }
+ MyGame::Example::LongEnum long_enum_normal_default() const {
+ return static_cast<MyGame::Example::LongEnum>(GetField<uint64_t>(VT_LONG_ENUM_NORMAL_DEFAULT, 2ULL));
+ }
+ bool mutate_long_enum_normal_default(MyGame::Example::LongEnum _long_enum_normal_default = static_cast<MyGame::Example::LongEnum>(2ULL)) {
+ return SetField<uint64_t>(VT_LONG_ENUM_NORMAL_DEFAULT, static_cast<uint64_t>(_long_enum_normal_default), 2ULL);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyField<MyGame::Example::Vec3>(verifier, VT_POS, 8) &&
+ VerifyField<int16_t>(verifier, VT_MANA, 2) &&
+ VerifyField<int16_t>(verifier, VT_HP, 2) &&
+ VerifyOffsetRequired(verifier, VT_NAME) &&
+ verifier.VerifyString(name()) &&
+ VerifyOffset(verifier, VT_INVENTORY) &&
+ verifier.VerifyVector(inventory()) &&
+ VerifyField<uint8_t>(verifier, VT_COLOR, 1) &&
+ VerifyField<uint8_t>(verifier, VT_TEST_TYPE, 1) &&
+ VerifyOffset(verifier, VT_TEST) &&
+ VerifyAny(verifier, test(), test_type()) &&
+ VerifyOffset(verifier, VT_TEST4) &&
+ verifier.VerifyVector(test4()) &&
+ VerifyOffset(verifier, VT_TESTARRAYOFSTRING) &&
+ verifier.VerifyVector(testarrayofstring()) &&
+ verifier.VerifyVectorOfStrings(testarrayofstring()) &&
+ VerifyOffset(verifier, VT_TESTARRAYOFTABLES) &&
+ verifier.VerifyVector(testarrayoftables()) &&
+ verifier.VerifyVectorOfTables(testarrayoftables()) &&
+ VerifyOffset(verifier, VT_ENEMY) &&
+ verifier.VerifyTable(enemy()) &&
+ VerifyOffset(verifier, VT_TESTNESTEDFLATBUFFER) &&
+ verifier.VerifyVector(testnestedflatbuffer()) &&
+ verifier.VerifyNestedFlatBuffer<MyGame::Example::Monster>(testnestedflatbuffer(), nullptr) &&
+ VerifyOffset(verifier, VT_TESTEMPTY) &&
+ verifier.VerifyTable(testempty()) &&
+ VerifyField<uint8_t>(verifier, VT_TESTBOOL, 1) &&
+ VerifyField<int32_t>(verifier, VT_TESTHASHS32_FNV1, 4) &&
+ VerifyField<uint32_t>(verifier, VT_TESTHASHU32_FNV1, 4) &&
+ VerifyField<int64_t>(verifier, VT_TESTHASHS64_FNV1, 8) &&
+ VerifyField<uint64_t>(verifier, VT_TESTHASHU64_FNV1, 8) &&
+ VerifyField<int32_t>(verifier, VT_TESTHASHS32_FNV1A, 4) &&
+ VerifyField<uint32_t>(verifier, VT_TESTHASHU32_FNV1A, 4) &&
+ VerifyField<int64_t>(verifier, VT_TESTHASHS64_FNV1A, 8) &&
+ VerifyField<uint64_t>(verifier, VT_TESTHASHU64_FNV1A, 8) &&
+ VerifyOffset(verifier, VT_TESTARRAYOFBOOLS) &&
+ verifier.VerifyVector(testarrayofbools()) &&
+ VerifyField<float>(verifier, VT_TESTF, 4) &&
+ VerifyField<float>(verifier, VT_TESTF2, 4) &&
+ VerifyField<float>(verifier, VT_TESTF3, 4) &&
+ VerifyOffset(verifier, VT_TESTARRAYOFSTRING2) &&
+ verifier.VerifyVector(testarrayofstring2()) &&
+ verifier.VerifyVectorOfStrings(testarrayofstring2()) &&
+ VerifyOffset(verifier, VT_TESTARRAYOFSORTEDSTRUCT) &&
+ verifier.VerifyVector(testarrayofsortedstruct()) &&
+ VerifyOffset(verifier, VT_FLEX) &&
+ verifier.VerifyVector(flex()) &&
+ flexbuffers::VerifyNestedFlexBuffer(flex(), verifier) &&
+ VerifyOffset(verifier, VT_TEST5) &&
+ verifier.VerifyVector(test5()) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_LONGS) &&
+ verifier.VerifyVector(vector_of_longs()) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_DOUBLES) &&
+ verifier.VerifyVector(vector_of_doubles()) &&
+ VerifyOffset(verifier, VT_PARENT_NAMESPACE_TEST) &&
+ verifier.VerifyTable(parent_namespace_test()) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_REFERRABLES) &&
+ verifier.VerifyVector(vector_of_referrables()) &&
+ verifier.VerifyVectorOfTables(vector_of_referrables()) &&
+ VerifyField<uint64_t>(verifier, VT_SINGLE_WEAK_REFERENCE, 8) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_WEAK_REFERENCES) &&
+ verifier.VerifyVector(vector_of_weak_references()) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_STRONG_REFERRABLES) &&
+ verifier.VerifyVector(vector_of_strong_referrables()) &&
+ verifier.VerifyVectorOfTables(vector_of_strong_referrables()) &&
+ VerifyField<uint64_t>(verifier, VT_CO_OWNING_REFERENCE, 8) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_CO_OWNING_REFERENCES) &&
+ verifier.VerifyVector(vector_of_co_owning_references()) &&
+ VerifyField<uint64_t>(verifier, VT_NON_OWNING_REFERENCE, 8) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_NON_OWNING_REFERENCES) &&
+ verifier.VerifyVector(vector_of_non_owning_references()) &&
+ VerifyField<uint8_t>(verifier, VT_ANY_UNIQUE_TYPE, 1) &&
+ VerifyOffset(verifier, VT_ANY_UNIQUE) &&
+ VerifyAnyUniqueAliases(verifier, any_unique(), any_unique_type()) &&
+ VerifyField<uint8_t>(verifier, VT_ANY_AMBIGUOUS_TYPE, 1) &&
+ VerifyOffset(verifier, VT_ANY_AMBIGUOUS) &&
+ VerifyAnyAmbiguousAliases(verifier, any_ambiguous(), any_ambiguous_type()) &&
+ VerifyOffset(verifier, VT_VECTOR_OF_ENUMS) &&
+ verifier.VerifyVector(vector_of_enums()) &&
+ VerifyField<int8_t>(verifier, VT_SIGNED_ENUM, 1) &&
+ VerifyOffset(verifier, VT_TESTREQUIREDNESTEDFLATBUFFER) &&
+ verifier.VerifyVector(testrequirednestedflatbuffer()) &&
+ verifier.VerifyNestedFlatBuffer<MyGame::Example::Monster>(testrequirednestedflatbuffer(), nullptr) &&
+ VerifyOffset(verifier, VT_SCALAR_KEY_SORTED_TABLES) &&
+ verifier.VerifyVector(scalar_key_sorted_tables()) &&
+ verifier.VerifyVectorOfTables(scalar_key_sorted_tables()) &&
+ VerifyField<MyGame::Example::Test>(verifier, VT_NATIVE_INLINE, 2) &&
+ VerifyField<uint64_t>(verifier, VT_LONG_ENUM_NON_ENUM_DEFAULT, 8) &&
+ VerifyField<uint64_t>(verifier, VT_LONG_ENUM_NORMAL_DEFAULT, 8) &&
+ verifier.EndTable();
+ }
+ MonsterT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<Monster> Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+template<> inline const MyGame::Example::Monster *Monster::test_as<MyGame::Example::Monster>() const {
+ return test_as_Monster();
+}
+
+template<> inline const MyGame::Example::TestSimpleTableWithEnum *Monster::test_as<MyGame::Example::TestSimpleTableWithEnum>() const {
+ return test_as_TestSimpleTableWithEnum();
+}
+
+template<> inline const MyGame::Example2::Monster *Monster::test_as<MyGame::Example2::Monster>() const {
+ return test_as_MyGame_Example2_Monster();
+}
+
+template<> inline const MyGame::Example::Monster *Monster::any_unique_as<MyGame::Example::Monster>() const {
+ return any_unique_as_M();
+}
+
+template<> inline const MyGame::Example::TestSimpleTableWithEnum *Monster::any_unique_as<MyGame::Example::TestSimpleTableWithEnum>() const {
+ return any_unique_as_TS();
+}
+
+template<> inline const MyGame::Example2::Monster *Monster::any_unique_as<MyGame::Example2::Monster>() const {
+ return any_unique_as_M2();
+}
+
+struct MonsterBuilder {
+ typedef Monster Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_pos(const MyGame::Example::Vec3 *pos) {
+ fbb_.AddStruct(Monster::VT_POS, pos);
+ }
+ void add_mana(int16_t mana) {
+ fbb_.AddElement<int16_t>(Monster::VT_MANA, mana, 150);
+ }
+ void add_hp(int16_t hp) {
+ fbb_.AddElement<int16_t>(Monster::VT_HP, hp, 100);
+ }
+ void add_name(flatbuffers::Offset<flatbuffers::String> name) {
+ fbb_.AddOffset(Monster::VT_NAME, name);
+ }
+ void add_inventory(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> inventory) {
+ fbb_.AddOffset(Monster::VT_INVENTORY, inventory);
+ }
+ void add_color(MyGame::Example::Color color) {
+ fbb_.AddElement<uint8_t>(Monster::VT_COLOR, static_cast<uint8_t>(color), 8);
+ }
+ void add_test_type(MyGame::Example::Any test_type) {
+ fbb_.AddElement<uint8_t>(Monster::VT_TEST_TYPE, static_cast<uint8_t>(test_type), 0);
+ }
+ void add_test(flatbuffers::Offset<void> test) {
+ fbb_.AddOffset(Monster::VT_TEST, test);
+ }
+ void add_test4(flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Test *>> test4) {
+ fbb_.AddOffset(Monster::VT_TEST4, test4);
+ }
+ void add_testarrayofstring(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring) {
+ fbb_.AddOffset(Monster::VT_TESTARRAYOFSTRING, testarrayofstring);
+ }
+ void add_testarrayoftables(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>>> testarrayoftables) {
+ fbb_.AddOffset(Monster::VT_TESTARRAYOFTABLES, testarrayoftables);
+ }
+ void add_enemy(flatbuffers::Offset<MyGame::Example::Monster> enemy) {
+ fbb_.AddOffset(Monster::VT_ENEMY, enemy);
+ }
+ void add_testnestedflatbuffer(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testnestedflatbuffer) {
+ fbb_.AddOffset(Monster::VT_TESTNESTEDFLATBUFFER, testnestedflatbuffer);
+ }
+ void add_testempty(flatbuffers::Offset<MyGame::Example::Stat> testempty) {
+ fbb_.AddOffset(Monster::VT_TESTEMPTY, testempty);
+ }
+ void add_testbool(bool testbool) {
+ fbb_.AddElement<uint8_t>(Monster::VT_TESTBOOL, static_cast<uint8_t>(testbool), 0);
+ }
+ void add_testhashs32_fnv1(int32_t testhashs32_fnv1) {
+ fbb_.AddElement<int32_t>(Monster::VT_TESTHASHS32_FNV1, testhashs32_fnv1, 0);
+ }
+ void add_testhashu32_fnv1(uint32_t testhashu32_fnv1) {
+ fbb_.AddElement<uint32_t>(Monster::VT_TESTHASHU32_FNV1, testhashu32_fnv1, 0);
+ }
+ void add_testhashs64_fnv1(int64_t testhashs64_fnv1) {
+ fbb_.AddElement<int64_t>(Monster::VT_TESTHASHS64_FNV1, testhashs64_fnv1, 0);
+ }
+ void add_testhashu64_fnv1(uint64_t testhashu64_fnv1) {
+ fbb_.AddElement<uint64_t>(Monster::VT_TESTHASHU64_FNV1, testhashu64_fnv1, 0);
+ }
+ void add_testhashs32_fnv1a(int32_t testhashs32_fnv1a) {
+ fbb_.AddElement<int32_t>(Monster::VT_TESTHASHS32_FNV1A, testhashs32_fnv1a, 0);
+ }
+ void add_testhashu32_fnv1a(uint32_t testhashu32_fnv1a) {
+ fbb_.AddElement<uint32_t>(Monster::VT_TESTHASHU32_FNV1A, testhashu32_fnv1a, 0);
+ }
+ void add_testhashs64_fnv1a(int64_t testhashs64_fnv1a) {
+ fbb_.AddElement<int64_t>(Monster::VT_TESTHASHS64_FNV1A, testhashs64_fnv1a, 0);
+ }
+ void add_testhashu64_fnv1a(uint64_t testhashu64_fnv1a) {
+ fbb_.AddElement<uint64_t>(Monster::VT_TESTHASHU64_FNV1A, testhashu64_fnv1a, 0);
+ }
+ void add_testarrayofbools(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testarrayofbools) {
+ fbb_.AddOffset(Monster::VT_TESTARRAYOFBOOLS, testarrayofbools);
+ }
+ void add_testf(float testf) {
+ fbb_.AddElement<float>(Monster::VT_TESTF, testf, 3.14159f);
+ }
+ void add_testf2(float testf2) {
+ fbb_.AddElement<float>(Monster::VT_TESTF2, testf2, 3.0f);
+ }
+ void add_testf3(float testf3) {
+ fbb_.AddElement<float>(Monster::VT_TESTF3, testf3, 0.0f);
+ }
+ void add_testarrayofstring2(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring2) {
+ fbb_.AddOffset(Monster::VT_TESTARRAYOFSTRING2, testarrayofstring2);
+ }
+ void add_testarrayofsortedstruct(flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Ability *>> testarrayofsortedstruct) {
+ fbb_.AddOffset(Monster::VT_TESTARRAYOFSORTEDSTRUCT, testarrayofsortedstruct);
+ }
+ void add_flex(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> flex) {
+ fbb_.AddOffset(Monster::VT_FLEX, flex);
+ }
+ void add_test5(flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Test *>> test5) {
+ fbb_.AddOffset(Monster::VT_TEST5, test5);
+ }
+ void add_vector_of_longs(flatbuffers::Offset<flatbuffers::Vector<int64_t>> vector_of_longs) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_LONGS, vector_of_longs);
+ }
+ void add_vector_of_doubles(flatbuffers::Offset<flatbuffers::Vector<double>> vector_of_doubles) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_DOUBLES, vector_of_doubles);
+ }
+ void add_parent_namespace_test(flatbuffers::Offset<MyGame::InParentNamespace> parent_namespace_test) {
+ fbb_.AddOffset(Monster::VT_PARENT_NAMESPACE_TEST, parent_namespace_test);
+ }
+ void add_vector_of_referrables(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>>> vector_of_referrables) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_REFERRABLES, vector_of_referrables);
+ }
+ void add_single_weak_reference(uint64_t single_weak_reference) {
+ fbb_.AddElement<uint64_t>(Monster::VT_SINGLE_WEAK_REFERENCE, single_weak_reference, 0);
+ }
+ void add_vector_of_weak_references(flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_weak_references) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_WEAK_REFERENCES, vector_of_weak_references);
+ }
+ void add_vector_of_strong_referrables(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>>> vector_of_strong_referrables) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_STRONG_REFERRABLES, vector_of_strong_referrables);
+ }
+ void add_co_owning_reference(uint64_t co_owning_reference) {
+ fbb_.AddElement<uint64_t>(Monster::VT_CO_OWNING_REFERENCE, co_owning_reference, 0);
+ }
+ void add_vector_of_co_owning_references(flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_co_owning_references) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_CO_OWNING_REFERENCES, vector_of_co_owning_references);
+ }
+ void add_non_owning_reference(uint64_t non_owning_reference) {
+ fbb_.AddElement<uint64_t>(Monster::VT_NON_OWNING_REFERENCE, non_owning_reference, 0);
+ }
+ void add_vector_of_non_owning_references(flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_non_owning_references) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_NON_OWNING_REFERENCES, vector_of_non_owning_references);
+ }
+ void add_any_unique_type(MyGame::Example::AnyUniqueAliases any_unique_type) {
+ fbb_.AddElement<uint8_t>(Monster::VT_ANY_UNIQUE_TYPE, static_cast<uint8_t>(any_unique_type), 0);
+ }
+ void add_any_unique(flatbuffers::Offset<void> any_unique) {
+ fbb_.AddOffset(Monster::VT_ANY_UNIQUE, any_unique);
+ }
+ void add_any_ambiguous_type(MyGame::Example::AnyAmbiguousAliases any_ambiguous_type) {
+ fbb_.AddElement<uint8_t>(Monster::VT_ANY_AMBIGUOUS_TYPE, static_cast<uint8_t>(any_ambiguous_type), 0);
+ }
+ void add_any_ambiguous(flatbuffers::Offset<void> any_ambiguous) {
+ fbb_.AddOffset(Monster::VT_ANY_AMBIGUOUS, any_ambiguous);
+ }
+ void add_vector_of_enums(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> vector_of_enums) {
+ fbb_.AddOffset(Monster::VT_VECTOR_OF_ENUMS, vector_of_enums);
+ }
+ void add_signed_enum(MyGame::Example::Race signed_enum) {
+ fbb_.AddElement<int8_t>(Monster::VT_SIGNED_ENUM, static_cast<int8_t>(signed_enum), -1);
+ }
+ void add_testrequirednestedflatbuffer(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testrequirednestedflatbuffer) {
+ fbb_.AddOffset(Monster::VT_TESTREQUIREDNESTEDFLATBUFFER, testrequirednestedflatbuffer);
+ }
+ void add_scalar_key_sorted_tables(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>>> scalar_key_sorted_tables) {
+ fbb_.AddOffset(Monster::VT_SCALAR_KEY_SORTED_TABLES, scalar_key_sorted_tables);
+ }
+ void add_native_inline(const MyGame::Example::Test *native_inline) {
+ fbb_.AddStruct(Monster::VT_NATIVE_INLINE, native_inline);
+ }
+ void add_long_enum_non_enum_default(MyGame::Example::LongEnum long_enum_non_enum_default) {
+ fbb_.AddElement<uint64_t>(Monster::VT_LONG_ENUM_NON_ENUM_DEFAULT, static_cast<uint64_t>(long_enum_non_enum_default), 0);
+ }
+ void add_long_enum_normal_default(MyGame::Example::LongEnum long_enum_normal_default) {
+ fbb_.AddElement<uint64_t>(Monster::VT_LONG_ENUM_NORMAL_DEFAULT, static_cast<uint64_t>(long_enum_normal_default), 2ULL);
+ }
+ explicit MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<Monster> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<Monster>(end);
+ fbb_.Required(o, Monster::VT_NAME);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<Monster> CreateMonster(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ const MyGame::Example::Vec3 *pos = nullptr,
+ int16_t mana = 150,
+ int16_t hp = 100,
+ flatbuffers::Offset<flatbuffers::String> name = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> inventory = 0,
+ MyGame::Example::Color color = MyGame::Example::Color_Blue,
+ MyGame::Example::Any test_type = MyGame::Example::Any_NONE,
+ flatbuffers::Offset<void> test = 0,
+ flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Test *>> test4 = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Monster>>> testarrayoftables = 0,
+ flatbuffers::Offset<MyGame::Example::Monster> enemy = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testnestedflatbuffer = 0,
+ flatbuffers::Offset<MyGame::Example::Stat> testempty = 0,
+ bool testbool = false,
+ int32_t testhashs32_fnv1 = 0,
+ uint32_t testhashu32_fnv1 = 0,
+ int64_t testhashs64_fnv1 = 0,
+ uint64_t testhashu64_fnv1 = 0,
+ int32_t testhashs32_fnv1a = 0,
+ uint32_t testhashu32_fnv1a = 0,
+ int64_t testhashs64_fnv1a = 0,
+ uint64_t testhashu64_fnv1a = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testarrayofbools = 0,
+ float testf = 3.14159f,
+ float testf2 = 3.0f,
+ float testf3 = 0.0f,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> testarrayofstring2 = 0,
+ flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Ability *>> testarrayofsortedstruct = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> flex = 0,
+ flatbuffers::Offset<flatbuffers::Vector<const MyGame::Example::Test *>> test5 = 0,
+ flatbuffers::Offset<flatbuffers::Vector<int64_t>> vector_of_longs = 0,
+ flatbuffers::Offset<flatbuffers::Vector<double>> vector_of_doubles = 0,
+ flatbuffers::Offset<MyGame::InParentNamespace> parent_namespace_test = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>>> vector_of_referrables = 0,
+ uint64_t single_weak_reference = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_weak_references = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Referrable>>> vector_of_strong_referrables = 0,
+ uint64_t co_owning_reference = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_co_owning_references = 0,
+ uint64_t non_owning_reference = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint64_t>> vector_of_non_owning_references = 0,
+ MyGame::Example::AnyUniqueAliases any_unique_type = MyGame::Example::AnyUniqueAliases_NONE,
+ flatbuffers::Offset<void> any_unique = 0,
+ MyGame::Example::AnyAmbiguousAliases any_ambiguous_type = MyGame::Example::AnyAmbiguousAliases_NONE,
+ flatbuffers::Offset<void> any_ambiguous = 0,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> vector_of_enums = 0,
+ MyGame::Example::Race signed_enum = MyGame::Example::Race_None,
+ flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testrequirednestedflatbuffer = 0,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<MyGame::Example::Stat>>> scalar_key_sorted_tables = 0,
+ const MyGame::Example::Test *native_inline = nullptr,
+ MyGame::Example::LongEnum long_enum_non_enum_default = static_cast<MyGame::Example::LongEnum>(0),
+ MyGame::Example::LongEnum long_enum_normal_default = MyGame::Example::LongEnum_LongOne) {
+ MonsterBuilder builder_(_fbb);
+ builder_.add_long_enum_normal_default(long_enum_normal_default);
+ builder_.add_long_enum_non_enum_default(long_enum_non_enum_default);
+ builder_.add_non_owning_reference(non_owning_reference);
+ builder_.add_co_owning_reference(co_owning_reference);
+ builder_.add_single_weak_reference(single_weak_reference);
+ builder_.add_testhashu64_fnv1a(testhashu64_fnv1a);
+ builder_.add_testhashs64_fnv1a(testhashs64_fnv1a);
+ builder_.add_testhashu64_fnv1(testhashu64_fnv1);
+ builder_.add_testhashs64_fnv1(testhashs64_fnv1);
+ builder_.add_native_inline(native_inline);
+ builder_.add_scalar_key_sorted_tables(scalar_key_sorted_tables);
+ builder_.add_testrequirednestedflatbuffer(testrequirednestedflatbuffer);
+ builder_.add_vector_of_enums(vector_of_enums);
+ builder_.add_any_ambiguous(any_ambiguous);
+ builder_.add_any_unique(any_unique);
+ builder_.add_vector_of_non_owning_references(vector_of_non_owning_references);
+ builder_.add_vector_of_co_owning_references(vector_of_co_owning_references);
+ builder_.add_vector_of_strong_referrables(vector_of_strong_referrables);
+ builder_.add_vector_of_weak_references(vector_of_weak_references);
+ builder_.add_vector_of_referrables(vector_of_referrables);
+ builder_.add_parent_namespace_test(parent_namespace_test);
+ builder_.add_vector_of_doubles(vector_of_doubles);
+ builder_.add_vector_of_longs(vector_of_longs);
+ builder_.add_test5(test5);
+ builder_.add_flex(flex);
+ builder_.add_testarrayofsortedstruct(testarrayofsortedstruct);
+ builder_.add_testarrayofstring2(testarrayofstring2);
+ builder_.add_testf3(testf3);
+ builder_.add_testf2(testf2);
+ builder_.add_testf(testf);
+ builder_.add_testarrayofbools(testarrayofbools);
+ builder_.add_testhashu32_fnv1a(testhashu32_fnv1a);
+ builder_.add_testhashs32_fnv1a(testhashs32_fnv1a);
+ builder_.add_testhashu32_fnv1(testhashu32_fnv1);
+ builder_.add_testhashs32_fnv1(testhashs32_fnv1);
+ builder_.add_testempty(testempty);
+ builder_.add_testnestedflatbuffer(testnestedflatbuffer);
+ builder_.add_enemy(enemy);
+ builder_.add_testarrayoftables(testarrayoftables);
+ builder_.add_testarrayofstring(testarrayofstring);
+ builder_.add_test4(test4);
+ builder_.add_test(test);
+ builder_.add_inventory(inventory);
+ builder_.add_name(name);
+ builder_.add_pos(pos);
+ builder_.add_hp(hp);
+ builder_.add_mana(mana);
+ builder_.add_signed_enum(signed_enum);
+ builder_.add_any_ambiguous_type(any_ambiguous_type);
+ builder_.add_any_unique_type(any_unique_type);
+ builder_.add_testbool(testbool);
+ builder_.add_test_type(test_type);
+ builder_.add_color(color);
+ return builder_.Finish();
+}
+
+inline flatbuffers::Offset<Monster> CreateMonsterDirect(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ const MyGame::Example::Vec3 *pos = nullptr,
+ int16_t mana = 150,
+ int16_t hp = 100,
+ const char *name = nullptr,
+ const std::vector<uint8_t> *inventory = nullptr,
+ MyGame::Example::Color color = MyGame::Example::Color_Blue,
+ MyGame::Example::Any test_type = MyGame::Example::Any_NONE,
+ flatbuffers::Offset<void> test = 0,
+ const std::vector<MyGame::Example::Test> *test4 = nullptr,
+ const std::vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring = nullptr,
+ std::vector<flatbuffers::Offset<MyGame::Example::Monster>> *testarrayoftables = nullptr,
+ flatbuffers::Offset<MyGame::Example::Monster> enemy = 0,
+ const std::vector<uint8_t> *testnestedflatbuffer = nullptr,
+ flatbuffers::Offset<MyGame::Example::Stat> testempty = 0,
+ bool testbool = false,
+ int32_t testhashs32_fnv1 = 0,
+ uint32_t testhashu32_fnv1 = 0,
+ int64_t testhashs64_fnv1 = 0,
+ uint64_t testhashu64_fnv1 = 0,
+ int32_t testhashs32_fnv1a = 0,
+ uint32_t testhashu32_fnv1a = 0,
+ int64_t testhashs64_fnv1a = 0,
+ uint64_t testhashu64_fnv1a = 0,
+ const std::vector<uint8_t> *testarrayofbools = nullptr,
+ float testf = 3.14159f,
+ float testf2 = 3.0f,
+ float testf3 = 0.0f,
+ const std::vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring2 = nullptr,
+ std::vector<MyGame::Example::Ability> *testarrayofsortedstruct = nullptr,
+ const std::vector<uint8_t> *flex = nullptr,
+ const std::vector<MyGame::Example::Test> *test5 = nullptr,
+ const std::vector<int64_t> *vector_of_longs = nullptr,
+ const std::vector<double> *vector_of_doubles = nullptr,
+ flatbuffers::Offset<MyGame::InParentNamespace> parent_namespace_test = 0,
+ std::vector<flatbuffers::Offset<MyGame::Example::Referrable>> *vector_of_referrables = nullptr,
+ uint64_t single_weak_reference = 0,
+ const std::vector<uint64_t> *vector_of_weak_references = nullptr,
+ std::vector<flatbuffers::Offset<MyGame::Example::Referrable>> *vector_of_strong_referrables = nullptr,
+ uint64_t co_owning_reference = 0,
+ const std::vector<uint64_t> *vector_of_co_owning_references = nullptr,
+ uint64_t non_owning_reference = 0,
+ const std::vector<uint64_t> *vector_of_non_owning_references = nullptr,
+ MyGame::Example::AnyUniqueAliases any_unique_type = MyGame::Example::AnyUniqueAliases_NONE,
+ flatbuffers::Offset<void> any_unique = 0,
+ MyGame::Example::AnyAmbiguousAliases any_ambiguous_type = MyGame::Example::AnyAmbiguousAliases_NONE,
+ flatbuffers::Offset<void> any_ambiguous = 0,
+ const std::vector<uint8_t> *vector_of_enums = nullptr,
+ MyGame::Example::Race signed_enum = MyGame::Example::Race_None,
+ const std::vector<uint8_t> *testrequirednestedflatbuffer = nullptr,
+ std::vector<flatbuffers::Offset<MyGame::Example::Stat>> *scalar_key_sorted_tables = nullptr,
+ const MyGame::Example::Test *native_inline = nullptr,
+ MyGame::Example::LongEnum long_enum_non_enum_default = static_cast<MyGame::Example::LongEnum>(0),
+ MyGame::Example::LongEnum long_enum_normal_default = MyGame::Example::LongEnum_LongOne) {
+ auto name__ = name ? _fbb.CreateString(name) : 0;
+ auto inventory__ = inventory ? _fbb.CreateVector<uint8_t>(*inventory) : 0;
+ auto test4__ = test4 ? _fbb.CreateVectorOfStructs<MyGame::Example::Test>(*test4) : 0;
+ auto testarrayofstring__ = testarrayofstring ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*testarrayofstring) : 0;
+ auto testarrayoftables__ = testarrayoftables ? _fbb.CreateVectorOfSortedTables<MyGame::Example::Monster>(testarrayoftables) : 0;
+ auto testnestedflatbuffer__ = testnestedflatbuffer ? _fbb.CreateVector<uint8_t>(*testnestedflatbuffer) : 0;
+ auto testarrayofbools__ = testarrayofbools ? _fbb.CreateVector<uint8_t>(*testarrayofbools) : 0;
+ auto testarrayofstring2__ = testarrayofstring2 ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*testarrayofstring2) : 0;
+ auto testarrayofsortedstruct__ = testarrayofsortedstruct ? _fbb.CreateVectorOfSortedStructs<MyGame::Example::Ability>(testarrayofsortedstruct) : 0;
+ auto flex__ = flex ? _fbb.CreateVector<uint8_t>(*flex) : 0;
+ auto test5__ = test5 ? _fbb.CreateVectorOfStructs<MyGame::Example::Test>(*test5) : 0;
+ auto vector_of_longs__ = vector_of_longs ? _fbb.CreateVector<int64_t>(*vector_of_longs) : 0;
+ auto vector_of_doubles__ = vector_of_doubles ? _fbb.CreateVector<double>(*vector_of_doubles) : 0;
+ auto vector_of_referrables__ = vector_of_referrables ? _fbb.CreateVectorOfSortedTables<MyGame::Example::Referrable>(vector_of_referrables) : 0;
+ auto vector_of_weak_references__ = vector_of_weak_references ? _fbb.CreateVector<uint64_t>(*vector_of_weak_references) : 0;
+ auto vector_of_strong_referrables__ = vector_of_strong_referrables ? _fbb.CreateVectorOfSortedTables<MyGame::Example::Referrable>(vector_of_strong_referrables) : 0;
+ auto vector_of_co_owning_references__ = vector_of_co_owning_references ? _fbb.CreateVector<uint64_t>(*vector_of_co_owning_references) : 0;
+ auto vector_of_non_owning_references__ = vector_of_non_owning_references ? _fbb.CreateVector<uint64_t>(*vector_of_non_owning_references) : 0;
+ auto vector_of_enums__ = vector_of_enums ? _fbb.CreateVector<uint8_t>(*vector_of_enums) : 0;
+ auto testrequirednestedflatbuffer__ = testrequirednestedflatbuffer ? _fbb.CreateVector<uint8_t>(*testrequirednestedflatbuffer) : 0;
+ auto scalar_key_sorted_tables__ = scalar_key_sorted_tables ? _fbb.CreateVectorOfSortedTables<MyGame::Example::Stat>(scalar_key_sorted_tables) : 0;
+ return MyGame::Example::CreateMonster(
+ _fbb,
+ pos,
+ mana,
+ hp,
+ name__,
+ inventory__,
+ color,
+ test_type,
+ test,
+ test4__,
+ testarrayofstring__,
+ testarrayoftables__,
+ enemy,
+ testnestedflatbuffer__,
+ testempty,
+ testbool,
+ testhashs32_fnv1,
+ testhashu32_fnv1,
+ testhashs64_fnv1,
+ testhashu64_fnv1,
+ testhashs32_fnv1a,
+ testhashu32_fnv1a,
+ testhashs64_fnv1a,
+ testhashu64_fnv1a,
+ testarrayofbools__,
+ testf,
+ testf2,
+ testf3,
+ testarrayofstring2__,
+ testarrayofsortedstruct__,
+ flex__,
+ test5__,
+ vector_of_longs__,
+ vector_of_doubles__,
+ parent_namespace_test,
+ vector_of_referrables__,
+ single_weak_reference,
+ vector_of_weak_references__,
+ vector_of_strong_referrables__,
+ co_owning_reference,
+ vector_of_co_owning_references__,
+ non_owning_reference,
+ vector_of_non_owning_references__,
+ any_unique_type,
+ any_unique,
+ any_ambiguous_type,
+ any_ambiguous,
+ vector_of_enums__,
+ signed_enum,
+ testrequirednestedflatbuffer__,
+ scalar_key_sorted_tables__,
+ native_inline,
+ long_enum_non_enum_default,
+ long_enum_normal_default);
+}
+
+flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+struct TypeAliasesT : public flatbuffers::NativeTable {
+ typedef TypeAliases TableType;
+ int8_t i8 = 0;
+ uint8_t u8 = 0;
+ int16_t i16 = 0;
+ uint16_t u16 = 0;
+ int32_t i32 = 0;
+ uint32_t u32 = 0;
+ int64_t i64 = 0;
+ uint64_t u64 = 0;
+ float f32 = 0.0f;
+ double f64 = 0.0;
+ std::vector<int8_t> v8{};
+ std::vector<double> vf64{};
+};
+
+struct TypeAliases FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef TypeAliasesT NativeTableType;
+ typedef TypeAliasesBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return TypeAliasesTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_I8 = 4,
+ VT_U8 = 6,
+ VT_I16 = 8,
+ VT_U16 = 10,
+ VT_I32 = 12,
+ VT_U32 = 14,
+ VT_I64 = 16,
+ VT_U64 = 18,
+ VT_F32 = 20,
+ VT_F64 = 22,
+ VT_V8 = 24,
+ VT_VF64 = 26
+ };
+ int8_t i8() const {
+ return GetField<int8_t>(VT_I8, 0);
+ }
+ bool mutate_i8(int8_t _i8 = 0) {
+ return SetField<int8_t>(VT_I8, _i8, 0);
+ }
+ uint8_t u8() const {
+ return GetField<uint8_t>(VT_U8, 0);
+ }
+ bool mutate_u8(uint8_t _u8 = 0) {
+ return SetField<uint8_t>(VT_U8, _u8, 0);
+ }
+ int16_t i16() const {
+ return GetField<int16_t>(VT_I16, 0);
+ }
+ bool mutate_i16(int16_t _i16 = 0) {
+ return SetField<int16_t>(VT_I16, _i16, 0);
+ }
+ uint16_t u16() const {
+ return GetField<uint16_t>(VT_U16, 0);
+ }
+ bool mutate_u16(uint16_t _u16 = 0) {
+ return SetField<uint16_t>(VT_U16, _u16, 0);
+ }
+ int32_t i32() const {
+ return GetField<int32_t>(VT_I32, 0);
+ }
+ bool mutate_i32(int32_t _i32 = 0) {
+ return SetField<int32_t>(VT_I32, _i32, 0);
+ }
+ uint32_t u32() const {
+ return GetField<uint32_t>(VT_U32, 0);
+ }
+ bool mutate_u32(uint32_t _u32 = 0) {
+ return SetField<uint32_t>(VT_U32, _u32, 0);
+ }
+ int64_t i64() const {
+ return GetField<int64_t>(VT_I64, 0);
+ }
+ bool mutate_i64(int64_t _i64 = 0) {
+ return SetField<int64_t>(VT_I64, _i64, 0);
+ }
+ uint64_t u64() const {
+ return GetField<uint64_t>(VT_U64, 0);
+ }
+ bool mutate_u64(uint64_t _u64 = 0) {
+ return SetField<uint64_t>(VT_U64, _u64, 0);
+ }
+ float f32() const {
+ return GetField<float>(VT_F32, 0.0f);
+ }
+ bool mutate_f32(float _f32 = 0.0f) {
+ return SetField<float>(VT_F32, _f32, 0.0f);
+ }
+ double f64() const {
+ return GetField<double>(VT_F64, 0.0);
+ }
+ bool mutate_f64(double _f64 = 0.0) {
+ return SetField<double>(VT_F64, _f64, 0.0);
+ }
+ const flatbuffers::Vector<int8_t> *v8() const {
+ return GetPointer<const flatbuffers::Vector<int8_t> *>(VT_V8);
+ }
+ flatbuffers::Vector<int8_t> *mutable_v8() {
+ return GetPointer<flatbuffers::Vector<int8_t> *>(VT_V8);
+ }
+ const flatbuffers::Vector<double> *vf64() const {
+ return GetPointer<const flatbuffers::Vector<double> *>(VT_VF64);
+ }
+ flatbuffers::Vector<double> *mutable_vf64() {
+ return GetPointer<flatbuffers::Vector<double> *>(VT_VF64);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyField<int8_t>(verifier, VT_I8, 1) &&
+ VerifyField<uint8_t>(verifier, VT_U8, 1) &&
+ VerifyField<int16_t>(verifier, VT_I16, 2) &&
+ VerifyField<uint16_t>(verifier, VT_U16, 2) &&
+ VerifyField<int32_t>(verifier, VT_I32, 4) &&
+ VerifyField<uint32_t>(verifier, VT_U32, 4) &&
+ VerifyField<int64_t>(verifier, VT_I64, 8) &&
+ VerifyField<uint64_t>(verifier, VT_U64, 8) &&
+ VerifyField<float>(verifier, VT_F32, 4) &&
+ VerifyField<double>(verifier, VT_F64, 8) &&
+ VerifyOffset(verifier, VT_V8) &&
+ verifier.VerifyVector(v8()) &&
+ VerifyOffset(verifier, VT_VF64) &&
+ verifier.VerifyVector(vf64()) &&
+ verifier.EndTable();
+ }
+ TypeAliasesT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(TypeAliasesT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<TypeAliases> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct TypeAliasesBuilder {
+ typedef TypeAliases Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_i8(int8_t i8) {
+ fbb_.AddElement<int8_t>(TypeAliases::VT_I8, i8, 0);
+ }
+ void add_u8(uint8_t u8) {
+ fbb_.AddElement<uint8_t>(TypeAliases::VT_U8, u8, 0);
+ }
+ void add_i16(int16_t i16) {
+ fbb_.AddElement<int16_t>(TypeAliases::VT_I16, i16, 0);
+ }
+ void add_u16(uint16_t u16) {
+ fbb_.AddElement<uint16_t>(TypeAliases::VT_U16, u16, 0);
+ }
+ void add_i32(int32_t i32) {
+ fbb_.AddElement<int32_t>(TypeAliases::VT_I32, i32, 0);
+ }
+ void add_u32(uint32_t u32) {
+ fbb_.AddElement<uint32_t>(TypeAliases::VT_U32, u32, 0);
+ }
+ void add_i64(int64_t i64) {
+ fbb_.AddElement<int64_t>(TypeAliases::VT_I64, i64, 0);
+ }
+ void add_u64(uint64_t u64) {
+ fbb_.AddElement<uint64_t>(TypeAliases::VT_U64, u64, 0);
+ }
+ void add_f32(float f32) {
+ fbb_.AddElement<float>(TypeAliases::VT_F32, f32, 0.0f);
+ }
+ void add_f64(double f64) {
+ fbb_.AddElement<double>(TypeAliases::VT_F64, f64, 0.0);
+ }
+ void add_v8(flatbuffers::Offset<flatbuffers::Vector<int8_t>> v8) {
+ fbb_.AddOffset(TypeAliases::VT_V8, v8);
+ }
+ void add_vf64(flatbuffers::Offset<flatbuffers::Vector<double>> vf64) {
+ fbb_.AddOffset(TypeAliases::VT_VF64, vf64);
+ }
+ explicit TypeAliasesBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<TypeAliases> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<TypeAliases>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<TypeAliases> CreateTypeAliases(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ int8_t i8 = 0,
+ uint8_t u8 = 0,
+ int16_t i16 = 0,
+ uint16_t u16 = 0,
+ int32_t i32 = 0,
+ uint32_t u32 = 0,
+ int64_t i64 = 0,
+ uint64_t u64 = 0,
+ float f32 = 0.0f,
+ double f64 = 0.0,
+ flatbuffers::Offset<flatbuffers::Vector<int8_t>> v8 = 0,
+ flatbuffers::Offset<flatbuffers::Vector<double>> vf64 = 0) {
+ TypeAliasesBuilder builder_(_fbb);
+ builder_.add_f64(f64);
+ builder_.add_u64(u64);
+ builder_.add_i64(i64);
+ builder_.add_vf64(vf64);
+ builder_.add_v8(v8);
+ builder_.add_f32(f32);
+ builder_.add_u32(u32);
+ builder_.add_i32(i32);
+ builder_.add_u16(u16);
+ builder_.add_i16(i16);
+ builder_.add_u8(u8);
+ builder_.add_i8(i8);
+ return builder_.Finish();
+}
+
+inline flatbuffers::Offset<TypeAliases> CreateTypeAliasesDirect(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ int8_t i8 = 0,
+ uint8_t u8 = 0,
+ int16_t i16 = 0,
+ uint16_t u16 = 0,
+ int32_t i32 = 0,
+ uint32_t u32 = 0,
+ int64_t i64 = 0,
+ uint64_t u64 = 0,
+ float f32 = 0.0f,
+ double f64 = 0.0,
+ const std::vector<int8_t> *v8 = nullptr,
+ const std::vector<double> *vf64 = nullptr) {
+ auto v8__ = v8 ? _fbb.CreateVector<int8_t>(*v8) : 0;
+ auto vf64__ = vf64 ? _fbb.CreateVector<double>(*vf64) : 0;
+ return MyGame::Example::CreateTypeAliases(
+ _fbb,
+ i8,
+ u8,
+ i16,
+ u16,
+ i32,
+ u32,
+ i64,
+ u64,
+ f32,
+ f64,
+ v8__,
+ vf64__);
+}
+
+flatbuffers::Offset<TypeAliases> CreateTypeAliases(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+} // namespace Example
+
+
+inline bool operator==(const InParentNamespaceT &, const InParentNamespaceT &) {
+ return true;
+}
+
+inline bool operator!=(const InParentNamespaceT &lhs, const InParentNamespaceT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline InParentNamespaceT *InParentNamespace::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<InParentNamespaceT>(new InParentNamespaceT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void InParentNamespace::UnPackTo(InParentNamespaceT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+}
+
+inline flatbuffers::Offset<InParentNamespace> InParentNamespace::Pack(flatbuffers::FlatBufferBuilder &_fbb, const InParentNamespaceT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateInParentNamespace(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<InParentNamespace> CreateInParentNamespace(flatbuffers::FlatBufferBuilder &_fbb, const InParentNamespaceT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const InParentNamespaceT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ return MyGame::CreateInParentNamespace(
+ _fbb);
+}
+
+namespace Example2 {
+
+
+inline bool operator==(const MonsterT &, const MonsterT &) {
+ return true;
+}
+
+inline bool operator!=(const MonsterT &lhs, const MonsterT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline MonsterT *Monster::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<MonsterT>(new MonsterT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void Monster::UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+}
+
+inline flatbuffers::Offset<Monster> Monster::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateMonster(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const MonsterT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ return MyGame::Example2::CreateMonster(
+ _fbb);
+}
+
+} // namespace Example2
+
+namespace Example {
+
+
+inline bool operator==(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs) {
+ return
+ (lhs.color == rhs.color);
+}
+
+inline bool operator!=(const TestSimpleTableWithEnumT &lhs, const TestSimpleTableWithEnumT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline TestSimpleTableWithEnumT *TestSimpleTableWithEnum::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<TestSimpleTableWithEnumT>(new TestSimpleTableWithEnumT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void TestSimpleTableWithEnum::UnPackTo(TestSimpleTableWithEnumT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = color(); _o->color = _e; }
+}
+
+inline flatbuffers::Offset<TestSimpleTableWithEnum> TestSimpleTableWithEnum::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateTestSimpleTableWithEnum(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<TestSimpleTableWithEnum> CreateTestSimpleTableWithEnum(flatbuffers::FlatBufferBuilder &_fbb, const TestSimpleTableWithEnumT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TestSimpleTableWithEnumT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _color = _o->color;
+ return MyGame::Example::CreateTestSimpleTableWithEnum(
+ _fbb,
+ _color);
+}
+
+
+inline bool operator==(const StatT &lhs, const StatT &rhs) {
+ return
+ (lhs.id == rhs.id) &&
+ (lhs.val == rhs.val) &&
+ (lhs.count == rhs.count);
+}
+
+inline bool operator!=(const StatT &lhs, const StatT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline StatT *Stat::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<StatT>(new StatT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void Stat::UnPackTo(StatT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = id(); if (_e) _o->id = _e->str(); }
+ { auto _e = val(); _o->val = _e; }
+ { auto _e = count(); _o->count = _e; }
+}
+
+inline flatbuffers::Offset<Stat> Stat::Pack(flatbuffers::FlatBufferBuilder &_fbb, const StatT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateStat(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<Stat> CreateStat(flatbuffers::FlatBufferBuilder &_fbb, const StatT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const StatT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _id = _o->id.empty() ? 0 : _fbb.CreateString(_o->id);
+ auto _val = _o->val;
+ auto _count = _o->count;
+ return MyGame::Example::CreateStat(
+ _fbb,
+ _id,
+ _val,
+ _count);
+}
+
+
+inline bool operator==(const ReferrableT &lhs, const ReferrableT &rhs) {
+ return
+ (lhs.id == rhs.id);
+}
+
+inline bool operator!=(const ReferrableT &lhs, const ReferrableT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline ReferrableT *Referrable::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<ReferrableT>(new ReferrableT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void Referrable::UnPackTo(ReferrableT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = id(); _o->id = _e; }
+}
+
+inline flatbuffers::Offset<Referrable> Referrable::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ReferrableT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateReferrable(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<Referrable> CreateReferrable(flatbuffers::FlatBufferBuilder &_fbb, const ReferrableT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ReferrableT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _id = _o->id;
+ return MyGame::Example::CreateReferrable(
+ _fbb,
+ _id);
+}
+
+
+inline bool operator==(const MonsterT &lhs, const MonsterT &rhs) {
+ return
+ ((lhs.pos == rhs.pos) || (lhs.pos && rhs.pos && *lhs.pos == *rhs.pos)) &&
+ (lhs.mana == rhs.mana) &&
+ (lhs.hp == rhs.hp) &&
+ (lhs.name == rhs.name) &&
+ (lhs.inventory == rhs.inventory) &&
+ (lhs.color == rhs.color) &&
+ (lhs.test == rhs.test) &&
+ (lhs.test4 == rhs.test4) &&
+ (lhs.testarrayofstring == rhs.testarrayofstring) &&
+ (lhs.testarrayoftables.size() == rhs.testarrayoftables.size() && std::equal(lhs.testarrayoftables.cbegin(), lhs.testarrayoftables.cend(), rhs.testarrayoftables.cbegin(), [](flatbuffers::unique_ptr<MyGame::Example::MonsterT> const &a, flatbuffers::unique_ptr<MyGame::Example::MonsterT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
+ ((lhs.enemy == rhs.enemy) || (lhs.enemy && rhs.enemy && *lhs.enemy == *rhs.enemy)) &&
+ (lhs.testnestedflatbuffer == rhs.testnestedflatbuffer) &&
+ ((lhs.testempty == rhs.testempty) || (lhs.testempty && rhs.testempty && *lhs.testempty == *rhs.testempty)) &&
+ (lhs.testbool == rhs.testbool) &&
+ (lhs.testhashs32_fnv1 == rhs.testhashs32_fnv1) &&
+ (lhs.testhashu32_fnv1 == rhs.testhashu32_fnv1) &&
+ (lhs.testhashs64_fnv1 == rhs.testhashs64_fnv1) &&
+ (lhs.testhashu64_fnv1 == rhs.testhashu64_fnv1) &&
+ (lhs.testhashs32_fnv1a == rhs.testhashs32_fnv1a) &&
+ (lhs.testhashu32_fnv1a == rhs.testhashu32_fnv1a) &&
+ (lhs.testhashs64_fnv1a == rhs.testhashs64_fnv1a) &&
+ (lhs.testhashu64_fnv1a == rhs.testhashu64_fnv1a) &&
+ (lhs.testarrayofbools == rhs.testarrayofbools) &&
+ (lhs.testf == rhs.testf) &&
+ (lhs.testf2 == rhs.testf2) &&
+ (lhs.testf3 == rhs.testf3) &&
+ (lhs.testarrayofstring2 == rhs.testarrayofstring2) &&
+ (lhs.testarrayofsortedstruct == rhs.testarrayofsortedstruct) &&
+ (lhs.flex == rhs.flex) &&
+ (lhs.test5 == rhs.test5) &&
+ (lhs.vector_of_longs == rhs.vector_of_longs) &&
+ (lhs.vector_of_doubles == rhs.vector_of_doubles) &&
+ ((lhs.parent_namespace_test == rhs.parent_namespace_test) || (lhs.parent_namespace_test && rhs.parent_namespace_test && *lhs.parent_namespace_test == *rhs.parent_namespace_test)) &&
+ (lhs.vector_of_referrables.size() == rhs.vector_of_referrables.size() && std::equal(lhs.vector_of_referrables.cbegin(), lhs.vector_of_referrables.cend(), rhs.vector_of_referrables.cbegin(), [](flatbuffers::unique_ptr<MyGame::Example::ReferrableT> const &a, flatbuffers::unique_ptr<MyGame::Example::ReferrableT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
+ (lhs.single_weak_reference == rhs.single_weak_reference) &&
+ (lhs.vector_of_weak_references == rhs.vector_of_weak_references) &&
+ (lhs.vector_of_strong_referrables.size() == rhs.vector_of_strong_referrables.size() && std::equal(lhs.vector_of_strong_referrables.cbegin(), lhs.vector_of_strong_referrables.cend(), rhs.vector_of_strong_referrables.cbegin(), [](flatbuffers::unique_ptr<MyGame::Example::ReferrableT> const &a, flatbuffers::unique_ptr<MyGame::Example::ReferrableT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
+ (lhs.co_owning_reference == rhs.co_owning_reference) &&
+ (lhs.vector_of_co_owning_references == rhs.vector_of_co_owning_references) &&
+ (lhs.non_owning_reference == rhs.non_owning_reference) &&
+ (lhs.vector_of_non_owning_references == rhs.vector_of_non_owning_references) &&
+ (lhs.any_unique == rhs.any_unique) &&
+ (lhs.any_ambiguous == rhs.any_ambiguous) &&
+ (lhs.vector_of_enums == rhs.vector_of_enums) &&
+ (lhs.signed_enum == rhs.signed_enum) &&
+ (lhs.testrequirednestedflatbuffer == rhs.testrequirednestedflatbuffer) &&
+ (lhs.scalar_key_sorted_tables.size() == rhs.scalar_key_sorted_tables.size() && std::equal(lhs.scalar_key_sorted_tables.cbegin(), lhs.scalar_key_sorted_tables.cend(), rhs.scalar_key_sorted_tables.cbegin(), [](flatbuffers::unique_ptr<MyGame::Example::StatT> const &a, flatbuffers::unique_ptr<MyGame::Example::StatT> const &b) { return (a == b) || (a && b && *a == *b); })) &&
+ (lhs.native_inline == rhs.native_inline) &&
+ (lhs.long_enum_non_enum_default == rhs.long_enum_non_enum_default) &&
+ (lhs.long_enum_normal_default == rhs.long_enum_normal_default);
+}
+
+inline bool operator!=(const MonsterT &lhs, const MonsterT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline MonsterT::MonsterT(const MonsterT &o)
+ : pos((o.pos) ? new MyGame::Example::Vec3(*o.pos) : nullptr),
+ mana(o.mana),
+ hp(o.hp),
+ name(o.name),
+ inventory(o.inventory),
+ color(o.color),
+ test(o.test),
+ test4(o.test4),
+ testarrayofstring(o.testarrayofstring),
+ enemy((o.enemy) ? new MyGame::Example::MonsterT(*o.enemy) : nullptr),
+ testnestedflatbuffer(o.testnestedflatbuffer),
+ testempty((o.testempty) ? new MyGame::Example::StatT(*o.testempty) : nullptr),
+ testbool(o.testbool),
+ testhashs32_fnv1(o.testhashs32_fnv1),
+ testhashu32_fnv1(o.testhashu32_fnv1),
+ testhashs64_fnv1(o.testhashs64_fnv1),
+ testhashu64_fnv1(o.testhashu64_fnv1),
+ testhashs32_fnv1a(o.testhashs32_fnv1a),
+ testhashu32_fnv1a(o.testhashu32_fnv1a),
+ testhashs64_fnv1a(o.testhashs64_fnv1a),
+ testhashu64_fnv1a(o.testhashu64_fnv1a),
+ testarrayofbools(o.testarrayofbools),
+ testf(o.testf),
+ testf2(o.testf2),
+ testf3(o.testf3),
+ testarrayofstring2(o.testarrayofstring2),
+ testarrayofsortedstruct(o.testarrayofsortedstruct),
+ flex(o.flex),
+ test5(o.test5),
+ vector_of_longs(o.vector_of_longs),
+ vector_of_doubles(o.vector_of_doubles),
+ parent_namespace_test((o.parent_namespace_test) ? new MyGame::InParentNamespaceT(*o.parent_namespace_test) : nullptr),
+ single_weak_reference(o.single_weak_reference),
+ vector_of_weak_references(o.vector_of_weak_references),
+ co_owning_reference(o.co_owning_reference),
+ non_owning_reference(o.non_owning_reference),
+ vector_of_non_owning_references(o.vector_of_non_owning_references),
+ any_unique(o.any_unique),
+ any_ambiguous(o.any_ambiguous),
+ vector_of_enums(o.vector_of_enums),
+ signed_enum(o.signed_enum),
+ testrequirednestedflatbuffer(o.testrequirednestedflatbuffer),
+ native_inline(o.native_inline),
+ long_enum_non_enum_default(o.long_enum_non_enum_default),
+ long_enum_normal_default(o.long_enum_normal_default) {
+ testarrayoftables.reserve(o.testarrayoftables.size());
+ for (const auto &testarrayoftables_ : o.testarrayoftables) { testarrayoftables.emplace_back((testarrayoftables_) ? new MyGame::Example::MonsterT(*testarrayoftables_) : nullptr); }
+ vector_of_referrables.reserve(o.vector_of_referrables.size());
+ for (const auto &vector_of_referrables_ : o.vector_of_referrables) { vector_of_referrables.emplace_back((vector_of_referrables_) ? new MyGame::Example::ReferrableT(*vector_of_referrables_) : nullptr); }
+ vector_of_strong_referrables.reserve(o.vector_of_strong_referrables.size());
+ for (const auto &vector_of_strong_referrables_ : o.vector_of_strong_referrables) { vector_of_strong_referrables.emplace_back((vector_of_strong_referrables_) ? new MyGame::Example::ReferrableT(*vector_of_strong_referrables_) : nullptr); }
+ vector_of_co_owning_references.reserve(o.vector_of_co_owning_references.size());
+ for (const auto &vector_of_co_owning_references_ : o.vector_of_co_owning_references) { vector_of_co_owning_references.emplace_back((vector_of_co_owning_references_) ? new ReferrableT(*vector_of_co_owning_references_) : nullptr); }
+ scalar_key_sorted_tables.reserve(o.scalar_key_sorted_tables.size());
+ for (const auto &scalar_key_sorted_tables_ : o.scalar_key_sorted_tables) { scalar_key_sorted_tables.emplace_back((scalar_key_sorted_tables_) ? new MyGame::Example::StatT(*scalar_key_sorted_tables_) : nullptr); }
+}
+
+inline MonsterT &MonsterT::operator=(MonsterT o) FLATBUFFERS_NOEXCEPT {
+ std::swap(pos, o.pos);
+ std::swap(mana, o.mana);
+ std::swap(hp, o.hp);
+ std::swap(name, o.name);
+ std::swap(inventory, o.inventory);
+ std::swap(color, o.color);
+ std::swap(test, o.test);
+ std::swap(test4, o.test4);
+ std::swap(testarrayofstring, o.testarrayofstring);
+ std::swap(testarrayoftables, o.testarrayoftables);
+ std::swap(enemy, o.enemy);
+ std::swap(testnestedflatbuffer, o.testnestedflatbuffer);
+ std::swap(testempty, o.testempty);
+ std::swap(testbool, o.testbool);
+ std::swap(testhashs32_fnv1, o.testhashs32_fnv1);
+ std::swap(testhashu32_fnv1, o.testhashu32_fnv1);
+ std::swap(testhashs64_fnv1, o.testhashs64_fnv1);
+ std::swap(testhashu64_fnv1, o.testhashu64_fnv1);
+ std::swap(testhashs32_fnv1a, o.testhashs32_fnv1a);
+ std::swap(testhashu32_fnv1a, o.testhashu32_fnv1a);
+ std::swap(testhashs64_fnv1a, o.testhashs64_fnv1a);
+ std::swap(testhashu64_fnv1a, o.testhashu64_fnv1a);
+ std::swap(testarrayofbools, o.testarrayofbools);
+ std::swap(testf, o.testf);
+ std::swap(testf2, o.testf2);
+ std::swap(testf3, o.testf3);
+ std::swap(testarrayofstring2, o.testarrayofstring2);
+ std::swap(testarrayofsortedstruct, o.testarrayofsortedstruct);
+ std::swap(flex, o.flex);
+ std::swap(test5, o.test5);
+ std::swap(vector_of_longs, o.vector_of_longs);
+ std::swap(vector_of_doubles, o.vector_of_doubles);
+ std::swap(parent_namespace_test, o.parent_namespace_test);
+ std::swap(vector_of_referrables, o.vector_of_referrables);
+ std::swap(single_weak_reference, o.single_weak_reference);
+ std::swap(vector_of_weak_references, o.vector_of_weak_references);
+ std::swap(vector_of_strong_referrables, o.vector_of_strong_referrables);
+ std::swap(co_owning_reference, o.co_owning_reference);
+ std::swap(vector_of_co_owning_references, o.vector_of_co_owning_references);
+ std::swap(non_owning_reference, o.non_owning_reference);
+ std::swap(vector_of_non_owning_references, o.vector_of_non_owning_references);
+ std::swap(any_unique, o.any_unique);
+ std::swap(any_ambiguous, o.any_ambiguous);
+ std::swap(vector_of_enums, o.vector_of_enums);
+ std::swap(signed_enum, o.signed_enum);
+ std::swap(testrequirednestedflatbuffer, o.testrequirednestedflatbuffer);
+ std::swap(scalar_key_sorted_tables, o.scalar_key_sorted_tables);
+ std::swap(native_inline, o.native_inline);
+ std::swap(long_enum_non_enum_default, o.long_enum_non_enum_default);
+ std::swap(long_enum_normal_default, o.long_enum_normal_default);
+ return *this;
+}
+
+inline MonsterT *Monster::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<MonsterT>(new MonsterT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void Monster::UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = pos(); if (_e) _o->pos = flatbuffers::unique_ptr<MyGame::Example::Vec3>(new MyGame::Example::Vec3(*_e)); }
+ { auto _e = mana(); _o->mana = _e; }
+ { auto _e = hp(); _o->hp = _e; }
+ { auto _e = name(); if (_e) _o->name = _e->str(); }
+ { auto _e = inventory(); if (_e) { _o->inventory.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->inventory.begin()); } }
+ { auto _e = color(); _o->color = _e; }
+ { auto _e = test_type(); _o->test.type = _e; }
+ { auto _e = test(); if (_e) _o->test.value = MyGame::Example::AnyUnion::UnPack(_e, test_type(), _resolver); }
+ { auto _e = test4(); if (_e) { _o->test4.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test4[_i] = *_e->Get(_i); } } else { _o->test4.resize(0); } }
+ { auto _e = testarrayofstring(); if (_e) { _o->testarrayofstring.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring[_i] = _e->Get(_i)->str(); } } else { _o->testarrayofstring.resize(0); } }
+ { auto _e = testarrayoftables(); if (_e) { _o->testarrayoftables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->testarrayoftables[_i]) { _e->Get(_i)->UnPackTo(_o->testarrayoftables[_i].get(), _resolver); } else { _o->testarrayoftables[_i] = flatbuffers::unique_ptr<MyGame::Example::MonsterT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->testarrayoftables.resize(0); } }
+ { auto _e = enemy(); if (_e) { if(_o->enemy) { _e->UnPackTo(_o->enemy.get(), _resolver); } else { _o->enemy = flatbuffers::unique_ptr<MyGame::Example::MonsterT>(_e->UnPack(_resolver)); } } else if (_o->enemy) { _o->enemy.reset(); } }
+ { auto _e = testnestedflatbuffer(); if (_e) { _o->testnestedflatbuffer.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->testnestedflatbuffer.begin()); } }
+ { auto _e = testempty(); if (_e) { if(_o->testempty) { _e->UnPackTo(_o->testempty.get(), _resolver); } else { _o->testempty = flatbuffers::unique_ptr<MyGame::Example::StatT>(_e->UnPack(_resolver)); } } else if (_o->testempty) { _o->testempty.reset(); } }
+ { auto _e = testbool(); _o->testbool = _e; }
+ { auto _e = testhashs32_fnv1(); _o->testhashs32_fnv1 = _e; }
+ { auto _e = testhashu32_fnv1(); _o->testhashu32_fnv1 = _e; }
+ { auto _e = testhashs64_fnv1(); _o->testhashs64_fnv1 = _e; }
+ { auto _e = testhashu64_fnv1(); _o->testhashu64_fnv1 = _e; }
+ { auto _e = testhashs32_fnv1a(); _o->testhashs32_fnv1a = _e; }
+ { auto _e = testhashu32_fnv1a(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->testhashu32_fnv1a), static_cast<flatbuffers::hash_value_t>(_e)); else _o->testhashu32_fnv1a = nullptr; }
+ { auto _e = testhashs64_fnv1a(); _o->testhashs64_fnv1a = _e; }
+ { auto _e = testhashu64_fnv1a(); _o->testhashu64_fnv1a = _e; }
+ { auto _e = testarrayofbools(); if (_e) { _o->testarrayofbools.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofbools[_i] = _e->Get(_i) != 0; } } else { _o->testarrayofbools.resize(0); } }
+ { auto _e = testf(); _o->testf = _e; }
+ { auto _e = testf2(); _o->testf2 = _e; }
+ { auto _e = testf3(); _o->testf3 = _e; }
+ { auto _e = testarrayofstring2(); if (_e) { _o->testarrayofstring2.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring2[_i] = _e->Get(_i)->str(); } } else { _o->testarrayofstring2.resize(0); } }
+ { auto _e = testarrayofsortedstruct(); if (_e) { _o->testarrayofsortedstruct.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofsortedstruct[_i] = *_e->Get(_i); } } else { _o->testarrayofsortedstruct.resize(0); } }
+ { auto _e = flex(); if (_e) { _o->flex.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->flex.begin()); } }
+ { auto _e = test5(); if (_e) { _o->test5.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test5[_i] = *_e->Get(_i); } } else { _o->test5.resize(0); } }
+ { auto _e = vector_of_longs(); if (_e) { _o->vector_of_longs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_longs[_i] = _e->Get(_i); } } else { _o->vector_of_longs.resize(0); } }
+ { auto _e = vector_of_doubles(); if (_e) { _o->vector_of_doubles.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_doubles[_i] = _e->Get(_i); } } else { _o->vector_of_doubles.resize(0); } }
+ { auto _e = parent_namespace_test(); if (_e) { if(_o->parent_namespace_test) { _e->UnPackTo(_o->parent_namespace_test.get(), _resolver); } else { _o->parent_namespace_test = flatbuffers::unique_ptr<MyGame::InParentNamespaceT>(_e->UnPack(_resolver)); } } else if (_o->parent_namespace_test) { _o->parent_namespace_test.reset(); } }
+ { auto _e = vector_of_referrables(); if (_e) { _o->vector_of_referrables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->vector_of_referrables[_i]) { _e->Get(_i)->UnPackTo(_o->vector_of_referrables[_i].get(), _resolver); } else { _o->vector_of_referrables[_i] = flatbuffers::unique_ptr<MyGame::Example::ReferrableT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->vector_of_referrables.resize(0); } }
+ { auto _e = single_weak_reference(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->single_weak_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->single_weak_reference = nullptr; }
+ { auto _e = vector_of_weak_references(); if (_e) { _o->vector_of_weak_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { /*vector resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_weak_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i))); else _o->vector_of_weak_references[_i] = nullptr; } } else { _o->vector_of_weak_references.resize(0); } }
+ { auto _e = vector_of_strong_referrables(); if (_e) { _o->vector_of_strong_referrables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->vector_of_strong_referrables[_i]) { _e->Get(_i)->UnPackTo(_o->vector_of_strong_referrables[_i].get(), _resolver); } else { _o->vector_of_strong_referrables[_i] = flatbuffers::unique_ptr<MyGame::Example::ReferrableT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->vector_of_strong_referrables.resize(0); } }
+ { auto _e = co_owning_reference(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->co_owning_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->co_owning_reference = nullptr; }
+ { auto _e = vector_of_co_owning_references(); if (_e) { _o->vector_of_co_owning_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { /*vector resolver, default_ptr_type*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_co_owning_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i)));/* else do nothing */; } } else { _o->vector_of_co_owning_references.resize(0); } }
+ { auto _e = non_owning_reference(); /*scalar resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->non_owning_reference), static_cast<flatbuffers::hash_value_t>(_e)); else _o->non_owning_reference = nullptr; }
+ { auto _e = vector_of_non_owning_references(); if (_e) { _o->vector_of_non_owning_references.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { /*vector resolver, naked*/ if (_resolver) (*_resolver)(reinterpret_cast<void **>(&_o->vector_of_non_owning_references[_i]), static_cast<flatbuffers::hash_value_t>(_e->Get(_i))); else _o->vector_of_non_owning_references[_i] = nullptr; } } else { _o->vector_of_non_owning_references.resize(0); } }
+ { auto _e = any_unique_type(); _o->any_unique.type = _e; }
+ { auto _e = any_unique(); if (_e) _o->any_unique.value = MyGame::Example::AnyUniqueAliasesUnion::UnPack(_e, any_unique_type(), _resolver); }
+ { auto _e = any_ambiguous_type(); _o->any_ambiguous.type = _e; }
+ { auto _e = any_ambiguous(); if (_e) _o->any_ambiguous.value = MyGame::Example::AnyAmbiguousAliasesUnion::UnPack(_e, any_ambiguous_type(), _resolver); }
+ { auto _e = vector_of_enums(); if (_e) { _o->vector_of_enums.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vector_of_enums[_i] = static_cast<MyGame::Example::Color>(_e->Get(_i)); } } else { _o->vector_of_enums.resize(0); } }
+ { auto _e = signed_enum(); _o->signed_enum = _e; }
+ { auto _e = testrequirednestedflatbuffer(); if (_e) { _o->testrequirednestedflatbuffer.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->testrequirednestedflatbuffer.begin()); } }
+ { auto _e = scalar_key_sorted_tables(); if (_e) { _o->scalar_key_sorted_tables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { if(_o->scalar_key_sorted_tables[_i]) { _e->Get(_i)->UnPackTo(_o->scalar_key_sorted_tables[_i].get(), _resolver); } else { _o->scalar_key_sorted_tables[_i] = flatbuffers::unique_ptr<MyGame::Example::StatT>(_e->Get(_i)->UnPack(_resolver)); }; } } else { _o->scalar_key_sorted_tables.resize(0); } }
+ { auto _e = native_inline(); if (_e) _o->native_inline = *_e; }
+ { auto _e = long_enum_non_enum_default(); _o->long_enum_non_enum_default = _e; }
+ { auto _e = long_enum_normal_default(); _o->long_enum_normal_default = _e; }
+}
+
+inline flatbuffers::Offset<Monster> Monster::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateMonster(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const MonsterT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _pos = _o->pos ? _o->pos.get() : nullptr;
+ auto _mana = _o->mana;
+ auto _hp = _o->hp;
+ auto _name = _fbb.CreateString(_o->name);
+ auto _inventory = _o->inventory.size() ? _fbb.CreateVector(_o->inventory) : 0;
+ auto _color = _o->color;
+ auto _test_type = _o->test.type;
+ auto _test = _o->test.Pack(_fbb);
+ auto _test4 = _o->test4.size() ? _fbb.CreateVectorOfStructs(_o->test4) : 0;
+ auto _testarrayofstring = _o->testarrayofstring.size() ? _fbb.CreateVectorOfStrings(_o->testarrayofstring) : 0;
+ auto _testarrayoftables = _o->testarrayoftables.size() ? _fbb.CreateVector<flatbuffers::Offset<MyGame::Example::Monster>> (_o->testarrayoftables.size(), [](size_t i, _VectorArgs *__va) { return CreateMonster(*__va->__fbb, __va->__o->testarrayoftables[i].get(), __va->__rehasher); }, &_va ) : 0;
+ auto _enemy = _o->enemy ? CreateMonster(_fbb, _o->enemy.get(), _rehasher) : 0;
+ auto _testnestedflatbuffer = _o->testnestedflatbuffer.size() ? _fbb.CreateVector(_o->testnestedflatbuffer) : 0;
+ auto _testempty = _o->testempty ? CreateStat(_fbb, _o->testempty.get(), _rehasher) : 0;
+ auto _testbool = _o->testbool;
+ auto _testhashs32_fnv1 = _o->testhashs32_fnv1;
+ auto _testhashu32_fnv1 = _o->testhashu32_fnv1;
+ auto _testhashs64_fnv1 = _o->testhashs64_fnv1;
+ auto _testhashu64_fnv1 = _o->testhashu64_fnv1;
+ auto _testhashs32_fnv1a = _o->testhashs32_fnv1a;
+ auto _testhashu32_fnv1a = _rehasher ? static_cast<uint32_t>((*_rehasher)(_o->testhashu32_fnv1a)) : 0;
+ auto _testhashs64_fnv1a = _o->testhashs64_fnv1a;
+ auto _testhashu64_fnv1a = _o->testhashu64_fnv1a;
+ auto _testarrayofbools = _o->testarrayofbools.size() ? _fbb.CreateVector(_o->testarrayofbools) : 0;
+ auto _testf = _o->testf;
+ auto _testf2 = _o->testf2;
+ auto _testf3 = _o->testf3;
+ auto _testarrayofstring2 = _o->testarrayofstring2.size() ? _fbb.CreateVectorOfStrings(_o->testarrayofstring2) : 0;
+ auto _testarrayofsortedstruct = _o->testarrayofsortedstruct.size() ? _fbb.CreateVectorOfStructs(_o->testarrayofsortedstruct) : 0;
+ auto _flex = _o->flex.size() ? _fbb.CreateVector(_o->flex) : 0;
+ auto _test5 = _o->test5.size() ? _fbb.CreateVectorOfStructs(_o->test5) : 0;
+ auto _vector_of_longs = _o->vector_of_longs.size() ? _fbb.CreateVector(_o->vector_of_longs) : 0;
+ auto _vector_of_doubles = _o->vector_of_doubles.size() ? _fbb.CreateVector(_o->vector_of_doubles) : 0;
+ auto _parent_namespace_test = _o->parent_namespace_test ? CreateInParentNamespace(_fbb, _o->parent_namespace_test.get(), _rehasher) : 0;
+ auto _vector_of_referrables = _o->vector_of_referrables.size() ? _fbb.CreateVector<flatbuffers::Offset<MyGame::Example::Referrable>> (_o->vector_of_referrables.size(), [](size_t i, _VectorArgs *__va) { return CreateReferrable(*__va->__fbb, __va->__o->vector_of_referrables[i].get(), __va->__rehasher); }, &_va ) : 0;
+ auto _single_weak_reference = _rehasher ? static_cast<uint64_t>((*_rehasher)(_o->single_weak_reference)) : 0;
+ auto _vector_of_weak_references = _o->vector_of_weak_references.size() ? _fbb.CreateVector<uint64_t>(_o->vector_of_weak_references.size(), [](size_t i, _VectorArgs *__va) { return __va->__rehasher ? static_cast<uint64_t>((*__va->__rehasher)(__va->__o->vector_of_weak_references[i])) : 0; }, &_va ) : 0;
+ auto _vector_of_strong_referrables = _o->vector_of_strong_referrables.size() ? _fbb.CreateVector<flatbuffers::Offset<MyGame::Example::Referrable>> (_o->vector_of_strong_referrables.size(), [](size_t i, _VectorArgs *__va) { return CreateReferrable(*__va->__fbb, __va->__o->vector_of_strong_referrables[i].get(), __va->__rehasher); }, &_va ) : 0;
+ auto _co_owning_reference = _rehasher ? static_cast<uint64_t>((*_rehasher)(_o->co_owning_reference)) : 0;
+ auto _vector_of_co_owning_references = _o->vector_of_co_owning_references.size() ? _fbb.CreateVector<uint64_t>(_o->vector_of_co_owning_references.size(), [](size_t i, _VectorArgs *__va) { return __va->__rehasher ? static_cast<uint64_t>((*__va->__rehasher)(__va->__o->vector_of_co_owning_references[i].get())) : 0; }, &_va ) : 0;
+ auto _non_owning_reference = _rehasher ? static_cast<uint64_t>((*_rehasher)(_o->non_owning_reference)) : 0;
+ auto _vector_of_non_owning_references = _o->vector_of_non_owning_references.size() ? _fbb.CreateVector<uint64_t>(_o->vector_of_non_owning_references.size(), [](size_t i, _VectorArgs *__va) { return __va->__rehasher ? static_cast<uint64_t>((*__va->__rehasher)(__va->__o->vector_of_non_owning_references[i])) : 0; }, &_va ) : 0;
+ auto _any_unique_type = _o->any_unique.type;
+ auto _any_unique = _o->any_unique.Pack(_fbb);
+ auto _any_ambiguous_type = _o->any_ambiguous.type;
+ auto _any_ambiguous = _o->any_ambiguous.Pack(_fbb);
+ auto _vector_of_enums = _o->vector_of_enums.size() ? _fbb.CreateVectorScalarCast<uint8_t>(flatbuffers::data(_o->vector_of_enums), _o->vector_of_enums.size()) : 0;
+ auto _signed_enum = _o->signed_enum;
+ auto _testrequirednestedflatbuffer = _o->testrequirednestedflatbuffer.size() ? _fbb.CreateVector(_o->testrequirednestedflatbuffer) : 0;
+ auto _scalar_key_sorted_tables = _o->scalar_key_sorted_tables.size() ? _fbb.CreateVector<flatbuffers::Offset<MyGame::Example::Stat>> (_o->scalar_key_sorted_tables.size(), [](size_t i, _VectorArgs *__va) { return CreateStat(*__va->__fbb, __va->__o->scalar_key_sorted_tables[i].get(), __va->__rehasher); }, &_va ) : 0;
+ auto _native_inline = &_o->native_inline;
+ auto _long_enum_non_enum_default = _o->long_enum_non_enum_default;
+ auto _long_enum_normal_default = _o->long_enum_normal_default;
+ return MyGame::Example::CreateMonster(
+ _fbb,
+ _pos,
+ _mana,
+ _hp,
+ _name,
+ _inventory,
+ _color,
+ _test_type,
+ _test,
+ _test4,
+ _testarrayofstring,
+ _testarrayoftables,
+ _enemy,
+ _testnestedflatbuffer,
+ _testempty,
+ _testbool,
+ _testhashs32_fnv1,
+ _testhashu32_fnv1,
+ _testhashs64_fnv1,
+ _testhashu64_fnv1,
+ _testhashs32_fnv1a,
+ _testhashu32_fnv1a,
+ _testhashs64_fnv1a,
+ _testhashu64_fnv1a,
+ _testarrayofbools,
+ _testf,
+ _testf2,
+ _testf3,
+ _testarrayofstring2,
+ _testarrayofsortedstruct,
+ _flex,
+ _test5,
+ _vector_of_longs,
+ _vector_of_doubles,
+ _parent_namespace_test,
+ _vector_of_referrables,
+ _single_weak_reference,
+ _vector_of_weak_references,
+ _vector_of_strong_referrables,
+ _co_owning_reference,
+ _vector_of_co_owning_references,
+ _non_owning_reference,
+ _vector_of_non_owning_references,
+ _any_unique_type,
+ _any_unique,
+ _any_ambiguous_type,
+ _any_ambiguous,
+ _vector_of_enums,
+ _signed_enum,
+ _testrequirednestedflatbuffer,
+ _scalar_key_sorted_tables,
+ _native_inline,
+ _long_enum_non_enum_default,
+ _long_enum_normal_default);
+}
+
+
+inline bool operator==(const TypeAliasesT &lhs, const TypeAliasesT &rhs) {
+ return
+ (lhs.i8 == rhs.i8) &&
+ (lhs.u8 == rhs.u8) &&
+ (lhs.i16 == rhs.i16) &&
+ (lhs.u16 == rhs.u16) &&
+ (lhs.i32 == rhs.i32) &&
+ (lhs.u32 == rhs.u32) &&
+ (lhs.i64 == rhs.i64) &&
+ (lhs.u64 == rhs.u64) &&
+ (lhs.f32 == rhs.f32) &&
+ (lhs.f64 == rhs.f64) &&
+ (lhs.v8 == rhs.v8) &&
+ (lhs.vf64 == rhs.vf64);
+}
+
+inline bool operator!=(const TypeAliasesT &lhs, const TypeAliasesT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline TypeAliasesT *TypeAliases::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<TypeAliasesT>(new TypeAliasesT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void TypeAliases::UnPackTo(TypeAliasesT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = i8(); _o->i8 = _e; }
+ { auto _e = u8(); _o->u8 = _e; }
+ { auto _e = i16(); _o->i16 = _e; }
+ { auto _e = u16(); _o->u16 = _e; }
+ { auto _e = i32(); _o->i32 = _e; }
+ { auto _e = u32(); _o->u32 = _e; }
+ { auto _e = i64(); _o->i64 = _e; }
+ { auto _e = u64(); _o->u64 = _e; }
+ { auto _e = f32(); _o->f32 = _e; }
+ { auto _e = f64(); _o->f64 = _e; }
+ { auto _e = v8(); if (_e) { _o->v8.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->v8.begin()); } }
+ { auto _e = vf64(); if (_e) { _o->vf64.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vf64[_i] = _e->Get(_i); } } else { _o->vf64.resize(0); } }
+}
+
+inline flatbuffers::Offset<TypeAliases> TypeAliases::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateTypeAliases(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<TypeAliases> CreateTypeAliases(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TypeAliasesT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _i8 = _o->i8;
+ auto _u8 = _o->u8;
+ auto _i16 = _o->i16;
+ auto _u16 = _o->u16;
+ auto _i32 = _o->i32;
+ auto _u32 = _o->u32;
+ auto _i64 = _o->i64;
+ auto _u64 = _o->u64;
+ auto _f32 = _o->f32;
+ auto _f64 = _o->f64;
+ auto _v8 = _o->v8.size() ? _fbb.CreateVector(_o->v8) : 0;
+ auto _vf64 = _o->vf64.size() ? _fbb.CreateVector(_o->vf64) : 0;
+ return MyGame::Example::CreateTypeAliases(
+ _fbb,
+ _i8,
+ _u8,
+ _i16,
+ _u16,
+ _i32,
+ _u32,
+ _i64,
+ _u64,
+ _f32,
+ _f64,
+ _v8,
+ _vf64);
+}
+
+inline bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type) {
+ switch (type) {
+ case Any_NONE: {
+ return true;
+ }
+ case Any_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case Any_TestSimpleTableWithEnum: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnum *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case Any_MyGame_Example2_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ default: return true;
+ }
+}
+
+inline bool VerifyAnyVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
+ if (!values || !types) return !values && !types;
+ if (values->size() != types->size()) return false;
+ for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
+ if (!VerifyAny(
+ verifier, values->Get(i), types->GetEnum<Any>(i))) {
+ return false;
+ }
+ }
+ return true;
+}
+
+inline void *AnyUnion::UnPack(const void *obj, Any type, const flatbuffers::resolver_function_t *resolver) {
+ (void)resolver;
+ switch (type) {
+ case Any_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case Any_TestSimpleTableWithEnum: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnum *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case Any_MyGame_Example2_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ default: return nullptr;
+ }
+}
+
+inline flatbuffers::Offset<void> AnyUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
+ (void)_rehasher;
+ switch (type) {
+ case Any_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ case Any_TestSimpleTableWithEnum: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(value);
+ return CreateTestSimpleTableWithEnum(_fbb, ptr, _rehasher).Union();
+ }
+ case Any_MyGame_Example2_Monster: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ default: return 0;
+ }
+}
+
+inline AnyUnion::AnyUnion(const AnyUnion &u) : type(u.type), value(nullptr) {
+ switch (type) {
+ case Any_Monster: {
+ value = new MyGame::Example::MonsterT(*reinterpret_cast<MyGame::Example::MonsterT *>(u.value));
+ break;
+ }
+ case Any_TestSimpleTableWithEnum: {
+ value = new MyGame::Example::TestSimpleTableWithEnumT(*reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(u.value));
+ break;
+ }
+ case Any_MyGame_Example2_Monster: {
+ value = new MyGame::Example2::MonsterT(*reinterpret_cast<MyGame::Example2::MonsterT *>(u.value));
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+inline void AnyUnion::Reset() {
+ switch (type) {
+ case Any_Monster: {
+ auto ptr = reinterpret_cast<MyGame::Example::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ case Any_TestSimpleTableWithEnum: {
+ auto ptr = reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(value);
+ delete ptr;
+ break;
+ }
+ case Any_MyGame_Example2_Monster: {
+ auto ptr = reinterpret_cast<MyGame::Example2::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ default: break;
+ }
+ value = nullptr;
+ type = Any_NONE;
+}
+
+inline bool VerifyAnyUniqueAliases(flatbuffers::Verifier &verifier, const void *obj, AnyUniqueAliases type) {
+ switch (type) {
+ case AnyUniqueAliases_NONE: {
+ return true;
+ }
+ case AnyUniqueAliases_M: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case AnyUniqueAliases_TS: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnum *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case AnyUniqueAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ default: return true;
+ }
+}
+
+inline bool VerifyAnyUniqueAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
+ if (!values || !types) return !values && !types;
+ if (values->size() != types->size()) return false;
+ for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
+ if (!VerifyAnyUniqueAliases(
+ verifier, values->Get(i), types->GetEnum<AnyUniqueAliases>(i))) {
+ return false;
+ }
+ }
+ return true;
+}
+
+inline void *AnyUniqueAliasesUnion::UnPack(const void *obj, AnyUniqueAliases type, const flatbuffers::resolver_function_t *resolver) {
+ (void)resolver;
+ switch (type) {
+ case AnyUniqueAliases_M: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case AnyUniqueAliases_TS: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnum *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case AnyUniqueAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ default: return nullptr;
+ }
+}
+
+inline flatbuffers::Offset<void> AnyUniqueAliasesUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
+ (void)_rehasher;
+ switch (type) {
+ case AnyUniqueAliases_M: {
+ auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ case AnyUniqueAliases_TS: {
+ auto ptr = reinterpret_cast<const MyGame::Example::TestSimpleTableWithEnumT *>(value);
+ return CreateTestSimpleTableWithEnum(_fbb, ptr, _rehasher).Union();
+ }
+ case AnyUniqueAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example2::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ default: return 0;
+ }
+}
+
+inline AnyUniqueAliasesUnion::AnyUniqueAliasesUnion(const AnyUniqueAliasesUnion &u) : type(u.type), value(nullptr) {
+ switch (type) {
+ case AnyUniqueAliases_M: {
+ value = new MyGame::Example::MonsterT(*reinterpret_cast<MyGame::Example::MonsterT *>(u.value));
+ break;
+ }
+ case AnyUniqueAliases_TS: {
+ value = new MyGame::Example::TestSimpleTableWithEnumT(*reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(u.value));
+ break;
+ }
+ case AnyUniqueAliases_M2: {
+ value = new MyGame::Example2::MonsterT(*reinterpret_cast<MyGame::Example2::MonsterT *>(u.value));
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+inline void AnyUniqueAliasesUnion::Reset() {
+ switch (type) {
+ case AnyUniqueAliases_M: {
+ auto ptr = reinterpret_cast<MyGame::Example::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ case AnyUniqueAliases_TS: {
+ auto ptr = reinterpret_cast<MyGame::Example::TestSimpleTableWithEnumT *>(value);
+ delete ptr;
+ break;
+ }
+ case AnyUniqueAliases_M2: {
+ auto ptr = reinterpret_cast<MyGame::Example2::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ default: break;
+ }
+ value = nullptr;
+ type = AnyUniqueAliases_NONE;
+}
+
+inline bool VerifyAnyAmbiguousAliases(flatbuffers::Verifier &verifier, const void *obj, AnyAmbiguousAliases type) {
+ switch (type) {
+ case AnyAmbiguousAliases_NONE: {
+ return true;
+ }
+ case AnyAmbiguousAliases_M1: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case AnyAmbiguousAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ case AnyAmbiguousAliases_M3: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return verifier.VerifyTable(ptr);
+ }
+ default: return true;
+ }
+}
+
+inline bool VerifyAnyAmbiguousAliasesVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector<flatbuffers::Offset<void>> *values, const flatbuffers::Vector<uint8_t> *types) {
+ if (!values || !types) return !values && !types;
+ if (values->size() != types->size()) return false;
+ for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) {
+ if (!VerifyAnyAmbiguousAliases(
+ verifier, values->Get(i), types->GetEnum<AnyAmbiguousAliases>(i))) {
+ return false;
+ }
+ }
+ return true;
+}
+
+inline void *AnyAmbiguousAliasesUnion::UnPack(const void *obj, AnyAmbiguousAliases type, const flatbuffers::resolver_function_t *resolver) {
+ (void)resolver;
+ switch (type) {
+ case AnyAmbiguousAliases_M1: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case AnyAmbiguousAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ case AnyAmbiguousAliases_M3: {
+ auto ptr = reinterpret_cast<const MyGame::Example::Monster *>(obj);
+ return ptr->UnPack(resolver);
+ }
+ default: return nullptr;
+ }
+}
+
+inline flatbuffers::Offset<void> AnyAmbiguousAliasesUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const {
+ (void)_rehasher;
+ switch (type) {
+ case AnyAmbiguousAliases_M1: {
+ auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ case AnyAmbiguousAliases_M2: {
+ auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ case AnyAmbiguousAliases_M3: {
+ auto ptr = reinterpret_cast<const MyGame::Example::MonsterT *>(value);
+ return CreateMonster(_fbb, ptr, _rehasher).Union();
+ }
+ default: return 0;
+ }
+}
+
+inline AnyAmbiguousAliasesUnion::AnyAmbiguousAliasesUnion(const AnyAmbiguousAliasesUnion &u) : type(u.type), value(nullptr) {
+ switch (type) {
+ case AnyAmbiguousAliases_M1: {
+ value = new MyGame::Example::MonsterT(*reinterpret_cast<MyGame::Example::MonsterT *>(u.value));
+ break;
+ }
+ case AnyAmbiguousAliases_M2: {
+ value = new MyGame::Example::MonsterT(*reinterpret_cast<MyGame::Example::MonsterT *>(u.value));
+ break;
+ }
+ case AnyAmbiguousAliases_M3: {
+ value = new MyGame::Example::MonsterT(*reinterpret_cast<MyGame::Example::MonsterT *>(u.value));
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+inline void AnyAmbiguousAliasesUnion::Reset() {
+ switch (type) {
+ case AnyAmbiguousAliases_M1: {
+ auto ptr = reinterpret_cast<MyGame::Example::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ case AnyAmbiguousAliases_M2: {
+ auto ptr = reinterpret_cast<MyGame::Example::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ case AnyAmbiguousAliases_M3: {
+ auto ptr = reinterpret_cast<MyGame::Example::MonsterT *>(value);
+ delete ptr;
+ break;
+ }
+ default: break;
+ }
+ value = nullptr;
+ type = AnyAmbiguousAliases_NONE;
+}
+
+inline const flatbuffers::TypeTable *ColorTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_UCHAR, 0, 0 },
+ { flatbuffers::ET_UCHAR, 0, 0 },
+ { flatbuffers::ET_UCHAR, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::ColorTypeTable
+ };
+ static const int64_t values[] = { 1, 2, 8 };
+ static const char * const names[] = {
+ "Red",
+ "Green",
+ "Blue"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *RaceTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_CHAR, 0, 0 },
+ { flatbuffers::ET_CHAR, 0, 0 },
+ { flatbuffers::ET_CHAR, 0, 0 },
+ { flatbuffers::ET_CHAR, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::RaceTypeTable
+ };
+ static const int64_t values[] = { -1, 0, 1, 2 };
+ static const char * const names[] = {
+ "None",
+ "Human",
+ "Dwarf",
+ "Elf"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_ENUM, 4, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *LongEnumTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_ULONG, 0, 0 },
+ { flatbuffers::ET_ULONG, 0, 0 },
+ { flatbuffers::ET_ULONG, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::LongEnumTypeTable
+ };
+ static const int64_t values[] = { 2ULL, 4ULL, 1099511627776ULL };
+ static const char * const names[] = {
+ "LongOne",
+ "LongTwo",
+ "LongBig"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *AnyTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 1 },
+ { flatbuffers::ET_SEQUENCE, 0, 2 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::MonsterTypeTable,
+ MyGame::Example::TestSimpleTableWithEnumTypeTable,
+ MyGame::Example2::MonsterTypeTable
+ };
+ static const char * const names[] = {
+ "NONE",
+ "Monster",
+ "TestSimpleTableWithEnum",
+ "MyGame_Example2_Monster"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_UNION, 4, type_codes, type_refs, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *AnyUniqueAliasesTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 1 },
+ { flatbuffers::ET_SEQUENCE, 0, 2 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::MonsterTypeTable,
+ MyGame::Example::TestSimpleTableWithEnumTypeTable,
+ MyGame::Example2::MonsterTypeTable
+ };
+ static const char * const names[] = {
+ "NONE",
+ "M",
+ "TS",
+ "M2"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_UNION, 4, type_codes, type_refs, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *AnyAmbiguousAliasesTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::MonsterTypeTable
+ };
+ static const char * const names[] = {
+ "NONE",
+ "M1",
+ "M2",
+ "M3"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_UNION, 4, type_codes, type_refs, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+} // namespace Example
+
+inline const flatbuffers::TypeTable *InParentNamespaceTypeTable() {
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 0, nullptr, nullptr, nullptr, nullptr, nullptr
+ };
+ return &tt;
+}
+
+namespace Example2 {
+
+inline const flatbuffers::TypeTable *MonsterTypeTable() {
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 0, nullptr, nullptr, nullptr, nullptr, nullptr
+ };
+ return &tt;
+}
+
+} // namespace Example2
+
+namespace Example {
+
+inline const flatbuffers::TypeTable *TestTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SHORT, 0, -1 },
+ { flatbuffers::ET_CHAR, 0, -1 }
+ };
+ static const int64_t values[] = { 0, 2, 4 };
+ static const char * const names[] = {
+ "a",
+ "b"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 2, type_codes, nullptr, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *TestSimpleTableWithEnumTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_UCHAR, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::ColorTypeTable
+ };
+ static const char * const names[] = {
+ "color"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 1, type_codes, type_refs, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *Vec3TypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_DOUBLE, 0, -1 },
+ { flatbuffers::ET_UCHAR, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 1 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::ColorTypeTable,
+ MyGame::Example::TestTypeTable
+ };
+ static const int64_t values[] = { 0, 4, 8, 16, 24, 26, 32 };
+ static const char * const names[] = {
+ "x",
+ "y",
+ "z",
+ "test1",
+ "test2",
+ "test3"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 6, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *AbilityTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_UINT, 0, -1 },
+ { flatbuffers::ET_UINT, 0, -1 }
+ };
+ static const int64_t values[] = { 0, 4, 8 };
+ static const char * const names[] = {
+ "id",
+ "distance"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 2, type_codes, nullptr, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *StructOfStructsTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SEQUENCE, 0, 1 },
+ { flatbuffers::ET_SEQUENCE, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::AbilityTypeTable,
+ MyGame::Example::TestTypeTable
+ };
+ static const int64_t values[] = { 0, 8, 12, 20 };
+ static const char * const names[] = {
+ "a",
+ "b",
+ "c"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 3, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *StructOfStructsOfStructsTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::StructOfStructsTypeTable
+ };
+ static const int64_t values[] = { 0, 20 };
+ static const char * const names[] = {
+ "a"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_STRUCT, 1, type_codes, type_refs, nullptr, values, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *StatTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_STRING, 0, -1 },
+ { flatbuffers::ET_LONG, 0, -1 },
+ { flatbuffers::ET_USHORT, 0, -1 }
+ };
+ static const char * const names[] = {
+ "id",
+ "val",
+ "count"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 3, type_codes, nullptr, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *ReferrableTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_ULONG, 0, -1 }
+ };
+ static const char * const names[] = {
+ "id"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 1, type_codes, nullptr, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *MonsterTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 0, 0 },
+ { flatbuffers::ET_SHORT, 0, -1 },
+ { flatbuffers::ET_SHORT, 0, -1 },
+ { flatbuffers::ET_STRING, 0, -1 },
+ { flatbuffers::ET_BOOL, 0, -1 },
+ { flatbuffers::ET_UCHAR, 1, -1 },
+ { flatbuffers::ET_UCHAR, 0, 1 },
+ { flatbuffers::ET_UTYPE, 0, 2 },
+ { flatbuffers::ET_SEQUENCE, 0, 2 },
+ { flatbuffers::ET_SEQUENCE, 1, 3 },
+ { flatbuffers::ET_STRING, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 1, 4 },
+ { flatbuffers::ET_SEQUENCE, 0, 4 },
+ { flatbuffers::ET_UCHAR, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 5 },
+ { flatbuffers::ET_BOOL, 0, -1 },
+ { flatbuffers::ET_INT, 0, -1 },
+ { flatbuffers::ET_UINT, 0, -1 },
+ { flatbuffers::ET_LONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_INT, 0, -1 },
+ { flatbuffers::ET_UINT, 0, -1 },
+ { flatbuffers::ET_LONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_BOOL, 1, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_STRING, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 1, 6 },
+ { flatbuffers::ET_UCHAR, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 1, 3 },
+ { flatbuffers::ET_LONG, 1, -1 },
+ { flatbuffers::ET_DOUBLE, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 0, 7 },
+ { flatbuffers::ET_SEQUENCE, 1, 8 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 1, 8 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 1, -1 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 1, -1 },
+ { flatbuffers::ET_UTYPE, 0, 9 },
+ { flatbuffers::ET_SEQUENCE, 0, 9 },
+ { flatbuffers::ET_UTYPE, 0, 10 },
+ { flatbuffers::ET_SEQUENCE, 0, 10 },
+ { flatbuffers::ET_UCHAR, 1, 1 },
+ { flatbuffers::ET_CHAR, 0, 11 },
+ { flatbuffers::ET_UCHAR, 1, -1 },
+ { flatbuffers::ET_SEQUENCE, 1, 5 },
+ { flatbuffers::ET_SEQUENCE, 0, 3 },
+ { flatbuffers::ET_ULONG, 0, 12 },
+ { flatbuffers::ET_ULONG, 0, 12 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ MyGame::Example::Vec3TypeTable,
+ MyGame::Example::ColorTypeTable,
+ MyGame::Example::AnyTypeTable,
+ MyGame::Example::TestTypeTable,
+ MyGame::Example::MonsterTypeTable,
+ MyGame::Example::StatTypeTable,
+ MyGame::Example::AbilityTypeTable,
+ MyGame::InParentNamespaceTypeTable,
+ MyGame::Example::ReferrableTypeTable,
+ MyGame::Example::AnyUniqueAliasesTypeTable,
+ MyGame::Example::AnyAmbiguousAliasesTypeTable,
+ MyGame::Example::RaceTypeTable,
+ MyGame::Example::LongEnumTypeTable
+ };
+ static const char * const names[] = {
+ "pos",
+ "mana",
+ "hp",
+ "name",
+ "friendly",
+ "inventory",
+ "color",
+ "test_type",
+ "test",
+ "test4",
+ "testarrayofstring",
+ "testarrayoftables",
+ "enemy",
+ "testnestedflatbuffer",
+ "testempty",
+ "testbool",
+ "testhashs32_fnv1",
+ "testhashu32_fnv1",
+ "testhashs64_fnv1",
+ "testhashu64_fnv1",
+ "testhashs32_fnv1a",
+ "testhashu32_fnv1a",
+ "testhashs64_fnv1a",
+ "testhashu64_fnv1a",
+ "testarrayofbools",
+ "testf",
+ "testf2",
+ "testf3",
+ "testarrayofstring2",
+ "testarrayofsortedstruct",
+ "flex",
+ "test5",
+ "vector_of_longs",
+ "vector_of_doubles",
+ "parent_namespace_test",
+ "vector_of_referrables",
+ "single_weak_reference",
+ "vector_of_weak_references",
+ "vector_of_strong_referrables",
+ "co_owning_reference",
+ "vector_of_co_owning_references",
+ "non_owning_reference",
+ "vector_of_non_owning_references",
+ "any_unique_type",
+ "any_unique",
+ "any_ambiguous_type",
+ "any_ambiguous",
+ "vector_of_enums",
+ "signed_enum",
+ "testrequirednestedflatbuffer",
+ "scalar_key_sorted_tables",
+ "native_inline",
+ "long_enum_non_enum_default",
+ "long_enum_normal_default"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 54, type_codes, type_refs, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *TypeAliasesTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_CHAR, 0, -1 },
+ { flatbuffers::ET_UCHAR, 0, -1 },
+ { flatbuffers::ET_SHORT, 0, -1 },
+ { flatbuffers::ET_USHORT, 0, -1 },
+ { flatbuffers::ET_INT, 0, -1 },
+ { flatbuffers::ET_UINT, 0, -1 },
+ { flatbuffers::ET_LONG, 0, -1 },
+ { flatbuffers::ET_ULONG, 0, -1 },
+ { flatbuffers::ET_FLOAT, 0, -1 },
+ { flatbuffers::ET_DOUBLE, 0, -1 },
+ { flatbuffers::ET_CHAR, 1, -1 },
+ { flatbuffers::ET_DOUBLE, 1, -1 }
+ };
+ static const char * const names[] = {
+ "i8",
+ "u8",
+ "i16",
+ "u16",
+ "i32",
+ "u32",
+ "i64",
+ "u64",
+ "f32",
+ "f64",
+ "v8",
+ "vf64"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 12, type_codes, nullptr, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const MyGame::Example::Monster *GetMonster(const void *buf) {
+ return flatbuffers::GetRoot<MyGame::Example::Monster>(buf);
+}
+
+inline const MyGame::Example::Monster *GetSizePrefixedMonster(const void *buf) {
+ return flatbuffers::GetSizePrefixedRoot<MyGame::Example::Monster>(buf);
+}
+
+inline Monster *GetMutableMonster(void *buf) {
+ return flatbuffers::GetMutableRoot<Monster>(buf);
+}
+
+inline MyGame::Example::Monster *GetMutableSizePrefixedMonster(void *buf) {
+ return flatbuffers::GetMutableSizePrefixedRoot<MyGame::Example::Monster>(buf);
+}
+
+inline const char *MonsterIdentifier() {
+ return "MONS";
+}
+
+inline bool MonsterBufferHasIdentifier(const void *buf) {
+ return flatbuffers::BufferHasIdentifier(
+ buf, MonsterIdentifier());
+}
+
+inline bool SizePrefixedMonsterBufferHasIdentifier(const void *buf) {
+ return flatbuffers::BufferHasIdentifier(
+ buf, MonsterIdentifier(), true);
+}
+
+inline bool VerifyMonsterBuffer(
+ flatbuffers::Verifier &verifier) {
+ return verifier.VerifyBuffer<MyGame::Example::Monster>(MonsterIdentifier());
+}
+
+inline bool VerifySizePrefixedMonsterBuffer(
+ flatbuffers::Verifier &verifier) {
+ return verifier.VerifySizePrefixedBuffer<MyGame::Example::Monster>(MonsterIdentifier());
+}
+
+inline const char *MonsterExtension() {
+ return "mon";
+}
+
+inline void FinishMonsterBuffer(
+ flatbuffers::FlatBufferBuilder &fbb,
+ flatbuffers::Offset<MyGame::Example::Monster> root) {
+ fbb.Finish(root, MonsterIdentifier());
+}
+
+inline void FinishSizePrefixedMonsterBuffer(
+ flatbuffers::FlatBufferBuilder &fbb,
+ flatbuffers::Offset<MyGame::Example::Monster> root) {
+ fbb.FinishSizePrefixed(root, MonsterIdentifier());
+}
+
+inline flatbuffers::unique_ptr<MyGame::Example::MonsterT> UnPackMonster(
+ const void *buf,
+ const flatbuffers::resolver_function_t *res = nullptr) {
+ return flatbuffers::unique_ptr<MyGame::Example::MonsterT>(GetMonster(buf)->UnPack(res));
+}
+
+inline flatbuffers::unique_ptr<MyGame::Example::MonsterT> UnPackSizePrefixedMonster(
+ const void *buf,
+ const flatbuffers::resolver_function_t *res = nullptr) {
+ return flatbuffers::unique_ptr<MyGame::Example::MonsterT>(GetSizePrefixedMonster(buf)->UnPack(res));
+}
+
+} // namespace Example
+} // namespace MyGame
+
+#endif // FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_H_
diff --git a/tests/monsterdata_test.afb b/tests/monsterdata_test.afb
new file mode 100644
index 0000000..8e3c00f
--- /dev/null
+++ b/tests/monsterdata_test.afb
@@ -0,0 +1,276 @@
+// Annotated Flatbuffer Binary
+//
+// Schema file: monster_test.fbs
+// Binary file: monsterdata_test.mon
+
+header:
+ +0x0000 | 78 00 00 00 | UOffset32 | 0x00000078 (120) Loc: +0x0078 | offset to root table `MyGame.Example.Monster`
+ +0x0004 | 4D 4F 4E 53 | char[4] | MONS | File Identifier
+
+padding:
+ +0x0008 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vtable (MyGame.Example.Monster):
+ +0x000C | 6C 00 | uint16_t | 0x006C (108) | size of this vtable
+ +0x000E | 94 00 | uint16_t | 0x0094 (148) | size of referring table
+ +0x0010 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `pos` (id: 0)
+ +0x0012 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `mana` (id: 1) <defaults to 150> (Short)
+ +0x0014 | 06 00 | VOffset16 | 0x0006 (6) | offset to field `hp` (id: 2)
+ +0x0016 | 2C 00 | VOffset16 | 0x002C (44) | offset to field `name` (id: 3)
+ +0x0018 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `friendly` (id: 4) <defaults to 0> (Bool)
+ +0x001A | 30 00 | VOffset16 | 0x0030 (48) | offset to field `inventory` (id: 5)
+ +0x001C | 00 00 | VOffset16 | 0x0000 (0) | offset to field `color` (id: 6) <defaults to 8> (UByte)
+ +0x001E | 04 00 | VOffset16 | 0x0004 (4) | offset to field `test_type` (id: 7)
+ +0x0020 | 34 00 | VOffset16 | 0x0034 (52) | offset to field `test` (id: 8)
+ +0x0022 | 38 00 | VOffset16 | 0x0038 (56) | offset to field `test4` (id: 9)
+ +0x0024 | 3C 00 | VOffset16 | 0x003C (60) | offset to field `testarrayofstring` (id: 10)
+ +0x0026 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `testarrayoftables` (id: 11) <null> (Vector)
+ +0x0028 | 40 00 | VOffset16 | 0x0040 (64) | offset to field `enemy` (id: 12)
+ +0x002A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `testnestedflatbuffer` (id: 13) <null> (Vector)
+ +0x002C | 00 00 | VOffset16 | 0x0000 (0) | offset to field `testempty` (id: 14) <null> (Obj)
+ +0x002E | 05 00 | VOffset16 | 0x0005 (5) | offset to field `testbool` (id: 15)
+ +0x0030 | 44 00 | VOffset16 | 0x0044 (68) | offset to field `testhashs32_fnv1` (id: 16)
+ +0x0032 | 48 00 | VOffset16 | 0x0048 (72) | offset to field `testhashu32_fnv1` (id: 17)
+ +0x0034 | 70 00 | VOffset16 | 0x0070 (112) | offset to field `testhashs64_fnv1` (id: 18)
+ +0x0036 | 78 00 | VOffset16 | 0x0078 (120) | offset to field `testhashu64_fnv1` (id: 19)
+ +0x0038 | 4C 00 | VOffset16 | 0x004C (76) | offset to field `testhashs32_fnv1a` (id: 20)
+ +0x003A | 50 00 | VOffset16 | 0x0050 (80) | offset to field `testhashu32_fnv1a` (id: 21)
+ +0x003C | 80 00 | VOffset16 | 0x0080 (128) | offset to field `testhashs64_fnv1a` (id: 22)
+ +0x003E | 88 00 | VOffset16 | 0x0088 (136) | offset to field `testhashu64_fnv1a` (id: 23)
+ +0x0040 | 54 00 | VOffset16 | 0x0054 (84) | offset to field `testarrayofbools` (id: 24)
+ +0x0042 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `testf` (id: 25) <defaults to 3.141590> (Float)
+ +0x0044 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `testf2` (id: 26) <defaults to 3.000000> (Float)
+ +0x0046 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `testf3` (id: 27) <defaults to 0.000000> (Float)
+ +0x0048 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `testarrayofstring2` (id: 28) <null> (Vector)
+ +0x004A | 58 00 | VOffset16 | 0x0058 (88) | offset to field `testarrayofsortedstruct` (id: 29)
+ +0x004C | 00 00 | VOffset16 | 0x0000 (0) | offset to field `flex` (id: 30) <null> (Vector)
+ +0x004E | 5C 00 | VOffset16 | 0x005C (92) | offset to field `test5` (id: 31)
+ +0x0050 | 60 00 | VOffset16 | 0x0060 (96) | offset to field `vector_of_longs` (id: 32)
+ +0x0052 | 64 00 | VOffset16 | 0x0064 (100) | offset to field `vector_of_doubles` (id: 33)
+ +0x0054 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `parent_namespace_test` (id: 34) <null> (Obj)
+ +0x0056 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `vector_of_referrables` (id: 35) <null> (Vector)
+ +0x0058 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `single_weak_reference` (id: 36) <defaults to 0> (ULong)
+ +0x005A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `vector_of_weak_references` (id: 37) <null> (Vector)
+ +0x005C | 00 00 | VOffset16 | 0x0000 (0) | offset to field `vector_of_strong_referrables` (id: 38) <null> (Vector)
+ +0x005E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `co_owning_reference` (id: 39) <defaults to 0> (ULong)
+ +0x0060 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `vector_of_co_owning_references` (id: 40) <null> (Vector)
+ +0x0062 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `non_owning_reference` (id: 41) <defaults to 0> (ULong)
+ +0x0064 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `vector_of_non_owning_references` (id: 42) <null> (Vector)
+ +0x0066 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `any_unique_type` (id: 43) <defaults to 0> (UType)
+ +0x0068 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `any_unique` (id: 44) <null> (Union)
+ +0x006A | 00 00 | VOffset16 | 0x0000 (0) | offset to field `any_ambiguous_type` (id: 45) <defaults to 0> (UType)
+ +0x006C | 00 00 | VOffset16 | 0x0000 (0) | offset to field `any_ambiguous` (id: 46) <null> (Union)
+ +0x006E | 00 00 | VOffset16 | 0x0000 (0) | offset to field `vector_of_enums` (id: 47) <null> (Vector)
+ +0x0070 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `signed_enum` (id: 48) <defaults to -1> (Byte)
+ +0x0072 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `testrequirednestedflatbuffer` (id: 49) <null> (Vector)
+ +0x0074 | 68 00 | VOffset16 | 0x0068 (104) | offset to field `scalar_key_sorted_tables` (id: 50)
+ +0x0076 | 6C 00 | VOffset16 | 0x006C (108) | offset to field `native_inline` (id: 51)
+
+root_table (MyGame.Example.Monster):
+ +0x0078 | 6C 00 00 00 | SOffset32 | 0x0000006C (108) Loc: +0x000C | offset to vtable
+ +0x007C | 01 | UType8 | 0x01 (1) | table field `test_type` (UType)
+ +0x007D | 01 | uint8_t | 0x01 (1) | table field `testbool` (Bool)
+ +0x007E | 50 00 | int16_t | 0x0050 (80) | table field `hp` (Short)
+ +0x0080 | 00 00 80 3F | float | 0x3F800000 (1) | struct field `MyGame.Example.Vec3.x` (Float)
+ +0x0084 | 00 00 00 40 | float | 0x40000000 (2) | struct field `MyGame.Example.Vec3.y` (Float)
+ +0x0088 | 00 00 40 40 | float | 0x40400000 (3) | struct field `MyGame.Example.Vec3.z` (Float)
+ +0x008C | 00 00 00 00 | uint8_t[4] | .... | padding
+ +0x0090 | 00 00 00 00 00 00 08 40 | double | 0x4008000000000000 (3) | struct field `MyGame.Example.Vec3.test1` (Double)
+ +0x0098 | 02 | uint8_t | 0x02 (2) | struct field `MyGame.Example.Vec3.test2` (UByte)
+ +0x0099 | 00 | uint8_t[1] | . | padding
+ +0x009A | 05 00 | int16_t | 0x0005 (5) | struct field `MyGame.Example.Test.a` (Short)
+ +0x009C | 06 | uint8_t | 0x06 (6) | struct field `MyGame.Example.Test.b` (Byte)
+ +0x009D | 00 | uint8_t[1] | . | padding
+ +0x009E | 00 00 | uint8_t[2] | .. | padding
+ +0x00A0 | 00 00 00 00 | uint8_t[4] | .... | padding
+ +0x00A4 | A4 01 00 00 | UOffset32 | 0x000001A4 (420) Loc: +0x0248 | offset to field `name` (string)
+ +0x00A8 | 94 01 00 00 | UOffset32 | 0x00000194 (404) Loc: +0x023C | offset to field `inventory` (vector)
+ +0x00AC | 2C 01 00 00 | UOffset32 | 0x0000012C (300) Loc: +0x01D8 | offset to field `test` (union of type `Monster`)
+ +0x00B0 | 10 01 00 00 | UOffset32 | 0x00000110 (272) Loc: +0x01C0 | offset to field `test4` (vector)
+ +0x00B4 | DC 00 00 00 | UOffset32 | 0x000000DC (220) Loc: +0x0190 | offset to field `testarrayofstring` (vector)
+ +0x00B8 | C4 00 00 00 | UOffset32 | 0x000000C4 (196) Loc: +0x017C | offset to field `enemy` (table)
+ +0x00BC | 41 C9 79 DD | uint32_t | 0xDD79C941 (3715746113) | table field `testhashs32_fnv1` (Int)
+ +0x00C0 | 41 C9 79 DD | uint32_t | 0xDD79C941 (3715746113) | table field `testhashu32_fnv1` (UInt)
+ +0x00C4 | 71 A4 81 8E | uint32_t | 0x8E81A471 (2390860913) | table field `testhashs32_fnv1a` (Int)
+ +0x00C8 | 71 A4 81 8E | uint32_t | 0x8E81A471 (2390860913) | table field `testhashu32_fnv1a` (UInt)
+ +0x00CC | A8 00 00 00 | UOffset32 | 0x000000A8 (168) Loc: +0x0174 | offset to field `testarrayofbools` (vector)
+ +0x00D0 | 88 00 00 00 | UOffset32 | 0x00000088 (136) Loc: +0x0158 | offset to field `testarrayofsortedstruct` (vector)
+ +0x00D4 | E0 00 00 00 | UOffset32 | 0x000000E0 (224) Loc: +0x01B4 | offset to field `test5` (vector)
+ +0x00D8 | 34 01 00 00 | UOffset32 | 0x00000134 (308) Loc: +0x020C | offset to field `vector_of_longs` (vector)
+ +0x00DC | 10 01 00 00 | UOffset32 | 0x00000110 (272) Loc: +0x01EC | offset to field `vector_of_doubles` (vector)
+ +0x00E0 | 2C 00 00 00 | UOffset32 | 0x0000002C (44) Loc: +0x010C | offset to field `scalar_key_sorted_tables` (vector)
+ +0x00E4 | 01 00 | int16_t | 0x0001 (1) | struct field `MyGame.Example.Test.a` (Short)
+ +0x00E6 | 02 | uint8_t | 0x02 (2) | struct field `MyGame.Example.Test.b` (Byte)
+ +0x00E7 | 00 | uint8_t[1] | . | padding
+ +0x00E8 | 81 91 7B F2 CD 80 0F 6E | int64_t | 0x6E0F80CDF27B9181 (7930699090847568257) | table field `testhashs64_fnv1` (Long)
+ +0x00F0 | 81 91 7B F2 CD 80 0F 6E | uint64_t | 0x6E0F80CDF27B9181 (7930699090847568257) | table field `testhashu64_fnv1` (ULong)
+ +0x00F8 | F1 DD 67 C7 DC 48 F9 43 | int64_t | 0x43F948DCC767DDF1 (4898026182817603057) | table field `testhashs64_fnv1a` (Long)
+ +0x0100 | F1 DD 67 C7 DC 48 F9 43 | uint64_t | 0x43F948DCC767DDF1 (4898026182817603057) | table field `testhashu64_fnv1a` (ULong)
+ +0x0108 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (MyGame.Example.Monster.scalar_key_sorted_tables):
+ +0x010C | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x0110 | 10 00 00 00 | UOffset32 | 0x00000010 (16) Loc: +0x0120 | offset to table[0]
+ +0x0114 | 28 00 00 00 | UOffset32 | 0x00000028 (40) Loc: +0x013C | offset to table[1]
+
+padding:
+ +0x0118 | 00 00 | uint8_t[2] | .. | padding
+
+vtable (MyGame.Example.Stat):
+ +0x011A | 06 00 | uint16_t | 0x0006 (6) | size of this vtable
+ +0x011C | 08 00 | uint16_t | 0x0008 (8) | size of referring table
+ +0x011E | 04 00 | VOffset16 | 0x0004 (4) | offset to field `id` (id: 0)
+
+table (MyGame.Example.Stat):
+ +0x0120 | 06 00 00 00 | SOffset32 | 0x00000006 (6) Loc: +0x011A | offset to vtable
+ +0x0124 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0128 | offset to field `id` (string)
+
+string (MyGame.Example.Stat.id):
+ +0x0128 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x012C | 6D 69 73 73 | char[4] | miss | string literal
+ +0x0130 | 00 | char | 0x00 (0) | string terminator
+
+vtable (MyGame.Example.Stat):
+ +0x0132 | 0A 00 | uint16_t | 0x000A (10) | size of this vtable
+ +0x0134 | 14 00 | uint16_t | 0x0014 (20) | size of referring table
+ +0x0136 | 08 00 | VOffset16 | 0x0008 (8) | offset to field `id` (id: 0)
+ +0x0138 | 0C 00 | VOffset16 | 0x000C (12) | offset to field `val` (id: 1)
+ +0x013A | 06 00 | VOffset16 | 0x0006 (6) | offset to field `count` (id: 2)
+
+table (MyGame.Example.Stat):
+ +0x013C | 0A 00 00 00 | SOffset32 | 0x0000000A (10) Loc: +0x0132 | offset to vtable
+ +0x0140 | 00 00 | uint8_t[2] | .. | padding
+ +0x0142 | 01 00 | uint16_t | 0x0001 (1) | table field `count` (UShort)
+ +0x0144 | 0C 00 00 00 | UOffset32 | 0x0000000C (12) Loc: +0x0150 | offset to field `id` (string)
+ +0x0148 | 0A 00 00 00 00 00 00 00 | int64_t | 0x000000000000000A (10) | table field `val` (Long)
+
+string (MyGame.Example.Stat.id):
+ +0x0150 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of string
+ +0x0154 | 68 69 74 | char[3] | hit | string literal
+ +0x0157 | 00 | char | 0x00 (0) | string terminator
+
+vector (MyGame.Example.Monster.testarrayofsortedstruct):
+ +0x0158 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x015C | 00 00 00 00 | uint32_t | 0x00000000 (0) | struct field `MyGame.Example.Ability.id` (UInt)
+ +0x0160 | 2D 00 00 00 | uint32_t | 0x0000002D (45) | struct field `MyGame.Example.Ability.distance` (UInt)
+ +0x0164 | 01 00 00 00 | uint32_t | 0x00000001 (1) | struct field `MyGame.Example.Ability.id` (UInt)
+ +0x0168 | 15 00 00 00 | uint32_t | 0x00000015 (21) | struct field `MyGame.Example.Ability.distance` (UInt)
+ +0x016C | 05 00 00 00 | uint32_t | 0x00000005 (5) | struct field `MyGame.Example.Ability.id` (UInt)
+ +0x0170 | 0C 00 00 00 | uint32_t | 0x0000000C (12) | struct field `MyGame.Example.Ability.distance` (UInt)
+
+vector (MyGame.Example.Monster.testarrayofbools):
+ +0x0174 | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x0178 | 01 | uint8_t | 0x01 (1) | value[0]
+ +0x0179 | 00 | uint8_t | 0x00 (0) | value[1]
+ +0x017A | 01 | uint8_t | 0x01 (1) | value[2]
+
+table (MyGame.Example.Monster):
+ +0x017C | B0 FF FF FF | SOffset32 | 0xFFFFFFB0 (-80) Loc: +0x01CC | offset to vtable
+ +0x0180 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x0184 | offset to field `name` (string)
+
+string (MyGame.Example.Monster.name):
+ +0x0184 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x0188 | 46 72 65 64 | char[4] | Fred | string literal
+ +0x018C | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x018D | 00 00 00 | uint8_t[3] | ... | padding
+
+vector (MyGame.Example.Monster.testarrayofstring):
+ +0x0190 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x0194 | 14 00 00 00 | UOffset32 | 0x00000014 (20) Loc: +0x01A8 | offset to string[0]
+ +0x0198 | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x019C | offset to string[1]
+
+string (MyGame.Example.Monster.testarrayofstring):
+ +0x019C | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x01A0 | 74 65 73 74 32 | char[5] | test2 | string literal
+ +0x01A5 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x01A6 | 00 00 | uint8_t[2] | .. | padding
+
+string (MyGame.Example.Monster.testarrayofstring):
+ +0x01A8 | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of string
+ +0x01AC | 74 65 73 74 31 | char[5] | test1 | string literal
+ +0x01B1 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x01B2 | 00 00 | uint8_t[2] | .. | padding
+
+vector (MyGame.Example.Monster.test5):
+ +0x01B4 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x01B8 | 0A 00 | int16_t | 0x000A (10) | struct field `MyGame.Example.Test.a` (Short)
+ +0x01BA | 14 | uint8_t | 0x14 (20) | struct field `MyGame.Example.Test.b` (Byte)
+ +0x01BB | 00 | uint8_t[1] | . | padding
+ +0x01BC | 1E 00 | int16_t | 0x001E (30) | struct field `MyGame.Example.Test.a` (Short)
+ +0x01BE | 28 | uint8_t | 0x28 (40) | struct field `MyGame.Example.Test.b` (Byte)
+ +0x01BF | 00 | uint8_t[1] | . | padding
+
+vector (MyGame.Example.Monster.test4):
+ +0x01C0 | 02 00 00 00 | uint32_t | 0x00000002 (2) | length of vector (# items)
+ +0x01C4 | 0A 00 | int16_t | 0x000A (10) | struct field `MyGame.Example.Test.a` (Short)
+ +0x01C6 | 14 | uint8_t | 0x14 (20) | struct field `MyGame.Example.Test.b` (Byte)
+ +0x01C7 | 00 | uint8_t[1] | . | padding
+ +0x01C8 | 1E 00 | int16_t | 0x001E (30) | struct field `MyGame.Example.Test.a` (Short)
+ +0x01CA | 28 | uint8_t | 0x28 (40) | struct field `MyGame.Example.Test.b` (Byte)
+ +0x01CB | 00 | uint8_t[1] | . | padding
+
+vtable (MyGame.Example.Monster):
+ +0x01CC | 0C 00 | uint16_t | 0x000C (12) | size of this vtable
+ +0x01CE | 08 00 | uint16_t | 0x0008 (8) | size of referring table
+ +0x01D0 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `pos` (id: 0) <null> (Obj)
+ +0x01D2 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `mana` (id: 1) <defaults to 150> (Short)
+ +0x01D4 | 00 00 | VOffset16 | 0x0000 (0) | offset to field `hp` (id: 2) <defaults to 100> (Short)
+ +0x01D6 | 04 00 | VOffset16 | 0x0004 (4) | offset to field `name` (id: 3)
+
+table (MyGame.Example.Monster):
+ +0x01D8 | 0C 00 00 00 | SOffset32 | 0x0000000C (12) Loc: +0x01CC | offset to vtable
+ +0x01DC | 04 00 00 00 | UOffset32 | 0x00000004 (4) Loc: +0x01E0 | offset to field `name` (string)
+
+string (MyGame.Example.Monster.name):
+ +0x01E0 | 04 00 00 00 | uint32_t | 0x00000004 (4) | length of string
+ +0x01E4 | 46 72 65 64 | char[4] | Fred | string literal
+ +0x01E8 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x01E9 | 00 00 00 | uint8_t[3] | ... | padding
+
+vector (MyGame.Example.Monster.vector_of_doubles):
+ +0x01EC | 03 00 00 00 | uint32_t | 0x00000003 (3) | length of vector (# items)
+ +0x01F0 | FF FF FF FF FF FF EF FF | double | 0xFFEFFFFFFFFFFFFF (-1.79769e+308) | value[0]
+ +0x01F8 | 00 00 00 00 00 00 00 00 | double | 0x0000000000000000 (0) | value[1]
+ +0x0200 | FF FF FF FF FF FF EF 7F | double | 0x7FEFFFFFFFFFFFFF (1.79769e+308) | value[2]
+
+padding:
+ +0x0208 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (MyGame.Example.Monster.vector_of_longs):
+ +0x020C | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of vector (# items)
+ +0x0210 | 01 00 00 00 00 00 00 00 | int64_t | 0x0000000000000001 (1) | value[0]
+ +0x0218 | 64 00 00 00 00 00 00 00 | int64_t | 0x0000000000000064 (100) | value[1]
+ +0x0220 | 10 27 00 00 00 00 00 00 | int64_t | 0x0000000000002710 (10000) | value[2]
+ +0x0228 | 40 42 0F 00 00 00 00 00 | int64_t | 0x00000000000F4240 (1000000) | value[3]
+ +0x0230 | 00 E1 F5 05 00 00 00 00 | int64_t | 0x0000000005F5E100 (100000000) | value[4]
+
+padding:
+ +0x0238 | 00 00 00 00 | uint8_t[4] | .... | padding
+
+vector (MyGame.Example.Monster.inventory):
+ +0x023C | 05 00 00 00 | uint32_t | 0x00000005 (5) | length of vector (# items)
+ +0x0240 | 00 | uint8_t | 0x00 (0) | value[0]
+ +0x0241 | 01 | uint8_t | 0x01 (1) | value[1]
+ +0x0242 | 02 | uint8_t | 0x02 (2) | value[2]
+ +0x0243 | 03 | uint8_t | 0x03 (3) | value[3]
+ +0x0244 | 04 | uint8_t | 0x04 (4) | value[4]
+
+padding:
+ +0x0245 | 00 00 00 | uint8_t[3] | ... | padding
+
+string (MyGame.Example.Monster.name):
+ +0x0248 | 09 00 00 00 | uint32_t | 0x00000009 (9) | length of string
+ +0x024C | 4D 79 4D 6F 6E 73 74 65 | char[9] | MyMonste | string literal
+ +0x0254 | 72 | | r
+ +0x0255 | 00 | char | 0x00 (0) | string terminator
+
+padding:
+ +0x0256 | 00 00 | uint8_t[2] | .. | padding
diff --git a/tests/more_defaults/abc_generated.rs b/tests/more_defaults/abc_generated.rs
index 8622d9b..f2bdbad 100644
--- a/tests/more_defaults/abc_generated.rs
+++ b/tests/more_defaults/abc_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
@@ -42,8 +47,8 @@
}
}
}
-impl std::fmt::Debug for ABC {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for ABC {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
diff --git a/tests/more_defaults/mod.rs b/tests/more_defaults/mod.rs
index 639f8ac..940204d 100644
--- a/tests/more_defaults/mod.rs
+++ b/tests/more_defaults/mod.rs
@@ -1,4 +1,5 @@
// Automatically generated by the Flatbuffers compiler. Do not modify.
+// @generated
mod abc_generated;
pub use self::abc_generated::*;
mod more_defaults_generated;
diff --git a/tests/more_defaults/more_defaults_generated.rs b/tests/more_defaults/more_defaults_generated.rs
index 0a88105..27fa65c 100644
--- a/tests/more_defaults/more_defaults_generated.rs
+++ b/tests/more_defaults/more_defaults_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum MoreDefaultsOffset {}
@@ -194,8 +199,8 @@
}
}
-impl std::fmt::Debug for MoreDefaults<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for MoreDefaults<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("MoreDefaults");
ds.field("ints", &self.ints());
ds.field("floats", &self.floats());
diff --git a/tests/my-game/example/ability.js b/tests/my-game/example/ability.js
index 9fea3d6..4d7d3db 100644
--- a/tests/my-game/example/ability.js
+++ b/tests/my-game/example/ability.js
@@ -24,7 +24,7 @@
return true;
}
static getFullyQualifiedName() {
- return 'MyGame.Example.Ability';
+ return 'MyGame_Example_Ability';
}
static sizeOf() {
return 8;
diff --git a/tests/my-game/example/ability.ts b/tests/my-game/example/ability.ts
index 26395fb..36b0eb8 100644
--- a/tests/my-game/example/ability.ts
+++ b/tests/my-game/example/ability.ts
@@ -7,7 +7,7 @@
export class Ability {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):Ability {
+ __init(i:number, bb:flatbuffers.ByteBuffer):Ability {
this.bb_pos = i;
this.bb = bb;
return this;
@@ -32,7 +32,7 @@
}
static getFullyQualifiedName():string {
- return 'MyGame.Example.Ability';
+ return 'MyGame_Example_Ability';
}
static sizeOf():number {
diff --git a/tests/my-game/example/any-ambiguous-aliases.ts b/tests/my-game/example/any-ambiguous-aliases.ts
index 6687a41..fb308fc 100644
--- a/tests/my-game/example/any-ambiguous-aliases.ts
+++ b/tests/my-game/example/any-ambiguous-aliases.ts
@@ -3,7 +3,7 @@
import { Monster, MonsterT } from '../../my-game/example/monster';
-export enum AnyAmbiguousAliases{
+export enum AnyAmbiguousAliases {
NONE = 0,
M1 = 1,
M2 = 2,
@@ -36,4 +36,3 @@
default: return null;
}
}
-
diff --git a/tests/my-game/example/any-unique-aliases.js b/tests/my-game/example/any-unique-aliases.js
index b5cc882..98e5597 100644
--- a/tests/my-game/example/any-unique-aliases.js
+++ b/tests/my-game/example/any-unique-aliases.js
@@ -1,5 +1,5 @@
// automatically generated by the FlatBuffers compiler, do not modify
-import { Monster as MyGameExample2Monster } from '../../my-game/example2/monster';
+import { Monster as MyGame_Example2_Monster } from '../../my-game/example2/monster';
import { Monster } from '../../my-game/example/monster';
import { TestSimpleTableWithEnum } from '../../my-game/example/test-simple-table-with-enum';
export var AnyUniqueAliases;
@@ -14,7 +14,7 @@
case 'NONE': return null;
case 'M': return accessor(new Monster());
case 'TS': return accessor(new TestSimpleTableWithEnum());
- case 'M2': return accessor(new MyGameExample2Monster());
+ case 'M2': return accessor(new MyGame_Example2_Monster());
default: return null;
}
}
@@ -23,7 +23,7 @@
case 'NONE': return null;
case 'M': return accessor(index, new Monster());
case 'TS': return accessor(index, new TestSimpleTableWithEnum());
- case 'M2': return accessor(index, new MyGameExample2Monster());
+ case 'M2': return accessor(index, new MyGame_Example2_Monster());
default: return null;
}
}
diff --git a/tests/my-game/example/any-unique-aliases.ts b/tests/my-game/example/any-unique-aliases.ts
index 5106148..7ca769f 100644
--- a/tests/my-game/example/any-unique-aliases.ts
+++ b/tests/my-game/example/any-unique-aliases.ts
@@ -1,11 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
-import { Monster as MyGameExample2Monster, MonsterT as MyGameExample2MonsterT } from '../../my-game/example2/monster';
+import { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from '../../my-game/example2/monster';
import { Monster, MonsterT } from '../../my-game/example/monster';
import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from '../../my-game/example/test-simple-table-with-enum';
-export enum AnyUniqueAliases{
+export enum AnyUniqueAliases {
NONE = 0,
M = 1,
TS = 2,
@@ -14,28 +14,27 @@
export function unionToAnyUniqueAliases(
type: AnyUniqueAliases,
- accessor: (obj:Monster|MyGameExample2Monster|TestSimpleTableWithEnum) => Monster|MyGameExample2Monster|TestSimpleTableWithEnum|null
-): Monster|MyGameExample2Monster|TestSimpleTableWithEnum|null {
+ accessor: (obj:Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum) => Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null
+): Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null {
switch(AnyUniqueAliases[type]) {
case 'NONE': return null;
case 'M': return accessor(new Monster())! as Monster;
case 'TS': return accessor(new TestSimpleTableWithEnum())! as TestSimpleTableWithEnum;
- case 'M2': return accessor(new MyGameExample2Monster())! as MyGameExample2Monster;
+ case 'M2': return accessor(new MyGame_Example2_Monster())! as MyGame_Example2_Monster;
default: return null;
}
}
export function unionListToAnyUniqueAliases(
type: AnyUniqueAliases,
- accessor: (index: number, obj:Monster|MyGameExample2Monster|TestSimpleTableWithEnum) => Monster|MyGameExample2Monster|TestSimpleTableWithEnum|null,
+ accessor: (index: number, obj:Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum) => Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null,
index: number
-): Monster|MyGameExample2Monster|TestSimpleTableWithEnum|null {
+): Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null {
switch(AnyUniqueAliases[type]) {
case 'NONE': return null;
case 'M': return accessor(index, new Monster())! as Monster;
case 'TS': return accessor(index, new TestSimpleTableWithEnum())! as TestSimpleTableWithEnum;
- case 'M2': return accessor(index, new MyGameExample2Monster())! as MyGameExample2Monster;
+ case 'M2': return accessor(index, new MyGame_Example2_Monster())! as MyGame_Example2_Monster;
default: return null;
}
}
-
diff --git a/tests/my-game/example/any.js b/tests/my-game/example/any.js
index 7349c07..47bfb25 100644
--- a/tests/my-game/example/any.js
+++ b/tests/my-game/example/any.js
@@ -1,5 +1,5 @@
// automatically generated by the FlatBuffers compiler, do not modify
-import { Monster as MyGameExample2Monster } from '../../my-game/example2/monster';
+import { Monster as MyGame_Example2_Monster } from '../../my-game/example2/monster';
import { Monster } from '../../my-game/example/monster';
import { TestSimpleTableWithEnum } from '../../my-game/example/test-simple-table-with-enum';
export var Any;
@@ -14,7 +14,7 @@
case 'NONE': return null;
case 'Monster': return accessor(new Monster());
case 'TestSimpleTableWithEnum': return accessor(new TestSimpleTableWithEnum());
- case 'MyGame_Example2_Monster': return accessor(new MyGameExample2Monster());
+ case 'MyGame_Example2_Monster': return accessor(new MyGame_Example2_Monster());
default: return null;
}
}
@@ -23,7 +23,7 @@
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 MyGameExample2Monster());
+ case 'MyGame_Example2_Monster': return accessor(index, new MyGame_Example2_Monster());
default: return null;
}
}
diff --git a/tests/my-game/example/any.ts b/tests/my-game/example/any.ts
index 9d8b2a6..f7bb94f 100644
--- a/tests/my-game/example/any.ts
+++ b/tests/my-game/example/any.ts
@@ -1,11 +1,11 @@
// automatically generated by the FlatBuffers compiler, do not modify
-import { Monster as MyGameExample2Monster, MonsterT as MyGameExample2MonsterT } from '../../my-game/example2/monster';
+import { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from '../../my-game/example2/monster';
import { Monster, MonsterT } from '../../my-game/example/monster';
import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from '../../my-game/example/test-simple-table-with-enum';
-export enum Any{
+export enum Any {
NONE = 0,
Monster = 1,
TestSimpleTableWithEnum = 2,
@@ -14,28 +14,27 @@
export function unionToAny(
type: Any,
- accessor: (obj:Monster|MyGameExample2Monster|TestSimpleTableWithEnum) => Monster|MyGameExample2Monster|TestSimpleTableWithEnum|null
-): Monster|MyGameExample2Monster|TestSimpleTableWithEnum|null {
+ accessor: (obj:Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum) => Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null
+): Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null {
switch(Any[type]) {
case 'NONE': return null;
case 'Monster': return accessor(new Monster())! as Monster;
case 'TestSimpleTableWithEnum': return accessor(new TestSimpleTableWithEnum())! as TestSimpleTableWithEnum;
- case 'MyGame_Example2_Monster': return accessor(new MyGameExample2Monster())! as MyGameExample2Monster;
+ case 'MyGame_Example2_Monster': return accessor(new MyGame_Example2_Monster())! as MyGame_Example2_Monster;
default: return null;
}
}
export function unionListToAny(
type: Any,
- accessor: (index: number, obj:Monster|MyGameExample2Monster|TestSimpleTableWithEnum) => Monster|MyGameExample2Monster|TestSimpleTableWithEnum|null,
+ accessor: (index: number, obj:Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum) => Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null,
index: number
-): Monster|MyGameExample2Monster|TestSimpleTableWithEnum|null {
+): Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null {
switch(Any[type]) {
case 'NONE': return null;
case 'Monster': return accessor(index, new Monster())! as Monster;
case 'TestSimpleTableWithEnum': return accessor(index, new TestSimpleTableWithEnum())! as TestSimpleTableWithEnum;
- case 'MyGame_Example2_Monster': return accessor(index, new MyGameExample2Monster())! as MyGameExample2Monster;
+ case 'MyGame_Example2_Monster': return accessor(index, new MyGame_Example2_Monster())! as MyGame_Example2_Monster;
default: return null;
}
}
-
diff --git a/tests/my-game/example/color.ts b/tests/my-game/example/color.ts
index ceb31f8..8ce58da 100644
--- a/tests/my-game/example/color.ts
+++ b/tests/my-game/example/color.ts
@@ -3,7 +3,7 @@
/**
* Composite components of Monster color.
*/
-export enum Color{
+export enum Color {
Red = 1,
/**
@@ -17,4 +17,3 @@
*/
Blue = 8
}
-
diff --git a/tests/my-game/example/long-enum.ts b/tests/my-game/example/long-enum.ts
index be41819..31ea188 100644
--- a/tests/my-game/example/long-enum.ts
+++ b/tests/my-game/example/long-enum.ts
@@ -1,8 +1,7 @@
// automatically generated by the FlatBuffers compiler, do not modify
-export enum LongEnum{
+export enum LongEnum {
LongOne = '2',
LongTwo = '4',
LongBig = '1099511627776'
}
-
diff --git a/tests/my-game/example/monster.js b/tests/my-game/example/monster.js
index 3c3c23b..f9c8cca 100644
--- a/tests/my-game/example/monster.js
+++ b/tests/my-game/example/monster.js
@@ -527,7 +527,7 @@
return true;
}
static getFullyQualifiedName() {
- return 'MyGame.Example.Monster';
+ return 'MyGame_Example_Monster';
}
static startMonster(builder) {
builder.startObject(54);
diff --git a/tests/my-game/example/monster.ts b/tests/my-game/example/monster.ts
index c6cb33e..d65b7c3 100644
--- a/tests/my-game/example/monster.ts
+++ b/tests/my-game/example/monster.ts
@@ -2,7 +2,7 @@
import * as flatbuffers from 'flatbuffers';
-import { Monster as MyGameExample2Monster, MonsterT as MyGameExample2MonsterT } from '../../my-game/example2/monster';
+import { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from '../../my-game/example2/monster';
import { Ability, AbilityT } from '../../my-game/example/ability';
import { Any, unionToAny, unionListToAny } from '../../my-game/example/any';
import { AnyAmbiguousAliases, unionToAnyAmbiguousAliases, unionListToAnyAmbiguousAliases } from '../../my-game/example/any-ambiguous-aliases';
@@ -23,7 +23,7 @@
export class Monster {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):Monster {
+ __init(i:number, bb:flatbuffers.ByteBuffer):Monster {
this.bb_pos = i;
this.bb = bb;
return this;
@@ -684,7 +684,7 @@
}
static getFullyQualifiedName():string {
- return 'MyGame.Example.Monster';
+ return 'MyGame_Example_Monster';
}
static startMonster(builder:flatbuffers.Builder) {
@@ -1296,7 +1296,7 @@
public inventory: (number)[] = [],
public color: Color = Color.Blue,
public testType: Any = Any.NONE,
- public test: MonsterT|MyGameExample2MonsterT|TestSimpleTableWithEnumT|null = null,
+ public test: MonsterT|MyGame_Example2_MonsterT|TestSimpleTableWithEnumT|null = null,
public test4: (TestT)[] = [],
public testarrayofstring: (string)[] = [],
public testarrayoftables: (MonsterT)[] = [],
@@ -1332,7 +1332,7 @@
public nonOwningReference: bigint = BigInt('0'),
public vectorOfNonOwningReferences: (bigint)[] = [],
public anyUniqueType: AnyUniqueAliases = AnyUniqueAliases.NONE,
- public anyUnique: MonsterT|MyGameExample2MonsterT|TestSimpleTableWithEnumT|null = null,
+ public anyUnique: MonsterT|MyGame_Example2_MonsterT|TestSimpleTableWithEnumT|null = null,
public anyAmbiguousType: AnyAmbiguousAliases = AnyAmbiguousAliases.NONE,
public anyAmbiguous: MonsterT|null = null,
public vectorOfEnums: (Color)[] = [],
diff --git a/tests/my-game/example/race.ts b/tests/my-game/example/race.ts
index 06ca128..8cb9654 100644
--- a/tests/my-game/example/race.ts
+++ b/tests/my-game/example/race.ts
@@ -1,9 +1,8 @@
// automatically generated by the FlatBuffers compiler, do not modify
-export enum Race{
+export enum Race {
None = -1,
Human = 0,
Dwarf = 1,
Elf = 2
}
-
diff --git a/tests/my-game/example/referrable.js b/tests/my-game/example/referrable.js
index 0370768..367034b 100644
--- a/tests/my-game/example/referrable.js
+++ b/tests/my-game/example/referrable.js
@@ -30,7 +30,7 @@
return true;
}
static getFullyQualifiedName() {
- return 'MyGame.Example.Referrable';
+ return 'MyGame_Example_Referrable';
}
static startReferrable(builder) {
builder.startObject(1);
diff --git a/tests/my-game/example/referrable.ts b/tests/my-game/example/referrable.ts
index fdac6c3..ec02980 100644
--- a/tests/my-game/example/referrable.ts
+++ b/tests/my-game/example/referrable.ts
@@ -7,7 +7,7 @@
export class Referrable {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):Referrable {
+ __init(i:number, bb:flatbuffers.ByteBuffer):Referrable {
this.bb_pos = i;
this.bb = bb;
return this;
@@ -39,7 +39,7 @@
}
static getFullyQualifiedName():string {
- return 'MyGame.Example.Referrable';
+ return 'MyGame_Example_Referrable';
}
static startReferrable(builder:flatbuffers.Builder) {
diff --git a/tests/my-game/example/stat.js b/tests/my-game/example/stat.js
index 46eec43..43b569f 100644
--- a/tests/my-game/example/stat.js
+++ b/tests/my-game/example/stat.js
@@ -46,7 +46,7 @@
return true;
}
static getFullyQualifiedName() {
- return 'MyGame.Example.Stat';
+ return 'MyGame_Example_Stat';
}
static startStat(builder) {
builder.startObject(3);
diff --git a/tests/my-game/example/stat.ts b/tests/my-game/example/stat.ts
index 0082ef8..e452599 100644
--- a/tests/my-game/example/stat.ts
+++ b/tests/my-game/example/stat.ts
@@ -7,7 +7,7 @@
export class Stat {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):Stat {
+ __init(i:number, bb:flatbuffers.ByteBuffer):Stat {
this.bb_pos = i;
this.bb = bb;
return this;
@@ -62,7 +62,7 @@
}
static getFullyQualifiedName():string {
- return 'MyGame.Example.Stat';
+ return 'MyGame_Example_Stat';
}
static startStat(builder:flatbuffers.Builder) {
diff --git a/tests/my-game/example/struct-of-structs-of-structs.ts b/tests/my-game/example/struct-of-structs-of-structs.ts
new file mode 100644
index 0000000..afe869f
--- /dev/null
+++ b/tests/my-game/example/struct-of-structs-of-structs.ts
@@ -0,0 +1,74 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { StructOfStructs, StructOfStructsT } from '../../my-game/example/struct-of-structs';
+
+
+export class StructOfStructsOfStructs {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructsOfStructs {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+a(obj?:StructOfStructs):StructOfStructs|null {
+ return (obj || new StructOfStructs()).__init(this.bb_pos, this.bb!);
+}
+
+static getFullyQualifiedName():string {
+ return 'MyGame_Example_StructOfStructsOfStructs';
+}
+
+static sizeOf():number {
+ return 20;
+}
+
+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 {
+ 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(): StructOfStructsOfStructsT {
+ return new StructOfStructsOfStructsT(
+ (this.a() !== null ? this.a()!.unpack() : null)
+ );
+}
+
+
+unpackTo(_o: StructOfStructsOfStructsT): void {
+ _o.a = (this.a() !== null ? this.a()!.unpack() : null);
+}
+}
+
+export class StructOfStructsOfStructsT {
+constructor(
+ public a: StructOfStructsT|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ 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)
+ );
+}
+}
diff --git a/tests/my-game/example/struct-of-structs.js b/tests/my-game/example/struct-of-structs.js
index 2debc29..09c7910 100644
--- a/tests/my-game/example/struct-of-structs.js
+++ b/tests/my-game/example/struct-of-structs.js
@@ -21,7 +21,7 @@
return (obj || new Ability()).__init(this.bb_pos + 12, this.bb);
}
static getFullyQualifiedName() {
- return 'MyGame.Example.StructOfStructs';
+ return 'MyGame_Example_StructOfStructs';
}
static sizeOf() {
return 20;
@@ -56,6 +56,7 @@
this.c = c;
}
pack(builder) {
- return StructOfStructs.createStructOfStructs(builder, (this.a === null ? 0 : this.a.id), (this.a === null ? 0 : this.a.distance), (this.b === null ? 0 : this.b.a), (this.b === null ? 0 : this.b.b), (this.c === null ? 0 : this.c.id), (this.c === null ? 0 : this.c.distance));
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
+ return StructOfStructs.createStructOfStructs(builder, ((_b = (_a = this.a) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : 0), ((_d = (_c = this.a) === null || _c === void 0 ? void 0 : _c.distance) !== null && _d !== void 0 ? _d : 0), ((_f = (_e = this.b) === null || _e === void 0 ? void 0 : _e.a) !== null && _f !== void 0 ? _f : 0), ((_h = (_g = this.b) === null || _g === void 0 ? void 0 : _g.b) !== null && _h !== void 0 ? _h : 0), ((_k = (_j = this.c) === null || _j === void 0 ? void 0 : _j.id) !== null && _k !== void 0 ? _k : 0), ((_m = (_l = this.c) === null || _l === void 0 ? void 0 : _l.distance) !== null && _m !== void 0 ? _m : 0));
}
}
diff --git a/tests/my-game/example/struct-of-structs.ts b/tests/my-game/example/struct-of-structs.ts
index 11eca7e..0cb87de 100644
--- a/tests/my-game/example/struct-of-structs.ts
+++ b/tests/my-game/example/struct-of-structs.ts
@@ -9,7 +9,7 @@
export class StructOfStructs {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructs {
+ __init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructs {
this.bb_pos = i;
this.bb = bb;
return this;
@@ -28,7 +28,7 @@
}
static getFullyQualifiedName():string {
- return 'MyGame.Example.StructOfStructs';
+ return 'MyGame_Example_StructOfStructs';
}
static sizeOf():number {
@@ -77,12 +77,12 @@
pack(builder:flatbuffers.Builder): flatbuffers.Offset {
return StructOfStructs.createStructOfStructs(builder,
- (this.a === null ? 0 : this.a.id!),
- (this.a === null ? 0 : this.a.distance!),
- (this.b === null ? 0 : this.b.a!),
- (this.b === null ? 0 : this.b.b!),
- (this.c === null ? 0 : this.c.id!),
- (this.c === null ? 0 : this.c.distance!)
+ (this.a?.id ?? 0),
+ (this.a?.distance ?? 0),
+ (this.b?.a ?? 0),
+ (this.b?.b ?? 0),
+ (this.c?.id ?? 0),
+ (this.c?.distance ?? 0)
);
}
}
diff --git a/tests/my-game/example/test-simple-table-with-enum.js b/tests/my-game/example/test-simple-table-with-enum.js
index b56bda4..a31d011 100644
--- a/tests/my-game/example/test-simple-table-with-enum.js
+++ b/tests/my-game/example/test-simple-table-with-enum.js
@@ -31,7 +31,7 @@
return true;
}
static getFullyQualifiedName() {
- return 'MyGame.Example.TestSimpleTableWithEnum';
+ return 'MyGame_Example_TestSimpleTableWithEnum';
}
static startTestSimpleTableWithEnum(builder) {
builder.startObject(1);
diff --git a/tests/my-game/example/test-simple-table-with-enum.ts b/tests/my-game/example/test-simple-table-with-enum.ts
index 99a541f..86a19aa 100644
--- a/tests/my-game/example/test-simple-table-with-enum.ts
+++ b/tests/my-game/example/test-simple-table-with-enum.ts
@@ -8,7 +8,7 @@
export class TestSimpleTableWithEnum {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):TestSimpleTableWithEnum {
+ __init(i:number, bb:flatbuffers.ByteBuffer):TestSimpleTableWithEnum {
this.bb_pos = i;
this.bb = bb;
return this;
@@ -40,7 +40,7 @@
}
static getFullyQualifiedName():string {
- return 'MyGame.Example.TestSimpleTableWithEnum';
+ return 'MyGame_Example_TestSimpleTableWithEnum';
}
static startTestSimpleTableWithEnum(builder:flatbuffers.Builder) {
diff --git a/tests/my-game/example/test.js b/tests/my-game/example/test.js
index ba6ebfb..9c43619 100644
--- a/tests/my-game/example/test.js
+++ b/tests/my-game/example/test.js
@@ -24,7 +24,7 @@
return true;
}
static getFullyQualifiedName() {
- return 'MyGame.Example.Test';
+ return 'MyGame_Example_Test';
}
static sizeOf() {
return 4;
diff --git a/tests/my-game/example/test.ts b/tests/my-game/example/test.ts
index afed125..b3d84ee 100644
--- a/tests/my-game/example/test.ts
+++ b/tests/my-game/example/test.ts
@@ -7,7 +7,7 @@
export class Test {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):Test {
+ __init(i:number, bb:flatbuffers.ByteBuffer):Test {
this.bb_pos = i;
this.bb = bb;
return this;
@@ -32,7 +32,7 @@
}
static getFullyQualifiedName():string {
- return 'MyGame.Example.Test';
+ return 'MyGame_Example_Test';
}
static sizeOf():number {
diff --git a/tests/my-game/example/type-aliases.js b/tests/my-game/example/type-aliases.js
index f26f226..a4b5f89 100644
--- a/tests/my-game/example/type-aliases.js
+++ b/tests/my-game/example/type-aliases.js
@@ -162,7 +162,7 @@
return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
}
static getFullyQualifiedName() {
- return 'MyGame.Example.TypeAliases';
+ return 'MyGame_Example_TypeAliases';
}
static startTypeAliases(builder) {
builder.startObject(12);
diff --git a/tests/my-game/example/type-aliases.ts b/tests/my-game/example/type-aliases.ts
index edb4567..805c8cf 100644
--- a/tests/my-game/example/type-aliases.ts
+++ b/tests/my-game/example/type-aliases.ts
@@ -7,7 +7,7 @@
export class TypeAliases {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):TypeAliases {
+ __init(i:number, bb:flatbuffers.ByteBuffer):TypeAliases {
this.bb_pos = i;
this.bb = bb;
return this;
@@ -213,7 +213,7 @@
}
static getFullyQualifiedName():string {
- return 'MyGame.Example.TypeAliases';
+ return 'MyGame_Example_TypeAliases';
}
static startTypeAliases(builder:flatbuffers.Builder) {
diff --git a/tests/my-game/example/vec3.js b/tests/my-game/example/vec3.js
index 5fd2447..82b2eab 100644
--- a/tests/my-game/example/vec3.js
+++ b/tests/my-game/example/vec3.js
@@ -49,7 +49,7 @@
return (obj || new Test()).__init(this.bb_pos + 26, this.bb);
}
static getFullyQualifiedName() {
- return 'MyGame.Example.Vec3';
+ return 'MyGame_Example_Vec3';
}
static sizeOf() {
return 32;
@@ -92,6 +92,7 @@
this.test3 = test3;
}
pack(builder) {
- return Vec3.createVec3(builder, this.x, this.y, this.z, this.test1, this.test2, (this.test3 === null ? 0 : this.test3.a), (this.test3 === null ? 0 : this.test3.b));
+ var _a, _b, _c, _d;
+ return Vec3.createVec3(builder, this.x, this.y, this.z, this.test1, this.test2, ((_b = (_a = this.test3) === null || _a === void 0 ? void 0 : _a.a) !== null && _b !== void 0 ? _b : 0), ((_d = (_c = this.test3) === null || _c === void 0 ? void 0 : _c.b) !== null && _d !== void 0 ? _d : 0));
}
}
diff --git a/tests/my-game/example/vec3.ts b/tests/my-game/example/vec3.ts
index 9756977..3c692e2 100644
--- a/tests/my-game/example/vec3.ts
+++ b/tests/my-game/example/vec3.ts
@@ -9,7 +9,7 @@
export class Vec3 {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):Vec3 {
+ __init(i:number, bb:flatbuffers.ByteBuffer):Vec3 {
this.bb_pos = i;
this.bb = bb;
return this;
@@ -65,7 +65,7 @@
}
static getFullyQualifiedName():string {
- return 'MyGame.Example.Vec3';
+ return 'MyGame_Example_Vec3';
}
static sizeOf():number {
@@ -130,8 +130,8 @@
this.z,
this.test1,
this.test2,
- (this.test3 === null ? 0 : this.test3.a!),
- (this.test3 === null ? 0 : this.test3.b!)
+ (this.test3?.a ?? 0),
+ (this.test3?.b ?? 0)
);
}
}
diff --git a/tests/my-game/example2/monster.js b/tests/my-game/example2/monster.js
index 17f02b1..f50a2c8 100644
--- a/tests/my-game/example2/monster.js
+++ b/tests/my-game/example2/monster.js
@@ -18,7 +18,7 @@
return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getFullyQualifiedName() {
- return 'MyGame.Example2.Monster';
+ return 'MyGame_Example2_Monster';
}
static startMonster(builder) {
builder.startObject(0);
diff --git a/tests/my-game/example2/monster.ts b/tests/my-game/example2/monster.ts
index 14d7685..7240476 100644
--- a/tests/my-game/example2/monster.ts
+++ b/tests/my-game/example2/monster.ts
@@ -7,7 +7,7 @@
export class Monster {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):Monster {
+ __init(i:number, bb:flatbuffers.ByteBuffer):Monster {
this.bb_pos = i;
this.bb = bb;
return this;
@@ -23,7 +23,7 @@
}
static getFullyQualifiedName():string {
- return 'MyGame.Example2.Monster';
+ return 'MyGame_Example2_Monster';
}
static startMonster(builder:flatbuffers.Builder) {
diff --git a/tests/my-game/in-parent-namespace.js b/tests/my-game/in-parent-namespace.js
index 4881741..24b0ed7 100644
--- a/tests/my-game/in-parent-namespace.js
+++ b/tests/my-game/in-parent-namespace.js
@@ -18,7 +18,7 @@
return (obj || new InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}
static getFullyQualifiedName() {
- return 'MyGame.InParentNamespace';
+ return 'MyGame_InParentNamespace';
}
static startInParentNamespace(builder) {
builder.startObject(0);
diff --git a/tests/my-game/in-parent-namespace.ts b/tests/my-game/in-parent-namespace.ts
index 8cfe9b6..0de94df 100644
--- a/tests/my-game/in-parent-namespace.ts
+++ b/tests/my-game/in-parent-namespace.ts
@@ -7,7 +7,7 @@
export class InParentNamespace {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):InParentNamespace {
+ __init(i:number, bb:flatbuffers.ByteBuffer):InParentNamespace {
this.bb_pos = i;
this.bb = bb;
return this;
@@ -23,7 +23,7 @@
}
static getFullyQualifiedName():string {
- return 'MyGame.InParentNamespace';
+ return 'MyGame_InParentNamespace';
}
static startInParentNamespace(builder:flatbuffers.Builder) {
diff --git a/tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.cs b/tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.cs
index 0ed6a63..2874a27 100644
--- a/tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.cs
+++ b/tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.cs
@@ -7,7 +7,7 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct StructInNestedNS : IFlatbufferObject
{
diff --git a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs
index 9e67112..fab8e02 100644
--- a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs
+++ b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.cs
@@ -7,13 +7,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct TableInNestedNS : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static TableInNestedNS GetRootAsTableInNestedNS(ByteBuffer _bb) { return GetRootAsTableInNestedNS(_bb, new TableInNestedNS()); }
public static TableInNestedNS GetRootAsTableInNestedNS(ByteBuffer _bb, TableInNestedNS obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
diff --git a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.java b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.java
index 45e4974..e185e4b 100644
--- a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.java
+++ b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.java
@@ -9,7 +9,7 @@
@SuppressWarnings("unused")
public final class TableInNestedNS extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static TableInNestedNS getRootAsTableInNestedNS(ByteBuffer _bb) { return getRootAsTableInNestedNS(_bb, new TableInNestedNS()); }
public static TableInNestedNS getRootAsTableInNestedNS(ByteBuffer _bb, TableInNestedNS obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
diff --git a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.kt b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.kt
index cb4cc10..0fbbba8 100644
--- a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.kt
+++ b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.kt
@@ -32,7 +32,7 @@
}
}
companion object {
- fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
fun getRootAsTableInNestedNS(_bb: ByteBuffer): TableInNestedNS = getRootAsTableInNestedNS(_bb, TableInNestedNS())
fun getRootAsTableInNestedNS(_bb: ByteBuffer, obj: TableInNestedNS): TableInNestedNS {
_bb.order(ByteOrder.LITTLE_ENDIAN)
diff --git a/tests/namespace_test/NamespaceA/NamespaceB/UnionInNestedNS.cs b/tests/namespace_test/NamespaceA/NamespaceB/UnionInNestedNS.cs
index 7d1234f..08bc431 100644
--- a/tests/namespace_test/NamespaceA/NamespaceB/UnionInNestedNS.cs
+++ b/tests/namespace_test/NamespaceA/NamespaceB/UnionInNestedNS.cs
@@ -25,7 +25,7 @@
public NamespaceA.NamespaceB.TableInNestedNST AsTableInNestedNS() { return this.As<NamespaceA.NamespaceB.TableInNestedNST>(); }
public static UnionInNestedNSUnion FromTableInNestedNS(NamespaceA.NamespaceB.TableInNestedNST _tableinnestedns) { return new UnionInNestedNSUnion{ Type = UnionInNestedNS.TableInNestedNS, Value = _tableinnestedns }; }
- public static int Pack(FlatBuffers.FlatBufferBuilder builder, UnionInNestedNSUnion _o) {
+ public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, UnionInNestedNSUnion _o) {
switch (_o.Type) {
default: return 0;
case UnionInNestedNS.TableInNestedNS: return NamespaceA.NamespaceB.TableInNestedNS.Pack(builder, _o.AsTableInNestedNS()).Value;
diff --git a/tests/namespace_test/NamespaceA/SecondTableInA.cs b/tests/namespace_test/NamespaceA/SecondTableInA.cs
index 6e7ef88..9db2226 100644
--- a/tests/namespace_test/NamespaceA/SecondTableInA.cs
+++ b/tests/namespace_test/NamespaceA/SecondTableInA.cs
@@ -7,13 +7,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct SecondTableInA : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static SecondTableInA GetRootAsSecondTableInA(ByteBuffer _bb) { return GetRootAsSecondTableInA(_bb, new SecondTableInA()); }
public static SecondTableInA GetRootAsSecondTableInA(ByteBuffer _bb, SecondTableInA obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
diff --git a/tests/namespace_test/NamespaceA/SecondTableInA.java b/tests/namespace_test/NamespaceA/SecondTableInA.java
index ff539ab..f2e65d4 100644
--- a/tests/namespace_test/NamespaceA/SecondTableInA.java
+++ b/tests/namespace_test/NamespaceA/SecondTableInA.java
@@ -9,7 +9,7 @@
@SuppressWarnings("unused")
public final class SecondTableInA extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static SecondTableInA getRootAsSecondTableInA(ByteBuffer _bb) { return getRootAsSecondTableInA(_bb, new SecondTableInA()); }
public static SecondTableInA getRootAsSecondTableInA(ByteBuffer _bb, SecondTableInA obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
diff --git a/tests/namespace_test/NamespaceA/SecondTableInA.kt b/tests/namespace_test/NamespaceA/SecondTableInA.kt
index a516070..50d02df 100644
--- a/tests/namespace_test/NamespaceA/SecondTableInA.kt
+++ b/tests/namespace_test/NamespaceA/SecondTableInA.kt
@@ -27,7 +27,7 @@
}
}
companion object {
- fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
fun getRootAsSecondTableInA(_bb: ByteBuffer): SecondTableInA = getRootAsSecondTableInA(_bb, SecondTableInA())
fun getRootAsSecondTableInA(_bb: ByteBuffer, obj: SecondTableInA): SecondTableInA {
_bb.order(ByteOrder.LITTLE_ENDIAN)
diff --git a/tests/namespace_test/NamespaceA/TableInFirstNS.cs b/tests/namespace_test/NamespaceA/TableInFirstNS.cs
index 6522f49..ad72eee 100644
--- a/tests/namespace_test/NamespaceA/TableInFirstNS.cs
+++ b/tests/namespace_test/NamespaceA/TableInFirstNS.cs
@@ -7,13 +7,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct TableInFirstNS : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static TableInFirstNS GetRootAsTableInFirstNS(ByteBuffer _bb) { return GetRootAsTableInFirstNS(_bb, new TableInFirstNS()); }
public static TableInFirstNS GetRootAsTableInFirstNS(ByteBuffer _bb, TableInFirstNS obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
diff --git a/tests/namespace_test/NamespaceA/TableInFirstNS.java b/tests/namespace_test/NamespaceA/TableInFirstNS.java
index 2fdfec8..809ece2 100644
--- a/tests/namespace_test/NamespaceA/TableInFirstNS.java
+++ b/tests/namespace_test/NamespaceA/TableInFirstNS.java
@@ -9,7 +9,7 @@
@SuppressWarnings("unused")
public final class TableInFirstNS extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static TableInFirstNS getRootAsTableInFirstNS(ByteBuffer _bb) { return getRootAsTableInFirstNS(_bb, new TableInFirstNS()); }
public static TableInFirstNS getRootAsTableInFirstNS(ByteBuffer _bb, TableInFirstNS obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
diff --git a/tests/namespace_test/NamespaceA/TableInFirstNS.kt b/tests/namespace_test/NamespaceA/TableInFirstNS.kt
index bec3319..4ae9368 100644
--- a/tests/namespace_test/NamespaceA/TableInFirstNS.kt
+++ b/tests/namespace_test/NamespaceA/TableInFirstNS.kt
@@ -67,7 +67,7 @@
}
}
companion object {
- fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
fun getRootAsTableInFirstNS(_bb: ByteBuffer): TableInFirstNS = getRootAsTableInFirstNS(_bb, TableInFirstNS())
fun getRootAsTableInFirstNS(_bb: ByteBuffer, obj: TableInFirstNS): TableInFirstNS {
_bb.order(ByteOrder.LITTLE_ENDIAN)
diff --git a/tests/namespace_test/NamespaceC/TableInC.cs b/tests/namespace_test/NamespaceC/TableInC.cs
index 2077e32..50ca3e4 100644
--- a/tests/namespace_test/NamespaceC/TableInC.cs
+++ b/tests/namespace_test/NamespaceC/TableInC.cs
@@ -7,13 +7,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct TableInC : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static TableInC GetRootAsTableInC(ByteBuffer _bb) { return GetRootAsTableInC(_bb, new TableInC()); }
public static TableInC GetRootAsTableInC(ByteBuffer _bb, TableInC obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
diff --git a/tests/namespace_test/NamespaceC/TableInC.java b/tests/namespace_test/NamespaceC/TableInC.java
index 04ceac7..7af7620 100644
--- a/tests/namespace_test/NamespaceC/TableInC.java
+++ b/tests/namespace_test/NamespaceC/TableInC.java
@@ -9,7 +9,7 @@
@SuppressWarnings("unused")
public final class TableInC extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static TableInC getRootAsTableInC(ByteBuffer _bb) { return getRootAsTableInC(_bb, new TableInC()); }
public static TableInC getRootAsTableInC(ByteBuffer _bb, TableInC obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
diff --git a/tests/namespace_test/NamespaceC/TableInC.kt b/tests/namespace_test/NamespaceC/TableInC.kt
index 7586e25..b195c6c 100644
--- a/tests/namespace_test/NamespaceC/TableInC.kt
+++ b/tests/namespace_test/NamespaceC/TableInC.kt
@@ -36,7 +36,7 @@
}
}
companion object {
- fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
fun getRootAsTableInC(_bb: ByteBuffer): TableInC = getRootAsTableInC(_bb, TableInC())
fun getRootAsTableInC(_bb: ByteBuffer, obj: TableInC): TableInC {
_bb.order(ByteOrder.LITTLE_ENDIAN)
diff --git a/tests/namespace_test/mod.rs b/tests/namespace_test/mod.rs
index 8572c8d..22c667e 100644
--- a/tests/namespace_test/mod.rs
+++ b/tests/namespace_test/mod.rs
@@ -1,4 +1,5 @@
// Automatically generated by the Flatbuffers compiler. Do not modify.
+// @generated
pub mod namespace_a {
use super::*;
pub mod namespace_b {
diff --git a/tests/namespace_test/namespace_a/namespace_b/enum_in_nested_ns_generated.rs b/tests/namespace_test/namespace_a/namespace_b/enum_in_nested_ns_generated.rs
index b636638..246d28f 100644
--- a/tests/namespace_test/namespace_a/namespace_b/enum_in_nested_ns_generated.rs
+++ b/tests/namespace_test/namespace_a/namespace_b/enum_in_nested_ns_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
@@ -42,8 +47,8 @@
}
}
}
-impl std::fmt::Debug for EnumInNestedNS {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for EnumInNestedNS {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
diff --git a/tests/namespace_test/namespace_a/namespace_b/struct_in_nested_ns_generated.rs b/tests/namespace_test/namespace_a/namespace_b/struct_in_nested_ns_generated.rs
index 55fff40..dc13b0c 100644
--- a/tests/namespace_test/namespace_a/namespace_b/struct_in_nested_ns_generated.rs
+++ b/tests/namespace_test/namespace_a/namespace_b/struct_in_nested_ns_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
// struct StructInNestedNS, aligned to 4
@@ -13,8 +18,8 @@
Self([0; 8])
}
}
-impl std::fmt::Debug for StructInNestedNS {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for StructInNestedNS {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("StructInNestedNS")
.field("a", &self.a())
.field("b", &self.b())
@@ -43,7 +48,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(self as *const StructInNestedNS as *const u8, Self::size())
+ ::core::slice::from_raw_parts(self as *const StructInNestedNS as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
@@ -54,7 +59,7 @@
#[inline]
fn push(&self, dst: &mut [u8], _rest: &[u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(*self as *const StructInNestedNS as *const u8, Self::size())
+ ::core::slice::from_raw_parts(*self as *const StructInNestedNS as *const u8, Self::size())
};
dst.copy_from_slice(src);
}
diff --git a/tests/namespace_test/namespace_a/namespace_b/table_in_nested_ns_generated.rs b/tests/namespace_test/namespace_a/namespace_b/table_in_nested_ns_generated.rs
index 10d5b7c..76744f9 100644
--- a/tests/namespace_test/namespace_a/namespace_b/table_in_nested_ns_generated.rs
+++ b/tests/namespace_test/namespace_a/namespace_b/table_in_nested_ns_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TableInNestedNSOffset {}
@@ -101,8 +106,8 @@
}
}
-impl std::fmt::Debug for TableInNestedNS<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for TableInNestedNS<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TableInNestedNS");
ds.field("foo", &self.foo());
ds.finish()
diff --git a/tests/namespace_test/namespace_a/namespace_b/union_in_nested_ns_generated.rs b/tests/namespace_test/namespace_a/namespace_b/union_in_nested_ns_generated.rs
index 8d650a5..a77108f 100644
--- a/tests/namespace_test/namespace_a/namespace_b/union_in_nested_ns_generated.rs
+++ b/tests/namespace_test/namespace_a/namespace_b/union_in_nested_ns_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
@@ -38,8 +43,8 @@
}
}
}
-impl std::fmt::Debug for UnionInNestedNS {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for UnionInNestedNS {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
@@ -121,7 +126,7 @@
/// If the union variant matches, return the owned TableInNestedNST, setting the union to NONE.
pub fn take_table_in_nested_ns(&mut self) -> Option<Box<TableInNestedNST>> {
if let Self::TableInNestedNS(_) = self {
- let v = std::mem::replace(self, Self::NONE);
+ let v = core::mem::replace(self, Self::NONE);
if let Self::TableInNestedNS(w) = v {
Some(w)
} else {
diff --git a/tests/namespace_test/namespace_a/second_table_in_a_generated.rs b/tests/namespace_test/namespace_a/second_table_in_a_generated.rs
index d63438b..c32fdc0 100644
--- a/tests/namespace_test/namespace_a/second_table_in_a_generated.rs
+++ b/tests/namespace_test/namespace_a/second_table_in_a_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum SecondTableInAOffset {}
@@ -103,8 +108,8 @@
}
}
-impl std::fmt::Debug for SecondTableInA<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for SecondTableInA<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("SecondTableInA");
ds.field("refer_to_c", &self.refer_to_c());
ds.finish()
diff --git a/tests/namespace_test/namespace_a/table_in_first_ns_generated.rs b/tests/namespace_test/namespace_a/table_in_first_ns_generated.rs
index 0a16074..ab46d7e 100644
--- a/tests/namespace_test/namespace_a/table_in_first_ns_generated.rs
+++ b/tests/namespace_test/namespace_a/table_in_first_ns_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TableInFirstNSOffset {}
@@ -185,8 +190,8 @@
}
}
-impl std::fmt::Debug for TableInFirstNS<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for TableInFirstNS<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TableInFirstNS");
ds.field("foo_table", &self.foo_table());
ds.field("foo_enum", &self.foo_enum());
diff --git a/tests/namespace_test/namespace_c/table_in_c_generated.rs b/tests/namespace_test/namespace_c/table_in_c_generated.rs
index d4ac783..a6ba7bf 100644
--- a/tests/namespace_test/namespace_c/table_in_c_generated.rs
+++ b/tests/namespace_test/namespace_c/table_in_c_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum TableInCOffset {}
@@ -120,8 +125,8 @@
}
}
-impl std::fmt::Debug for TableInC<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for TableInC<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("TableInC");
ds.field("refer_to_a1", &self.refer_to_a1());
ds.field("refer_to_a2", &self.refer_to_a2());
diff --git a/tests/namespace_test/namespace_test1_generated.h b/tests/namespace_test/namespace_test1_generated.h
index bb82236..c2af28e 100644
--- a/tests/namespace_test/namespace_test1_generated.h
+++ b/tests/namespace_test/namespace_test1_generated.h
@@ -6,6 +6,13 @@
#include "flatbuffers/flatbuffers.h"
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
+
namespace NamespaceA {
namespace NamespaceB {
diff --git a/tests/namespace_test/namespace_test2_generated.h b/tests/namespace_test/namespace_test2_generated.h
index ff164cc..85dc12f 100644
--- a/tests/namespace_test/namespace_test2_generated.h
+++ b/tests/namespace_test/namespace_test2_generated.h
@@ -6,6 +6,13 @@
#include "flatbuffers/flatbuffers.h"
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
+
namespace NamespaceA {
struct TableInFirstNS;
@@ -386,7 +393,7 @@
inline void TableInFirstNS::UnPackTo(TableInFirstNST *_o, const flatbuffers::resolver_function_t *_resolver) const {
(void)_o;
(void)_resolver;
- { auto _e = foo_table(); if (_e) { if(_o->foo_table) { _e->UnPackTo(_o->foo_table.get(), _resolver); } else { _o->foo_table = flatbuffers::unique_ptr<NamespaceA::NamespaceB::TableInNestedNST>(_e->UnPack(_resolver)); } } }
+ { auto _e = foo_table(); if (_e) { if(_o->foo_table) { _e->UnPackTo(_o->foo_table.get(), _resolver); } else { _o->foo_table = flatbuffers::unique_ptr<NamespaceA::NamespaceB::TableInNestedNST>(_e->UnPack(_resolver)); } } else if (_o->foo_table) { _o->foo_table.reset(); } }
{ auto _e = foo_enum(); _o->foo_enum = _e; }
{ auto _e = foo_union_type(); _o->foo_union.type = _e; }
{ auto _e = foo_union(); if (_e) _o->foo_union.value = NamespaceA::NamespaceB::UnionInNestedNSUnion::UnPack(_e, foo_union_type(), _resolver); }
@@ -405,7 +412,7 @@
auto _foo_enum = _o->foo_enum;
auto _foo_union_type = _o->foo_union.type;
auto _foo_union = _o->foo_union.Pack(_fbb);
- auto _foo_struct = _o->foo_struct ? _o->foo_struct.get() : 0;
+ auto _foo_struct = _o->foo_struct ? _o->foo_struct.get() : nullptr;
return NamespaceA::CreateTableInFirstNS(
_fbb,
_foo_table,
@@ -451,8 +458,8 @@
inline void TableInC::UnPackTo(TableInCT *_o, const flatbuffers::resolver_function_t *_resolver) const {
(void)_o;
(void)_resolver;
- { auto _e = refer_to_a1(); if (_e) { if(_o->refer_to_a1) { _e->UnPackTo(_o->refer_to_a1.get(), _resolver); } else { _o->refer_to_a1 = flatbuffers::unique_ptr<NamespaceA::TableInFirstNST>(_e->UnPack(_resolver)); } } }
- { auto _e = refer_to_a2(); if (_e) { if(_o->refer_to_a2) { _e->UnPackTo(_o->refer_to_a2.get(), _resolver); } else { _o->refer_to_a2 = flatbuffers::unique_ptr<NamespaceA::SecondTableInAT>(_e->UnPack(_resolver)); } } }
+ { auto _e = refer_to_a1(); if (_e) { if(_o->refer_to_a1) { _e->UnPackTo(_o->refer_to_a1.get(), _resolver); } else { _o->refer_to_a1 = flatbuffers::unique_ptr<NamespaceA::TableInFirstNST>(_e->UnPack(_resolver)); } } else if (_o->refer_to_a1) { _o->refer_to_a1.reset(); } }
+ { auto _e = refer_to_a2(); if (_e) { if(_o->refer_to_a2) { _e->UnPackTo(_o->refer_to_a2.get(), _resolver); } else { _o->refer_to_a2 = flatbuffers::unique_ptr<NamespaceA::SecondTableInAT>(_e->UnPack(_resolver)); } } else if (_o->refer_to_a2) { _o->refer_to_a2.reset(); } }
}
inline flatbuffers::Offset<TableInC> TableInC::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TableInCT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
@@ -504,7 +511,7 @@
inline void SecondTableInA::UnPackTo(SecondTableInAT *_o, const flatbuffers::resolver_function_t *_resolver) const {
(void)_o;
(void)_resolver;
- { auto _e = refer_to_c(); if (_e) { if(_o->refer_to_c) { _e->UnPackTo(_o->refer_to_c.get(), _resolver); } else { _o->refer_to_c = flatbuffers::unique_ptr<NamespaceC::TableInCT>(_e->UnPack(_resolver)); } } }
+ { auto _e = refer_to_c(); if (_e) { if(_o->refer_to_c) { _e->UnPackTo(_o->refer_to_c.get(), _resolver); } else { _o->refer_to_c = flatbuffers::unique_ptr<NamespaceC::TableInCT>(_e->UnPack(_resolver)); } } else if (_o->refer_to_c) { _o->refer_to_c.reset(); } }
}
inline flatbuffers::Offset<SecondTableInA> SecondTableInA::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SecondTableInAT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
diff --git a/tests/native_inline_table_test.fbs b/tests/native_inline_table_test.fbs
new file mode 100644
index 0000000..cbe8940
--- /dev/null
+++ b/tests/native_inline_table_test.fbs
@@ -0,0 +1,7 @@
+table NativeInlineTable {
+ a: int;
+}
+
+table TestNativeInlineTable {
+ t: [NativeInlineTable] (native_inline);
+}
diff --git a/tests/native_inline_table_test_generated.h b/tests/native_inline_table_test_generated.h
new file mode 100644
index 0000000..9502663
--- /dev/null
+++ b/tests/native_inline_table_test_generated.h
@@ -0,0 +1,263 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+
+#ifndef FLATBUFFERS_GENERATED_NATIVEINLINETABLETEST_H_
+#define FLATBUFFERS_GENERATED_NATIVEINLINETABLETEST_H_
+
+#include "flatbuffers/flatbuffers.h"
+
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
+
+struct NativeInlineTable;
+struct NativeInlineTableBuilder;
+struct NativeInlineTableT;
+
+struct TestNativeInlineTable;
+struct TestNativeInlineTableBuilder;
+struct TestNativeInlineTableT;
+
+bool operator==(const NativeInlineTableT &lhs, const NativeInlineTableT &rhs);
+bool operator!=(const NativeInlineTableT &lhs, const NativeInlineTableT &rhs);
+bool operator==(const TestNativeInlineTableT &lhs, const TestNativeInlineTableT &rhs);
+bool operator!=(const TestNativeInlineTableT &lhs, const TestNativeInlineTableT &rhs);
+
+inline const flatbuffers::TypeTable *NativeInlineTableTypeTable();
+
+inline const flatbuffers::TypeTable *TestNativeInlineTableTypeTable();
+
+struct NativeInlineTableT : public flatbuffers::NativeTable {
+ typedef NativeInlineTable TableType;
+ int32_t a = 0;
+};
+
+struct NativeInlineTable FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef NativeInlineTableT NativeTableType;
+ typedef NativeInlineTableBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return NativeInlineTableTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_A = 4
+ };
+ int32_t a() const {
+ return GetField<int32_t>(VT_A, 0);
+ }
+ bool mutate_a(int32_t _a = 0) {
+ return SetField<int32_t>(VT_A, _a, 0);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyField<int32_t>(verifier, VT_A, 4) &&
+ verifier.EndTable();
+ }
+ NativeInlineTableT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(NativeInlineTableT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<NativeInlineTable> Pack(flatbuffers::FlatBufferBuilder &_fbb, const NativeInlineTableT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct NativeInlineTableBuilder {
+ typedef NativeInlineTable Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_a(int32_t a) {
+ fbb_.AddElement<int32_t>(NativeInlineTable::VT_A, a, 0);
+ }
+ explicit NativeInlineTableBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<NativeInlineTable> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<NativeInlineTable>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<NativeInlineTable> CreateNativeInlineTable(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ int32_t a = 0) {
+ NativeInlineTableBuilder builder_(_fbb);
+ builder_.add_a(a);
+ return builder_.Finish();
+}
+
+flatbuffers::Offset<NativeInlineTable> CreateNativeInlineTable(flatbuffers::FlatBufferBuilder &_fbb, const NativeInlineTableT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+struct TestNativeInlineTableT : public flatbuffers::NativeTable {
+ typedef TestNativeInlineTable TableType;
+ std::vector<NativeInlineTableT> t{};
+};
+
+struct TestNativeInlineTable FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef TestNativeInlineTableT NativeTableType;
+ typedef TestNativeInlineTableBuilder Builder;
+ static const flatbuffers::TypeTable *MiniReflectTypeTable() {
+ return TestNativeInlineTableTypeTable();
+ }
+ enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
+ VT_T = 4
+ };
+ const flatbuffers::Vector<flatbuffers::Offset<NativeInlineTable>> *t() const {
+ return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<NativeInlineTable>> *>(VT_T);
+ }
+ flatbuffers::Vector<flatbuffers::Offset<NativeInlineTable>> *mutable_t() {
+ return GetPointer<flatbuffers::Vector<flatbuffers::Offset<NativeInlineTable>> *>(VT_T);
+ }
+ bool Verify(flatbuffers::Verifier &verifier) const {
+ return VerifyTableStart(verifier) &&
+ VerifyOffset(verifier, VT_T) &&
+ verifier.VerifyVector(t()) &&
+ verifier.VerifyVectorOfTables(t()) &&
+ verifier.EndTable();
+ }
+ TestNativeInlineTableT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ void UnPackTo(TestNativeInlineTableT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
+ static flatbuffers::Offset<TestNativeInlineTable> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TestNativeInlineTableT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+};
+
+struct TestNativeInlineTableBuilder {
+ typedef TestNativeInlineTable Table;
+ flatbuffers::FlatBufferBuilder &fbb_;
+ flatbuffers::uoffset_t start_;
+ void add_t(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<NativeInlineTable>>> t) {
+ fbb_.AddOffset(TestNativeInlineTable::VT_T, t);
+ }
+ explicit TestNativeInlineTableBuilder(flatbuffers::FlatBufferBuilder &_fbb)
+ : fbb_(_fbb) {
+ start_ = fbb_.StartTable();
+ }
+ flatbuffers::Offset<TestNativeInlineTable> Finish() {
+ const auto end = fbb_.EndTable(start_);
+ auto o = flatbuffers::Offset<TestNativeInlineTable>(end);
+ return o;
+ }
+};
+
+inline flatbuffers::Offset<TestNativeInlineTable> CreateTestNativeInlineTable(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<NativeInlineTable>>> t = 0) {
+ TestNativeInlineTableBuilder builder_(_fbb);
+ builder_.add_t(t);
+ return builder_.Finish();
+}
+
+inline flatbuffers::Offset<TestNativeInlineTable> CreateTestNativeInlineTableDirect(
+ flatbuffers::FlatBufferBuilder &_fbb,
+ const std::vector<flatbuffers::Offset<NativeInlineTable>> *t = nullptr) {
+ auto t__ = t ? _fbb.CreateVector<flatbuffers::Offset<NativeInlineTable>>(*t) : 0;
+ return CreateTestNativeInlineTable(
+ _fbb,
+ t__);
+}
+
+flatbuffers::Offset<TestNativeInlineTable> CreateTestNativeInlineTable(flatbuffers::FlatBufferBuilder &_fbb, const TestNativeInlineTableT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
+
+
+inline bool operator==(const NativeInlineTableT &lhs, const NativeInlineTableT &rhs) {
+ return
+ (lhs.a == rhs.a);
+}
+
+inline bool operator!=(const NativeInlineTableT &lhs, const NativeInlineTableT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline NativeInlineTableT *NativeInlineTable::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<NativeInlineTableT>(new NativeInlineTableT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void NativeInlineTable::UnPackTo(NativeInlineTableT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = a(); _o->a = _e; }
+}
+
+inline flatbuffers::Offset<NativeInlineTable> NativeInlineTable::Pack(flatbuffers::FlatBufferBuilder &_fbb, const NativeInlineTableT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateNativeInlineTable(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<NativeInlineTable> CreateNativeInlineTable(flatbuffers::FlatBufferBuilder &_fbb, const NativeInlineTableT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const NativeInlineTableT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _a = _o->a;
+ return CreateNativeInlineTable(
+ _fbb,
+ _a);
+}
+
+
+inline bool operator==(const TestNativeInlineTableT &lhs, const TestNativeInlineTableT &rhs) {
+ return
+ (lhs.t == rhs.t);
+}
+
+inline bool operator!=(const TestNativeInlineTableT &lhs, const TestNativeInlineTableT &rhs) {
+ return !(lhs == rhs);
+}
+
+
+inline TestNativeInlineTableT *TestNativeInlineTable::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
+ auto _o = std::unique_ptr<TestNativeInlineTableT>(new TestNativeInlineTableT());
+ UnPackTo(_o.get(), _resolver);
+ return _o.release();
+}
+
+inline void TestNativeInlineTable::UnPackTo(TestNativeInlineTableT *_o, const flatbuffers::resolver_function_t *_resolver) const {
+ (void)_o;
+ (void)_resolver;
+ { auto _e = t(); if (_e) { _o->t.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->t[_i] = *flatbuffers::unique_ptr<NativeInlineTableT>(_e->Get(_i)->UnPack(_resolver)); } } else { _o->t.resize(0); } }
+}
+
+inline flatbuffers::Offset<TestNativeInlineTable> TestNativeInlineTable::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TestNativeInlineTableT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
+ return CreateTestNativeInlineTable(_fbb, _o, _rehasher);
+}
+
+inline flatbuffers::Offset<TestNativeInlineTable> CreateTestNativeInlineTable(flatbuffers::FlatBufferBuilder &_fbb, const TestNativeInlineTableT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
+ (void)_rehasher;
+ (void)_o;
+ struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TestNativeInlineTableT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _t = _o->t.size() ? _fbb.CreateVector<flatbuffers::Offset<NativeInlineTable>> (_o->t.size(), [](size_t i, _VectorArgs *__va) { return CreateNativeInlineTable(*__va->__fbb, &(__va->__o->t[i]), __va->__rehasher); }, &_va ) : 0;
+ return CreateTestNativeInlineTable(
+ _fbb,
+ _t);
+}
+
+inline const flatbuffers::TypeTable *NativeInlineTableTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_INT, 0, -1 }
+ };
+ static const char * const names[] = {
+ "a"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 1, type_codes, nullptr, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+inline const flatbuffers::TypeTable *TestNativeInlineTableTypeTable() {
+ static const flatbuffers::TypeCode type_codes[] = {
+ { flatbuffers::ET_SEQUENCE, 1, 0 }
+ };
+ static const flatbuffers::TypeFunction type_refs[] = {
+ NativeInlineTableTypeTable
+ };
+ static const char * const names[] = {
+ "t"
+ };
+ static const flatbuffers::TypeTable tt = {
+ flatbuffers::ST_TABLE, 1, type_codes, type_refs, nullptr, nullptr, names
+ };
+ return &tt;
+}
+
+#endif // FLATBUFFERS_GENERATED_NATIVEINLINETABLETEST_H_
diff --git a/tests/native_type_test_generated.h b/tests/native_type_test_generated.h
index 8678718..63304f1 100644
--- a/tests/native_type_test_generated.h
+++ b/tests/native_type_test_generated.h
@@ -6,6 +6,13 @@
#include "flatbuffers/flatbuffers.h"
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
+
#include "native_type_test_impl.h"
namespace Geometry {
@@ -201,8 +208,8 @@
inline void ApplicationData::UnPackTo(ApplicationDataT *_o, const flatbuffers::resolver_function_t *_resolver) const {
(void)_o;
(void)_resolver;
- { auto _e = vectors(); if (_e) { _o->vectors.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vectors[_i] = flatbuffers::UnPack(*_e->Get(_i)); } } }
- { auto _e = vectors_alt(); if (_e) { _o->vectors_alt.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vectors_alt[_i] = flatbuffers::UnPackVector3DAlt(*_e->Get(_i)); } } }
+ { auto _e = vectors(); if (_e) { _o->vectors.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vectors[_i] = flatbuffers::UnPack(*_e->Get(_i)); } } else { _o->vectors.resize(0); } }
+ { auto _e = vectors_alt(); if (_e) { _o->vectors_alt.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vectors_alt[_i] = flatbuffers::UnPackVector3DAlt(*_e->Get(_i)); } } else { _o->vectors_alt.resize(0); } }
}
inline flatbuffers::Offset<ApplicationData> ApplicationData::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ApplicationDataT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
diff --git a/tests/nested_namespace_test/nested_namespace_test1_generated.cs b/tests/nested_namespace_test/nested_namespace_test1_generated.cs
index e42e96a..f1e646c 100644
--- a/tests/nested_namespace_test/nested_namespace_test1_generated.cs
+++ b/tests/nested_namespace_test/nested_namespace_test1_generated.cs
@@ -7,7 +7,7 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public enum Color : sbyte
diff --git a/tests/nested_namespace_test/nested_namespace_test2_generated.cs b/tests/nested_namespace_test/nested_namespace_test2_generated.cs
index cdc1b09..efd2584 100644
--- a/tests/nested_namespace_test/nested_namespace_test2_generated.cs
+++ b/tests/nested_namespace_test/nested_namespace_test2_generated.cs
@@ -7,7 +7,7 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public enum Color : sbyte
diff --git a/tests/nested_namespace_test/nested_namespace_test3_generated.cs b/tests/nested_namespace_test/nested_namespace_test3_generated.cs
index f2f3778..85040c5 100644
--- a/tests/nested_namespace_test/nested_namespace_test3_generated.cs
+++ b/tests/nested_namespace_test/nested_namespace_test3_generated.cs
@@ -7,13 +7,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct ColorTestTable : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static ColorTestTable GetRootAsColorTestTable(ByteBuffer _bb) { return GetRootAsColorTestTable(_bb, new ColorTestTable()); }
public static ColorTestTable GetRootAsColorTestTable(ByteBuffer _bb, ColorTestTable obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
diff --git a/tests/optional-scalars/optional-byte.ts b/tests/optional-scalars/optional-byte.ts
index 1db479f..f4db265 100644
--- a/tests/optional-scalars/optional-byte.ts
+++ b/tests/optional-scalars/optional-byte.ts
@@ -1,8 +1,7 @@
// automatically generated by the FlatBuffers compiler, do not modify
-export enum OptionalByte{
+export enum OptionalByte {
None = 0,
One = 1,
Two = 2
}
-
diff --git a/tests/optional-scalars/scalar-stuff.ts b/tests/optional-scalars/scalar-stuff.ts
index a748c22..7c8fd51 100644
--- a/tests/optional-scalars/scalar-stuff.ts
+++ b/tests/optional-scalars/scalar-stuff.ts
@@ -8,7 +8,7 @@
export class ScalarStuff {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):ScalarStuff {
+ __init(i:number, bb:flatbuffers.ByteBuffer):ScalarStuff {
this.bb_pos = i;
this.bb = bb;
return this;
diff --git a/tests/optional_scalars.json b/tests/optional_scalars.json
new file mode 100644
index 0000000..87bd22e
--- /dev/null
+++ b/tests/optional_scalars.json
@@ -0,0 +1,21 @@
+{
+ just_i8: 4,
+ maybe_u8: 0,
+ default_u8: 0,
+ just_i16: 4,
+ maybe_u16: 0,
+ default_u16: 0,
+ just_i32: 4,
+ maybe_u32: 0,
+ default_u32: 0,
+ just_i64: 4,
+ maybe_u64: 0,
+ default_u64: 0,
+ just_f32: 4.0,
+ maybe_f64: 0.0,
+ default_f64: 0.0,
+ just_bool: true,
+ default_bool: false,
+ maybe_enum: "One",
+ default_enum: "Two"
+}
diff --git a/tests/optional_scalars/OptionalByte.py b/tests/optional_scalars/OptionalByte.py
new file mode 100644
index 0000000..5e7df8b
--- /dev/null
+++ b/tests/optional_scalars/OptionalByte.py
@@ -0,0 +1,8 @@
+# automatically generated by the FlatBuffers compiler, do not modify
+
+# namespace: optional_scalars
+
+class OptionalByte(object):
+ None_ = 0
+ One = 1
+ Two = 2
diff --git a/tests/optional_scalars/ScalarStuff.cs b/tests/optional_scalars/ScalarStuff.cs
index e549838..85c1672 100644
--- a/tests/optional_scalars/ScalarStuff.cs
+++ b/tests/optional_scalars/ScalarStuff.cs
@@ -7,13 +7,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct ScalarStuff : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static ScalarStuff GetRootAsScalarStuff(ByteBuffer _bb) { return GetRootAsScalarStuff(_bb, new ScalarStuff()); }
public static ScalarStuff GetRootAsScalarStuff(ByteBuffer _bb, ScalarStuff obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public static bool ScalarStuffBufferHasIdentifier(ByteBuffer _bb) { return Table.__has_identifier(_bb, "NULL"); }
diff --git a/tests/optional_scalars/ScalarStuff.go b/tests/optional_scalars/ScalarStuff.go
index 2992f30..8b56567 100644
--- a/tests/optional_scalars/ScalarStuff.go
+++ b/tests/optional_scalars/ScalarStuff.go
@@ -7,42 +7,42 @@
)
type ScalarStuffT struct {
- JustI8 int8
- MaybeI8 *int8
- DefaultI8 int8
- JustU8 byte
- MaybeU8 *byte
- DefaultU8 byte
- JustI16 int16
- MaybeI16 *int16
- DefaultI16 int16
- JustU16 uint16
- MaybeU16 *uint16
- DefaultU16 uint16
- JustI32 int32
- MaybeI32 *int32
- DefaultI32 int32
- JustU32 uint32
- MaybeU32 *uint32
- DefaultU32 uint32
- JustI64 int64
- MaybeI64 *int64
- DefaultI64 int64
- JustU64 uint64
- MaybeU64 *uint64
- DefaultU64 uint64
- JustF32 float32
- MaybeF32 *float32
- DefaultF32 float32
- JustF64 float64
- MaybeF64 *float64
- DefaultF64 float64
- JustBool bool
- MaybeBool *bool
- DefaultBool bool
- JustEnum OptionalByte
- MaybeEnum *OptionalByte
- DefaultEnum OptionalByte
+ JustI8 int8 `json:"just_i8"`
+ MaybeI8 *int8 `json:"maybe_i8"`
+ DefaultI8 int8 `json:"default_i8"`
+ JustU8 byte `json:"just_u8"`
+ MaybeU8 *byte `json:"maybe_u8"`
+ DefaultU8 byte `json:"default_u8"`
+ JustI16 int16 `json:"just_i16"`
+ MaybeI16 *int16 `json:"maybe_i16"`
+ DefaultI16 int16 `json:"default_i16"`
+ JustU16 uint16 `json:"just_u16"`
+ MaybeU16 *uint16 `json:"maybe_u16"`
+ DefaultU16 uint16 `json:"default_u16"`
+ JustI32 int32 `json:"just_i32"`
+ MaybeI32 *int32 `json:"maybe_i32"`
+ DefaultI32 int32 `json:"default_i32"`
+ JustU32 uint32 `json:"just_u32"`
+ MaybeU32 *uint32 `json:"maybe_u32"`
+ DefaultU32 uint32 `json:"default_u32"`
+ JustI64 int64 `json:"just_i64"`
+ MaybeI64 *int64 `json:"maybe_i64"`
+ DefaultI64 int64 `json:"default_i64"`
+ JustU64 uint64 `json:"just_u64"`
+ MaybeU64 *uint64 `json:"maybe_u64"`
+ DefaultU64 uint64 `json:"default_u64"`
+ JustF32 float32 `json:"just_f32"`
+ MaybeF32 *float32 `json:"maybe_f32"`
+ DefaultF32 float32 `json:"default_f32"`
+ JustF64 float64 `json:"just_f64"`
+ MaybeF64 *float64 `json:"maybe_f64"`
+ DefaultF64 float64 `json:"default_f64"`
+ JustBool bool `json:"just_bool"`
+ MaybeBool *bool `json:"maybe_bool"`
+ DefaultBool bool `json:"default_bool"`
+ JustEnum OptionalByte `json:"just_enum"`
+ MaybeEnum *OptionalByte `json:"maybe_enum"`
+ DefaultEnum OptionalByte `json:"default_enum"`
}
func (t *ScalarStuffT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
diff --git a/tests/optional_scalars/ScalarStuff.java b/tests/optional_scalars/ScalarStuff.java
index e415210..f4890b1 100644
--- a/tests/optional_scalars/ScalarStuff.java
+++ b/tests/optional_scalars/ScalarStuff.java
@@ -9,7 +9,7 @@
@SuppressWarnings("unused")
public final class ScalarStuff extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static ScalarStuff getRootAsScalarStuff(ByteBuffer _bb) { return getRootAsScalarStuff(_bb, new ScalarStuff()); }
public static ScalarStuff getRootAsScalarStuff(ByteBuffer _bb, ScalarStuff obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public static boolean ScalarStuffBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "NULL"); }
diff --git a/tests/optional_scalars/ScalarStuff.kt b/tests/optional_scalars/ScalarStuff.kt
index 5ab8bf4..e9067bb 100644
--- a/tests/optional_scalars/ScalarStuff.kt
+++ b/tests/optional_scalars/ScalarStuff.kt
@@ -197,7 +197,7 @@
return if(o != 0) bb.get(o + bb_pos) else 1
}
companion object {
- fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
fun getRootAsScalarStuff(_bb: ByteBuffer): ScalarStuff = getRootAsScalarStuff(_bb, ScalarStuff())
fun getRootAsScalarStuff(_bb: ByteBuffer, obj: ScalarStuff): ScalarStuff {
_bb.order(ByteOrder.LITTLE_ENDIAN)
diff --git a/tests/optional_scalars/ScalarStuff.py b/tests/optional_scalars/ScalarStuff.py
new file mode 100644
index 0000000..4dea123
--- /dev/null
+++ b/tests/optional_scalars/ScalarStuff.py
@@ -0,0 +1,532 @@
+# automatically generated by the FlatBuffers compiler, do not modify
+
+# namespace: optional_scalars
+
+import flatbuffers
+from flatbuffers.compat import import_numpy
+np = import_numpy()
+
+class ScalarStuff(object):
+ __slots__ = ['_tab']
+
+ @classmethod
+ def GetRootAs(cls, buf, offset=0):
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
+ x = ScalarStuff()
+ x.Init(buf, n + offset)
+ return x
+
+ @classmethod
+ def GetRootAsScalarStuff(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
+ def ScalarStuffBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
+ return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4E\x55\x4C\x4C", size_prefixed=size_prefixed)
+
+ # ScalarStuff
+ def Init(self, buf, pos):
+ self._tab = flatbuffers.table.Table(buf, pos)
+
+ # ScalarStuff
+ def JustI8(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
+ return 0
+
+ # ScalarStuff
+ def MaybeI8(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
+ return None
+
+ # ScalarStuff
+ def DefaultI8(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
+ return 42
+
+ # ScalarStuff
+ def JustU8(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
+ return 0
+
+ # ScalarStuff
+ def MaybeU8(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
+ return None
+
+ # ScalarStuff
+ def DefaultU8(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
+ return 42
+
+ # ScalarStuff
+ def JustI16(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
+ return 0
+
+ # ScalarStuff
+ def MaybeI16(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
+ return None
+
+ # ScalarStuff
+ def DefaultI16(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
+ return 42
+
+ # ScalarStuff
+ def JustU16(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint16Flags, o + self._tab.Pos)
+ return 0
+
+ # ScalarStuff
+ def MaybeU16(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint16Flags, o + self._tab.Pos)
+ return None
+
+ # ScalarStuff
+ def DefaultU16(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint16Flags, o + self._tab.Pos)
+ return 42
+
+ # ScalarStuff
+ def JustI32(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
+ return 0
+
+ # ScalarStuff
+ def MaybeI32(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
+ return None
+
+ # ScalarStuff
+ def DefaultI32(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
+ return 42
+
+ # ScalarStuff
+ def JustU32(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
+ return 0
+
+ # ScalarStuff
+ def MaybeU32(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
+ return None
+
+ # ScalarStuff
+ def DefaultU32(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
+ return 42
+
+ # ScalarStuff
+ def JustI64(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(40))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos)
+ return 0
+
+ # ScalarStuff
+ def MaybeI64(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(42))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos)
+ return None
+
+ # ScalarStuff
+ def DefaultI64(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(44))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos)
+ return 42
+
+ # ScalarStuff
+ def JustU64(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(46))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
+ return 0
+
+ # ScalarStuff
+ def MaybeU64(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(48))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
+ return None
+
+ # ScalarStuff
+ def DefaultU64(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(50))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
+ return 42
+
+ # ScalarStuff
+ def JustF32(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(52))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
+ return 0.0
+
+ # ScalarStuff
+ def MaybeF32(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(54))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
+ return None
+
+ # ScalarStuff
+ def DefaultF32(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(56))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
+ return 42.0
+
+ # ScalarStuff
+ def JustF64(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(58))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
+ return 0.0
+
+ # ScalarStuff
+ def MaybeF64(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(60))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
+ return None
+
+ # ScalarStuff
+ def DefaultF64(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(62))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
+ return 42.0
+
+ # ScalarStuff
+ def JustBool(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(64))
+ if o != 0:
+ return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
+ return False
+
+ # ScalarStuff
+ def MaybeBool(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(66))
+ if o != 0:
+ return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
+ return None
+
+ # ScalarStuff
+ def DefaultBool(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(68))
+ if o != 0:
+ return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
+ return True
+
+ # ScalarStuff
+ def JustEnum(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(70))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
+ return 0
+
+ # ScalarStuff
+ def MaybeEnum(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(72))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
+ return None
+
+ # ScalarStuff
+ def DefaultEnum(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(74))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
+ return 1
+
+def ScalarStuffStart(builder): builder.StartObject(36)
+def Start(builder):
+ return ScalarStuffStart(builder)
+def ScalarStuffAddJustI8(builder, justI8): builder.PrependInt8Slot(0, justI8, 0)
+def AddJustI8(builder, justI8):
+ return ScalarStuffAddJustI8(builder, justI8)
+def ScalarStuffAddMaybeI8(builder, maybeI8): builder.PrependInt8Slot(1, maybeI8, None)
+def AddMaybeI8(builder, maybeI8):
+ return ScalarStuffAddMaybeI8(builder, maybeI8)
+def ScalarStuffAddDefaultI8(builder, defaultI8): builder.PrependInt8Slot(2, defaultI8, 42)
+def AddDefaultI8(builder, defaultI8):
+ return ScalarStuffAddDefaultI8(builder, defaultI8)
+def ScalarStuffAddJustU8(builder, justU8): builder.PrependUint8Slot(3, justU8, 0)
+def AddJustU8(builder, justU8):
+ return ScalarStuffAddJustU8(builder, justU8)
+def ScalarStuffAddMaybeU8(builder, maybeU8): builder.PrependUint8Slot(4, maybeU8, None)
+def AddMaybeU8(builder, maybeU8):
+ return ScalarStuffAddMaybeU8(builder, maybeU8)
+def ScalarStuffAddDefaultU8(builder, defaultU8): builder.PrependUint8Slot(5, defaultU8, 42)
+def AddDefaultU8(builder, defaultU8):
+ return ScalarStuffAddDefaultU8(builder, defaultU8)
+def ScalarStuffAddJustI16(builder, justI16): builder.PrependInt16Slot(6, justI16, 0)
+def AddJustI16(builder, justI16):
+ return ScalarStuffAddJustI16(builder, justI16)
+def ScalarStuffAddMaybeI16(builder, maybeI16): builder.PrependInt16Slot(7, maybeI16, None)
+def AddMaybeI16(builder, maybeI16):
+ return ScalarStuffAddMaybeI16(builder, maybeI16)
+def ScalarStuffAddDefaultI16(builder, defaultI16): builder.PrependInt16Slot(8, defaultI16, 42)
+def AddDefaultI16(builder, defaultI16):
+ return ScalarStuffAddDefaultI16(builder, defaultI16)
+def ScalarStuffAddJustU16(builder, justU16): builder.PrependUint16Slot(9, justU16, 0)
+def AddJustU16(builder, justU16):
+ return ScalarStuffAddJustU16(builder, justU16)
+def ScalarStuffAddMaybeU16(builder, maybeU16): builder.PrependUint16Slot(10, maybeU16, None)
+def AddMaybeU16(builder, maybeU16):
+ return ScalarStuffAddMaybeU16(builder, maybeU16)
+def ScalarStuffAddDefaultU16(builder, defaultU16): builder.PrependUint16Slot(11, defaultU16, 42)
+def AddDefaultU16(builder, defaultU16):
+ return ScalarStuffAddDefaultU16(builder, defaultU16)
+def ScalarStuffAddJustI32(builder, justI32): builder.PrependInt32Slot(12, justI32, 0)
+def AddJustI32(builder, justI32):
+ return ScalarStuffAddJustI32(builder, justI32)
+def ScalarStuffAddMaybeI32(builder, maybeI32): builder.PrependInt32Slot(13, maybeI32, None)
+def AddMaybeI32(builder, maybeI32):
+ return ScalarStuffAddMaybeI32(builder, maybeI32)
+def ScalarStuffAddDefaultI32(builder, defaultI32): builder.PrependInt32Slot(14, defaultI32, 42)
+def AddDefaultI32(builder, defaultI32):
+ return ScalarStuffAddDefaultI32(builder, defaultI32)
+def ScalarStuffAddJustU32(builder, justU32): builder.PrependUint32Slot(15, justU32, 0)
+def AddJustU32(builder, justU32):
+ return ScalarStuffAddJustU32(builder, justU32)
+def ScalarStuffAddMaybeU32(builder, maybeU32): builder.PrependUint32Slot(16, maybeU32, None)
+def AddMaybeU32(builder, maybeU32):
+ return ScalarStuffAddMaybeU32(builder, maybeU32)
+def ScalarStuffAddDefaultU32(builder, defaultU32): builder.PrependUint32Slot(17, defaultU32, 42)
+def AddDefaultU32(builder, defaultU32):
+ return ScalarStuffAddDefaultU32(builder, defaultU32)
+def ScalarStuffAddJustI64(builder, justI64): builder.PrependInt64Slot(18, justI64, 0)
+def AddJustI64(builder, justI64):
+ return ScalarStuffAddJustI64(builder, justI64)
+def ScalarStuffAddMaybeI64(builder, maybeI64): builder.PrependInt64Slot(19, maybeI64, None)
+def AddMaybeI64(builder, maybeI64):
+ return ScalarStuffAddMaybeI64(builder, maybeI64)
+def ScalarStuffAddDefaultI64(builder, defaultI64): builder.PrependInt64Slot(20, defaultI64, 42)
+def AddDefaultI64(builder, defaultI64):
+ return ScalarStuffAddDefaultI64(builder, defaultI64)
+def ScalarStuffAddJustU64(builder, justU64): builder.PrependUint64Slot(21, justU64, 0)
+def AddJustU64(builder, justU64):
+ return ScalarStuffAddJustU64(builder, justU64)
+def ScalarStuffAddMaybeU64(builder, maybeU64): builder.PrependUint64Slot(22, maybeU64, None)
+def AddMaybeU64(builder, maybeU64):
+ return ScalarStuffAddMaybeU64(builder, maybeU64)
+def ScalarStuffAddDefaultU64(builder, defaultU64): builder.PrependUint64Slot(23, defaultU64, 42)
+def AddDefaultU64(builder, defaultU64):
+ return ScalarStuffAddDefaultU64(builder, defaultU64)
+def ScalarStuffAddJustF32(builder, justF32): builder.PrependFloat32Slot(24, justF32, 0.0)
+def AddJustF32(builder, justF32):
+ return ScalarStuffAddJustF32(builder, justF32)
+def ScalarStuffAddMaybeF32(builder, maybeF32): builder.PrependFloat32Slot(25, maybeF32, None)
+def AddMaybeF32(builder, maybeF32):
+ return ScalarStuffAddMaybeF32(builder, maybeF32)
+def ScalarStuffAddDefaultF32(builder, defaultF32): builder.PrependFloat32Slot(26, defaultF32, 42.0)
+def AddDefaultF32(builder, defaultF32):
+ return ScalarStuffAddDefaultF32(builder, defaultF32)
+def ScalarStuffAddJustF64(builder, justF64): builder.PrependFloat64Slot(27, justF64, 0.0)
+def AddJustF64(builder, justF64):
+ return ScalarStuffAddJustF64(builder, justF64)
+def ScalarStuffAddMaybeF64(builder, maybeF64): builder.PrependFloat64Slot(28, maybeF64, None)
+def AddMaybeF64(builder, maybeF64):
+ return ScalarStuffAddMaybeF64(builder, maybeF64)
+def ScalarStuffAddDefaultF64(builder, defaultF64): builder.PrependFloat64Slot(29, defaultF64, 42.0)
+def AddDefaultF64(builder, defaultF64):
+ return ScalarStuffAddDefaultF64(builder, defaultF64)
+def ScalarStuffAddJustBool(builder, justBool): builder.PrependBoolSlot(30, justBool, 0)
+def AddJustBool(builder, justBool):
+ return ScalarStuffAddJustBool(builder, justBool)
+def ScalarStuffAddMaybeBool(builder, maybeBool): builder.PrependBoolSlot(31, maybeBool, None)
+def AddMaybeBool(builder, maybeBool):
+ return ScalarStuffAddMaybeBool(builder, maybeBool)
+def ScalarStuffAddDefaultBool(builder, defaultBool): builder.PrependBoolSlot(32, defaultBool, 1)
+def AddDefaultBool(builder, defaultBool):
+ return ScalarStuffAddDefaultBool(builder, defaultBool)
+def ScalarStuffAddJustEnum(builder, justEnum): builder.PrependInt8Slot(33, justEnum, 0)
+def AddJustEnum(builder, justEnum):
+ return ScalarStuffAddJustEnum(builder, justEnum)
+def ScalarStuffAddMaybeEnum(builder, maybeEnum): builder.PrependInt8Slot(34, maybeEnum, None)
+def AddMaybeEnum(builder, maybeEnum):
+ return ScalarStuffAddMaybeEnum(builder, maybeEnum)
+def ScalarStuffAddDefaultEnum(builder, defaultEnum): builder.PrependInt8Slot(35, defaultEnum, 1)
+def AddDefaultEnum(builder, defaultEnum):
+ return ScalarStuffAddDefaultEnum(builder, defaultEnum)
+def ScalarStuffEnd(builder): return builder.EndObject()
+def End(builder):
+ return ScalarStuffEnd(builder)
+
+class ScalarStuffT(object):
+
+ # ScalarStuffT
+ def __init__(self):
+ self.justI8 = 0 # type: int
+ self.maybeI8 = None # type: Optional[int]
+ self.defaultI8 = 42 # type: int
+ self.justU8 = 0 # type: int
+ self.maybeU8 = None # type: Optional[int]
+ self.defaultU8 = 42 # type: int
+ self.justI16 = 0 # type: int
+ self.maybeI16 = None # type: Optional[int]
+ self.defaultI16 = 42 # type: int
+ self.justU16 = 0 # type: int
+ self.maybeU16 = None # type: Optional[int]
+ self.defaultU16 = 42 # type: int
+ self.justI32 = 0 # type: int
+ self.maybeI32 = None # type: Optional[int]
+ self.defaultI32 = 42 # type: int
+ self.justU32 = 0 # type: int
+ self.maybeU32 = None # type: Optional[int]
+ self.defaultU32 = 42 # type: int
+ self.justI64 = 0 # type: int
+ self.maybeI64 = None # type: Optional[int]
+ self.defaultI64 = 42 # type: int
+ self.justU64 = 0 # type: int
+ self.maybeU64 = None # type: Optional[int]
+ self.defaultU64 = 42 # type: int
+ self.justF32 = 0.0 # type: float
+ self.maybeF32 = None # type: Optional[float]
+ self.defaultF32 = 42.0 # type: float
+ self.justF64 = 0.0 # type: float
+ self.maybeF64 = None # type: Optional[float]
+ self.defaultF64 = 42.0 # type: float
+ self.justBool = False # type: bool
+ self.maybeBool = None # type: Optional[bool]
+ self.defaultBool = True # type: bool
+ self.justEnum = 0 # type: int
+ self.maybeEnum = None # type: Optional[int]
+ self.defaultEnum = 1 # type: int
+
+ @classmethod
+ def InitFromBuf(cls, buf, pos):
+ scalarStuff = ScalarStuff()
+ scalarStuff.Init(buf, pos)
+ return cls.InitFromObj(scalarStuff)
+
+ @classmethod
+ def InitFromObj(cls, scalarStuff):
+ x = ScalarStuffT()
+ x._UnPack(scalarStuff)
+ return x
+
+ # ScalarStuffT
+ def _UnPack(self, scalarStuff):
+ if scalarStuff is None:
+ return
+ self.justI8 = scalarStuff.JustI8()
+ self.maybeI8 = scalarStuff.MaybeI8()
+ self.defaultI8 = scalarStuff.DefaultI8()
+ self.justU8 = scalarStuff.JustU8()
+ self.maybeU8 = scalarStuff.MaybeU8()
+ self.defaultU8 = scalarStuff.DefaultU8()
+ self.justI16 = scalarStuff.JustI16()
+ self.maybeI16 = scalarStuff.MaybeI16()
+ self.defaultI16 = scalarStuff.DefaultI16()
+ self.justU16 = scalarStuff.JustU16()
+ self.maybeU16 = scalarStuff.MaybeU16()
+ self.defaultU16 = scalarStuff.DefaultU16()
+ self.justI32 = scalarStuff.JustI32()
+ self.maybeI32 = scalarStuff.MaybeI32()
+ self.defaultI32 = scalarStuff.DefaultI32()
+ self.justU32 = scalarStuff.JustU32()
+ self.maybeU32 = scalarStuff.MaybeU32()
+ self.defaultU32 = scalarStuff.DefaultU32()
+ self.justI64 = scalarStuff.JustI64()
+ self.maybeI64 = scalarStuff.MaybeI64()
+ self.defaultI64 = scalarStuff.DefaultI64()
+ self.justU64 = scalarStuff.JustU64()
+ self.maybeU64 = scalarStuff.MaybeU64()
+ self.defaultU64 = scalarStuff.DefaultU64()
+ self.justF32 = scalarStuff.JustF32()
+ self.maybeF32 = scalarStuff.MaybeF32()
+ self.defaultF32 = scalarStuff.DefaultF32()
+ self.justF64 = scalarStuff.JustF64()
+ self.maybeF64 = scalarStuff.MaybeF64()
+ self.defaultF64 = scalarStuff.DefaultF64()
+ self.justBool = scalarStuff.JustBool()
+ self.maybeBool = scalarStuff.MaybeBool()
+ self.defaultBool = scalarStuff.DefaultBool()
+ self.justEnum = scalarStuff.JustEnum()
+ self.maybeEnum = scalarStuff.MaybeEnum()
+ self.defaultEnum = scalarStuff.DefaultEnum()
+
+ # ScalarStuffT
+ def Pack(self, builder):
+ ScalarStuffStart(builder)
+ ScalarStuffAddJustI8(builder, self.justI8)
+ ScalarStuffAddMaybeI8(builder, self.maybeI8)
+ ScalarStuffAddDefaultI8(builder, self.defaultI8)
+ ScalarStuffAddJustU8(builder, self.justU8)
+ ScalarStuffAddMaybeU8(builder, self.maybeU8)
+ ScalarStuffAddDefaultU8(builder, self.defaultU8)
+ ScalarStuffAddJustI16(builder, self.justI16)
+ ScalarStuffAddMaybeI16(builder, self.maybeI16)
+ ScalarStuffAddDefaultI16(builder, self.defaultI16)
+ ScalarStuffAddJustU16(builder, self.justU16)
+ ScalarStuffAddMaybeU16(builder, self.maybeU16)
+ ScalarStuffAddDefaultU16(builder, self.defaultU16)
+ ScalarStuffAddJustI32(builder, self.justI32)
+ ScalarStuffAddMaybeI32(builder, self.maybeI32)
+ ScalarStuffAddDefaultI32(builder, self.defaultI32)
+ ScalarStuffAddJustU32(builder, self.justU32)
+ ScalarStuffAddMaybeU32(builder, self.maybeU32)
+ ScalarStuffAddDefaultU32(builder, self.defaultU32)
+ ScalarStuffAddJustI64(builder, self.justI64)
+ ScalarStuffAddMaybeI64(builder, self.maybeI64)
+ ScalarStuffAddDefaultI64(builder, self.defaultI64)
+ ScalarStuffAddJustU64(builder, self.justU64)
+ ScalarStuffAddMaybeU64(builder, self.maybeU64)
+ ScalarStuffAddDefaultU64(builder, self.defaultU64)
+ ScalarStuffAddJustF32(builder, self.justF32)
+ ScalarStuffAddMaybeF32(builder, self.maybeF32)
+ ScalarStuffAddDefaultF32(builder, self.defaultF32)
+ ScalarStuffAddJustF64(builder, self.justF64)
+ ScalarStuffAddMaybeF64(builder, self.maybeF64)
+ ScalarStuffAddDefaultF64(builder, self.defaultF64)
+ ScalarStuffAddJustBool(builder, self.justBool)
+ ScalarStuffAddMaybeBool(builder, self.maybeBool)
+ ScalarStuffAddDefaultBool(builder, self.defaultBool)
+ ScalarStuffAddJustEnum(builder, self.justEnum)
+ ScalarStuffAddMaybeEnum(builder, self.maybeEnum)
+ ScalarStuffAddDefaultEnum(builder, self.defaultEnum)
+ scalarStuff = ScalarStuffEnd(builder)
+ return scalarStuff
diff --git a/tests/optional_scalars/__init__.py b/tests/optional_scalars/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/optional_scalars/__init__.py
diff --git a/tests/optional_scalars/mod.rs b/tests/optional_scalars/mod.rs
index b7af3c5..84291e3 100644
--- a/tests/optional_scalars/mod.rs
+++ b/tests/optional_scalars/mod.rs
@@ -1,4 +1,5 @@
// Automatically generated by the Flatbuffers compiler. Do not modify.
+// @generated
pub mod optional_scalars {
use super::*;
mod optional_byte_generated;
diff --git a/tests/optional_scalars/optional_scalars/optional_byte_generated.rs b/tests/optional_scalars/optional_scalars/optional_byte_generated.rs
index 226e9ec..dae1366 100644
--- a/tests/optional_scalars/optional_scalars/optional_byte_generated.rs
+++ b/tests/optional_scalars/optional_scalars/optional_byte_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
@@ -42,8 +47,8 @@
}
}
}
-impl std::fmt::Debug for OptionalByte {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+impl core::fmt::Debug for OptionalByte {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if let Some(name) = self.variant_name() {
f.write_str(name)
} else {
diff --git a/tests/optional_scalars/optional_scalars/scalar_stuff_generated.rs b/tests/optional_scalars/optional_scalars/scalar_stuff_generated.rs
index 407e278..e201cc0 100644
--- a/tests/optional_scalars/optional_scalars/scalar_stuff_generated.rs
+++ b/tests/optional_scalars/optional_scalars/scalar_stuff_generated.rs
@@ -1,7 +1,12 @@
// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
extern crate flatbuffers;
-use std::mem;
-use std::cmp::Ordering;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
pub enum ScalarStuffOffset {}
@@ -626,8 +631,8 @@
}
}
-impl std::fmt::Debug for ScalarStuff<'_> {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+impl core::fmt::Debug for ScalarStuff<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("ScalarStuff");
ds.field("just_i8", &self.just_i8());
ds.field("maybe_i8", &self.maybe_i8());
diff --git a/tests/optional_scalars_defaults.json b/tests/optional_scalars_defaults.json
new file mode 100644
index 0000000..1f44993
--- /dev/null
+++ b/tests/optional_scalars_defaults.json
@@ -0,0 +1,38 @@
+{
+ just_i8: 4,
+ maybe_i8: null,
+ default_i8: 42,
+ just_u8: 0,
+ maybe_u8: 0,
+ default_u8: 0,
+ just_i16: 4,
+ maybe_i16: null,
+ default_i16: 42,
+ just_u16: 0,
+ maybe_u16: 0,
+ default_u16: 0,
+ just_i32: 4,
+ maybe_i32: null,
+ default_i32: 42,
+ just_u32: 0,
+ maybe_u32: 0,
+ default_u32: 0,
+ just_i64: 4,
+ maybe_i64: null,
+ default_i64: 42,
+ just_u64: 0,
+ maybe_u64: 0,
+ default_u64: 0,
+ just_f32: 4.0,
+ maybe_f32: null,
+ default_f32: 42.0,
+ just_f64: 0.0,
+ maybe_f64: 0.0,
+ default_f64: 0.0,
+ just_bool: true,
+ maybe_bool: null,
+ default_bool: false,
+ just_enum: "None",
+ maybe_enum: "One",
+ default_enum: "Two"
+}
diff --git a/tests/optional_scalars_generated.h b/tests/optional_scalars_generated.h
index c295eba..f71f98d 100644
--- a/tests/optional_scalars_generated.h
+++ b/tests/optional_scalars_generated.h
@@ -6,6 +6,13 @@
#include "flatbuffers/flatbuffers.h"
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
+
namespace optional_scalars {
struct ScalarStuff;
diff --git a/tests/optional_scalars_generated.lobster b/tests/optional_scalars_generated.lobster
index 95cba95..16d9c56 100644
--- a/tests/optional_scalars_generated.lobster
+++ b/tests/optional_scalars_generated.lobster
@@ -11,77 +11,77 @@
class ScalarStuff
class ScalarStuff : flatbuffers_handle
- def just_i8():
+ def just_i8() -> int:
return buf_.flatbuffers_field_int8(pos_, 4, 0)
- def maybe_i8():
+ def maybe_i8() -> int, bool:
return buf_.flatbuffers_field_int8(pos_, 6, 0), buf_.flatbuffers_field_present(pos_, 6)
- def default_i8():
+ def default_i8() -> int:
return buf_.flatbuffers_field_int8(pos_, 8, 42)
- def just_u8():
+ def just_u8() -> int:
return buf_.flatbuffers_field_uint8(pos_, 10, 0)
- def maybe_u8():
+ def maybe_u8() -> int, bool:
return buf_.flatbuffers_field_uint8(pos_, 12, 0), buf_.flatbuffers_field_present(pos_, 12)
- def default_u8():
+ def default_u8() -> int:
return buf_.flatbuffers_field_uint8(pos_, 14, 42)
- def just_i16():
+ def just_i16() -> int:
return buf_.flatbuffers_field_int16(pos_, 16, 0)
- def maybe_i16():
+ def maybe_i16() -> int, bool:
return buf_.flatbuffers_field_int16(pos_, 18, 0), buf_.flatbuffers_field_present(pos_, 18)
- def default_i16():
+ def default_i16() -> int:
return buf_.flatbuffers_field_int16(pos_, 20, 42)
- def just_u16():
+ def just_u16() -> int:
return buf_.flatbuffers_field_uint16(pos_, 22, 0)
- def maybe_u16():
+ def maybe_u16() -> int, bool:
return buf_.flatbuffers_field_uint16(pos_, 24, 0), buf_.flatbuffers_field_present(pos_, 24)
- def default_u16():
+ def default_u16() -> int:
return buf_.flatbuffers_field_uint16(pos_, 26, 42)
- def just_i32():
+ def just_i32() -> int:
return buf_.flatbuffers_field_int32(pos_, 28, 0)
- def maybe_i32():
+ def maybe_i32() -> int, bool:
return buf_.flatbuffers_field_int32(pos_, 30, 0), buf_.flatbuffers_field_present(pos_, 30)
- def default_i32():
+ def default_i32() -> int:
return buf_.flatbuffers_field_int32(pos_, 32, 42)
- def just_u32():
+ def just_u32() -> int:
return buf_.flatbuffers_field_uint32(pos_, 34, 0)
- def maybe_u32():
+ def maybe_u32() -> int, bool:
return buf_.flatbuffers_field_uint32(pos_, 36, 0), buf_.flatbuffers_field_present(pos_, 36)
- def default_u32():
+ def default_u32() -> int:
return buf_.flatbuffers_field_uint32(pos_, 38, 42)
- def just_i64():
+ def just_i64() -> int:
return buf_.flatbuffers_field_int64(pos_, 40, 0)
- def maybe_i64():
+ def maybe_i64() -> int, bool:
return buf_.flatbuffers_field_int64(pos_, 42, 0), buf_.flatbuffers_field_present(pos_, 42)
- def default_i64():
+ def default_i64() -> int:
return buf_.flatbuffers_field_int64(pos_, 44, 42)
- def just_u64():
+ def just_u64() -> int:
return buf_.flatbuffers_field_uint64(pos_, 46, 0)
- def maybe_u64():
+ def maybe_u64() -> int, bool:
return buf_.flatbuffers_field_uint64(pos_, 48, 0), buf_.flatbuffers_field_present(pos_, 48)
- def default_u64():
+ def default_u64() -> int:
return buf_.flatbuffers_field_uint64(pos_, 50, 42)
- def just_f32():
+ def just_f32() -> float:
return buf_.flatbuffers_field_float32(pos_, 52, 0.0)
- def maybe_f32():
+ def maybe_f32() -> float, bool:
return buf_.flatbuffers_field_float32(pos_, 54, 0), buf_.flatbuffers_field_present(pos_, 54)
- def default_f32():
+ def default_f32() -> float:
return buf_.flatbuffers_field_float32(pos_, 56, 42.0)
- def just_f64():
+ def just_f64() -> float:
return buf_.flatbuffers_field_float64(pos_, 58, 0.0)
- def maybe_f64():
+ def maybe_f64() -> float, bool:
return buf_.flatbuffers_field_float64(pos_, 60, 0), buf_.flatbuffers_field_present(pos_, 60)
- def default_f64():
+ def default_f64() -> float:
return buf_.flatbuffers_field_float64(pos_, 62, 42.0)
- def just_bool():
- return buf_.flatbuffers_field_int8(pos_, 64, 0)
- def maybe_bool():
- return buf_.flatbuffers_field_int8(pos_, 66, 0), buf_.flatbuffers_field_present(pos_, 66)
- def default_bool():
- return buf_.flatbuffers_field_int8(pos_, 68, 1)
- def just_enum():
+ def just_bool() -> bool:
+ return bool(buf_.flatbuffers_field_int8(pos_, 64, 0))
+ def maybe_bool() -> bool, bool:
+ return bool(buf_.flatbuffers_field_int8(pos_, 66, 0)), buf_.flatbuffers_field_present(pos_, 66)
+ def default_bool() -> bool:
+ return bool(buf_.flatbuffers_field_int8(pos_, 68, 1))
+ def just_enum() -> OptionalByte:
return OptionalByte(buf_.flatbuffers_field_int8(pos_, 70, 0))
- def maybe_enum():
+ def maybe_enum() -> OptionalByte, bool:
return OptionalByte(buf_.flatbuffers_field_int8(pos_, 72, 0)), buf_.flatbuffers_field_present(pos_, 72)
- def default_enum():
+ def default_enum() -> OptionalByte:
return OptionalByte(buf_.flatbuffers_field_int8(pos_, 74, 1))
def GetRootAsScalarStuff(buf:string): return ScalarStuff { buf, buf.flatbuffers_indirect(0) }
@@ -181,13 +181,13 @@
def add_default_f64(default_f64:float):
b_.PrependFloat64Slot(29, default_f64, 42.0)
return this
- def add_just_bool(just_bool:int):
+ def add_just_bool(just_bool:bool):
b_.PrependBoolSlot(30, just_bool, 0)
return this
- def add_maybe_bool(maybe_bool:int):
+ def add_maybe_bool(maybe_bool:bool):
b_.PrependBoolSlot(31, maybe_bool)
return this
- def add_default_bool(default_bool:int):
+ def add_default_bool(default_bool:bool):
b_.PrependBoolSlot(32, default_bool, 1)
return this
def add_just_enum(just_enum:OptionalByte):
diff --git a/tests/optional_scalars_generated.ts b/tests/optional_scalars_generated.ts
new file mode 100644
index 0000000..4a83c43
--- /dev/null
+++ b/tests/optional_scalars_generated.ts
@@ -0,0 +1,4 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+export { OptionalByte } from './optional-scalars/optional-byte';
+export { ScalarStuff } from './optional-scalars/scalar-stuff';
diff --git a/tests/optional_scalars_test.cpp b/tests/optional_scalars_test.cpp
new file mode 100644
index 0000000..7d4a87d
--- /dev/null
+++ b/tests/optional_scalars_test.cpp
@@ -0,0 +1,101 @@
+#include "optional_scalars_test.h"
+#include <string>
+#include <vector>
+#include "flatbuffers/idl.h"
+#include "optional_scalars_generated.h"
+#include "test_assert.h"
+
+namespace flatbuffers{
+ namespace tests{
+
+
+void OptionalScalarsTest() {
+ // Simple schemas and a "has optional scalar" sentinal.
+ std::vector<std::string> schemas;
+ schemas.push_back("table Monster { mana : int; }");
+ schemas.push_back("table Monster { mana : int = 42; }");
+ schemas.push_back("table Monster { mana : int = null; }");
+ schemas.push_back("table Monster { mana : long; }");
+ schemas.push_back("table Monster { mana : long = 42; }");
+ schemas.push_back("table Monster { mana : long = null; }");
+ schemas.push_back("table Monster { mana : float; }");
+ schemas.push_back("table Monster { mana : float = 42; }");
+ schemas.push_back("table Monster { mana : float = null; }");
+ schemas.push_back("table Monster { mana : double; }");
+ schemas.push_back("table Monster { mana : double = 42; }");
+ schemas.push_back("table Monster { mana : double = null; }");
+ schemas.push_back("table Monster { mana : bool; }");
+ schemas.push_back("table Monster { mana : bool = 42; }");
+ schemas.push_back("table Monster { mana : bool = null; }");
+ schemas.push_back(
+ "enum Enum: int {A=0, B=1} "
+ "table Monster { mana : Enum; }");
+ schemas.push_back(
+ "enum Enum: int {A=0, B=1} "
+ "table Monster { mana : Enum = B; }");
+ schemas.push_back(
+ "enum Enum: int {A=0, B=1} "
+ "table Monster { mana : Enum = null; }");
+
+ // Check the FieldDef is correctly set.
+ for (auto schema = schemas.begin(); schema < schemas.end(); schema++) {
+ const bool has_null = schema->find("null") != std::string::npos;
+ flatbuffers::Parser parser;
+ TEST_ASSERT(parser.Parse(schema->c_str()));
+ const auto *mana = parser.structs_.Lookup("Monster")->fields.Lookup("mana");
+ TEST_EQ(mana->IsOptional(), has_null);
+ }
+
+ // Test if nullable scalars are allowed for each language.
+ for (unsigned lang = 1; lang < flatbuffers::IDLOptions::kMAX; lang <<= 1) {
+ flatbuffers::IDLOptions opts;
+ opts.lang_to_generate = lang;
+ if (false == flatbuffers::Parser::SupportsOptionalScalars(opts)) {
+ continue;
+ }
+ for (auto schema = schemas.begin(); schema < schemas.end(); schema++) {
+ flatbuffers::Parser parser(opts);
+ auto done = parser.Parse(schema->c_str());
+ TEST_EQ_STR(parser.error_.c_str(), "");
+ TEST_ASSERT(done);
+ }
+ }
+
+ // test C++ nullable
+ flatbuffers::FlatBufferBuilder fbb;
+ FinishScalarStuffBuffer(
+ fbb, optional_scalars::CreateScalarStuff(fbb, 1, static_cast<int8_t>(2)));
+ auto opts = optional_scalars::GetMutableScalarStuff(fbb.GetBufferPointer());
+ TEST_ASSERT(!opts->maybe_bool());
+ TEST_ASSERT(!opts->maybe_f32().has_value());
+ TEST_ASSERT(opts->maybe_i8().has_value());
+ TEST_EQ(opts->maybe_i8().value(), 2);
+ TEST_ASSERT(opts->mutate_maybe_i8(3));
+ TEST_ASSERT(opts->maybe_i8().has_value());
+ TEST_EQ(opts->maybe_i8().value(), 3);
+ TEST_ASSERT(!opts->mutate_maybe_i16(-10));
+
+ optional_scalars::ScalarStuffT obj;
+ TEST_ASSERT(!obj.maybe_bool);
+ TEST_ASSERT(!obj.maybe_f32.has_value());
+ opts->UnPackTo(&obj);
+ TEST_ASSERT(!obj.maybe_bool);
+ TEST_ASSERT(!obj.maybe_f32.has_value());
+ TEST_ASSERT(obj.maybe_i8.has_value() && obj.maybe_i8.value() == 3);
+ TEST_ASSERT(obj.maybe_i8 && *obj.maybe_i8 == 3);
+ obj.maybe_i32 = -1;
+ obj.maybe_enum = optional_scalars::OptionalByte_Two;
+
+ fbb.Clear();
+ FinishScalarStuffBuffer(fbb, optional_scalars::ScalarStuff::Pack(fbb, &obj));
+ opts = optional_scalars::GetMutableScalarStuff(fbb.GetBufferPointer());
+ TEST_ASSERT(opts->maybe_i8().has_value());
+ TEST_EQ(opts->maybe_i8().value(), 3);
+ TEST_ASSERT(opts->maybe_i32().has_value());
+ TEST_EQ(opts->maybe_i32().value(), -1);
+ TEST_EQ(opts->maybe_enum().value(), optional_scalars::OptionalByte_Two);
+ TEST_ASSERT(opts->maybe_i32() == flatbuffers::Optional<int64_t>(-1));
+}
+
+ }
+}
\ No newline at end of file
diff --git a/tests/optional_scalars_test.h b/tests/optional_scalars_test.h
new file mode 100644
index 0000000..922e52c
--- /dev/null
+++ b/tests/optional_scalars_test.h
@@ -0,0 +1,13 @@
+#ifndef TESTS_OPTIONAL_SCALARS_TEST_H
+#define TESTS_OPTIONAL_SCALARS_TEST_H
+
+
+namespace flatbuffers {
+namespace tests {
+
+void OptionalScalarsTest();
+
+} // namespace tests
+} // namespace flatbuffers
+
+#endif
diff --git a/tests/package.json b/tests/package.json
deleted file mode 100644
index 654e57f..0000000
--- a/tests/package.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "dependencies": {
- "esm": "^3.2.25",
- "flatbuffers": "../",
- "grpc": "^1.24.6"
- }
-}
diff --git a/tests/parser_test.cpp b/tests/parser_test.cpp
new file mode 100644
index 0000000..1a43504
--- /dev/null
+++ b/tests/parser_test.cpp
@@ -0,0 +1,900 @@
+#include "parser_test.h"
+
+#include <cmath>
+#include <string>
+
+#include "flatbuffers/idl.h"
+#include "test_assert.h"
+
+namespace flatbuffers {
+namespace tests {
+namespace {
+
+// Shortcuts for the infinity.
+static const auto infinity_f = std::numeric_limits<float>::infinity();
+static const auto infinity_d = std::numeric_limits<double>::infinity();
+
+// Test that parser errors are actually generated.
+static void TestError_(const char *src, const char *error_substr, bool strict_json,
+ const char *file, int line, const char *func) {
+ flatbuffers::IDLOptions opts;
+ opts.strict_json = strict_json;
+ flatbuffers::Parser parser(opts);
+ if (parser.Parse(src)) {
+ TestFail("true", "false",
+ ("parser.Parse(\"" + std::string(src) + "\")").c_str(), file, line,
+ func);
+ } else if (!strstr(parser.error_.c_str(), error_substr)) {
+ TestFail(error_substr, parser.error_.c_str(),
+ ("parser.Parse(\"" + std::string(src) + "\")").c_str(), file, line,
+ func);
+ }
+}
+
+static void TestError_(const char *src, const char *error_substr, const char *file,
+ int line, const char *func) {
+ TestError_(src, error_substr, false, file, line, func);
+}
+
+#ifdef _WIN32
+# define TestError(src, ...) \
+ TestError_(src, __VA_ARGS__, __FILE__, __LINE__, __FUNCTION__)
+#else
+# define TestError(src, ...) \
+ TestError_(src, __VA_ARGS__, __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#endif
+
+static bool FloatCompare(float a, float b) { return fabs(a - b) < 0.001; }
+
+} // namespace
+
+// Test that parsing errors occur as we'd expect.
+// Also useful for coverage, making sure these paths are run.
+void ErrorTest() {
+ // In order they appear in idl_parser.cpp
+ TestError("table X { Y:byte; } root_type X; { Y: 999 }", "does not fit");
+ TestError("\"\0", "illegal");
+ TestError("\"\\q", "escape code");
+ TestError("table ///", "documentation");
+ TestError("@", "illegal");
+ TestError("table 1", "expecting");
+ TestError("table X { Y:[[int]]; }", "nested vector");
+ TestError("table X { Y:1; }", "illegal type");
+ TestError("table X { Y:int; Y:int; }", "field already");
+ TestError("table Y {} table X { Y:int; }", "same as table");
+ TestError("struct X { Y:string; }", "only scalar");
+ TestError("struct X { a:uint = 42; }", "default values");
+ TestError("enum Y:byte { Z = 1 } table X { y:Y; }", "not part of enum");
+ TestError("struct X { Y:int (deprecated); }", "deprecate");
+ TestError("union Z { X } table X { Y:Z; } root_type X; { Y: {}, A:1 }",
+ "missing type field");
+ TestError("union Z { X } table X { Y:Z; } root_type X; { Y_type: 99, Y: {",
+ "type id");
+ TestError("table X { Y:int; } root_type X; { Z:", "unknown field");
+ TestError("table X { Y:int; } root_type X; { Y:", "string constant", true);
+ TestError("table X { Y:int; } root_type X; { \"Y\":1, }", "string constant",
+ true);
+ TestError(
+ "struct X { Y:int; Z:int; } table W { V:X; } root_type W; "
+ "{ V:{ Y:1 } }",
+ "wrong number");
+ TestError("enum E:byte { A } table X { Y:E; } root_type X; { Y:U }",
+ "unknown enum value");
+ TestError("table X { Y:byte; } root_type X; { Y:; }", "starting");
+ TestError("enum X:byte { Y } enum X {", "enum already");
+ TestError("enum X:float {}", "underlying");
+ TestError("enum X:byte { Y, Y }", "value already");
+ TestError("enum X:byte { Y=2, Z=2 }", "unique");
+ TestError("enum X:byte (force_align: 4) { Y }", "force_align");
+ TestError("table X { Y:int; } table X {", "datatype already");
+ TestError("table X { } union X { }", "datatype already");
+ TestError("union X { } table X { }", "datatype already");
+ TestError("namespace A; table X { } namespace A; union X { }",
+ "datatype already");
+ TestError("namespace A; union X { } namespace A; table X { }",
+ "datatype already");
+ TestError("struct X (force_align: 7) { Y:int; }", "force_align");
+ TestError("struct X {}", "size 0");
+ TestError("{}", "no root");
+ TestError("table X { Y:byte; } root_type X; { Y:1 } { Y:1 }", "end of file");
+ TestError("table X { Y:byte; } root_type X; { Y:1 } table Y{ Z:int }",
+ "end of file");
+ TestError("root_type X;", "unknown root");
+ TestError("struct X { Y:int; } root_type X;", "a table");
+ TestError("union X { Y }", "referenced");
+ TestError("union Z { X } struct X { Y:int; }", "only tables");
+ TestError("table X { Y:[int]; YLength:int; }", "clash");
+ TestError("table X { Y:byte; } root_type X; { Y:1, Y:2 }", "more than once");
+ // float to integer conversion is forbidden
+ TestError("table X { Y:int; } root_type X; { Y:1.0 }", "float");
+ TestError("table X { Y:bool; } root_type X; { Y:1.0 }", "float");
+ TestError("enum X:bool { Y = true }", "must be integral");
+ // Array of non-scalar
+ TestError("table X { x:int; } struct Y { y:[X:2]; }",
+ "may contain only scalar or struct fields");
+ // Non-snake case field names
+ TestError("table X { Y: int; } root_type Y: {Y:1.0}", "snake_case");
+ // Complex defaults
+ TestError("table X { y: string = 1; }", "expecting: string");
+ TestError("table X { y: string = []; }", " Cannot assign token");
+ TestError("table X { y: [int] = [1]; }", "Expected `]`");
+ TestError("table X { y: [int] = [; }", "Expected `]`");
+ TestError("table X { y: [int] = \"\"; }", "type mismatch");
+ // An identifier can't start from sign (+|-)
+ TestError("table X { -Y: int; } root_type Y: {Y:1.0}", "identifier");
+ TestError("table X { +Y: int; } root_type Y: {Y:1.0}", "identifier");
+}
+
+void EnumOutOfRangeTest() {
+ TestError("enum X:byte { Y = 128 }", "enum value does not fit");
+ TestError("enum X:byte { Y = -129 }", "enum value does not fit");
+ TestError("enum X:byte { Y = 126, Z0, Z1 }", "enum value does not fit");
+ TestError("enum X:ubyte { Y = -1 }", "enum value does not fit");
+ TestError("enum X:ubyte { Y = 256 }", "enum value does not fit");
+ TestError("enum X:ubyte { Y = 255, Z }", "enum value does not fit");
+ TestError("table Y{} union X { Y = -1 }", "enum value does not fit");
+ TestError("table Y{} union X { Y = 256 }", "enum value does not fit");
+ TestError("table Y{} union X { Y = 255, Z:Y }", "enum value does not fit");
+ TestError("enum X:int { Y = -2147483649 }", "enum value does not fit");
+ TestError("enum X:int { Y = 2147483648 }", "enum value does not fit");
+ TestError("enum X:uint { Y = -1 }", "enum value does not fit");
+ TestError("enum X:uint { Y = 4294967297 }", "enum value does not fit");
+ TestError("enum X:long { Y = 9223372036854775808 }", "does not fit");
+ TestError("enum X:long { Y = 9223372036854775807, Z }",
+ "enum value does not fit");
+ TestError("enum X:ulong { Y = -1 }", "does not fit");
+ TestError("enum X:ubyte (bit_flags) { Y=8 }", "bit flag out");
+ TestError("enum X:byte (bit_flags) { Y=7 }", "must be unsigned"); // -128
+ // bit_flgs out of range
+ TestError("enum X:ubyte (bit_flags) { Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8 }",
+ "out of range");
+}
+
+void IntegerOutOfRangeTest() {
+ TestError("table T { F:byte; } root_type T; { F:128 }",
+ "constant does not fit");
+ TestError("table T { F:byte; } root_type T; { F:-129 }",
+ "constant does not fit");
+ TestError("table T { F:ubyte; } root_type T; { F:256 }",
+ "constant does not fit");
+ TestError("table T { F:ubyte; } root_type T; { F:-1 }",
+ "constant does not fit");
+ TestError("table T { F:short; } root_type T; { F:32768 }",
+ "constant does not fit");
+ TestError("table T { F:short; } root_type T; { F:-32769 }",
+ "constant does not fit");
+ TestError("table T { F:ushort; } root_type T; { F:65536 }",
+ "constant does not fit");
+ TestError("table T { F:ushort; } root_type T; { F:-1 }",
+ "constant does not fit");
+ TestError("table T { F:int; } root_type T; { F:2147483648 }",
+ "constant does not fit");
+ TestError("table T { F:int; } root_type T; { F:-2147483649 }",
+ "constant does not fit");
+ TestError("table T { F:uint; } root_type T; { F:4294967296 }",
+ "constant does not fit");
+ TestError("table T { F:uint; } root_type T; { F:-1 }",
+ "constant does not fit");
+ // Check fixed width aliases
+ TestError("table X { Y:uint8; } root_type X; { Y: -1 }", "does not fit");
+ TestError("table X { Y:uint8; } root_type X; { Y: 256 }", "does not fit");
+ TestError("table X { Y:uint16; } root_type X; { Y: -1 }", "does not fit");
+ TestError("table X { Y:uint16; } root_type X; { Y: 65536 }", "does not fit");
+ TestError("table X { Y:uint32; } root_type X; { Y: -1 }", "");
+ TestError("table X { Y:uint32; } root_type X; { Y: 4294967296 }",
+ "does not fit");
+ TestError("table X { Y:uint64; } root_type X; { Y: -1 }", "");
+ TestError("table X { Y:uint64; } root_type X; { Y: -9223372036854775809 }",
+ "does not fit");
+ TestError("table X { Y:uint64; } root_type X; { Y: 18446744073709551616 }",
+ "does not fit");
+
+ TestError("table X { Y:int8; } root_type X; { Y: -129 }", "does not fit");
+ TestError("table X { Y:int8; } root_type X; { Y: 128 }", "does not fit");
+ TestError("table X { Y:int16; } root_type X; { Y: -32769 }", "does not fit");
+ TestError("table X { Y:int16; } root_type X; { Y: 32768 }", "does not fit");
+ TestError("table X { Y:int32; } root_type X; { Y: -2147483649 }", "");
+ TestError("table X { Y:int32; } root_type X; { Y: 2147483648 }",
+ "does not fit");
+ TestError("table X { Y:int64; } root_type X; { Y: -9223372036854775809 }",
+ "does not fit");
+ TestError("table X { Y:int64; } root_type X; { Y: 9223372036854775808 }",
+ "does not fit");
+ // check out-of-int64 as int8
+ TestError("table X { Y:int8; } root_type X; { Y: -9223372036854775809 }",
+ "does not fit");
+ TestError("table X { Y:int8; } root_type X; { Y: 9223372036854775808 }",
+ "does not fit");
+
+ // Check default values
+ TestError("table X { Y:int64=-9223372036854775809; } root_type X; {}",
+ "does not fit");
+ TestError("table X { Y:int64= 9223372036854775808; } root_type X; {}",
+ "does not fit");
+ TestError("table X { Y:uint64; } root_type X; { Y: -1 }", "");
+ TestError("table X { Y:uint64=-9223372036854775809; } root_type X; {}",
+ "does not fit");
+ TestError("table X { Y:uint64= 18446744073709551616; } root_type X; {}",
+ "does not fit");
+}
+
+void InvalidFloatTest() {
+ auto invalid_msg = "invalid number";
+ auto comma_msg = "expecting: ,";
+ TestError("table T { F:float; } root_type T; { F:1,0 }", "");
+ TestError("table T { F:float; } root_type T; { F:. }", "");
+ TestError("table T { F:float; } root_type T; { F:- }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:+ }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:-. }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:+. }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:.e }", "");
+ TestError("table T { F:float; } root_type T; { F:-e }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:+e }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:-.e }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:+.e }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:-e1 }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:+e1 }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:1.0e+ }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:1.0e- }", invalid_msg);
+ // exponent pP is mandatory for hex-float
+ TestError("table T { F:float; } root_type T; { F:0x0 }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:-0x. }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:0x. }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:0Xe }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:\"0Xe\" }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:\"nan(1)\" }", invalid_msg);
+ // eE not exponent in hex-float!
+ TestError("table T { F:float; } root_type T; { F:0x0.0e+ }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:0x0.0e- }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:0x0.0p }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:0x0.0p+ }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:0x0.0p- }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:0x0.0pa1 }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:0x0.0e+ }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:0x0.0e- }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:0x0.0e+0 }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:0x0.0e-0 }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:0x0.0ep+ }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:0x0.0ep- }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:1.2.3 }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:1.2.e3 }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:1.2e.3 }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:1.2e0.3 }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:1.2e3. }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:1.2e3.0 }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:+-1.0 }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:1.0e+-1 }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:\"1.0e+-1\" }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:1.e0e }", comma_msg);
+ TestError("table T { F:float; } root_type T; { F:0x1.p0e }", comma_msg);
+ TestError("table T { F:float; } root_type T; { F:\" 0x10 \" }", invalid_msg);
+ // floats in string
+ TestError("table T { F:float; } root_type T; { F:\"1,2.\" }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:\"1.2e3.\" }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:\"0x1.p0e\" }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:\"0x1.0\" }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:\" 0x1.0\" }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:\"+ 0\" }", invalid_msg);
+ // disable escapes for "number-in-string"
+ TestError("table T { F:float; } root_type T; { F:\"\\f1.2e3.\" }", "invalid");
+ TestError("table T { F:float; } root_type T; { F:\"\\t1.2e3.\" }", "invalid");
+ TestError("table T { F:float; } root_type T; { F:\"\\n1.2e3.\" }", "invalid");
+ TestError("table T { F:float; } root_type T; { F:\"\\r1.2e3.\" }", "invalid");
+ TestError("table T { F:float; } root_type T; { F:\"4\\x005\" }", "invalid");
+ TestError("table T { F:float; } root_type T; { F:\"\'12\'\" }", invalid_msg);
+ // null is not a number constant!
+ TestError("table T { F:float; } root_type T; { F:\"null\" }", invalid_msg);
+ TestError("table T { F:float; } root_type T; { F:null }", invalid_msg);
+}
+
+void UnicodeInvalidSurrogatesTest() {
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\\uD800\"}",
+ "unpaired high surrogate");
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\\uD800abcd\"}",
+ "unpaired high surrogate");
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\\uD800\\n\"}",
+ "unpaired high surrogate");
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\\uD800\\uD800\"}",
+ "multiple high surrogates");
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\\uDC00\"}",
+ "unpaired low surrogate");
+}
+
+void InvalidUTF8Test() {
+ // "1 byte" pattern, under min length of 2 bytes
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\x80\"}",
+ "illegal UTF-8 sequence");
+ // 2 byte pattern, string too short
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\xDF\"}",
+ "illegal UTF-8 sequence");
+ // 3 byte pattern, string too short
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\xEF\xBF\"}",
+ "illegal UTF-8 sequence");
+ // 4 byte pattern, string too short
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\xF7\xBF\xBF\"}",
+ "illegal UTF-8 sequence");
+ // "5 byte" pattern, string too short
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\xFB\xBF\xBF\xBF\"}",
+ "illegal UTF-8 sequence");
+ // "6 byte" pattern, string too short
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\xFD\xBF\xBF\xBF\xBF\"}",
+ "illegal UTF-8 sequence");
+ // "7 byte" pattern, string too short
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\xFE\xBF\xBF\xBF\xBF\xBF\"}",
+ "illegal UTF-8 sequence");
+ // "5 byte" pattern, over max length of 4 bytes
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\xFB\xBF\xBF\xBF\xBF\"}",
+ "illegal UTF-8 sequence");
+ // "6 byte" pattern, over max length of 4 bytes
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\xFD\xBF\xBF\xBF\xBF\xBF\"}",
+ "illegal UTF-8 sequence");
+ // "7 byte" pattern, over max length of 4 bytes
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\xFE\xBF\xBF\xBF\xBF\xBF\xBF\"}",
+ "illegal UTF-8 sequence");
+
+ // Three invalid encodings for U+000A (\n, aka NEWLINE)
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\xC0\x8A\"}",
+ "illegal UTF-8 sequence");
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\xE0\x80\x8A\"}",
+ "illegal UTF-8 sequence");
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\xF0\x80\x80\x8A\"}",
+ "illegal UTF-8 sequence");
+
+ // Two invalid encodings for U+00A9 (COPYRIGHT SYMBOL)
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\xE0\x81\xA9\"}",
+ "illegal UTF-8 sequence");
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\xF0\x80\x81\xA9\"}",
+ "illegal UTF-8 sequence");
+
+ // Invalid encoding for U+20AC (EURO SYMBOL)
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\xF0\x82\x82\xAC\"}",
+ "illegal UTF-8 sequence");
+
+ // UTF-16 surrogate values between U+D800 and U+DFFF cannot be encoded in
+ // UTF-8
+ TestError(
+ "table T { F:string; }"
+ "root_type T;"
+ // U+10400 "encoded" as U+D801 U+DC00
+ "{ F:\"\xED\xA0\x81\xED\xB0\x80\"}",
+ "illegal UTF-8 sequence");
+
+ // Check independence of identifier from locale.
+ std::string locale_ident;
+ locale_ident += "table T { F";
+ locale_ident += static_cast<char>(-32); // unsigned 0xE0
+ locale_ident += " :string; }";
+ locale_ident += "root_type T;";
+ locale_ident += "{}";
+ TestError(locale_ident.c_str(), "");
+}
+
+template<typename T>
+T TestValue(const char *json, const char *type_name,
+ const char *decls = nullptr) {
+ flatbuffers::Parser parser;
+ parser.builder_.ForceDefaults(true); // return defaults
+ auto check_default = json ? false : true;
+ if (check_default) { parser.opts.output_default_scalars_in_json = true; }
+ // Simple schema.
+ std::string schema = std::string(decls ? decls : "") + "\n" +
+ "table X { y:" + std::string(type_name) +
+ "; } root_type X;";
+ auto schema_done = parser.Parse(schema.c_str());
+ TEST_EQ_STR(parser.error_.c_str(), "");
+ TEST_EQ(schema_done, true);
+
+ auto done = parser.Parse(check_default ? "{}" : json);
+ TEST_EQ_STR(parser.error_.c_str(), "");
+ TEST_EQ(done, true);
+
+ // Check with print.
+ std::string print_back;
+ parser.opts.indent_step = -1;
+ TEST_EQ(GenerateText(parser, parser.builder_.GetBufferPointer(), &print_back),
+ true);
+ // restore value from its default
+ if (check_default) { TEST_EQ(parser.Parse(print_back.c_str()), true); }
+
+ auto root = flatbuffers::GetRoot<flatbuffers::Table>(
+ parser.builder_.GetBufferPointer());
+ return root->GetField<T>(flatbuffers::FieldIndexToOffset(0), 0);
+}
+
+// Additional parser testing not covered elsewhere.
+void ValueTest() {
+ // Test scientific notation numbers.
+ TEST_EQ(
+ FloatCompare(TestValue<float>("{ y:0.0314159e+2 }", "float"), 3.14159f),
+ true);
+ // number in string
+ TEST_EQ(FloatCompare(TestValue<float>("{ y:\"0.0314159e+2\" }", "float"),
+ 3.14159f),
+ true);
+
+ // Test conversion functions.
+ TEST_EQ(FloatCompare(TestValue<float>("{ y:cos(rad(180)) }", "float"), -1),
+ true);
+
+ // int embedded to string
+ TEST_EQ(TestValue<int>("{ y:\"-876\" }", "int=-123"), -876);
+ TEST_EQ(TestValue<int>("{ y:\"876\" }", "int=-123"), 876);
+
+ // Test negative hex constant.
+ TEST_EQ(TestValue<int>("{ y:-0x8ea0 }", "int=-0x8ea0"), -36512);
+ TEST_EQ(TestValue<int>(nullptr, "int=-0x8ea0"), -36512);
+
+ // positive hex constant
+ TEST_EQ(TestValue<int>("{ y:0x1abcdef }", "int=0x1"), 0x1abcdef);
+ // with optional '+' sign
+ TEST_EQ(TestValue<int>("{ y:+0x1abcdef }", "int=+0x1"), 0x1abcdef);
+ // hex in string
+ TEST_EQ(TestValue<int>("{ y:\"0x1abcdef\" }", "int=+0x1"), 0x1abcdef);
+
+ // Make sure we do unsigned 64bit correctly.
+ TEST_EQ(TestValue<uint64_t>("{ y:12335089644688340133 }", "ulong"),
+ 12335089644688340133ULL);
+
+ // bool in string
+ TEST_EQ(TestValue<bool>("{ y:\"false\" }", "bool=true"), false);
+ TEST_EQ(TestValue<bool>("{ y:\"true\" }", "bool=\"true\""), true);
+ TEST_EQ(TestValue<bool>("{ y:'false' }", "bool=true"), false);
+ TEST_EQ(TestValue<bool>("{ y:'true' }", "bool=\"true\""), true);
+
+ // check comments before and after json object
+ TEST_EQ(TestValue<int>("/*before*/ { y:1 } /*after*/", "int"), 1);
+ TEST_EQ(TestValue<int>("//before \n { y:1 } //after", "int"), 1);
+}
+
+void NestedListTest() {
+ flatbuffers::Parser parser1;
+ TEST_EQ(parser1.Parse("struct Test { a:short; b:byte; } table T { F:[Test]; }"
+ "root_type T;"
+ "{ F:[ [10,20], [30,40]] }"),
+ true);
+}
+
+void EnumStringsTest() {
+ flatbuffers::Parser parser1;
+ TEST_EQ(parser1.Parse("enum E:byte { A, B, C } table T { F:[E]; }"
+ "root_type T;"
+ "{ F:[ A, B, \"C\", \"A B C\" ] }"),
+ true);
+ flatbuffers::Parser parser2;
+ TEST_EQ(parser2.Parse("enum E:byte { A, B, C } table T { F:[int]; }"
+ "root_type T;"
+ "{ F:[ \"E.C\", \"E.A E.B E.C\" ] }"),
+ true);
+ // unsigned bit_flags
+ flatbuffers::Parser parser3;
+ TEST_EQ(
+ parser3.Parse("enum E:uint16 (bit_flags) { F0, F07=7, F08, F14=14, F15 }"
+ " table T { F: E = \"F15 F08\"; }"
+ "root_type T;"),
+ true);
+}
+
+void EnumValueTest() {
+ // json: "{ Y:0 }", schema: table X { y: "E"}
+ // 0 in enum (V=0) E then Y=0 is valid.
+ TEST_EQ(TestValue<int>("{ y:0 }", "E", "enum E:int { V }"), 0);
+ TEST_EQ(TestValue<int>("{ y:V }", "E", "enum E:int { V }"), 0);
+ // A default value of Y is 0.
+ TEST_EQ(TestValue<int>("{ }", "E", "enum E:int { V }"), 0);
+ TEST_EQ(TestValue<int>("{ y:5 }", "E=V", "enum E:int { V=5 }"), 5);
+ // Generate json with defaults and check.
+ TEST_EQ(TestValue<int>(nullptr, "E=V", "enum E:int { V=5 }"), 5);
+ // 5 in enum
+ TEST_EQ(TestValue<int>("{ y:5 }", "E", "enum E:int { Z, V=5 }"), 5);
+ TEST_EQ(TestValue<int>("{ y:5 }", "E=V", "enum E:int { Z, V=5 }"), 5);
+ // Generate json with defaults and check.
+ TEST_EQ(TestValue<int>(nullptr, "E", "enum E:int { Z, V=5 }"), 0);
+ TEST_EQ(TestValue<int>(nullptr, "E=V", "enum E:int { Z, V=5 }"), 5);
+ // u84 test
+ TEST_EQ(TestValue<uint64_t>(nullptr, "E=V",
+ "enum E:ulong { V = 13835058055282163712 }"),
+ 13835058055282163712ULL);
+ TEST_EQ(TestValue<uint64_t>(nullptr, "E=V",
+ "enum E:ulong { V = 18446744073709551615 }"),
+ 18446744073709551615ULL);
+ // Assign non-enum value to enum field. Is it right?
+ TEST_EQ(TestValue<int>("{ y:7 }", "E", "enum E:int { V = 0 }"), 7);
+ // Check that non-ascending values are valid.
+ TEST_EQ(TestValue<int>("{ y:5 }", "E=V", "enum E:int { Z=10, V=5 }"), 5);
+}
+
+void IntegerBoundaryTest() {
+ // Check numerical compatibility with non-C++ languages.
+ // By the C++ standard, std::numerical_limits<int64_t>::min() ==
+ // -9223372036854775807 (-2^63+1) or less* The Flatbuffers grammar and most of
+ // the languages (C#, Java, Rust) expect that minimum values are: -128,
+ // -32768,.., -9223372036854775808. Since C++20,
+ // static_cast<int64>(0x8000000000000000ULL) is well-defined two's complement
+ // cast. Therefore -9223372036854775808 should be valid negative value.
+ TEST_EQ(flatbuffers::numeric_limits<int8_t>::min(), -128);
+ TEST_EQ(flatbuffers::numeric_limits<int8_t>::max(), 127);
+ TEST_EQ(flatbuffers::numeric_limits<int16_t>::min(), -32768);
+ TEST_EQ(flatbuffers::numeric_limits<int16_t>::max(), 32767);
+ TEST_EQ(flatbuffers::numeric_limits<int32_t>::min() + 1, -2147483647);
+ TEST_EQ(flatbuffers::numeric_limits<int32_t>::max(), 2147483647ULL);
+ TEST_EQ(flatbuffers::numeric_limits<int64_t>::min() + 1LL,
+ -9223372036854775807LL);
+ TEST_EQ(flatbuffers::numeric_limits<int64_t>::max(), 9223372036854775807ULL);
+ TEST_EQ(flatbuffers::numeric_limits<uint8_t>::max(), 255);
+ TEST_EQ(flatbuffers::numeric_limits<uint16_t>::max(), 65535);
+ TEST_EQ(flatbuffers::numeric_limits<uint32_t>::max(), 4294967295ULL);
+ TEST_EQ(flatbuffers::numeric_limits<uint64_t>::max(),
+ 18446744073709551615ULL);
+
+ TEST_EQ(TestValue<int8_t>("{ y:127 }", "byte"), 127);
+ TEST_EQ(TestValue<int8_t>("{ y:-128 }", "byte"), -128);
+ TEST_EQ(TestValue<uint8_t>("{ y:255 }", "ubyte"), 255);
+ TEST_EQ(TestValue<uint8_t>("{ y:0 }", "ubyte"), 0);
+ TEST_EQ(TestValue<int16_t>("{ y:32767 }", "short"), 32767);
+ TEST_EQ(TestValue<int16_t>("{ y:-32768 }", "short"), -32768);
+ TEST_EQ(TestValue<uint16_t>("{ y:65535 }", "ushort"), 65535);
+ TEST_EQ(TestValue<uint16_t>("{ y:0 }", "ushort"), 0);
+ TEST_EQ(TestValue<int32_t>("{ y:2147483647 }", "int"), 2147483647);
+ TEST_EQ(TestValue<int32_t>("{ y:-2147483648 }", "int") + 1, -2147483647);
+ TEST_EQ(TestValue<uint32_t>("{ y:4294967295 }", "uint"), 4294967295);
+ TEST_EQ(TestValue<uint32_t>("{ y:0 }", "uint"), 0);
+ TEST_EQ(TestValue<int64_t>("{ y:9223372036854775807 }", "long"),
+ 9223372036854775807LL);
+ TEST_EQ(TestValue<int64_t>("{ y:-9223372036854775808 }", "long") + 1LL,
+ -9223372036854775807LL);
+ TEST_EQ(TestValue<uint64_t>("{ y:18446744073709551615 }", "ulong"),
+ 18446744073709551615ULL);
+ TEST_EQ(TestValue<uint64_t>("{ y:0 }", "ulong"), 0);
+ TEST_EQ(TestValue<uint64_t>("{ y: 18446744073709551615 }", "uint64"),
+ 18446744073709551615ULL);
+ // check that the default works
+ TEST_EQ(TestValue<uint64_t>(nullptr, "uint64 = 18446744073709551615"),
+ 18446744073709551615ULL);
+}
+
+void ValidFloatTest() {
+ // check rounding to infinity
+ TEST_EQ(TestValue<float>("{ y:+3.4029e+38 }", "float"), +infinity_f);
+ TEST_EQ(TestValue<float>("{ y:-3.4029e+38 }", "float"), -infinity_f);
+ TEST_EQ(TestValue<double>("{ y:+1.7977e+308 }", "double"), +infinity_d);
+ TEST_EQ(TestValue<double>("{ y:-1.7977e+308 }", "double"), -infinity_d);
+
+ TEST_EQ(
+ FloatCompare(TestValue<float>("{ y:0.0314159e+2 }", "float"), 3.14159f),
+ true);
+ // float in string
+ TEST_EQ(FloatCompare(TestValue<float>("{ y:\" 0.0314159e+2 \" }", "float"),
+ 3.14159f),
+ true);
+
+ TEST_EQ(TestValue<float>("{ y:1 }", "float"), 1.0f);
+ TEST_EQ(TestValue<float>("{ y:1.0 }", "float"), 1.0f);
+ TEST_EQ(TestValue<float>("{ y:1. }", "float"), 1.0f);
+ TEST_EQ(TestValue<float>("{ y:+1. }", "float"), 1.0f);
+ TEST_EQ(TestValue<float>("{ y:-1. }", "float"), -1.0f);
+ TEST_EQ(TestValue<float>("{ y:1.e0 }", "float"), 1.0f);
+ TEST_EQ(TestValue<float>("{ y:1.e+0 }", "float"), 1.0f);
+ TEST_EQ(TestValue<float>("{ y:1.e-0 }", "float"), 1.0f);
+ TEST_EQ(TestValue<float>("{ y:0.125 }", "float"), 0.125f);
+ TEST_EQ(TestValue<float>("{ y:.125 }", "float"), 0.125f);
+ TEST_EQ(TestValue<float>("{ y:-.125 }", "float"), -0.125f);
+ TEST_EQ(TestValue<float>("{ y:+.125 }", "float"), +0.125f);
+ TEST_EQ(TestValue<float>("{ y:5 }", "float"), 5.0f);
+ TEST_EQ(TestValue<float>("{ y:\"5\" }", "float"), 5.0f);
+
+#if defined(FLATBUFFERS_HAS_NEW_STRTOD) && (FLATBUFFERS_HAS_NEW_STRTOD > 0)
+ // Old MSVC versions may have problem with this check.
+ // https://www.exploringbinary.com/visual-c-plus-plus-strtod-still-broken/
+ TEST_EQ(TestValue<double>("{ y:6.9294956446009195e15 }", "double"),
+ 6929495644600920.0);
+ // check nan's
+ TEST_EQ(std::isnan(TestValue<double>("{ y:nan }", "double")), true);
+ TEST_EQ(std::isnan(TestValue<float>("{ y:nan }", "float")), true);
+ TEST_EQ(std::isnan(TestValue<float>("{ y:\"nan\" }", "float")), true);
+ TEST_EQ(std::isnan(TestValue<float>("{ y:\"+nan\" }", "float")), true);
+ TEST_EQ(std::isnan(TestValue<float>("{ y:\"-nan\" }", "float")), true);
+ TEST_EQ(std::isnan(TestValue<float>("{ y:+nan }", "float")), true);
+ TEST_EQ(std::isnan(TestValue<float>("{ y:-nan }", "float")), true);
+ TEST_EQ(std::isnan(TestValue<float>(nullptr, "float=nan")), true);
+ TEST_EQ(std::isnan(TestValue<float>(nullptr, "float=-nan")), true);
+ // check inf
+ TEST_EQ(TestValue<float>("{ y:inf }", "float"), infinity_f);
+ TEST_EQ(TestValue<float>("{ y:\"inf\" }", "float"), infinity_f);
+ TEST_EQ(TestValue<float>("{ y:\"-inf\" }", "float"), -infinity_f);
+ TEST_EQ(TestValue<float>("{ y:\"+inf\" }", "float"), infinity_f);
+ TEST_EQ(TestValue<float>("{ y:+inf }", "float"), infinity_f);
+ TEST_EQ(TestValue<float>("{ y:-inf }", "float"), -infinity_f);
+ TEST_EQ(TestValue<float>(nullptr, "float=inf"), infinity_f);
+ TEST_EQ(TestValue<float>(nullptr, "float=-inf"), -infinity_f);
+ TestValue<double>(
+ "{ y: [0.2, .2, 1.0, -1.0, -2., 2., 1e0, -1e0, 1.0e0, -1.0e0, -3.e2, "
+ "3.0e2] }",
+ "[double]");
+ TestValue<float>(
+ "{ y: [0.2, .2, 1.0, -1.0, -2., 2., 1e0, -1e0, 1.0e0, -1.0e0, -3.e2, "
+ "3.0e2] }",
+ "[float]");
+
+ // Test binary format of float point.
+ // https://en.cppreference.com/w/cpp/language/floating_literal
+ // 0x11.12p-1 = (1*16^1 + 2*16^0 + 3*16^-1 + 4*16^-2) * 2^-1 =
+ TEST_EQ(TestValue<double>("{ y:0x12.34p-1 }", "double"), 9.1015625);
+ // hex fraction 1.2 (decimal 1.125) scaled by 2^3, that is 9.0
+ TEST_EQ(TestValue<float>("{ y:-0x0.2p0 }", "float"), -0.125f);
+ TEST_EQ(TestValue<float>("{ y:-0x.2p1 }", "float"), -0.25f);
+ TEST_EQ(TestValue<float>("{ y:0x1.2p3 }", "float"), 9.0f);
+ TEST_EQ(TestValue<float>("{ y:0x10.1p0 }", "float"), 16.0625f);
+ TEST_EQ(TestValue<double>("{ y:0x1.2p3 }", "double"), 9.0);
+ TEST_EQ(TestValue<double>("{ y:0x10.1p0 }", "double"), 16.0625);
+ TEST_EQ(TestValue<double>("{ y:0xC.68p+2 }", "double"), 49.625);
+ TestValue<double>("{ y: [0x20.4ep1, +0x20.4ep1, -0x20.4ep1] }", "[double]");
+ TestValue<float>("{ y: [0x20.4ep1, +0x20.4ep1, -0x20.4ep1] }", "[float]");
+
+#else // FLATBUFFERS_HAS_NEW_STRTOD
+ TEST_OUTPUT_LINE("FLATBUFFERS_HAS_NEW_STRTOD tests skipped");
+#endif // !FLATBUFFERS_HAS_NEW_STRTOD
+}
+
+void UnicodeTest() {
+ flatbuffers::Parser parser;
+ // Without setting allow_non_utf8 = true, we treat \x sequences as byte
+ // sequences which are then validated as UTF-8.
+ TEST_EQ(parser.Parse("table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\\u20AC\\u00A2\\u30E6\\u30FC\\u30B6\\u30FC"
+ "\\u5225\\u30B5\\u30A4\\u30C8\\xE2\\x82\\xAC\\u0080\\uD8"
+ "3D\\uDE0E\" }"),
+ true);
+ std::string jsongen;
+ parser.opts.indent_step = -1;
+ auto result =
+ GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen);
+ TEST_EQ(result, true);
+ TEST_EQ_STR(jsongen.c_str(),
+ "{F: \"\\u20AC\\u00A2\\u30E6\\u30FC\\u30B6\\u30FC"
+ "\\u5225\\u30B5\\u30A4\\u30C8\\u20AC\\u0080\\uD83D\\uDE0E\"}");
+}
+
+void UnicodeTestAllowNonUTF8() {
+ flatbuffers::Parser parser;
+ parser.opts.allow_non_utf8 = true;
+ TEST_EQ(
+ parser.Parse(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\\u20AC\\u00A2\\u30E6\\u30FC\\u30B6\\u30FC"
+ "\\u5225\\u30B5\\u30A4\\u30C8\\x01\\x80\\u0080\\uD83D\\uDE0E\" }"),
+ true);
+ std::string jsongen;
+ parser.opts.indent_step = -1;
+ auto result =
+ GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen);
+ TEST_EQ(result, true);
+ TEST_EQ_STR(
+ jsongen.c_str(),
+ "{F: \"\\u20AC\\u00A2\\u30E6\\u30FC\\u30B6\\u30FC"
+ "\\u5225\\u30B5\\u30A4\\u30C8\\u0001\\x80\\u0080\\uD83D\\uDE0E\"}");
+}
+
+void UnicodeTestGenerateTextFailsOnNonUTF8() {
+ flatbuffers::Parser parser;
+ // Allow non-UTF-8 initially to model what happens when we load a binary
+ // flatbuffer from disk which contains non-UTF-8 strings.
+ parser.opts.allow_non_utf8 = true;
+ TEST_EQ(
+ parser.Parse(
+ "table T { F:string; }"
+ "root_type T;"
+ "{ F:\"\\u20AC\\u00A2\\u30E6\\u30FC\\u30B6\\u30FC"
+ "\\u5225\\u30B5\\u30A4\\u30C8\\x01\\x80\\u0080\\uD83D\\uDE0E\" }"),
+ true);
+ std::string jsongen;
+ parser.opts.indent_step = -1;
+ // Now, disallow non-UTF-8 (the default behavior) so GenerateText indicates
+ // failure.
+ parser.opts.allow_non_utf8 = false;
+ auto result =
+ GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen);
+ TEST_EQ(result, false);
+}
+
+void UnicodeSurrogatesTest() {
+ flatbuffers::Parser parser;
+
+ TEST_EQ(parser.Parse("table T { F:string (id: 0); }"
+ "root_type T;"
+ "{ F:\"\\uD83D\\uDCA9\"}"),
+ true);
+ auto root = flatbuffers::GetRoot<flatbuffers::Table>(
+ parser.builder_.GetBufferPointer());
+ auto string = root->GetPointer<flatbuffers::String *>(
+ flatbuffers::FieldIndexToOffset(0));
+ TEST_EQ_STR(string->c_str(), "\xF0\x9F\x92\xA9");
+}
+
+
+
+void UnknownFieldsTest() {
+ flatbuffers::IDLOptions opts;
+ opts.skip_unexpected_fields_in_json = true;
+ flatbuffers::Parser parser(opts);
+
+ TEST_EQ(parser.Parse("table T { str:string; i:int;}"
+ "root_type T;"
+ "{ str:\"test\","
+ "unknown_string:\"test\","
+ "\"unknown_string\":\"test\","
+ "unknown_int:10,"
+ "unknown_float:1.0,"
+ "unknown_array: [ 1, 2, 3, 4],"
+ "unknown_object: { i: 10 },"
+ "\"unknown_object\": { \"i\": 10 },"
+ "i:10}"),
+ true);
+
+ std::string jsongen;
+ parser.opts.indent_step = -1;
+ auto result =
+ GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen);
+ TEST_EQ(result, true);
+ TEST_EQ_STR(jsongen.c_str(), "{str: \"test\",i: 10}");
+}
+
+void ParseUnionTest() {
+ // Unions must be parseable with the type field following the object.
+ flatbuffers::Parser parser;
+ TEST_EQ(parser.Parse("table T { A:int; }"
+ "union U { T }"
+ "table V { X:U; }"
+ "root_type V;"
+ "{ X:{ A:1 }, X_type: T }"),
+ true);
+ // Unions must be parsable with prefixed namespace.
+ flatbuffers::Parser parser2;
+ TEST_EQ(parser2.Parse("namespace N; table A {} namespace; union U { N.A }"
+ "table B { e:U; } root_type B;"
+ "{ e_type: N_A, e: {} }"),
+ true);
+}
+
+void ValidSameNameDifferentNamespaceTest() {
+ // Duplicate table names in different namespaces must be parsable
+ TEST_ASSERT(flatbuffers::Parser().Parse(
+ "namespace A; table X {} namespace B; table X {}"));
+ // Duplicate union names in different namespaces must be parsable
+ TEST_ASSERT(flatbuffers::Parser().Parse(
+ "namespace A; union X {} namespace B; union X {}"));
+ // Clashing table and union names in different namespaces must be parsable
+ TEST_ASSERT(flatbuffers::Parser().Parse(
+ "namespace A; table X {} namespace B; union X {}"));
+ TEST_ASSERT(flatbuffers::Parser().Parse(
+ "namespace A; union X {} namespace B; table X {}"));
+}
+
+void WarningsAsErrorsTest() {
+ {
+ flatbuffers::IDLOptions opts;
+ // opts.warnings_as_errors should default to false
+ flatbuffers::Parser parser(opts);
+ TEST_EQ(parser.Parse("table T { THIS_NAME_CAUSES_A_WARNING:string;}\n"
+ "root_type T;"),
+ true);
+ }
+ {
+ flatbuffers::IDLOptions opts;
+ opts.warnings_as_errors = true;
+ flatbuffers::Parser parser(opts);
+ TEST_EQ(parser.Parse("table T { THIS_NAME_CAUSES_A_WARNING:string;}\n"
+ "root_type T;"),
+ false);
+ }
+}
+
+void StringVectorDefaultsTest() {
+ std::vector<std::string> schemas;
+ schemas.push_back("table Monster { mana: string = \"\"; }");
+ schemas.push_back("table Monster { mana: string = \"mystr\"; }");
+ schemas.push_back("table Monster { mana: string = \" \"; }");
+ schemas.push_back("table Monster { mana: string = \"null\"; }");
+ schemas.push_back("table Monster { mana: [int] = []; }");
+ schemas.push_back("table Monster { mana: [uint] = [ ]; }");
+ schemas.push_back("table Monster { mana: [byte] = [\t\t\n]; }");
+ schemas.push_back("enum E:int{}table Monster{mana:[E]=[];}");
+ for (auto s = schemas.begin(); s < schemas.end(); s++) {
+ flatbuffers::Parser parser;
+ TEST_ASSERT(parser.Parse(s->c_str()));
+ const auto *mana = parser.structs_.Lookup("Monster")->fields.Lookup("mana");
+ TEST_EQ(mana->IsDefault(), true);
+ }
+}
+
+void FieldIdentifierTest() {
+ using flatbuffers::Parser;
+ TEST_EQ(true, Parser().Parse("table T{ f: int (id:0); }"));
+ // non-integer `id` should be rejected
+ TEST_EQ(false, Parser().Parse("table T{ f: int (id:text); }"));
+ TEST_EQ(false, Parser().Parse("table T{ f: int (id:\"text\"); }"));
+ TEST_EQ(false, Parser().Parse("table T{ f: int (id:0text); }"));
+ TEST_EQ(false, Parser().Parse("table T{ f: int (id:1.0); }"));
+ TEST_EQ(false, Parser().Parse("table T{ f: int (id:-1); g: int (id:0); }"));
+ TEST_EQ(false, Parser().Parse("table T{ f: int (id:129496726); }"));
+ // A unuion filed occupys two ids: enumerator + pointer (offset).
+ TEST_EQ(false,
+ Parser().Parse("union X{} table T{ u: X(id:0); table F{x:int;\n}"));
+ // Positive tests for unions
+ TEST_EQ(true, Parser().Parse("union X{} table T{ u: X (id:1); }"));
+ TEST_EQ(true, Parser().Parse("union X{} table T{ u: X; }"));
+ // Test using 'inf' and 'nan' words both as identifiers and as default values.
+ TEST_EQ(true, Parser().Parse("table T{ nan: string; }"));
+ TEST_EQ(true, Parser().Parse("table T{ inf: string; }"));
+#if defined(FLATBUFFERS_HAS_NEW_STRTOD) && (FLATBUFFERS_HAS_NEW_STRTOD > 0)
+ TEST_EQ(true, Parser().Parse("table T{ inf: float = inf; }"));
+ TEST_EQ(true, Parser().Parse("table T{ nan: float = inf; }"));
+#endif
+}
+
+} // namespace tests
+} // namespace flatbuffers
diff --git a/tests/parser_test.h b/tests/parser_test.h
new file mode 100644
index 0000000..ce6b5e2
--- /dev/null
+++ b/tests/parser_test.h
@@ -0,0 +1,33 @@
+#ifndef TESTS_PARSER_TEST_H
+#define TESTS_PARSER_TEST_H
+
+namespace flatbuffers {
+namespace tests {
+
+void ErrorTest();
+void EnumOutOfRangeTest();
+void IntegerOutOfRangeTest();
+void InvalidFloatTest();
+void UnicodeInvalidSurrogatesTest();
+void InvalidUTF8Test();
+void ValueTest();
+void NestedListTest();
+void EnumStringsTest();
+void EnumValueTest();
+void IntegerBoundaryTest();
+void ValidFloatTest();
+void UnicodeTest();
+void UnicodeTestAllowNonUTF8();
+void UnicodeTestGenerateTextFailsOnNonUTF8();
+void UnicodeSurrogatesTest();
+void UnknownFieldsTest();
+void ParseUnionTest();
+void ValidSameNameDifferentNamespaceTest();
+void WarningsAsErrorsTest();
+void StringVectorDefaultsTest();
+void FieldIdentifierTest();
+
+} // namespace tests
+} // namespace flatbuffers
+
+#endif // TESTS_PARSER_TEST_H
\ No newline at end of file
diff --git a/tests/private_annotation_test.fbs b/tests/private_annotation_test.fbs
new file mode 100644
index 0000000..434927b
--- /dev/null
+++ b/tests/private_annotation_test.fbs
@@ -0,0 +1,18 @@
+enum AB:byte (private) {
+ A,
+ B,
+}
+
+struct Object (private) {
+ value: int;
+}
+
+union Any (private) { Game, Annotations }
+
+table Game (private) {
+ value: int;
+}
+
+table Annotations (private) {
+ value: int;
+}
\ No newline at end of file
diff --git a/tests/private_annotation_test/ab_generated.rs b/tests/private_annotation_test/ab_generated.rs
new file mode 100644
index 0000000..6ed8850
--- /dev/null
+++ b/tests/private_annotation_test/ab_generated.rs
@@ -0,0 +1,98 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
+extern crate flatbuffers;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
+use self::flatbuffers::{EndianScalar, Follow};
+use super::*;
+#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
+pub const ENUM_MIN_AB: i8 = 0;
+#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
+pub const ENUM_MAX_AB: i8 = 1;
+#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
+#[allow(non_camel_case_types)]
+pub const ENUM_VALUES_AB: [AB; 2] = [
+ AB::A,
+ AB::B,
+];
+
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
+#[repr(transparent)]
+pub(crate) struct AB(pub i8);
+#[allow(non_upper_case_globals)]
+impl AB {
+ pub const A: Self = Self(0);
+ pub const B: Self = Self(1);
+
+ pub const ENUM_MIN: i8 = 0;
+ pub const ENUM_MAX: i8 = 1;
+ pub const ENUM_VALUES: &'static [Self] = &[
+ Self::A,
+ Self::B,
+ ];
+ /// Returns the variant's name or "" if unknown.
+ pub fn variant_name(self) -> Option<&'static str> {
+ match self {
+ Self::A => Some("A"),
+ Self::B => Some("B"),
+ _ => None,
+ }
+ }
+}
+impl core::fmt::Debug for AB {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
+ if let Some(name) = self.variant_name() {
+ f.write_str(name)
+ } else {
+ f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
+ }
+ }
+}
+impl<'a> flatbuffers::Follow<'a> for AB {
+ type Inner = Self;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ let b = unsafe {
+ flatbuffers::read_scalar_at::<i8>(buf, loc)
+ };
+ Self(b)
+ }
+}
+
+impl flatbuffers::Push for AB {
+ type Output = AB;
+ #[inline]
+ fn push(&self, dst: &mut [u8], _rest: &[u8]) {
+ unsafe { flatbuffers::emplace_scalar::<i8>(dst, self.0); }
+ }
+}
+
+impl flatbuffers::EndianScalar for AB {
+ #[inline]
+ fn to_little_endian(self) -> Self {
+ let b = i8::to_le(self.0);
+ Self(b)
+ }
+ #[inline]
+ #[allow(clippy::wrong_self_convention)]
+ fn from_little_endian(self) -> Self {
+ let b = i8::from_le(self.0);
+ Self(b)
+ }
+}
+
+impl<'a> flatbuffers::Verifiable for AB {
+ #[inline]
+ fn run_verifier(
+ v: &mut flatbuffers::Verifier, pos: usize
+ ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
+ use self::flatbuffers::Verifiable;
+ i8::run_verifier(v, pos)
+ }
+}
+
+impl flatbuffers::SimpleToVerifyInSlice for AB {}
diff --git a/tests/private_annotation_test/annotations_generated.rs b/tests/private_annotation_test/annotations_generated.rs
new file mode 100644
index 0000000..7c5166b
--- /dev/null
+++ b/tests/private_annotation_test/annotations_generated.rs
@@ -0,0 +1,138 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
+extern crate flatbuffers;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
+use self::flatbuffers::{EndianScalar, Follow};
+use super::*;
+pub(crate) enum AnnotationsOffset {}
+#[derive(Copy, Clone, PartialEq)]
+
+pub(crate) struct Annotations<'a> {
+ pub _tab: flatbuffers::Table<'a>,
+}
+
+impl<'a> flatbuffers::Follow<'a> for Annotations<'a> {
+ type Inner = Annotations<'a>;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ Self { _tab: flatbuffers::Table { buf, loc } }
+ }
+}
+
+impl<'a> Annotations<'a> {
+ pub const VT_VALUE: flatbuffers::VOffsetT = 4;
+
+ pub const fn get_fully_qualified_name() -> &'static str {
+ "Annotations"
+ }
+
+ #[inline]
+ pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
+ Annotations { _tab: table }
+ }
+ #[allow(unused_mut)]
+ pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
+ _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
+ args: &'args AnnotationsArgs
+ ) -> flatbuffers::WIPOffset<Annotations<'bldr>> {
+ let mut builder = AnnotationsBuilder::new(_fbb);
+ builder.add_value(args.value);
+ builder.finish()
+ }
+
+ pub fn unpack(&self) -> AnnotationsT {
+ let value = self.value();
+ AnnotationsT {
+ value,
+ }
+ }
+
+ #[inline]
+ pub fn value(&self) -> i32 {
+ self._tab.get::<i32>(Annotations::VT_VALUE, Some(0)).unwrap()
+ }
+}
+
+impl flatbuffers::Verifiable for Annotations<'_> {
+ #[inline]
+ fn run_verifier(
+ v: &mut flatbuffers::Verifier, pos: usize
+ ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
+ use self::flatbuffers::Verifiable;
+ v.visit_table(pos)?
+ .visit_field::<i32>("value", Self::VT_VALUE, false)?
+ .finish();
+ Ok(())
+ }
+}
+pub(crate) struct AnnotationsArgs {
+ pub value: i32,
+}
+impl<'a> Default for AnnotationsArgs {
+ #[inline]
+ fn default() -> Self {
+ AnnotationsArgs {
+ value: 0,
+ }
+ }
+}
+
+pub(crate) struct AnnotationsBuilder<'a: 'b, 'b> {
+ fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
+ start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
+}
+impl<'a: 'b, 'b> AnnotationsBuilder<'a, 'b> {
+ #[inline]
+ pub fn add_value(&mut self, value: i32) {
+ self.fbb_.push_slot::<i32>(Annotations::VT_VALUE, value, 0);
+ }
+ #[inline]
+ pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> AnnotationsBuilder<'a, 'b> {
+ let start = _fbb.start_table();
+ AnnotationsBuilder {
+ fbb_: _fbb,
+ start_: start,
+ }
+ }
+ #[inline]
+ pub fn finish(self) -> flatbuffers::WIPOffset<Annotations<'a>> {
+ let o = self.fbb_.end_table(self.start_);
+ flatbuffers::WIPOffset::new(o.value())
+ }
+}
+
+impl core::fmt::Debug for Annotations<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+ let mut ds = f.debug_struct("Annotations");
+ ds.field("value", &self.value());
+ ds.finish()
+ }
+}
+#[non_exhaustive]
+#[derive(Debug, Clone, PartialEq)]
+pub(crate) struct AnnotationsT {
+ pub value: i32,
+}
+impl Default for AnnotationsT {
+ fn default() -> Self {
+ Self {
+ value: 0,
+ }
+ }
+}
+impl AnnotationsT {
+ pub fn pack<'b>(
+ &self,
+ _fbb: &mut flatbuffers::FlatBufferBuilder<'b>
+ ) -> flatbuffers::WIPOffset<Annotations<'b>> {
+ let value = self.value;
+ Annotations::create(_fbb, &AnnotationsArgs{
+ value,
+ })
+ }
+}
diff --git a/tests/private_annotation_test/any_generated.rs b/tests/private_annotation_test/any_generated.rs
new file mode 100644
index 0000000..c3049a0
--- /dev/null
+++ b/tests/private_annotation_test/any_generated.rs
@@ -0,0 +1,175 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
+extern crate flatbuffers;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
+use self::flatbuffers::{EndianScalar, Follow};
+use super::*;
+#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
+pub const ENUM_MIN_ANY: u8 = 0;
+#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
+pub const ENUM_MAX_ANY: u8 = 2;
+#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
+#[allow(non_camel_case_types)]
+pub const ENUM_VALUES_ANY: [Any; 3] = [
+ Any::NONE,
+ Any::Game,
+ Any::Annotations,
+];
+
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
+#[repr(transparent)]
+pub(crate) struct Any(pub u8);
+#[allow(non_upper_case_globals)]
+impl Any {
+ pub const NONE: Self = Self(0);
+ pub const Game: Self = Self(1);
+ pub const Annotations: Self = Self(2);
+
+ pub const ENUM_MIN: u8 = 0;
+ pub const ENUM_MAX: u8 = 2;
+ pub const ENUM_VALUES: &'static [Self] = &[
+ Self::NONE,
+ Self::Game,
+ Self::Annotations,
+ ];
+ /// Returns the variant's name or "" if unknown.
+ pub fn variant_name(self) -> Option<&'static str> {
+ match self {
+ Self::NONE => Some("NONE"),
+ Self::Game => Some("Game"),
+ Self::Annotations => Some("Annotations"),
+ _ => None,
+ }
+ }
+}
+impl core::fmt::Debug for Any {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
+ if let Some(name) = self.variant_name() {
+ f.write_str(name)
+ } else {
+ f.write_fmt(format_args!("<UNKNOWN {:?}>", self.0))
+ }
+ }
+}
+impl<'a> flatbuffers::Follow<'a> for Any {
+ type Inner = Self;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ let b = unsafe {
+ flatbuffers::read_scalar_at::<u8>(buf, loc)
+ };
+ Self(b)
+ }
+}
+
+impl flatbuffers::Push for Any {
+ type Output = Any;
+ #[inline]
+ fn push(&self, dst: &mut [u8], _rest: &[u8]) {
+ unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); }
+ }
+}
+
+impl flatbuffers::EndianScalar for Any {
+ #[inline]
+ fn to_little_endian(self) -> Self {
+ let b = u8::to_le(self.0);
+ Self(b)
+ }
+ #[inline]
+ #[allow(clippy::wrong_self_convention)]
+ fn from_little_endian(self) -> Self {
+ let b = u8::from_le(self.0);
+ Self(b)
+ }
+}
+
+impl<'a> flatbuffers::Verifiable for Any {
+ #[inline]
+ fn run_verifier(
+ v: &mut flatbuffers::Verifier, pos: usize
+ ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
+ use self::flatbuffers::Verifiable;
+ u8::run_verifier(v, pos)
+ }
+}
+
+impl flatbuffers::SimpleToVerifyInSlice for Any {}
+pub(crate) struct AnyUnionTableOffset {}
+
+#[allow(clippy::upper_case_acronyms)]
+#[non_exhaustive]
+#[derive(Debug, Clone, PartialEq)]
+pub(crate) enum AnyT {
+ NONE,
+ Game(Box<GameT>),
+ Annotations(Box<AnnotationsT>),
+}
+impl Default for AnyT {
+ fn default() -> Self {
+ Self::NONE
+ }
+}
+impl AnyT {
+ pub fn any_type(&self) -> Any {
+ match self {
+ Self::NONE => Any::NONE,
+ Self::Game(_) => Any::Game,
+ Self::Annotations(_) => Any::Annotations,
+ }
+ }
+ pub fn pack(&self, fbb: &mut flatbuffers::FlatBufferBuilder) -> Option<flatbuffers::WIPOffset<flatbuffers::UnionWIPOffset>> {
+ match self {
+ Self::NONE => None,
+ Self::Game(v) => Some(v.pack(fbb).as_union_value()),
+ Self::Annotations(v) => Some(v.pack(fbb).as_union_value()),
+ }
+ }
+ /// If the union variant matches, return the owned GameT, setting the union to NONE.
+ pub fn take_game(&mut self) -> Option<Box<GameT>> {
+ if let Self::Game(_) = self {
+ let v = core::mem::replace(self, Self::NONE);
+ if let Self::Game(w) = v {
+ Some(w)
+ } else {
+ unreachable!()
+ }
+ } else {
+ None
+ }
+ }
+ /// If the union variant matches, return a reference to the GameT.
+ pub fn as_game(&self) -> Option<&GameT> {
+ if let Self::Game(v) = self { Some(v.as_ref()) } else { None }
+ }
+ /// If the union variant matches, return a mutable reference to the GameT.
+ pub fn as_game_mut(&mut self) -> Option<&mut GameT> {
+ if let Self::Game(v) = self { Some(v.as_mut()) } else { None }
+ }
+ /// If the union variant matches, return the owned AnnotationsT, setting the union to NONE.
+ pub fn take_annotations(&mut self) -> Option<Box<AnnotationsT>> {
+ if let Self::Annotations(_) = self {
+ let v = core::mem::replace(self, Self::NONE);
+ if let Self::Annotations(w) = v {
+ Some(w)
+ } else {
+ unreachable!()
+ }
+ } else {
+ None
+ }
+ }
+ /// If the union variant matches, return a reference to the AnnotationsT.
+ pub fn as_annotations(&self) -> Option<&AnnotationsT> {
+ if let Self::Annotations(v) = self { Some(v.as_ref()) } else { None }
+ }
+ /// If the union variant matches, return a mutable reference to the AnnotationsT.
+ pub fn as_annotations_mut(&mut self) -> Option<&mut AnnotationsT> {
+ if let Self::Annotations(v) = self { Some(v.as_mut()) } else { None }
+ }
+}
diff --git a/tests/private_annotation_test/game_generated.rs b/tests/private_annotation_test/game_generated.rs
new file mode 100644
index 0000000..e696611
--- /dev/null
+++ b/tests/private_annotation_test/game_generated.rs
@@ -0,0 +1,138 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
+extern crate flatbuffers;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
+use self::flatbuffers::{EndianScalar, Follow};
+use super::*;
+pub(crate) enum GameOffset {}
+#[derive(Copy, Clone, PartialEq)]
+
+pub(crate) struct Game<'a> {
+ pub _tab: flatbuffers::Table<'a>,
+}
+
+impl<'a> flatbuffers::Follow<'a> for Game<'a> {
+ type Inner = Game<'a>;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ Self { _tab: flatbuffers::Table { buf, loc } }
+ }
+}
+
+impl<'a> Game<'a> {
+ pub const VT_VALUE: flatbuffers::VOffsetT = 4;
+
+ pub const fn get_fully_qualified_name() -> &'static str {
+ "Game"
+ }
+
+ #[inline]
+ pub fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
+ Game { _tab: table }
+ }
+ #[allow(unused_mut)]
+ pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
+ _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
+ args: &'args GameArgs
+ ) -> flatbuffers::WIPOffset<Game<'bldr>> {
+ let mut builder = GameBuilder::new(_fbb);
+ builder.add_value(args.value);
+ builder.finish()
+ }
+
+ pub fn unpack(&self) -> GameT {
+ let value = self.value();
+ GameT {
+ value,
+ }
+ }
+
+ #[inline]
+ pub fn value(&self) -> i32 {
+ self._tab.get::<i32>(Game::VT_VALUE, Some(0)).unwrap()
+ }
+}
+
+impl flatbuffers::Verifiable for Game<'_> {
+ #[inline]
+ fn run_verifier(
+ v: &mut flatbuffers::Verifier, pos: usize
+ ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
+ use self::flatbuffers::Verifiable;
+ v.visit_table(pos)?
+ .visit_field::<i32>("value", Self::VT_VALUE, false)?
+ .finish();
+ Ok(())
+ }
+}
+pub(crate) struct GameArgs {
+ pub value: i32,
+}
+impl<'a> Default for GameArgs {
+ #[inline]
+ fn default() -> Self {
+ GameArgs {
+ value: 0,
+ }
+ }
+}
+
+pub(crate) struct GameBuilder<'a: 'b, 'b> {
+ fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
+ start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
+}
+impl<'a: 'b, 'b> GameBuilder<'a, 'b> {
+ #[inline]
+ pub fn add_value(&mut self, value: i32) {
+ self.fbb_.push_slot::<i32>(Game::VT_VALUE, value, 0);
+ }
+ #[inline]
+ pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> GameBuilder<'a, 'b> {
+ let start = _fbb.start_table();
+ GameBuilder {
+ fbb_: _fbb,
+ start_: start,
+ }
+ }
+ #[inline]
+ pub fn finish(self) -> flatbuffers::WIPOffset<Game<'a>> {
+ let o = self.fbb_.end_table(self.start_);
+ flatbuffers::WIPOffset::new(o.value())
+ }
+}
+
+impl core::fmt::Debug for Game<'_> {
+ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+ let mut ds = f.debug_struct("Game");
+ ds.field("value", &self.value());
+ ds.finish()
+ }
+}
+#[non_exhaustive]
+#[derive(Debug, Clone, PartialEq)]
+pub(crate) struct GameT {
+ pub value: i32,
+}
+impl Default for GameT {
+ fn default() -> Self {
+ Self {
+ value: 0,
+ }
+ }
+}
+impl GameT {
+ pub fn pack<'b>(
+ &self,
+ _fbb: &mut flatbuffers::FlatBufferBuilder<'b>
+ ) -> flatbuffers::WIPOffset<Game<'b>> {
+ let value = self.value;
+ Game::create(_fbb, &GameArgs{
+ value,
+ })
+ }
+}
diff --git a/tests/private_annotation_test/mod.rs b/tests/private_annotation_test/mod.rs
new file mode 100644
index 0000000..def5184
--- /dev/null
+++ b/tests/private_annotation_test/mod.rs
@@ -0,0 +1,12 @@
+// Automatically generated by the Flatbuffers compiler. Do not modify.
+// @generated
+mod ab_generated;
+pub use self::ab_generated::*;
+mod any_generated;
+pub use self::any_generated::*;
+mod object_generated;
+pub use self::object_generated::*;
+mod game_generated;
+pub use self::game_generated::*;
+mod annotations_generated;
+pub use self::annotations_generated::*;
diff --git a/tests/private_annotation_test/object_generated.rs b/tests/private_annotation_test/object_generated.rs
new file mode 100644
index 0000000..64419a9
--- /dev/null
+++ b/tests/private_annotation_test/object_generated.rs
@@ -0,0 +1,132 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+// @generated
+extern crate alloc;
+extern crate flatbuffers;
+use alloc::boxed::Box;
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+use core::mem;
+use core::cmp::Ordering;
+use self::flatbuffers::{EndianScalar, Follow};
+use super::*;
+// struct Object, aligned to 4
+#[repr(transparent)]
+#[derive(Clone, Copy, PartialEq)]
+pub(crate) struct Object(pub [u8; 4]);
+impl Default for Object {
+ fn default() -> Self {
+ Self([0; 4])
+ }
+}
+impl core::fmt::Debug for Object {
+ fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
+ f.debug_struct("Object")
+ .field("value", &self.value())
+ .finish()
+ }
+}
+
+impl flatbuffers::SimpleToVerifyInSlice for Object {}
+impl flatbuffers::SafeSliceAccess for Object {}
+impl<'a> flatbuffers::Follow<'a> for Object {
+ type Inner = &'a Object;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ <&'a Object>::follow(buf, loc)
+ }
+}
+impl<'a> flatbuffers::Follow<'a> for &'a Object {
+ type Inner = &'a Object;
+ #[inline]
+ fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
+ flatbuffers::follow_cast_ref::<Object>(buf, loc)
+ }
+}
+impl<'b> flatbuffers::Push for Object {
+ type Output = Object;
+ #[inline]
+ fn push(&self, dst: &mut [u8], _rest: &[u8]) {
+ let src = unsafe {
+ ::core::slice::from_raw_parts(self as *const Object as *const u8, Self::size())
+ };
+ dst.copy_from_slice(src);
+ }
+}
+impl<'b> flatbuffers::Push for &'b Object {
+ type Output = Object;
+
+ #[inline]
+ fn push(&self, dst: &mut [u8], _rest: &[u8]) {
+ let src = unsafe {
+ ::core::slice::from_raw_parts(*self as *const Object as *const u8, Self::size())
+ };
+ dst.copy_from_slice(src);
+ }
+}
+
+impl<'a> flatbuffers::Verifiable for Object {
+ #[inline]
+ fn run_verifier(
+ v: &mut flatbuffers::Verifier, pos: usize
+ ) -> Result<(), flatbuffers::InvalidFlatbuffer> {
+ use self::flatbuffers::Verifiable;
+ v.in_buffer::<Self>(pos)
+ }
+}
+
+impl<'a> Object {
+ #[allow(clippy::too_many_arguments)]
+ pub fn new(
+ value: i32,
+ ) -> Self {
+ let mut s = Self([0; 4]);
+ s.set_value(value);
+ s
+ }
+
+ pub const fn get_fully_qualified_name() -> &'static str {
+ "Object"
+ }
+
+ pub fn value(&self) -> i32 {
+ let mut mem = core::mem::MaybeUninit::<i32>::uninit();
+ unsafe {
+ core::ptr::copy_nonoverlapping(
+ self.0[0..].as_ptr(),
+ mem.as_mut_ptr() as *mut u8,
+ core::mem::size_of::<i32>(),
+ );
+ mem.assume_init()
+ }.from_little_endian()
+ }
+
+ pub fn set_value(&mut self, x: i32) {
+ let x_le = x.to_little_endian();
+ unsafe {
+ core::ptr::copy_nonoverlapping(
+ &x_le as *const i32 as *const u8,
+ self.0[0..].as_mut_ptr(),
+ core::mem::size_of::<i32>(),
+ );
+ }
+ }
+
+ pub fn unpack(&self) -> ObjectT {
+ ObjectT {
+ value: self.value(),
+ }
+ }
+}
+
+#[derive(Debug, Clone, PartialEq, Default)]
+pub(crate) struct ObjectT {
+ pub value: i32,
+}
+impl ObjectT {
+ pub fn pack(&self) -> Object {
+ Object::new(
+ self.value,
+ )
+ }
+}
+
diff --git a/tests/proto_test.cpp b/tests/proto_test.cpp
new file mode 100644
index 0000000..7281c2c
--- /dev/null
+++ b/tests/proto_test.cpp
@@ -0,0 +1,204 @@
+#include "proto_test.h"
+
+#include "flatbuffers/idl.h"
+#include "test_assert.h"
+
+namespace flatbuffers {
+namespace tests {
+
+// Parse a .proto schema, output as .fbs
+void ParseProtoTest(const std::string &tests_data_path) {
+ // load the .proto and the golden file from disk
+ std::string protofile;
+ std::string goldenfile;
+ std::string goldenunionfile;
+ TEST_EQ(
+ flatbuffers::LoadFile((tests_data_path + "prototest/test.proto").c_str(),
+ false, &protofile),
+ true);
+ TEST_EQ(
+ flatbuffers::LoadFile((tests_data_path + "prototest/test.golden").c_str(),
+ false, &goldenfile),
+ true);
+ TEST_EQ(flatbuffers::LoadFile(
+ (tests_data_path + "prototest/test_union.golden").c_str(), false,
+ &goldenunionfile),
+ true);
+
+ flatbuffers::IDLOptions opts;
+ opts.include_dependence_headers = false;
+ opts.proto_mode = true;
+
+ // Parse proto.
+ flatbuffers::Parser parser(opts);
+ auto protopath = tests_data_path + "prototest/";
+ const char *include_directories[] = { protopath.c_str(), nullptr };
+ TEST_EQ(parser.Parse(protofile.c_str(), include_directories), true);
+
+ // Generate fbs.
+ auto fbs = flatbuffers::GenerateFBS(parser, "test");
+
+ // Ensure generated file is parsable.
+ flatbuffers::Parser parser2;
+ TEST_EQ(parser2.Parse(fbs.c_str(), nullptr), true);
+ TEST_EQ_STR(fbs.c_str(), goldenfile.c_str());
+
+ // Parse proto with --oneof-union option.
+ opts.proto_oneof_union = true;
+ flatbuffers::Parser parser3(opts);
+ TEST_EQ(parser3.Parse(protofile.c_str(), include_directories), true);
+
+ // Generate fbs.
+ auto fbs_union = flatbuffers::GenerateFBS(parser3, "test");
+
+ // Ensure generated file is parsable.
+ flatbuffers::Parser parser4;
+ TEST_EQ(parser4.Parse(fbs_union.c_str(), nullptr), true);
+ TEST_EQ_STR(fbs_union.c_str(), goldenunionfile.c_str());
+}
+
+// Parse a .proto schema, output as .fbs
+void ParseProtoTestWithSuffix(const std::string &tests_data_path) {
+ // load the .proto and the golden file from disk
+ std::string protofile;
+ std::string goldenfile;
+ std::string goldenunionfile;
+ TEST_EQ(
+ flatbuffers::LoadFile((tests_data_path + "prototest/test.proto").c_str(),
+ false, &protofile),
+ true);
+ TEST_EQ(flatbuffers::LoadFile(
+ (tests_data_path + "prototest/test_suffix.golden").c_str(), false,
+ &goldenfile),
+ true);
+ TEST_EQ(flatbuffers::LoadFile(
+ (tests_data_path + "prototest/test_union_suffix.golden").c_str(),
+ false, &goldenunionfile),
+ true);
+
+ flatbuffers::IDLOptions opts;
+ opts.include_dependence_headers = false;
+ opts.proto_mode = true;
+ opts.proto_namespace_suffix = "test_namespace_suffix";
+
+ // Parse proto.
+ flatbuffers::Parser parser(opts);
+ auto protopath = tests_data_path + "prototest/";
+ const char *include_directories[] = { protopath.c_str(), nullptr };
+ TEST_EQ(parser.Parse(protofile.c_str(), include_directories), true);
+
+ // Generate fbs.
+ auto fbs = flatbuffers::GenerateFBS(parser, "test");
+
+ // Ensure generated file is parsable.
+ flatbuffers::Parser parser2;
+ TEST_EQ(parser2.Parse(fbs.c_str(), nullptr), true);
+ TEST_EQ_STR(fbs.c_str(), goldenfile.c_str());
+
+ // Parse proto with --oneof-union option.
+ opts.proto_oneof_union = true;
+ flatbuffers::Parser parser3(opts);
+ TEST_EQ(parser3.Parse(protofile.c_str(), include_directories), true);
+
+ // Generate fbs.
+ auto fbs_union = flatbuffers::GenerateFBS(parser3, "test");
+
+ // Ensure generated file is parsable.
+ flatbuffers::Parser parser4;
+ TEST_EQ(parser4.Parse(fbs_union.c_str(), nullptr), true);
+ TEST_EQ_STR(fbs_union.c_str(), goldenunionfile.c_str());
+}
+
+// Parse a .proto schema, output as .fbs
+void ParseProtoTestWithIncludes(const std::string &tests_data_path) {
+ // load the .proto and the golden file from disk
+ std::string protofile;
+ std::string goldenfile;
+ std::string goldenunionfile;
+ std::string importprotofile;
+ TEST_EQ(
+ flatbuffers::LoadFile((tests_data_path + "prototest/test.proto").c_str(),
+ false, &protofile),
+ true);
+ TEST_EQ(flatbuffers::LoadFile(
+ (tests_data_path + "prototest/imported.proto").c_str(), false,
+ &importprotofile),
+ true);
+ TEST_EQ(flatbuffers::LoadFile(
+ (tests_data_path + "prototest/test_include.golden").c_str(),
+ false, &goldenfile),
+ true);
+ TEST_EQ(flatbuffers::LoadFile(
+ (tests_data_path + "prototest/test_union_include.golden").c_str(),
+ false, &goldenunionfile),
+ true);
+
+ flatbuffers::IDLOptions opts;
+ opts.include_dependence_headers = true;
+ opts.proto_mode = true;
+
+ // Parse proto.
+ flatbuffers::Parser parser(opts);
+ auto protopath = tests_data_path + "prototest/";
+ const char *include_directories[] = { protopath.c_str(), nullptr };
+ TEST_EQ(parser.Parse(protofile.c_str(), include_directories), true);
+
+ // Generate fbs.
+ auto fbs = flatbuffers::GenerateFBS(parser, "test");
+
+ // Generate fbs from import.proto
+ flatbuffers::Parser import_parser(opts);
+ TEST_EQ(import_parser.Parse(importprotofile.c_str(), include_directories),
+ true);
+ auto import_fbs = flatbuffers::GenerateFBS(import_parser, "test");
+
+ // Ensure generated file is parsable.
+ flatbuffers::Parser parser2;
+ // Since `imported.fbs` isn't in the filesystem AbsolutePath can't figure it
+ // out by itself. We manually construct it so Parser works.
+ std::string imported_fbs = flatbuffers::PosixPath(
+ flatbuffers::AbsolutePath(protopath) + "/imported.fbs");
+ TEST_EQ(parser2.Parse(import_fbs.c_str(), include_directories,
+ imported_fbs.c_str()),
+ true);
+ TEST_EQ(parser2.Parse(fbs.c_str(), nullptr), true);
+ TEST_EQ_STR(fbs.c_str(), goldenfile.c_str());
+
+ // Parse proto with --oneof-union option.
+ opts.proto_oneof_union = true;
+ flatbuffers::Parser parser3(opts);
+ TEST_EQ(parser3.Parse(protofile.c_str(), include_directories), true);
+
+ // Generate fbs.
+ auto fbs_union = flatbuffers::GenerateFBS(parser3, "test");
+
+ // Ensure generated file is parsable.
+ flatbuffers::Parser parser4;
+ TEST_EQ(parser4.Parse(import_fbs.c_str(), nullptr, imported_fbs.c_str()),
+ true);
+ TEST_EQ(parser4.Parse(fbs_union.c_str(), nullptr), true);
+ TEST_EQ_STR(fbs_union.c_str(), goldenunionfile.c_str());
+}
+
+void ParseProtoBufAsciiTest() {
+ // We can put the parser in a mode where it will accept JSON that looks more
+ // like Protobuf ASCII, for users that have data in that format.
+ // This uses no "" for field names (which we already support by default,
+ // omits `,`, `:` before `{` and a couple of other features.
+ flatbuffers::Parser parser;
+ parser.opts.protobuf_ascii_alike = true;
+ TEST_EQ(
+ parser.Parse("table S { B:int; } table T { A:[int]; C:S; } root_type T;"),
+ true);
+ TEST_EQ(parser.Parse("{ A [1 2] C { B:2 }}"), true);
+ // Similarly, in text output, it should omit these.
+ std::string text;
+ auto ok = flatbuffers::GenerateText(
+ parser, parser.builder_.GetBufferPointer(), &text);
+ TEST_EQ(ok, true);
+ TEST_EQ_STR(text.c_str(),
+ "{\n A [\n 1\n 2\n ]\n C {\n B: 2\n }\n}\n");
+}
+
+} // namespace tests
+} // namespace flatbuffers
\ No newline at end of file
diff --git a/tests/proto_test.h b/tests/proto_test.h
new file mode 100644
index 0000000..9f6137d
--- /dev/null
+++ b/tests/proto_test.h
@@ -0,0 +1,18 @@
+#ifndef TESTS_PROTO_TEST_H
+#define TESTS_PROTO_TEST_H
+
+#include <string>
+
+namespace flatbuffers {
+namespace tests {
+
+void ParseProtoTest(const std::string& tests_data_path);
+void ParseProtoTestWithSuffix(const std::string& tests_data_path);
+void ParseProtoTestWithIncludes(const std::string& tests_data_path);
+void ParseProtoBufAsciiTest();
+
+
+} // namespace tests
+} // namespace flatbuffers
+
+#endif
\ No newline at end of file
diff --git a/tests/prototest/test.golden b/tests/prototest/test.golden
index eb10671..949a003 100644
--- a/tests/prototest/test.golden
+++ b/tests/prototest/test.golden
@@ -51,6 +51,9 @@
/// doc comment for r.
r:proto.test.ProtoMessage_.Anonymous0;
outer_enum:proto.test.ProtoEnum;
+ u:float = +inf;
+ v:float = +inf;
+ w:float = -inf;
}
namespace proto.test.ProtoMessage_;
diff --git a/tests/prototest/test.proto b/tests/prototest/test.proto
index 10e45af..71ec8d5 100644
--- a/tests/prototest/test.proto
+++ b/tests/prototest/test.proto
@@ -67,4 +67,8 @@
OtherMessage t = 18;
}
optional ProtoEnum outer_enum = 33;
+ // Tests that `inf` and `+/-inf` can be parsed in proto options.
+ optional float u = 34 [default = inf];
+ optional float v = 35 [default = +inf];
+ optional float w = 36 [default = -inf];
}
diff --git a/tests/prototest/test_include.golden b/tests/prototest/test_include.golden
index 358c3f6..b98de44 100644
--- a/tests/prototest/test_include.golden
+++ b/tests/prototest/test_include.golden
@@ -49,6 +49,9 @@
/// doc comment for r.
r:proto.test.ProtoMessage_.Anonymous0;
outer_enum:proto.test.ProtoEnum;
+ u:float = +inf;
+ v:float = +inf;
+ w:float = -inf;
}
namespace proto.test.ProtoMessage_;
diff --git a/tests/prototest/test_suffix.golden b/tests/prototest/test_suffix.golden
index a99f807..4ab2146 100644
--- a/tests/prototest/test_suffix.golden
+++ b/tests/prototest/test_suffix.golden
@@ -51,6 +51,9 @@
/// doc comment for r.
r:proto.test.test_namespace_suffix.ProtoMessage_.Anonymous0;
outer_enum:proto.test.test_namespace_suffix.ProtoEnum;
+ u:float = +inf;
+ v:float = +inf;
+ w:float = -inf;
}
namespace proto.test.test_namespace_suffix.ProtoMessage_;
diff --git a/tests/prototest/test_union.golden b/tests/prototest/test_union.golden
index 3e6becd..241f349 100644
--- a/tests/prototest/test_union.golden
+++ b/tests/prototest/test_union.golden
@@ -61,6 +61,9 @@
/// doc comment for r.
r:proto.test.ProtoMessage_.RUnion;
outer_enum:proto.test.ProtoEnum;
+ u:float = +inf;
+ v:float = +inf;
+ w:float = -inf;
}
namespace proto.test.ProtoMessage_;
diff --git a/tests/prototest/test_union_include.golden b/tests/prototest/test_union_include.golden
index abdb6e2..1fdb2ac 100644
--- a/tests/prototest/test_union_include.golden
+++ b/tests/prototest/test_union_include.golden
@@ -59,6 +59,9 @@
/// doc comment for r.
r:proto.test.ProtoMessage_.RUnion;
outer_enum:proto.test.ProtoEnum;
+ u:float = +inf;
+ v:float = +inf;
+ w:float = -inf;
}
namespace proto.test.ProtoMessage_;
diff --git a/tests/prototest/test_union_suffix.golden b/tests/prototest/test_union_suffix.golden
index 6a240c0..2278edd 100644
--- a/tests/prototest/test_union_suffix.golden
+++ b/tests/prototest/test_union_suffix.golden
@@ -61,6 +61,9 @@
/// doc comment for r.
r:proto.test.test_namespace_suffix.ProtoMessage_.RUnion;
outer_enum:proto.test.test_namespace_suffix.ProtoEnum;
+ u:float = +inf;
+ v:float = +inf;
+ w:float = -inf;
}
namespace proto.test.test_namespace_suffix.ProtoMessage_;
diff --git a/tests/py_test.py b/tests/py_test.py
index ed966d5..5e3c547 100644
--- a/tests/py_test.py
+++ b/tests/py_test.py
@@ -48,6 +48,8 @@
import MyGame.Example.NestedStruct # refers to generated code
import MyGame.Example.TestEnum # refers to generated code
import monster_test_generated # the one-file version
+import optional_scalars
+import optional_scalars.ScalarStuff
def create_namespace_shortcut(is_onefile):
@@ -274,6 +276,35 @@
self.assertEqual(monster2.VectorOfEnumsLength(), 0)
self.assertTrue(monster2.VectorOfEnumsIsNone())
+ def test_optional_scalars_with_pack_and_unpack(self):
+ """ Serializes and deserializes between a buffer with optional values (no
+ specific values are filled when the buffer is created) and its python
+ object.
+ """
+ # Creates a flatbuffer with optional values.
+ b1 = flatbuffers.Builder(0)
+ optional_scalars.ScalarStuff.ScalarStuffStart(b1)
+ gen_opt = optional_scalars.ScalarStuff.ScalarStuffEnd(b1)
+ b1.Finish(gen_opt)
+
+ # Converts the flatbuffer into the object class.
+ opts1 = optional_scalars.ScalarStuff.ScalarStuff.GetRootAs(b1.Bytes, b1.Head())
+ optsT1 = optional_scalars.ScalarStuff.ScalarStuffT.InitFromObj(opts1)
+
+ # Packs the object class into another flatbuffer.
+ b2 = flatbuffers.Builder(0)
+ b2.Finish(optsT1.Pack(b2))
+ opts2 = optional_scalars.ScalarStuff.ScalarStuff.GetRootAs(b2.Bytes, b2.Head())
+ optsT2 = optional_scalars.ScalarStuff.ScalarStuffT.InitFromObj(opts2)
+ # Checks the default values.
+ self.assertTrue(opts2.JustI8() == 0)
+ self.assertTrue(opts2.MaybeF32() is None)
+ self.assertTrue(opts2.DefaultBool() is True)
+ self.assertTrue(optsT2.justU16 == 0)
+ self.assertTrue(optsT2.maybeEnum is None)
+ self.assertTrue(optsT2.defaultU64 == 42)
+
+
class TestAllMutableCodePathsOfExampleSchema(unittest.TestCase):
""" Tests the object API generated for monster_test.fbs for mutation
diff --git a/tests/reflection_test.cpp b/tests/reflection_test.cpp
new file mode 100644
index 0000000..b48bd81
--- /dev/null
+++ b/tests/reflection_test.cpp
@@ -0,0 +1,320 @@
+#include "reflection_test.h"
+#include "arrays_test_generated.h"
+#include "flatbuffers/minireflect.h"
+#include "flatbuffers/reflection.h"
+#include "flatbuffers/reflection_generated.h"
+#include "flatbuffers/verifier.h"
+#include "test_assert.h"
+#include "monster_test.h"
+#include "monster_test_generated.h"
+
+namespace flatbuffers {
+namespace tests {
+
+using namespace MyGame::Example;
+
+void ReflectionTest(const std::string& tests_data_path, uint8_t *flatbuf, size_t length) {
+ // Load a binary schema.
+ std::string bfbsfile;
+ TEST_EQ(flatbuffers::LoadFile((tests_data_path + "monster_test.bfbs").c_str(),
+ true, &bfbsfile),
+ true);
+
+ // Verify it, just in case:
+ flatbuffers::Verifier verifier(
+ reinterpret_cast<const uint8_t *>(bfbsfile.c_str()), bfbsfile.length());
+ TEST_EQ(reflection::VerifySchemaBuffer(verifier), true);
+
+ // Make sure the schema is what we expect it to be.
+ auto &schema = *reflection::GetSchema(bfbsfile.c_str());
+ auto root_table = schema.root_table();
+
+ // Check the declaration files.
+ TEST_EQ_STR(root_table->name()->c_str(), "MyGame.Example.Monster");
+ TEST_EQ_STR(root_table->declaration_file()->c_str(), "//monster_test.fbs");
+ TEST_EQ_STR(
+ schema.objects()->LookupByKey("TableA")->declaration_file()->c_str(),
+ "//include_test/include_test1.fbs");
+ TEST_EQ_STR(schema.objects()
+ ->LookupByKey("MyGame.OtherNameSpace.Unused")
+ ->declaration_file()
+ ->c_str(),
+ "//include_test/sub/include_test2.fbs");
+ TEST_EQ_STR(schema.enums()
+ ->LookupByKey("MyGame.OtherNameSpace.FromInclude")
+ ->declaration_file()
+ ->c_str(),
+ "//include_test/sub/include_test2.fbs");
+
+ // Check scheam filenames and their includes.
+ TEST_EQ(schema.fbs_files()->size(), 3);
+
+ const auto fbs0 = schema.fbs_files()->Get(0);
+ TEST_EQ_STR(fbs0->filename()->c_str(), "//include_test/include_test1.fbs");
+ const auto fbs0_includes = fbs0->included_filenames();
+ TEST_EQ(fbs0_includes->size(), 2);
+
+ // TODO(caspern): Should we force or disallow inclusion of self?
+ TEST_EQ_STR(fbs0_includes->Get(0)->c_str(),
+ "//include_test/include_test1.fbs");
+ TEST_EQ_STR(fbs0_includes->Get(1)->c_str(),
+ "//include_test/sub/include_test2.fbs");
+
+ const auto fbs1 = schema.fbs_files()->Get(1);
+ TEST_EQ_STR(fbs1->filename()->c_str(),
+ "//include_test/sub/include_test2.fbs");
+ const auto fbs1_includes = fbs1->included_filenames();
+ TEST_EQ(fbs1_includes->size(), 2);
+ TEST_EQ_STR(fbs1_includes->Get(0)->c_str(),
+ "//include_test/include_test1.fbs");
+ TEST_EQ_STR(fbs1_includes->Get(1)->c_str(),
+ "//include_test/sub/include_test2.fbs");
+
+ const auto fbs2 = schema.fbs_files()->Get(2);
+ TEST_EQ_STR(fbs2->filename()->c_str(), "//monster_test.fbs");
+ const auto fbs2_includes = fbs2->included_filenames();
+ TEST_EQ(fbs2_includes->size(), 1);
+ TEST_EQ_STR(fbs2_includes->Get(0)->c_str(),
+ "//include_test/include_test1.fbs");
+
+ // Check Root table fields
+ auto fields = root_table->fields();
+ auto hp_field_ptr = fields->LookupByKey("hp");
+ TEST_NOTNULL(hp_field_ptr);
+ auto &hp_field = *hp_field_ptr;
+ TEST_EQ_STR(hp_field.name()->c_str(), "hp");
+ TEST_EQ(hp_field.id(), 2);
+ TEST_EQ(hp_field.type()->base_type(), reflection::Short);
+
+ auto friendly_field_ptr = fields->LookupByKey("friendly");
+ TEST_NOTNULL(friendly_field_ptr);
+ TEST_NOTNULL(friendly_field_ptr->attributes());
+ TEST_NOTNULL(friendly_field_ptr->attributes()->LookupByKey("priority"));
+
+ // Make sure the table index is what we expect it to be.
+ auto pos_field_ptr = fields->LookupByKey("pos");
+ TEST_NOTNULL(pos_field_ptr);
+ TEST_EQ(pos_field_ptr->type()->base_type(), reflection::Obj);
+ auto pos_table_ptr = schema.objects()->Get(pos_field_ptr->type()->index());
+ TEST_NOTNULL(pos_table_ptr);
+ TEST_EQ_STR(pos_table_ptr->name()->c_str(), "MyGame.Example.Vec3");
+
+ // Test nullability of fields: hp is a 0-default scalar, pos is a struct =>
+ // optional, and name is a required string => not optional.
+ TEST_EQ(hp_field.optional(), false);
+ TEST_EQ(pos_field_ptr->optional(), true);
+ TEST_EQ(fields->LookupByKey("name")->optional(), false);
+
+ // Now use it to dynamically access a buffer.
+ auto &root = *flatbuffers::GetAnyRoot(flatbuf);
+
+ // Verify the buffer first using reflection based verification
+ TEST_EQ(flatbuffers::Verify(schema, *schema.root_table(), flatbuf, length),
+ true);
+
+ auto hp = flatbuffers::GetFieldI<uint16_t>(root, hp_field);
+ TEST_EQ(hp, 80);
+
+ // Rather than needing to know the type, we can also get the value of
+ // any field as an int64_t/double/string, regardless of what it actually is.
+ auto hp_int64 = flatbuffers::GetAnyFieldI(root, hp_field);
+ TEST_EQ(hp_int64, 80);
+ auto hp_double = flatbuffers::GetAnyFieldF(root, hp_field);
+ TEST_EQ(hp_double, 80.0);
+ auto hp_string = flatbuffers::GetAnyFieldS(root, hp_field, &schema);
+ TEST_EQ_STR(hp_string.c_str(), "80");
+
+ // Get struct field through reflection
+ auto pos_struct = flatbuffers::GetFieldStruct(root, *pos_field_ptr);
+ TEST_NOTNULL(pos_struct);
+ TEST_EQ(flatbuffers::GetAnyFieldF(*pos_struct,
+ *pos_table_ptr->fields()->LookupByKey("z")),
+ 3.0f);
+
+ auto test3_field = pos_table_ptr->fields()->LookupByKey("test3");
+ auto test3_struct = flatbuffers::GetFieldStruct(*pos_struct, *test3_field);
+ TEST_NOTNULL(test3_struct);
+ auto test3_object = schema.objects()->Get(test3_field->type()->index());
+
+ TEST_EQ(flatbuffers::GetAnyFieldF(*test3_struct,
+ *test3_object->fields()->LookupByKey("a")),
+ 10);
+
+ // We can also modify it.
+ flatbuffers::SetField<uint16_t>(&root, hp_field, 200);
+ hp = flatbuffers::GetFieldI<uint16_t>(root, hp_field);
+ TEST_EQ(hp, 200);
+
+ // We can also set fields generically:
+ flatbuffers::SetAnyFieldI(&root, hp_field, 300);
+ hp_int64 = flatbuffers::GetAnyFieldI(root, hp_field);
+ TEST_EQ(hp_int64, 300);
+ flatbuffers::SetAnyFieldF(&root, hp_field, 300.5);
+ hp_int64 = flatbuffers::GetAnyFieldI(root, hp_field);
+ TEST_EQ(hp_int64, 300);
+ flatbuffers::SetAnyFieldS(&root, hp_field, "300");
+ hp_int64 = flatbuffers::GetAnyFieldI(root, hp_field);
+ TEST_EQ(hp_int64, 300);
+
+ // Test buffer is valid after the modifications
+ TEST_EQ(flatbuffers::Verify(schema, *schema.root_table(), flatbuf, length),
+ true);
+
+ // Reset it, for further tests.
+ flatbuffers::SetField<uint16_t>(&root, hp_field, 80);
+
+ // More advanced functionality: changing the size of items in-line!
+ // First we put the FlatBuffer inside an std::vector.
+ std::vector<uint8_t> resizingbuf(flatbuf, flatbuf + length);
+ // Find the field we want to modify.
+ auto &name_field = *fields->LookupByKey("name");
+ // Get the root.
+ // This time we wrap the result from GetAnyRoot in a smartpointer that
+ // will keep rroot valid as resizingbuf resizes.
+ auto rroot = flatbuffers::piv(flatbuffers::GetAnyRoot(resizingbuf.data()),
+ resizingbuf);
+ SetString(schema, "totally new string", GetFieldS(**rroot, name_field),
+ &resizingbuf);
+ // Here resizingbuf has changed, but rroot is still valid.
+ TEST_EQ_STR(GetFieldS(**rroot, name_field)->c_str(), "totally new string");
+ // Now lets extend a vector by 100 elements (10 -> 110).
+ auto &inventory_field = *fields->LookupByKey("inventory");
+ auto rinventory = flatbuffers::piv(
+ flatbuffers::GetFieldV<uint8_t>(**rroot, inventory_field), resizingbuf);
+ flatbuffers::ResizeVector<uint8_t>(schema, 110, 50, *rinventory,
+ &resizingbuf);
+ // rinventory still valid, so lets read from it.
+ TEST_EQ(rinventory->Get(10), 50);
+
+ // For reflection uses not covered already, there is a more powerful way:
+ // we can simply generate whatever object we want to add/modify in a
+ // FlatBuffer of its own, then add that to an existing FlatBuffer:
+ // As an example, let's add a string to an array of strings.
+ // First, find our field:
+ auto &testarrayofstring_field = *fields->LookupByKey("testarrayofstring");
+ // Find the vector value:
+ auto rtestarrayofstring = flatbuffers::piv(
+ flatbuffers::GetFieldV<flatbuffers::Offset<flatbuffers::String>>(
+ **rroot, testarrayofstring_field),
+ resizingbuf);
+ // It's a vector of 2 strings, to which we add one more, initialized to
+ // offset 0.
+ flatbuffers::ResizeVector<flatbuffers::Offset<flatbuffers::String>>(
+ schema, 3, 0, *rtestarrayofstring, &resizingbuf);
+ // Here we just create a buffer that contans a single string, but this
+ // could also be any complex set of tables and other values.
+ flatbuffers::FlatBufferBuilder stringfbb;
+ stringfbb.Finish(stringfbb.CreateString("hank"));
+ // Add the contents of it to our existing FlatBuffer.
+ // We do this last, so the pointer doesn't get invalidated (since it is
+ // at the end of the buffer):
+ auto string_ptr = flatbuffers::AddFlatBuffer(
+ resizingbuf, stringfbb.GetBufferPointer(), stringfbb.GetSize());
+ // Finally, set the new value in the vector.
+ rtestarrayofstring->MutateOffset(2, string_ptr);
+ TEST_EQ_STR(rtestarrayofstring->Get(0)->c_str(), "bob");
+ TEST_EQ_STR(rtestarrayofstring->Get(2)->c_str(), "hank");
+ // Test integrity of all resize operations above.
+ flatbuffers::Verifier resize_verifier(
+ reinterpret_cast<const uint8_t *>(resizingbuf.data()),
+ resizingbuf.size());
+ TEST_EQ(VerifyMonsterBuffer(resize_verifier), true);
+
+ // Test buffer is valid using reflection as well
+ TEST_EQ(flatbuffers::Verify(schema, *schema.root_table(), resizingbuf.data(),
+ resizingbuf.size()),
+ true);
+
+ // As an additional test, also set it on the name field.
+ // Note: unlike the name change above, this just overwrites the offset,
+ // rather than changing the string in-place.
+ SetFieldT(*rroot, name_field, string_ptr);
+ TEST_EQ_STR(GetFieldS(**rroot, name_field)->c_str(), "hank");
+
+ // Using reflection, rather than mutating binary FlatBuffers, we can also copy
+ // tables and other things out of other FlatBuffers into a FlatBufferBuilder,
+ // either part or whole.
+ flatbuffers::FlatBufferBuilder fbb;
+ auto root_offset = flatbuffers::CopyTable(
+ fbb, schema, *root_table, *flatbuffers::GetAnyRoot(flatbuf), true);
+ fbb.Finish(root_offset, MonsterIdentifier());
+ // Test that it was copied correctly:
+ AccessFlatBufferTest(fbb.GetBufferPointer(), fbb.GetSize());
+
+ // Test buffer is valid using reflection as well
+ TEST_EQ(flatbuffers::Verify(schema, *schema.root_table(),
+ fbb.GetBufferPointer(), fbb.GetSize()),
+ true);
+}
+
+void MiniReflectFlatBuffersTest(uint8_t *flatbuf) {
+ auto s =
+ flatbuffers::FlatBufferToString(flatbuf, Monster::MiniReflectTypeTable());
+ TEST_EQ_STR(
+ s.c_str(),
+ "{ "
+ "pos: { x: 1.0, y: 2.0, z: 3.0, test1: 0.0, test2: Red, test3: "
+ "{ a: 10, b: 20 } }, "
+ "hp: 80, "
+ "name: \"MyMonster\", "
+ "inventory: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], "
+ "test_type: Monster, "
+ "test: { name: \"Fred\" }, "
+ "test4: [ { a: 10, b: 20 }, { a: 30, b: 40 } ], "
+ "testarrayofstring: [ \"bob\", \"fred\", \"bob\", \"fred\" ], "
+ "testarrayoftables: [ { hp: 1000, name: \"Barney\" }, { name: \"Fred\" "
+ "}, "
+ "{ name: \"Wilma\" } ], "
+ // TODO(wvo): should really print this nested buffer correctly.
+ "testnestedflatbuffer: [ 20, 0, 0, 0, 77, 79, 78, 83, 12, 0, 12, 0, 0, "
+ "0, "
+ "4, 0, 6, 0, 8, 0, 12, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 13, 0, 0, 0, 78, "
+ "101, 115, 116, 101, 100, 77, 111, 110, 115, 116, 101, 114, 0, 0, 0 ], "
+ "testarrayofstring2: [ \"jane\", \"mary\" ], "
+ "testarrayofsortedstruct: [ { id: 0, distance: 0 }, "
+ "{ id: 2, distance: 20 }, { id: 3, distance: 30 }, "
+ "{ id: 4, distance: 40 } ], "
+ "flex: [ 210, 4, 5, 2 ], "
+ "test5: [ { a: 10, b: 20 }, { a: 30, b: 40 } ], "
+ "vector_of_enums: [ Blue, Green ], "
+ "scalar_key_sorted_tables: [ { id: \"miss\" } ] "
+ "}");
+
+ Test test(16, 32);
+ Vec3 vec(1, 2, 3, 1.5, Color_Red, test);
+ flatbuffers::FlatBufferBuilder vec_builder;
+ vec_builder.Finish(vec_builder.CreateStruct(vec));
+ auto vec_buffer = vec_builder.Release();
+ auto vec_str = flatbuffers::FlatBufferToString(vec_buffer.data(),
+ Vec3::MiniReflectTypeTable());
+ TEST_EQ_STR(vec_str.c_str(),
+ "{ x: 1.0, y: 2.0, z: 3.0, test1: 1.5, test2: Red, test3: { a: "
+ "16, b: 32 } }");
+}
+
+void MiniReflectFixedLengthArrayTest() {
+ // VS10 does not support typed enums, exclude from tests
+#if !defined(_MSC_VER) || _MSC_VER >= 1700
+ flatbuffers::FlatBufferBuilder fbb;
+ MyGame::Example::ArrayStruct aStruct(2, 12, 1);
+ auto aTable = MyGame::Example::CreateArrayTable(fbb, &aStruct);
+ fbb.Finish(aTable);
+
+ auto flatbuf = fbb.Release();
+ auto s = flatbuffers::FlatBufferToString(
+ flatbuf.data(), MyGame::Example::ArrayTableTypeTable());
+ TEST_EQ_STR(
+ "{ "
+ "a: { a: 2.0, "
+ "b: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], "
+ "c: 12, "
+ "d: [ { a: [ 0, 0 ], b: A, c: [ A, A ], d: [ 0, 0 ] }, "
+ "{ a: [ 0, 0 ], b: A, c: [ A, A ], d: [ 0, 0 ] } ], "
+ "e: 1, f: [ 0, 0 ] } "
+ "}",
+ s.c_str());
+#endif
+}
+
+} // namespace tests
+} // namespace flatbuffers
\ No newline at end of file
diff --git a/tests/reflection_test.h b/tests/reflection_test.h
new file mode 100644
index 0000000..d514867
--- /dev/null
+++ b/tests/reflection_test.h
@@ -0,0 +1,16 @@
+#ifndef TESTS_REFLECTION_TEST_H
+#define TESTS_REFLECTION_TEST_H
+
+#include <string>
+
+namespace flatbuffers {
+namespace tests {
+
+void ReflectionTest(const std::string& tests_data_path, uint8_t *flatbuf, size_t length);
+void MiniReflectFixedLengthArrayTest();
+void MiniReflectFlatBuffersTest(uint8_t *flatbuf);
+
+} // namespace tests
+} // namespace flatbuffers
+
+#endif
diff --git a/tests/rust_usage_test/Cargo.toml b/tests/rust_usage_test/Cargo.toml
index e676970..d5731e7 100644
--- a/tests/rust_usage_test/Cargo.toml
+++ b/tests/rust_usage_test/Cargo.toml
@@ -4,6 +4,7 @@
authors = ["Robert Winslow <hello@rwinslow.com>",
"Casper Neo <cneo@google.com>",
"FlatBuffers Maintainers"]
+edition = "2018"
[dependencies]
flatbuffers = { path = "../../rust/flatbuffers", default-features = false }
diff --git a/tests/rust_usage_test/benches/flatbuffers_benchmarks.rs b/tests/rust_usage_test/benches/flatbuffers_benchmarks.rs
index 580d433..7d72501 100644
--- a/tests/rust_usage_test/benches/flatbuffers_benchmarks.rs
+++ b/tests/rust_usage_test/benches/flatbuffers_benchmarks.rs
@@ -14,9 +14,8 @@
* limitations under the License.
*/
+use bencher::{benchmark_group, Bencher};
use flatbuffers;
-use bencher::Bencher;
-
#[allow(dead_code, unused_imports)]
#[path = "../../monster_test/mod.rs"]
diff --git a/tests/rust_usage_test/benches/flexbuffers_benchmarks.rs b/tests/rust_usage_test/benches/flexbuffers_benchmarks.rs
index 1b9a8fb..2684291 100644
--- a/tests/rust_usage_test/benches/flexbuffers_benchmarks.rs
+++ b/tests/rust_usage_test/benches/flexbuffers_benchmarks.rs
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-use bencher::Bencher;
+use bencher::{benchmark_group, benchmark_main, Bencher};
use flexbuffers::*;
fn push_vec_u64_to_map(b: &mut Bencher) {
diff --git a/tests/rust_usage_test/tests/arrays_test.rs b/tests/rust_usage_test/tests/arrays_test.rs
index faa0ac8..e92e862 100644
--- a/tests/rust_usage_test/tests/arrays_test.rs
+++ b/tests/rust_usage_test/tests/arrays_test.rs
@@ -1,16 +1,23 @@
+#![no_std]
+
+#[cfg(not(feature = "no_std"))]
+extern crate std;
+
+extern crate alloc;
+
extern crate array_init;
#[allow(dead_code, unused_imports)]
#[path = "../../arrays_test/mod.rs"]
mod arrays_test_generated;
-use std::fmt::Debug;
+use alloc::format;
+use core::fmt::Debug;
use crate::arrays_test_generated::my_game::example::*;
extern crate quickcheck;
use array_init::array_init;
-use std::mem::size_of;
+use core::mem::size_of;
use quickcheck::{Arbitrary, Gen};
-
fn create_serialized_example_with_generated_code(builder: &mut flatbuffers::FlatBufferBuilder) {
let nested_struct1 = NestedStruct::new(
&[-1, 2],
@@ -111,12 +118,12 @@
#[test]
fn struct_netsted_struct_is_32_bytes() {
- assert_eq!(32, ::std::mem::size_of::<NestedStruct>());
+ assert_eq!(32, ::core::mem::size_of::<NestedStruct>());
}
#[test]
fn struct_array_struct_is_160_bytes() {
- assert_eq!(160, ::std::mem::size_of::<ArrayStruct>());
+ assert_eq!(160, ::core::mem::size_of::<ArrayStruct>());
}
#[test]
@@ -228,7 +235,7 @@
let b_start_ptr = array_struct.b().as_ptr() as usize;
let d_start_ptr = array_struct.d().as_ptr() as usize;
// The T type of b
- let b_aln = ::std::mem::align_of::<i32>();
+ let b_aln = ::core::mem::align_of::<i32>();
assert_eq!((b_start_ptr - struct_start_ptr) % b_aln, 0);
assert_eq!((d_start_ptr - b_start_ptr) % b_aln, 0);
assert_eq!((d_start_ptr - struct_start_ptr) % 8, 0);
diff --git a/tests/rust_usage_test/tests/flexbuffers_tests/binary_format.rs b/tests/rust_usage_test/tests/flexbuffers_tests/binary_format.rs
index 910fc78..84fd21b 100644
--- a/tests/rust_usage_test/tests/flexbuffers_tests/binary_format.rs
+++ b/tests/rust_usage_test/tests/flexbuffers_tests/binary_format.rs
@@ -115,7 +115,6 @@
let mut expected = x.to_le_bytes().to_vec();
expected.push(3 << 2 | 2); // Float W32.
expected.push(4); // Root width W32.
- println!("{:?}: {:?} vs {:?} cmp {:?}", x, &fxb, &expected, fxb==expected);
fxb == expected
}
}
@@ -321,7 +320,7 @@
v.push(IndirectUInt(u64::max_value()));
v.push(IndirectInt(i64::min_value()));
// TODO(cneo): Something about Float EPSILON and casting leads to a different binary format.
- v.push(IndirectFloat(std::f64::consts::PI));
+ v.push(IndirectFloat(core::f64::consts::PI));
v.push(0u32); // This is stored in 8 bits instead of 64 because of indirection.
v.end_vector();
assert_eq!(
@@ -385,7 +384,6 @@
v.push(IndirectInt(i64::max_value()));
v.end_vector();
let len_with_indirect = builder.view().len() as f32;
- dbg!(len_with_indirect, len_without_indirect);
assert!(len_with_indirect * 2.5 < len_without_indirect);
}
#[test]
diff --git a/tests/rust_usage_test/tests/flexbuffers_tests/mod.rs b/tests/rust_usage_test/tests/flexbuffers_tests/mod.rs
index 621f81b..ee52aca 100644
--- a/tests/rust_usage_test/tests/flexbuffers_tests/mod.rs
+++ b/tests/rust_usage_test/tests/flexbuffers_tests/mod.rs
@@ -13,6 +13,7 @@
// limitations under the License.
mod binary_format;
+#[cfg(not(feature = "no_std"))] // uses file I/O
mod interop;
mod other_api;
#[cfg(not(miri))] // slow.
diff --git a/tests/rust_usage_test/tests/flexbuffers_tests/other_api.rs b/tests/rust_usage_test/tests/flexbuffers_tests/other_api.rs
index d1c0873..9875c22 100644
--- a/tests/rust_usage_test/tests/flexbuffers_tests/other_api.rs
+++ b/tests/rust_usage_test/tests/flexbuffers_tests/other_api.rs
@@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+use alloc::vec::Vec;
+
use flexbuffers::*;
#[cfg(not(miri))] // slow.
use quickcheck::QuickCheck;
diff --git a/tests/rust_usage_test/tests/flexbuffers_tests/qc_serious.rs b/tests/rust_usage_test/tests/flexbuffers_tests/qc_serious.rs
index 1bed3c2..b2e04ec 100644
--- a/tests/rust_usage_test/tests/flexbuffers_tests/qc_serious.rs
+++ b/tests/rust_usage_test/tests/flexbuffers_tests/qc_serious.rs
@@ -1,7 +1,10 @@
+use alloc::collections::BTreeMap;
+use alloc::string::String;
+use alloc::vec::Vec;
+
use super::rwyw::NonNullString;
use flexbuffers::*;
use quickcheck::{Arbitrary, Gen};
-use std::collections::BTreeMap;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
enum Enum {
diff --git a/tests/rust_usage_test/tests/flexbuffers_tests/rwyw.rs b/tests/rust_usage_test/tests/flexbuffers_tests/rwyw.rs
index 8c27e6b..478d33a 100644
--- a/tests/rust_usage_test/tests/flexbuffers_tests/rwyw.rs
+++ b/tests/rust_usage_test/tests/flexbuffers_tests/rwyw.rs
@@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+use alloc::string::{String, ToString};
+use alloc::vec::Vec;
+
// Read what you wrote.
use flexbuffers::*;
#[cfg(not(miri))] // slow.
@@ -23,7 +26,7 @@
pub struct NonNullString(String);
impl quickcheck::Arbitrary for NonNullString {
fn arbitrary<G: quickcheck::Gen>(g: &mut G) -> Self {
- let size = std::cmp::min(1, usize::arbitrary(g));
+ let size = core::cmp::min(1, usize::arbitrary(g));
NonNullString(
(0..)
.map(|_| <char>::arbitrary(g))
@@ -74,7 +77,7 @@
}
v.end_vector();
let r = Reader::get_root(builder.view()).unwrap().as_vector();
- xs.iter().enumerate().all(|(i, &x)| (r.idx(i).as_f64() - x).abs() < std::f64::EPSILON)
+ xs.iter().enumerate().all(|(i, &x)| (r.idx(i).as_f64() - x).abs() < core::f64::EPSILON)
}
fn qc_vec_string(xs: Vec<String>) -> bool {
let mut builder = Builder::default();
@@ -86,6 +89,7 @@
let r = Reader::get_root(builder.view()).unwrap().as_vector();
xs.iter().enumerate().all(|(i, x)| (r.idx(i).as_str() == x))
}
+ #[cfg(not(feature = "no_std"))]
fn qc_map_int(xs: std::collections::BTreeMap<NonNullString, i64>) -> bool {
let mut builder = Builder::default();
let mut m = builder.start_map();
@@ -98,6 +102,7 @@
r.idx(i).as_i64() == v && r.idx(k.0.as_str()).as_i64() == v
})
}
+ #[cfg(not(feature = "no_std"))]
fn qc_map_string(xs: std::collections::BTreeMap<NonNullString, String>) -> bool {
let mut builder = Builder::default();
let mut m = builder.start_map();
@@ -195,7 +200,6 @@
let foo1 = Foo::default();
let mut s = FlexbufferSerializer::new();
foo1.serialize(&mut s).unwrap();
- dbg!(s.view());
let r = Reader::get_root(s.view()).unwrap();
let foo2 = Foo::deserialize(r).unwrap();
assert_eq!(foo1, foo2);
diff --git a/tests/rust_usage_test/tests/integration_test.rs b/tests/rust_usage_test/tests/integration_test.rs
index 9a4c8b3..73d4a1f 100644
--- a/tests/rust_usage_test/tests/integration_test.rs
+++ b/tests/rust_usage_test/tests/integration_test.rs
@@ -15,6 +15,18 @@
* limitations under the License.
*/
+#![no_std]
+
+#[cfg(not(feature = "no_std"))]
+extern crate std;
+#[cfg(not(feature = "no_std"))]
+use alloc::vec::Vec;
+
+#[macro_use]
+extern crate alloc;
+
+use alloc::string::String;
+
#[cfg(feature = "no_std")]
#[global_allocator]
static ALLOCATOR: libc_alloc::LibcAlloc = libc_alloc::LibcAlloc;
@@ -392,9 +404,9 @@
// If the verifier says a buffer is okay then using it won't cause a crash.
// We use write_fmt since Debug visits all the fields - but there's no need to store anything.
struct ForgetfulWriter;
- use std::fmt::Write;
+ use core::fmt::Write;
impl Write for ForgetfulWriter {
- fn write_str(&mut self, _: &str) -> Result<(), std::fmt::Error> {
+ fn write_str(&mut self, _: &str) -> Result<(), core::fmt::Error> {
Ok(())
}
}
@@ -442,7 +454,7 @@
let b = &mut flatbuffers::FlatBufferBuilder::new();
let name = Some(b.create_string("foo"));
// String amplification attack.
- let s = b.create_string(&(std::iter::repeat("X").take(1000).collect::<String>()));
+ let s = b.create_string(&(core::iter::repeat("X").take(1000).collect::<String>()));
let testarrayofstring = Some(b.create_vector(&vec![s; 1000]));
let m = Monster::create(b, &MonsterArgs {
testarrayofstring,
@@ -541,11 +553,12 @@
}
}
+#[cfg(not(feature = "no_std"))]
#[cfg(test)]
mod lifetime_correctness {
extern crate flatbuffers;
- use std::mem;
+ use core::mem;
use super::my_game;
use super::load_file;
@@ -593,6 +606,8 @@
mod roundtrip_generated_code {
extern crate flatbuffers;
+ use alloc::vec::Vec;
+
use super::my_game;
fn build_mon<'a, 'b>(builder: &'a mut flatbuffers::FlatBufferBuilder, args: &'b my_game::example::MonsterArgs) -> my_game::example::Monster<'a> {
@@ -988,25 +1003,25 @@
#[test]
fn enum_color_is_1_byte() {
- assert_eq!(1, ::std::mem::size_of::<my_game::example::Color>());
+ assert_eq!(1, ::core::mem::size_of::<my_game::example::Color>());
}
#[test]
fn union_any_is_1_byte() {
- assert_eq!(1, ::std::mem::size_of::<my_game::example::Any>());
+ assert_eq!(1, ::core::mem::size_of::<my_game::example::Any>());
}
#[test]
fn union_any_is_aligned_to_1() {
- assert_eq!(1, ::std::mem::align_of::<my_game::example::Any>());
+ assert_eq!(1, ::core::mem::align_of::<my_game::example::Any>());
}
#[test]
fn struct_test_is_4_bytes() {
- assert_eq!(4, ::std::mem::size_of::<my_game::example::Test>());
+ assert_eq!(4, ::core::mem::size_of::<my_game::example::Test>());
}
#[test]
fn struct_vec3_is_32_bytes() {
- assert_eq!(32, ::std::mem::size_of::<my_game::example::Vec3>());
+ assert_eq!(32, ::core::mem::size_of::<my_game::example::Vec3>());
}
#[test]
@@ -1036,7 +1051,7 @@
#[test]
fn struct_ability_is_8_bytes() {
- assert_eq!(8, ::std::mem::size_of::<my_game::example::Ability>());
+ assert_eq!(8, ::core::mem::size_of::<my_game::example::Ability>());
}
#[test]
@@ -1061,7 +1076,7 @@
for a in abilities.iter() {
let a_ptr = a as *const my_game::example::Ability as usize;
assert!(a_ptr > start_ptr);
- let aln = ::std::mem::align_of::<my_game::example::Ability>();
+ let aln = ::core::mem::align_of::<my_game::example::Ability>();
assert_eq!((a_ptr - start_ptr) % aln, 0);
}
for a in abilities.iter().rev() {
@@ -1166,6 +1181,8 @@
extern crate quickcheck;
extern crate flatbuffers;
+ use alloc::vec::Vec;
+
const N: u64 = 20;
fn prop<T>(xs: Vec<T>)
@@ -1173,7 +1190,7 @@
T: for<'a> flatbuffers::Follow<'a, Inner = T>
+ flatbuffers::EndianScalar
+ flatbuffers::Push
- + ::std::fmt::Debug,
+ + ::core::fmt::Debug,
{
use flatbuffers::Follow;
@@ -1247,7 +1264,7 @@
// complicated.
macro_rules! impl_prop {
($test_name:ident, $fn_name:ident, $ty:ident) => (
- fn $fn_name(xs: Vec<$ty>) {
+ fn $fn_name(xs: alloc::vec::Vec<$ty>) {
use flatbuffers::Follow;
let mut b = flatbuffers::FlatBufferBuilder::new();
@@ -1258,7 +1275,7 @@
assert_eq!(got, &xs[..]);
}
#[test]
- fn $test_name() { quickcheck::QuickCheck::new().max_tests(N).quickcheck($fn_name as fn(Vec<_>)); }
+ fn $test_name() { quickcheck::QuickCheck::new().max_tests(N).quickcheck($fn_name as fn(alloc::vec::Vec<_>)); }
)
}
@@ -1289,6 +1306,9 @@
extern crate quickcheck;
extern crate flatbuffers;
+ use alloc::string::String;
+ use alloc::vec::Vec;
+
fn prop(xs: Vec<String>) {
use flatbuffers::Follow;
@@ -1327,6 +1347,9 @@
extern crate quickcheck;
extern crate flatbuffers;
+ use alloc::string::String;
+ use alloc::vec::Vec;
+
fn prop(input: Vec<String>) {
let xs: Vec<&str> = input.iter().map(|s: &String| &s[..]).collect();
@@ -1358,6 +1381,8 @@
extern crate quickcheck;
extern crate flatbuffers;
+ use alloc::vec::Vec;
+
#[cfg(not(miri))] // slow.
#[test]
fn fuzz_manual_build() {
@@ -1409,8 +1434,11 @@
}
}
+#[cfg(not(feature = "no_std"))]
#[cfg(test)]
mod roundtrip_table {
+ use alloc::string::String;
+ use alloc::vec::Vec;
use std::collections::HashMap;
extern crate flatbuffers;
@@ -1429,9 +1457,9 @@
let uchar_val: u8 = 0xFF;
let short_val: i16 = -32222; // 0x8222;
let ushort_val: u16 = 0xFEEE;
- let int_val: i32 = unsafe { ::std::mem::transmute(0x83333333u32) };
+ let int_val: i32 = unsafe { ::core::mem::transmute(0x83333333u32) };
let uint_val: u32 = 0xFDDDDDDD;
- let long_val: i64 = unsafe { ::std::mem::transmute(0x8444444444444444u64) }; // TODO: byte literal?
+ let long_val: i64 = unsafe { ::core::mem::transmute(0x8444444444444444u64) }; // TODO: byte literal?
let ulong_val: u64 = 0xFCCCCCCCCCCCCCCCu64;
let float_val: f32 = 3.14159;
let double_val: f64 = 3.14159265359;
@@ -1598,6 +1626,9 @@
#[cfg(not(miri))] // slow.
mod table_of_vectors_of_scalars {
+
+ use alloc::vec::Vec;
+
extern crate flatbuffers;
#[cfg(not(miri))] // slow.
extern crate quickcheck;
@@ -1609,7 +1640,7 @@
T: for<'a> flatbuffers::Follow<'a, Inner = T>
+ flatbuffers::EndianScalar
+ flatbuffers::Push
- + ::std::fmt::Debug,
+ + ::core::fmt::Debug,
{
use flatbuffers::field_index_to_field_offset as fi2fo;
use flatbuffers::Follow;
@@ -1689,8 +1720,8 @@
const N: u64 = 1000;
- fn prop<T: PartialEq + ::std::fmt::Debug + Copy + flatbuffers::EndianScalar>(x: T) {
- let mut buf = vec![0u8; ::std::mem::size_of::<T>()];
+ fn prop<T: PartialEq + ::core::fmt::Debug + Copy + flatbuffers::EndianScalar>(x: T) {
+ let mut buf = vec![0u8; ::core::mem::size_of::<T>()];
let y = unsafe {
flatbuffers::emplace_scalar(&mut buf[..], x);
flatbuffers::read_scalar(&buf[..])
@@ -1742,7 +1773,7 @@
macro_rules! impl_prop {
($fn_name:ident, $ty:ident) => (
fn $fn_name(x: $ty) {
- let mut buf = vec![0u8; ::std::mem::size_of::<$ty>()];
+ let mut buf = vec![0u8; ::core::mem::size_of::<$ty>()];
x.push(&mut buf[..], &[][..]);
let fs: flatbuffers::FollowStart<$ty> = flatbuffers::FollowStart::new();
assert_eq!(fs.self_follow(&buf[..], 0), x);
@@ -1896,10 +1927,13 @@
}
}
+#[cfg(not(feature = "no_std"))]
#[cfg(test)]
mod read_examples_from_other_language_ports {
extern crate flatbuffers;
+ use std::println;
+
use super::load_file;
use super::serialized_example_is_accessible_and_correct;
@@ -1974,9 +2008,9 @@
fn struct_key_compare_with_value() {
let a = my_game::example::Ability::new(1, 2);
- assert_eq!(a.key_compare_with_value(0), ::std::cmp::Ordering::Greater);
- assert_eq!(a.key_compare_with_value(1), ::std::cmp::Ordering::Equal);
- assert_eq!(a.key_compare_with_value(2), ::std::cmp::Ordering::Less);
+ assert_eq!(a.key_compare_with_value(0), ::core::cmp::Ordering::Greater);
+ assert_eq!(a.key_compare_with_value(1), ::core::cmp::Ordering::Equal);
+ assert_eq!(a.key_compare_with_value(2), ::core::cmp::Ordering::Less);
}
#[test]
@@ -2010,9 +2044,9 @@
// preconditions
assert_eq!(a.name(), "MyMonster");
- assert_eq!(a.key_compare_with_value("AAA"), ::std::cmp::Ordering::Greater);
- assert_eq!(a.key_compare_with_value("MyMonster"), ::std::cmp::Ordering::Equal);
- assert_eq!(a.key_compare_with_value("ZZZ"), ::std::cmp::Ordering::Less);
+ assert_eq!(a.key_compare_with_value("AAA"), ::core::cmp::Ordering::Greater);
+ assert_eq!(a.key_compare_with_value("MyMonster"), ::core::cmp::Ordering::Equal);
+ assert_eq!(a.key_compare_with_value("ZZZ"), ::core::cmp::Ordering::Less);
}
#[test]
@@ -2116,6 +2150,8 @@
use flatbuffers::Follow;
use flatbuffers::field_index_to_field_offset as fi2fo;
+ use alloc::vec::Vec;
+
// Define a test struct to use in a few tests. This replicates the work that the code generator
// would normally do when defining a FlatBuffer struct. For reference, compare the following
// `FooStruct` code with the code generated for the `Vec3` struct in
@@ -2884,12 +2920,12 @@
c: i8,
_pad2: [u8; 4],
}
- assert_eq!(::std::mem::size_of::<foo>(), 16);
+ assert_eq!(::core::mem::size_of::<foo>(), 16);
impl<'b> flatbuffers::Push for &'b foo {
type Output = foo;
fn push<'a>(&'a self, dst: &'a mut [u8], _rest: &'a [u8]) {
let src = unsafe {
- ::std::slice::from_raw_parts(*self as *const foo as *const u8, ::std::mem::size_of::<foo>())
+ ::core::slice::from_raw_parts(*self as *const foo as *const u8, ::core::mem::size_of::<foo>())
};
dst.copy_from_slice(src);
}
@@ -3170,6 +3206,9 @@
#[cfg(test)]
mod copy_clone_traits {
+
+ use alloc::vec::Vec;
+
#[test]
fn follow_types_implement_copy_and_clone() {
static_assertions::assert_impl_all!(flatbuffers::WIPOffset<u32>: Copy, Clone);
@@ -3187,17 +3226,18 @@
mod fully_qualified_name {
#[test]
fn fully_qualified_name_generated() {
- assert!(check_eq!(::my_game::example::Monster::get_fully_qualified_name(), "MyGame.Example.Monster").is_ok());
- assert!(check_eq!(::my_game::example_2::Monster::get_fully_qualified_name(), "MyGame.Example2.Monster").is_ok());
+ assert!(check_eq!(super::my_game::example::Monster::get_fully_qualified_name(), "MyGame.Example.Monster").is_ok());
+ assert!(check_eq!(super::my_game::example_2::Monster::get_fully_qualified_name(), "MyGame.Example2.Monster").is_ok());
- assert!(check_eq!(::my_game::example::Vec3::get_fully_qualified_name(), "MyGame.Example.Vec3").is_ok());
- assert!(check_eq!(::my_game::example::Ability::get_fully_qualified_name(), "MyGame.Example.Ability").is_ok());
+ assert!(check_eq!(super::my_game::example::Vec3::get_fully_qualified_name(), "MyGame.Example.Vec3").is_ok());
+ assert!(check_eq!(super::my_game::example::Ability::get_fully_qualified_name(), "MyGame.Example.Ability").is_ok());
}
}
// this is not technically a test, but we want to always keep this generated
// file up-to-date, and the simplest way to do that is to make sure that when
// tests are run, the file is generated.
+#[cfg(not(feature = "no_std"))]
#[test]
fn write_example_wire_data_to_file() {
let b = &mut flatbuffers::FlatBufferBuilder::new();
@@ -3208,6 +3248,7 @@
f.write_all(b.finished_data()).unwrap();
}
+#[cfg(not(feature = "no_std"))]
fn load_file(filename: &str) -> Result<Vec<u8>, std::io::Error> {
use std::io::Read;
let mut f = std::fs::File::open(filename)?;
diff --git a/tests/rust_usage_test/tests/more_defaults_test.rs b/tests/rust_usage_test/tests/more_defaults_test.rs
index af664f2..4d62a4a 100644
--- a/tests/rust_usage_test/tests/more_defaults_test.rs
+++ b/tests/rust_usage_test/tests/more_defaults_test.rs
@@ -1,3 +1,8 @@
+extern crate alloc;
+
+use alloc::string::ToString;
+use alloc::vec::Vec;
+
#[allow(dead_code, unused_imports)]
#[path = "../../more_defaults/mod.rs"]
mod more_defaults_generated;
diff --git a/tests/FlatBuffers.Benchmarks.swift/Package.swift b/tests/swift/Wasm.tests/Package.swift
similarity index 79%
rename from tests/FlatBuffers.Benchmarks.swift/Package.swift
rename to tests/swift/Wasm.tests/Package.swift
index 2026247..6d3b164 100644
--- a/tests/FlatBuffers.Benchmarks.swift/Package.swift
+++ b/tests/swift/Wasm.tests/Package.swift
@@ -18,15 +18,17 @@
import PackageDescription
let package = Package(
- name: "FlatBuffers.Benchmarks.swift",
+ name: "FlatBuffers.Test.Swift.Wasm",
platforms: [
.macOS(.v10_14),
],
dependencies: [
- .package(path: "../../swift"),
+ .package(path: "../../../swift"),
],
targets: [
.target(
- name: "FlatBuffers.Benchmarks.swift",
- dependencies: ["FlatBuffers"]),
+ name: "Wasm"),
+ .testTarget(
+ name: "FlatBuffers.Test.Swift.WasmTests",
+ dependencies: ["FlatBuffers"])
])
diff --git a/tests/swift/Wasm.tests/Sources/Wasm/Wasm.swift b/tests/swift/Wasm.tests/Sources/Wasm/Wasm.swift
new file mode 100644
index 0000000..c14abeb
--- /dev/null
+++ b/tests/swift/Wasm.tests/Sources/Wasm/Wasm.swift
@@ -0,0 +1 @@
+public struct Wasm {}
\ No newline at end of file
diff --git a/tests/swift/Wasm.tests/Tests/FlatBuffers.Test.Swift.WasmTests/FlatBuffersMonsterWriterTests.swift b/tests/swift/Wasm.tests/Tests/FlatBuffers.Test.Swift.WasmTests/FlatBuffersMonsterWriterTests.swift
new file mode 100644
index 0000000..614791e
--- /dev/null
+++ b/tests/swift/Wasm.tests/Tests/FlatBuffers.Test.Swift.WasmTests/FlatBuffersMonsterWriterTests.swift
@@ -0,0 +1,355 @@
+/*
+ * Copyright 2021 Google Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Foundation
+import XCTest
+@testable import FlatBuffers
+
+typealias Test = MyGame_Example_Test
+typealias Monster = MyGame_Example_Monster
+typealias Vec3 = MyGame_Example_Vec3
+typealias Stat = MyGame_Example_Stat
+
+class FlatBuffersMonsterWriterTests: XCTestCase {
+
+ func testData() {
+ // swiftformat:disable all
+ let data: [UInt8] = [48, 0, 0, 0, 77, 79, 78, 83, 0, 0, 0, 0, 36, 0, 72, 0, 40, 0, 0, 0, 38, 0, 32, 0, 0, 0, 28, 0, 0, 0, 27, 0, 20, 0, 16, 0, 12, 0, 4, 0, 0, 0, 0, 0, 0, 0, 11, 0, 36, 0, 0, 0, 164, 0, 0, 0, 0, 0, 0, 1, 60, 0, 0, 0, 68, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 1, 88, 0, 0, 0, 120, 0, 0, 0, 0, 0, 80, 0, 0, 0, 128, 63, 0, 0, 0, 64, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 64, 2, 0, 5, 0, 6, 0, 0, 0, 2, 0, 0, 0, 64, 0, 0, 0, 48, 0, 0, 0, 2, 0, 0, 0, 30, 0, 40, 0, 10, 0, 20, 0, 152, 255, 255, 255, 4, 0, 0, 0, 4, 0, 0, 0, 70, 114, 101, 100, 0, 0, 0, 0, 5, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 5, 0, 0, 0, 116, 101, 115, 116, 50, 0, 0, 0, 5, 0, 0, 0, 116, 101, 115, 116, 49, 0, 0, 0, 9, 0, 0, 0, 77, 121, 77, 111, 110, 115, 116, 101, 114, 0, 0, 0, 3, 0, 0, 0, 20, 0, 0, 0, 36, 0, 0, 0, 4, 0, 0, 0, 240, 255, 255, 255, 32, 0, 0, 0, 248, 255, 255, 255, 36, 0, 0, 0, 12, 0, 8, 0, 0, 0, 0, 0, 0, 0, 4, 0, 12, 0, 0, 0, 28, 0, 0, 0, 5, 0, 0, 0, 87, 105, 108, 109, 97, 0, 0, 0, 6, 0, 0, 0, 66, 97, 114, 110, 101, 121, 0, 0, 5, 0, 0, 0, 70, 114, 111, 100, 111, 0, 0, 0]
+ // swiftformat:enable all
+ let _data = ByteBuffer(bytes: data)
+ readVerifiedMonster(fb: _data)
+ }
+
+ func testCreateMonster() {
+ let bytes = createMonster(withPrefix: false)
+ // swiftformat:disable all
+ XCTAssertEqual(bytes.sizedByteArray, [48, 0, 0, 0, 77, 79, 78, 83, 0, 0, 0, 0, 36, 0, 72, 0, 40, 0, 0, 0, 38, 0, 32, 0, 0, 0, 28, 0, 0, 0, 27, 0, 20, 0, 16, 0, 12, 0, 4, 0, 0, 0, 0, 0, 0, 0, 11, 0, 36, 0, 0, 0, 164, 0, 0, 0, 0, 0, 0, 1, 60, 0, 0, 0, 68, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 1, 88, 0, 0, 0, 120, 0, 0, 0, 0, 0, 80, 0, 0, 0, 128, 63, 0, 0, 0, 64, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 64, 2, 0, 5, 0, 6, 0, 0, 0, 2, 0, 0, 0, 64, 0, 0, 0, 48, 0, 0, 0, 2, 0, 0, 0, 30, 0, 40, 0, 10, 0, 20, 0, 152, 255, 255, 255, 4, 0, 0, 0, 4, 0, 0, 0, 70, 114, 101, 100, 0, 0, 0, 0, 5, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 5, 0, 0, 0, 116, 101, 115, 116, 50, 0, 0, 0, 5, 0, 0, 0, 116, 101, 115, 116, 49, 0, 0, 0, 9, 0, 0, 0, 77, 121, 77, 111, 110, 115, 116, 101, 114, 0, 0, 0, 3, 0, 0, 0, 20, 0, 0, 0, 36, 0, 0, 0, 4, 0, 0, 0, 240, 255, 255, 255, 32, 0, 0, 0, 248, 255, 255, 255, 36, 0, 0, 0, 12, 0, 8, 0, 0, 0, 0, 0, 0, 0, 4, 0, 12, 0, 0, 0, 28, 0, 0, 0, 5, 0, 0, 0, 87, 105, 108, 109, 97, 0, 0, 0, 6, 0, 0, 0, 66, 97, 114, 110, 101, 121, 0, 0, 5, 0, 0, 0, 70, 114, 111, 100, 111, 0, 0, 0])
+ // swiftformat:enable all
+ let monster = MyGame_Example_Monster.getRootAsMonster(bb: bytes.buffer)
+ readMonster(monster: monster)
+ mutateMonster(fb: bytes.buffer)
+ readMonster(monster: monster)
+ }
+
+ func testCreateMonsterResizedBuffer() {
+ let bytes = createMonster(withPrefix: false)
+ // swiftformat:disable all
+ XCTAssertEqual(bytes.sizedByteArray, [48, 0, 0, 0, 77, 79, 78, 83, 0, 0, 0, 0, 36, 0, 72, 0, 40, 0, 0, 0, 38, 0, 32, 0, 0, 0, 28, 0, 0, 0, 27, 0, 20, 0, 16, 0, 12, 0, 4, 0, 0, 0, 0, 0, 0, 0, 11, 0, 36, 0, 0, 0, 164, 0, 0, 0, 0, 0, 0, 1, 60, 0, 0, 0, 68, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 1, 88, 0, 0, 0, 120, 0, 0, 0, 0, 0, 80, 0, 0, 0, 128, 63, 0, 0, 0, 64, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 64, 2, 0, 5, 0, 6, 0, 0, 0, 2, 0, 0, 0, 64, 0, 0, 0, 48, 0, 0, 0, 2, 0, 0, 0, 30, 0, 40, 0, 10, 0, 20, 0, 152, 255, 255, 255, 4, 0, 0, 0, 4, 0, 0, 0, 70, 114, 101, 100, 0, 0, 0, 0, 5, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 5, 0, 0, 0, 116, 101, 115, 116, 50, 0, 0, 0, 5, 0, 0, 0, 116, 101, 115, 116, 49, 0, 0, 0, 9, 0, 0, 0, 77, 121, 77, 111, 110, 115, 116, 101, 114, 0, 0, 0, 3, 0, 0, 0, 20, 0, 0, 0, 36, 0, 0, 0, 4, 0, 0, 0, 240, 255, 255, 255, 32, 0, 0, 0, 248, 255, 255, 255, 36, 0, 0, 0, 12, 0, 8, 0, 0, 0, 0, 0, 0, 0, 4, 0, 12, 0, 0, 0, 28, 0, 0, 0, 5, 0, 0, 0, 87, 105, 108, 109, 97, 0, 0, 0, 6, 0, 0, 0, 66, 97, 114, 110, 101, 121, 0, 0, 5, 0, 0, 0, 70, 114, 111, 100, 111, 0, 0, 0])
+ // swiftformat:enable all
+ readVerifiedMonster(fb: bytes.sizedBuffer)
+ }
+
+ func testCreateMonsterPrefixed() {
+ let bytes = createMonster(withPrefix: true)
+ // swiftformat:disable all
+ XCTAssertEqual(bytes.sizedByteArray, [44, 1, 0, 0, 44, 0, 0, 0, 77, 79, 78, 83, 36, 0, 72, 0, 40, 0, 0, 0, 38, 0, 32, 0, 0, 0, 28, 0, 0, 0, 27, 0, 20, 0, 16, 0, 12, 0, 4, 0, 0, 0, 0, 0, 0, 0, 11, 0, 36, 0, 0, 0, 164, 0, 0, 0, 0, 0, 0, 1, 60, 0, 0, 0, 68, 0, 0, 0, 76, 0, 0, 0, 0, 0, 0, 1, 88, 0, 0, 0, 120, 0, 0, 0, 0, 0, 80, 0, 0, 0, 128, 63, 0, 0, 0, 64, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 64, 2, 0, 5, 0, 6, 0, 0, 0, 2, 0, 0, 0, 64, 0, 0, 0, 48, 0, 0, 0, 2, 0, 0, 0, 30, 0, 40, 0, 10, 0, 20, 0, 152, 255, 255, 255, 4, 0, 0, 0, 4, 0, 0, 0, 70, 114, 101, 100, 0, 0, 0, 0, 5, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 5, 0, 0, 0, 116, 101, 115, 116, 50, 0, 0, 0, 5, 0, 0, 0, 116, 101, 115, 116, 49, 0, 0, 0, 9, 0, 0, 0, 77, 121, 77, 111, 110, 115, 116, 101, 114, 0, 0, 0, 3, 0, 0, 0, 20, 0, 0, 0, 36, 0, 0, 0, 4, 0, 0, 0, 240, 255, 255, 255, 32, 0, 0, 0, 248, 255, 255, 255, 36, 0, 0, 0, 12, 0, 8, 0, 0, 0, 0, 0, 0, 0, 4, 0, 12, 0, 0, 0, 28, 0, 0, 0, 5, 0, 0, 0, 87, 105, 108, 109, 97, 0, 0, 0, 6, 0, 0, 0, 66, 97, 114, 110, 101, 121, 0, 0, 5, 0, 0, 0, 70, 114, 111, 100, 111, 0, 0, 0])
+ // swiftformat:enable all
+
+ var buffer = bytes.buffer
+ readMonster(monster: getPrefixedSizeRoot(byteBuffer: &buffer))
+ }
+
+ func testCreateMonsterUsingCreateMonsterMethodWithNilPos() {
+ var fbb = FlatBufferBuilder(initialSize: 1)
+ let name = fbb.create(string: "Frodo")
+ let mStart = Monster.startMonster(&fbb)
+ Monster.add(name: name, &fbb)
+ let root = Monster.endMonster(&fbb, start: mStart)
+ fbb.finish(offset: root)
+ let newMonster = Monster.getRootAsMonster(bb: fbb.sizedBuffer)
+ XCTAssertNil(newMonster.pos)
+ XCTAssertEqual(newMonster.name, "Frodo")
+ }
+
+ func testCreateMonsterUsingCreateMonsterMethodWithPosX() {
+ var fbb = FlatBufferBuilder(initialSize: 1)
+ let name = fbb.create(string: "Barney")
+ let mStart = Monster.startMonster(&fbb)
+ Monster.add(
+ pos: MyGame_Example_Vec3(
+ x: 10,
+ y: 0,
+ z: 0,
+ test1: 0,
+ test2: .blue,
+ test3: .init()),
+ &fbb)
+ Monster.add(name: name, &fbb)
+ let root = Monster.endMonster(&fbb, start: mStart)
+ fbb.finish(offset: root)
+
+ let newMonster = Monster.getRootAsMonster(bb: fbb.sizedBuffer)
+ XCTAssertEqual(newMonster.pos!.x, 10)
+ XCTAssertEqual(newMonster.name, "Barney")
+ }
+
+ func testArrayOfBools() {
+ let boolArray = [false, true, false, true, false, true, false]
+ var fbb = FlatBufferBuilder(initialSize: 1)
+ let name = fbb.create(string: "Frodo")
+ let bools = fbb.createVector(boolArray)
+ let root = Monster.createMonster(
+ &fbb,
+ nameOffset: name,
+ testarrayofboolsVectorOffset: bools)
+ fbb.finish(offset: root)
+ let monster = Monster.getRootAsMonster(bb: fbb.sizedBuffer)
+
+ let values = monster.testarrayofbools
+
+ XCTAssertEqual(boolArray, values)
+
+ for i in 0..<monster.testarrayofboolsCount {
+ XCTAssertEqual(boolArray[Int(i)], monster.testarrayofbools(at: i))
+ }
+ }
+
+ func readVerifiedMonster(fb: ByteBuffer) {
+ var byteBuffer = fb
+ XCTAssertNoThrow(
+ try readMonster(
+ monster: getCheckedRoot(
+ byteBuffer: &byteBuffer) as MyGame_Example_Monster))
+ }
+
+ func readMonster(monster: Monster) {
+ var monster = monster
+ readFlatbufferMonster(monster: &monster)
+ let unpacked: MyGame_Example_MonsterT? = monster.unpack()
+ readObjectApi(monster: unpacked!)
+ guard let buffer = unpacked?.serialize()
+ else { fatalError("Couldnt generate bytebuffer") }
+ var newMonster = Monster.getRootAsMonster(bb: buffer)
+ readFlatbufferMonster(monster: &newMonster)
+ }
+
+ func createMonster(withPrefix prefix: Bool) -> FlatBufferBuilder {
+ var fbb = FlatBufferBuilder(initialSize: 1)
+ let names = [
+ fbb.create(string: "Frodo"),
+ fbb.create(string: "Barney"),
+ fbb.create(string: "Wilma"),
+ ]
+ var offsets: [Offset] = []
+ let start1 = Monster.startMonster(&fbb)
+ Monster.add(name: names[0], &fbb)
+ offsets.append(Monster.endMonster(&fbb, start: start1))
+ let start2 = Monster.startMonster(&fbb)
+ Monster.add(name: names[1], &fbb)
+ offsets.append(Monster.endMonster(&fbb, start: start2))
+ let start3 = Monster.startMonster(&fbb)
+ Monster.add(name: names[2], &fbb)
+ offsets.append(Monster.endMonster(&fbb, start: start3))
+
+ let sortedArray = Monster.sortVectorOfMonster(offsets: offsets, &fbb)
+
+ let str = fbb.create(string: "MyMonster")
+ let test1 = fbb.create(string: "test1")
+ let test2 = fbb.create(string: "test2")
+ let _inv: [Byte] = [0, 1, 2, 3, 4]
+ let inv = fbb.createVector(_inv)
+
+ let fred = fbb.create(string: "Fred")
+ let mon1Start = Monster.startMonster(&fbb)
+ Monster.add(name: fred, &fbb)
+ let mon2 = Monster.endMonster(&fbb, start: mon1Start)
+
+ let test4 = fbb.createVector(ofStructs: [
+ MyGame_Example_Test(a: 30, b: 40),
+ MyGame_Example_Test(a: 10, b: 20),
+ ])
+
+ let stringTestVector = fbb.createVector(ofOffsets: [test1, test2])
+ let mStart = Monster.startMonster(&fbb)
+ Monster.add(
+ pos: MyGame_Example_Vec3(
+ x: 1,
+ y: 2,
+ z: 3,
+ test1: 3,
+ test2: .green,
+ test3: .init(a: 5, b: 6)),
+ &fbb)
+ Monster.add(hp: 80, &fbb)
+ Monster.add(name: str, &fbb)
+ Monster.addVectorOf(inventory: inv, &fbb)
+ Monster.add(testType: .monster, &fbb)
+ Monster.add(test: mon2, &fbb)
+ Monster.addVectorOf(test4: test4, &fbb)
+ Monster.addVectorOf(testarrayofstring: stringTestVector, &fbb)
+ Monster.add(testbool: true, &fbb)
+ Monster.addVectorOf(testarrayoftables: sortedArray, &fbb)
+ let end = Monster.endMonster(&fbb, start: mStart)
+ Monster.finish(&fbb, end: end, prefix: prefix)
+ return fbb
+ }
+
+ func mutateMonster(fb: ByteBuffer) {
+ let monster = Monster.getRootAsMonster(bb: fb)
+ XCTAssertFalse(monster.mutate(mana: 10))
+ XCTAssertEqual(monster.testarrayoftables(at: 0)?.name, "Barney")
+ XCTAssertEqual(monster.testarrayoftables(at: 1)?.name, "Frodo")
+ XCTAssertEqual(monster.testarrayoftables(at: 2)?.name, "Wilma")
+
+ // Example of searching for a table by the key
+ XCTAssertNotNil(monster.testarrayoftablesBy(key: "Frodo"))
+ XCTAssertNotNil(monster.testarrayoftablesBy(key: "Barney"))
+ XCTAssertNotNil(monster.testarrayoftablesBy(key: "Wilma"))
+
+ XCTAssertEqual(monster.testType, .monster)
+
+ XCTAssertEqual(monster.mutate(inventory: 1, at: 0), true)
+ XCTAssertEqual(monster.mutate(inventory: 2, at: 1), true)
+ XCTAssertEqual(monster.mutate(inventory: 3, at: 2), true)
+ XCTAssertEqual(monster.mutate(inventory: 4, at: 3), true)
+ XCTAssertEqual(monster.mutate(inventory: 5, at: 4), true)
+
+ for i in 0..<monster.inventoryCount {
+ XCTAssertEqual(monster.inventory(at: i), Byte(i + 1))
+ }
+
+ XCTAssertEqual(monster.mutate(inventory: 0, at: 0), true)
+ XCTAssertEqual(monster.mutate(inventory: 1, at: 1), true)
+ XCTAssertEqual(monster.mutate(inventory: 2, at: 2), true)
+ XCTAssertEqual(monster.mutate(inventory: 3, at: 3), true)
+ XCTAssertEqual(monster.mutate(inventory: 4, at: 4), true)
+
+ let vec = monster.mutablePos
+ XCTAssertEqual(vec?.x, 1)
+ XCTAssertTrue(vec?.mutate(x: 55.0) ?? false)
+ XCTAssertTrue(vec?.mutate(test1: 55) ?? false)
+ XCTAssertEqual(vec?.x, 55.0)
+ XCTAssertEqual(vec?.test1, 55.0)
+ XCTAssertTrue(vec?.mutate(x: 1) ?? false)
+ XCTAssertEqual(vec?.x, 1)
+ XCTAssertTrue(vec?.mutate(test1: 3) ?? false)
+ }
+
+ func readFlatbufferMonster(monster: inout MyGame_Example_Monster) {
+ XCTAssertEqual(monster.hp, 80)
+ XCTAssertEqual(monster.mana, 150)
+ XCTAssertEqual(monster.name, "MyMonster")
+ let pos = monster.pos
+ XCTAssertEqual(pos?.x, 1)
+ XCTAssertEqual(pos?.y, 2)
+ XCTAssertEqual(pos?.z, 3)
+ XCTAssertEqual(pos?.test1, 3)
+ XCTAssertEqual(pos?.test2, .green)
+ let test = pos?.test3
+ XCTAssertEqual(test?.a, 5)
+ XCTAssertEqual(test?.b, 6)
+ XCTAssertEqual(monster.testType, .monster)
+ let monster2 = monster.test(type: Monster.self)
+ XCTAssertEqual(monster2?.name, "Fred")
+
+ XCTAssertEqual(monster.mutate(mana: 10), false)
+
+ XCTAssertEqual(monster.mana, 150)
+ XCTAssertEqual(monster.inventoryCount, 5)
+ var sum: Byte = 0
+ for i in 0...monster.inventoryCount {
+ sum += monster.inventory(at: i)
+ }
+ XCTAssertEqual(sum, 10)
+ XCTAssertEqual(monster.test4Count, 2)
+
+ let test0 = monster.test4(at: 0)
+ let test1 = monster.test4(at: 1)
+ var sum0 = 0
+ var sum1 = 0
+ if let a = test0?.a, let b = test0?.b {
+ sum0 = Int(a) + Int(b)
+ }
+ if let a = test1?.a, let b = test1?.b {
+ sum1 = Int(a) + Int(b)
+ }
+ XCTAssertEqual(sum0 + sum1, 100)
+
+ let mutableTest0 = monster.mutableTest4(at: 0)
+ let mutableTest1 = monster.mutableTest4(at: 1)
+ var sum2 = 0
+ var sum3 = 0
+ if let a = mutableTest0?.a, let b = mutableTest0?.b {
+ sum2 = Int(a) + Int(b)
+ }
+ if let a = mutableTest1?.a, let b = mutableTest1?.b {
+ sum3 = Int(a) + Int(b)
+ }
+ XCTAssertEqual(sum2 + sum3, 100)
+
+ XCTAssertEqual(monster.testarrayofstringCount, 2)
+ XCTAssertEqual(monster.testarrayofstring(at: 0), "test1")
+ XCTAssertEqual(monster.testarrayofstring(at: 1), "test2")
+ XCTAssertEqual(monster.testbool, true)
+
+ let array = monster.nameSegmentArray
+ XCTAssertEqual(String(bytes: array ?? [], encoding: .utf8), "MyMonster")
+
+ if 0 == monster.testarrayofboolsCount {
+ XCTAssertEqual(monster.testarrayofbools.isEmpty, true)
+ } else {
+ XCTAssertEqual(monster.testarrayofbools.isEmpty, false)
+ }
+ }
+
+ func readObjectApi(monster: MyGame_Example_MonsterT) {
+ XCTAssertEqual(monster.hp, 80)
+ XCTAssertEqual(monster.mana, 150)
+ XCTAssertEqual(monster.name, "MyMonster")
+ let pos = monster.pos
+ XCTAssertEqual(pos?.x, 1)
+ XCTAssertEqual(pos?.y, 2)
+ XCTAssertEqual(pos?.z, 3)
+ XCTAssertEqual(pos?.test1, 3)
+ XCTAssertEqual(pos?.test2, .green)
+ let test = pos?.test3
+ XCTAssertEqual(test?.a, 5)
+ XCTAssertEqual(test?.b, 6)
+ let monster2 = monster.test?.value as? MyGame_Example_MonsterT
+ XCTAssertEqual(monster2?.name, "Fred")
+ XCTAssertEqual(monster.mana, 150)
+ monster.mana = 10
+ XCTAssertEqual(monster.mana, 10)
+ monster.mana = 150
+ XCTAssertEqual(monster.mana, 150)
+
+ XCTAssertEqual(monster.inventory.count, 5)
+ var sum: Byte = 0
+ for i in monster.inventory {
+ sum += i
+ }
+ XCTAssertEqual(sum, 10)
+ XCTAssertEqual(monster.test4.count, 2)
+ let test0 = monster.test4[0]
+ let test1 = monster.test4[1]
+ var sum0 = 0
+ var sum1 = 0
+ if let a = test0?.a, let b = test0?.b {
+ sum0 = Int(a) + Int(b)
+ }
+ if let a = test1?.a, let b = test1?.b {
+ sum1 = Int(a) + Int(b)
+ }
+ XCTAssertEqual(sum0 + sum1, 100)
+ XCTAssertEqual(monster.testbool, true)
+ }
+
+ var jsonData: String {
+ """
+ {\"hp\":80,\"inventory\":[0,1,2,3,4],\"test\":{\"name\":\"Fred\"},\"testarrayofstring\":[\"test1\",\"test2\"],\"testarrayoftables\":[{\"name\":\"Barney\"},{\"name\":\"Frodo\"},{\"name\":\"Wilma\"}],\"test4\":[{\"a\":30,\"b\":40},{\"a\":10,\"b\":20}],\"testbool\":true,\"test_type\":\"Monster\",\"pos\":{\"y\":2,\"test3\":{\"a\":5,\"b\":6},\"z\":3,\"x\":1,\"test1\":3,\"test2\":\"Green\"},\"name\":\"MyMonster\"}
+ """
+ }
+}
diff --git a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/monster_test_generated.swift b/tests/swift/Wasm.tests/Tests/FlatBuffers.Test.Swift.WasmTests/monster_test_generated.swift
similarity index 94%
rename from tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/monster_test_generated.swift
rename to tests/swift/Wasm.tests/Tests/FlatBuffers.Test.Swift.WasmTests/monster_test_generated.swift
index c8a0502..d37a5bb 100644
--- a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/monster_test_generated.swift
+++ b/tests/swift/Wasm.tests/Tests/FlatBuffers.Test.Swift.WasmTests/monster_test_generated.swift
@@ -237,7 +237,7 @@
}
public struct MyGame_Example_Test: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
private var _a: Int16
private var _b: Int8
@@ -291,7 +291,7 @@
public struct MyGame_Example_Test_Mutable: FlatBufferObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Struct
@@ -318,7 +318,7 @@
public struct MyGame_Example_Vec3: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
private var _x: Float32
private var _y: Float32
@@ -413,7 +413,7 @@
public struct MyGame_Example_Vec3_Mutable: FlatBufferObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Struct
@@ -447,7 +447,7 @@
public struct MyGame_Example_Ability: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
private var _id: UInt32
private var _distance: UInt32
@@ -500,7 +500,7 @@
public struct MyGame_Example_Ability_Mutable: FlatBufferObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Struct
@@ -527,7 +527,7 @@
public struct MyGame_Example_StructOfStructs: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
private var _a: MyGame_Example_Ability
private var _b: MyGame_Example_Test
@@ -587,7 +587,7 @@
public struct MyGame_Example_StructOfStructs_Mutable: FlatBufferObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Struct
@@ -611,13 +611,80 @@
}
}
+public struct MyGame_Example_StructOfStructsOfStructs: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
+
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
+
+ private var _a: MyGame_Example_StructOfStructs
+
+ public init(_ bb: ByteBuffer, o: Int32) {
+ let _accessor = Struct(bb: bb, position: o)
+ _a = MyGame_Example_StructOfStructs(_accessor.bb, o: _accessor.postion + 0)
+ }
+
+ public init(a: MyGame_Example_StructOfStructs) {
+ _a = a
+ }
+
+ public init() {
+ _a = MyGame_Example_StructOfStructs()
+ }
+
+ public init(_ _t: inout MyGame_Example_StructOfStructsOfStructs_Mutable) {
+ var _va = _t.a
+ _a = _va.unpack()
+ }
+
+ public var a: MyGame_Example_StructOfStructs { _a }
+
+ public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable {
+ try verifier.inBuffer(position: position, of: MyGame_Example_StructOfStructsOfStructs.self)
+ }
+}
+
+extension MyGame_Example_StructOfStructsOfStructs: Encodable {
+
+ enum CodingKeys: String, CodingKey {
+ case a = "a"
+ }
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(a, forKey: .a)
+ }
+}
+
+public struct MyGame_Example_StructOfStructsOfStructs_Mutable: FlatBufferObject {
+
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
+ public var __buffer: ByteBuffer! { return _accessor.bb }
+ private var _accessor: Struct
+
+ public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) }
+
+ public var a: MyGame_Example_StructOfStructs_Mutable { return MyGame_Example_StructOfStructs_Mutable(_accessor.bb, o: _accessor.postion + 0) }
+
+
+ public mutating func unpack() -> MyGame_Example_StructOfStructsOfStructs {
+ return MyGame_Example_StructOfStructsOfStructs(&self)
+ }
+ public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_StructOfStructsOfStructs?) -> Offset {
+ guard var obj = obj else { return Offset() }
+ return pack(&builder, obj: &obj)
+ }
+
+ public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_StructOfStructsOfStructs) -> Offset {
+ return builder.create(struct: obj)
+ }
+}
+
public struct MyGame_InParentNamespace: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
+ public static var id: String { "MONS" }
+ public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_InParentNamespace.id, addPrefix: prefix) }
public static func getRootAsInParentNamespace(bb: ByteBuffer) -> MyGame_InParentNamespace { return MyGame_InParentNamespace(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -666,11 +733,12 @@
}
public struct MyGame_Example2_Monster: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
+ public static var id: String { "MONS" }
+ public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example2_Monster.id, addPrefix: prefix) }
public static func getRootAsMonster(bb: ByteBuffer) -> MyGame_Example2_Monster { return MyGame_Example2_Monster(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -719,11 +787,12 @@
}
internal struct MyGame_Example_TestSimpleTableWithEnum: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
internal var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- internal static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
+ internal static var id: String { "MONS" }
+ internal static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example_TestSimpleTableWithEnum.id, addPrefix: prefix) }
internal static func getRootAsTestSimpleTableWithEnum(bb: ByteBuffer) -> MyGame_Example_TestSimpleTableWithEnum { return MyGame_Example_TestSimpleTableWithEnum(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -764,7 +833,7 @@
return MyGame_Example_TestSimpleTableWithEnum.endTestSimpleTableWithEnum(&builder, start: __root)
}
- public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable {
+ internal static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable {
var _v = try verifier.visitTable(at: position)
try _v.visit(field: VTOFFSET.color.p, fieldName: "color", required: false, type: MyGame_Example_Color.self)
_v.finish()
@@ -776,7 +845,7 @@
enum CodingKeys: String, CodingKey {
case color = "color"
}
- public func encode(to encoder: Encoder) throws {
+ internal func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
if color != .green {
try container.encodeIfPresent(color, forKey: .color)
@@ -801,11 +870,12 @@
}
public struct MyGame_Example_Stat: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
+ public static var id: String { "MONS" }
+ public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example_Stat.id, addPrefix: prefix) }
public static func getRootAsStat(bb: ByteBuffer) -> MyGame_Example_Stat { return MyGame_Example_Stat(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -941,11 +1011,12 @@
}
public struct MyGame_Example_Referrable: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
+ public static var id: String { "MONS" }
+ public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example_Referrable.id, addPrefix: prefix) }
public static func getRootAsReferrable(bb: ByteBuffer) -> MyGame_Example_Referrable { return MyGame_Example_Referrable(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -1048,11 +1119,12 @@
/// an example documentation comment: "monster object"
public struct MyGame_Example_Monster: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
+ public static var id: String { "MONS" }
+ public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example_Monster.id, addPrefix: prefix) }
public static func getRootAsMonster(bb: ByteBuffer) -> MyGame_Example_Monster { return MyGame_Example_Monster(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -1124,6 +1196,7 @@
@discardableResult public func mutate(hp: Int16) -> Bool {let o = _accessor.offset(VTOFFSET.hp.v); return _accessor.mutate(hp, index: o) }
public var name: String! { let o = _accessor.offset(VTOFFSET.name.v); return _accessor.string(at: o) }
public var nameSegmentArray: [UInt8]! { return _accessor.getVector(at: VTOFFSET.name.v) }
+ public var hasInventory: Bool { let o = _accessor.offset(VTOFFSET.inventory.v); return o == 0 ? false : true }
public var inventoryCount: Int32 { let o = _accessor.offset(VTOFFSET.inventory.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func inventory(at index: Int32) -> UInt8 { let o = _accessor.offset(VTOFFSET.inventory.v); return o == 0 ? 0 : _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1) }
public var inventory: [UInt8] { return _accessor.getVector(at: VTOFFSET.inventory.v) ?? [] }
@@ -1132,17 +1205,21 @@
@discardableResult public func mutate(color: MyGame_Example_Color) -> Bool {let o = _accessor.offset(VTOFFSET.color.v); return _accessor.mutate(color.rawValue, index: o) }
public var testType: MyGame_Example_Any_ { let o = _accessor.offset(VTOFFSET.testType.v); return o == 0 ? .none_ : MyGame_Example_Any_(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none_ }
public func test<T: FlatbuffersInitializable>(type: T.Type) -> T? { let o = _accessor.offset(VTOFFSET.test.v); return o == 0 ? nil : _accessor.union(o) }
+ public var hasTest4: Bool { let o = _accessor.offset(VTOFFSET.test4.v); return o == 0 ? false : true }
public var test4Count: Int32 { let o = _accessor.offset(VTOFFSET.test4.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func test4(at index: Int32) -> MyGame_Example_Test? { let o = _accessor.offset(VTOFFSET.test4.v); return o == 0 ? nil : _accessor.directRead(of: MyGame_Example_Test.self, offset: _accessor.vector(at: o) + index * 4) }
public func mutableTest4(at index: Int32) -> MyGame_Example_Test_Mutable? { let o = _accessor.offset(VTOFFSET.test4.v); return o == 0 ? nil : MyGame_Example_Test_Mutable(_accessor.bb, o: _accessor.vector(at: o) + index * 4) }
+ public var hasTestarrayofstring: Bool { let o = _accessor.offset(VTOFFSET.testarrayofstring.v); return o == 0 ? false : true }
public var testarrayofstringCount: Int32 { let o = _accessor.offset(VTOFFSET.testarrayofstring.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func testarrayofstring(at index: Int32) -> String? { let o = _accessor.offset(VTOFFSET.testarrayofstring.v); return o == 0 ? nil : _accessor.directString(at: _accessor.vector(at: o) + index * 4) }
/// an example documentation comment: this will end up in the generated code
/// multiline too
+ public var hasTestarrayoftables: Bool { let o = _accessor.offset(VTOFFSET.testarrayoftables.v); return o == 0 ? false : true }
public var testarrayoftablesCount: Int32 { let o = _accessor.offset(VTOFFSET.testarrayoftables.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func testarrayoftables(at index: Int32) -> MyGame_Example_Monster? { let o = _accessor.offset(VTOFFSET.testarrayoftables.v); return o == 0 ? nil : MyGame_Example_Monster(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) }
public func testarrayoftablesBy(key: String) -> MyGame_Example_Monster? { let o = _accessor.offset(VTOFFSET.testarrayoftables.v); return o == 0 ? nil : MyGame_Example_Monster.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) }
public var enemy: MyGame_Example_Monster? { let o = _accessor.offset(VTOFFSET.enemy.v); return o == 0 ? nil : MyGame_Example_Monster(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) }
+ public var hasTestnestedflatbuffer: Bool { let o = _accessor.offset(VTOFFSET.testnestedflatbuffer.v); return o == 0 ? false : true }
public var testnestedflatbufferCount: Int32 { let o = _accessor.offset(VTOFFSET.testnestedflatbuffer.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func testnestedflatbuffer(at index: Int32) -> UInt8 { let o = _accessor.offset(VTOFFSET.testnestedflatbuffer.v); return o == 0 ? 0 : _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1) }
public var testnestedflatbuffer: [UInt8] { return _accessor.getVector(at: VTOFFSET.testnestedflatbuffer.v) ?? [] }
@@ -1166,6 +1243,7 @@
@discardableResult public func mutate(testhashs64Fnv1a: Int64) -> Bool {let o = _accessor.offset(VTOFFSET.testhashs64Fnv1a.v); return _accessor.mutate(testhashs64Fnv1a, index: o) }
public var testhashu64Fnv1a: UInt64 { let o = _accessor.offset(VTOFFSET.testhashu64Fnv1a.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
@discardableResult public func mutate(testhashu64Fnv1a: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.testhashu64Fnv1a.v); return _accessor.mutate(testhashu64Fnv1a, index: o) }
+ public var hasTestarrayofbools: Bool { let o = _accessor.offset(VTOFFSET.testarrayofbools.v); return o == 0 ? false : true }
public var testarrayofboolsCount: Int32 { let o = _accessor.offset(VTOFFSET.testarrayofbools.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func testarrayofbools(at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.testarrayofbools.v); return o == 0 ? true : _accessor.directRead(of: Bool.self, offset: _accessor.vector(at: o) + index * 1) }
public var testarrayofbools: [Bool] { return _accessor.getVector(at: VTOFFSET.testarrayofbools.v) ?? [] }
@@ -1176,47 +1254,58 @@
@discardableResult public func mutate(testf2: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.testf2.v); return _accessor.mutate(testf2, index: o) }
public var testf3: Float32 { let o = _accessor.offset(VTOFFSET.testf3.v); return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o) }
@discardableResult public func mutate(testf3: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.testf3.v); return _accessor.mutate(testf3, index: o) }
+ public var hasTestarrayofstring2: Bool { let o = _accessor.offset(VTOFFSET.testarrayofstring2.v); return o == 0 ? false : true }
public var testarrayofstring2Count: Int32 { let o = _accessor.offset(VTOFFSET.testarrayofstring2.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func testarrayofstring2(at index: Int32) -> String? { let o = _accessor.offset(VTOFFSET.testarrayofstring2.v); return o == 0 ? nil : _accessor.directString(at: _accessor.vector(at: o) + index * 4) }
+ public var hasTestarrayofsortedstruct: Bool { let o = _accessor.offset(VTOFFSET.testarrayofsortedstruct.v); return o == 0 ? false : true }
public var testarrayofsortedstructCount: Int32 { let o = _accessor.offset(VTOFFSET.testarrayofsortedstruct.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func testarrayofsortedstruct(at index: Int32) -> MyGame_Example_Ability? { let o = _accessor.offset(VTOFFSET.testarrayofsortedstruct.v); return o == 0 ? nil : _accessor.directRead(of: MyGame_Example_Ability.self, offset: _accessor.vector(at: o) + index * 8) }
public func mutableTestarrayofsortedstruct(at index: Int32) -> MyGame_Example_Ability_Mutable? { let o = _accessor.offset(VTOFFSET.testarrayofsortedstruct.v); return o == 0 ? nil : MyGame_Example_Ability_Mutable(_accessor.bb, o: _accessor.vector(at: o) + index * 8) }
+ public var hasFlex: Bool { let o = _accessor.offset(VTOFFSET.flex.v); return o == 0 ? false : true }
public var flexCount: Int32 { let o = _accessor.offset(VTOFFSET.flex.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func flex(at index: Int32) -> UInt8 { let o = _accessor.offset(VTOFFSET.flex.v); return o == 0 ? 0 : _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1) }
public var flex: [UInt8] { return _accessor.getVector(at: VTOFFSET.flex.v) ?? [] }
public func mutate(flex: UInt8, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.flex.v); return _accessor.directMutate(flex, index: _accessor.vector(at: o) + index * 1) }
+ public var hasTest5: Bool { let o = _accessor.offset(VTOFFSET.test5.v); return o == 0 ? false : true }
public var test5Count: Int32 { let o = _accessor.offset(VTOFFSET.test5.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func test5(at index: Int32) -> MyGame_Example_Test? { let o = _accessor.offset(VTOFFSET.test5.v); return o == 0 ? nil : _accessor.directRead(of: MyGame_Example_Test.self, offset: _accessor.vector(at: o) + index * 4) }
public func mutableTest5(at index: Int32) -> MyGame_Example_Test_Mutable? { let o = _accessor.offset(VTOFFSET.test5.v); return o == 0 ? nil : MyGame_Example_Test_Mutable(_accessor.bb, o: _accessor.vector(at: o) + index * 4) }
+ public var hasVectorOfLongs: Bool { let o = _accessor.offset(VTOFFSET.vectorOfLongs.v); return o == 0 ? false : true }
public var vectorOfLongsCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfLongs.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vectorOfLongs(at index: Int32) -> Int64 { let o = _accessor.offset(VTOFFSET.vectorOfLongs.v); return o == 0 ? 0 : _accessor.directRead(of: Int64.self, offset: _accessor.vector(at: o) + index * 8) }
public var vectorOfLongs: [Int64] { return _accessor.getVector(at: VTOFFSET.vectorOfLongs.v) ?? [] }
public func mutate(vectorOfLongs: Int64, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.vectorOfLongs.v); return _accessor.directMutate(vectorOfLongs, index: _accessor.vector(at: o) + index * 8) }
+ public var hasVectorOfDoubles: Bool { let o = _accessor.offset(VTOFFSET.vectorOfDoubles.v); return o == 0 ? false : true }
public var vectorOfDoublesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfDoubles.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vectorOfDoubles(at index: Int32) -> Double { let o = _accessor.offset(VTOFFSET.vectorOfDoubles.v); return o == 0 ? 0 : _accessor.directRead(of: Double.self, offset: _accessor.vector(at: o) + index * 8) }
public var vectorOfDoubles: [Double] { return _accessor.getVector(at: VTOFFSET.vectorOfDoubles.v) ?? [] }
public func mutate(vectorOfDoubles: Double, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.vectorOfDoubles.v); return _accessor.directMutate(vectorOfDoubles, index: _accessor.vector(at: o) + index * 8) }
public var parentNamespaceTest: MyGame_InParentNamespace? { let o = _accessor.offset(VTOFFSET.parentNamespaceTest.v); return o == 0 ? nil : MyGame_InParentNamespace(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) }
+ public var hasVectorOfReferrables: Bool { let o = _accessor.offset(VTOFFSET.vectorOfReferrables.v); return o == 0 ? false : true }
public var vectorOfReferrablesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfReferrables.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vectorOfReferrables(at index: Int32) -> MyGame_Example_Referrable? { let o = _accessor.offset(VTOFFSET.vectorOfReferrables.v); return o == 0 ? nil : MyGame_Example_Referrable(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) }
public func vectorOfReferrablesBy(key: UInt64) -> MyGame_Example_Referrable? { let o = _accessor.offset(VTOFFSET.vectorOfReferrables.v); return o == 0 ? nil : MyGame_Example_Referrable.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) }
public var singleWeakReference: UInt64 { let o = _accessor.offset(VTOFFSET.singleWeakReference.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
@discardableResult public func mutate(singleWeakReference: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.singleWeakReference.v); return _accessor.mutate(singleWeakReference, index: o) }
+ public var hasVectorOfWeakReferences: Bool { let o = _accessor.offset(VTOFFSET.vectorOfWeakReferences.v); return o == 0 ? false : true }
public var vectorOfWeakReferencesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfWeakReferences.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vectorOfWeakReferences(at index: Int32) -> UInt64 { let o = _accessor.offset(VTOFFSET.vectorOfWeakReferences.v); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) }
public var vectorOfWeakReferences: [UInt64] { return _accessor.getVector(at: VTOFFSET.vectorOfWeakReferences.v) ?? [] }
public func mutate(vectorOfWeakReferences: UInt64, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.vectorOfWeakReferences.v); return _accessor.directMutate(vectorOfWeakReferences, index: _accessor.vector(at: o) + index * 8) }
+ public var hasVectorOfStrongReferrables: Bool { let o = _accessor.offset(VTOFFSET.vectorOfStrongReferrables.v); return o == 0 ? false : true }
public var vectorOfStrongReferrablesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfStrongReferrables.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vectorOfStrongReferrables(at index: Int32) -> MyGame_Example_Referrable? { let o = _accessor.offset(VTOFFSET.vectorOfStrongReferrables.v); return o == 0 ? nil : MyGame_Example_Referrable(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) }
public func vectorOfStrongReferrablesBy(key: UInt64) -> MyGame_Example_Referrable? { let o = _accessor.offset(VTOFFSET.vectorOfStrongReferrables.v); return o == 0 ? nil : MyGame_Example_Referrable.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) }
public var coOwningReference: UInt64 { let o = _accessor.offset(VTOFFSET.coOwningReference.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
@discardableResult public func mutate(coOwningReference: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.coOwningReference.v); return _accessor.mutate(coOwningReference, index: o) }
+ public var hasVectorOfCoOwningReferences: Bool { let o = _accessor.offset(VTOFFSET.vectorOfCoOwningReferences.v); return o == 0 ? false : true }
public var vectorOfCoOwningReferencesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfCoOwningReferences.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vectorOfCoOwningReferences(at index: Int32) -> UInt64 { let o = _accessor.offset(VTOFFSET.vectorOfCoOwningReferences.v); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) }
public var vectorOfCoOwningReferences: [UInt64] { return _accessor.getVector(at: VTOFFSET.vectorOfCoOwningReferences.v) ?? [] }
public func mutate(vectorOfCoOwningReferences: UInt64, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.vectorOfCoOwningReferences.v); return _accessor.directMutate(vectorOfCoOwningReferences, index: _accessor.vector(at: o) + index * 8) }
public var nonOwningReference: UInt64 { let o = _accessor.offset(VTOFFSET.nonOwningReference.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
@discardableResult public func mutate(nonOwningReference: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.nonOwningReference.v); return _accessor.mutate(nonOwningReference, index: o) }
+ public var hasVectorOfNonOwningReferences: Bool { let o = _accessor.offset(VTOFFSET.vectorOfNonOwningReferences.v); return o == 0 ? false : true }
public var vectorOfNonOwningReferencesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfNonOwningReferences.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vectorOfNonOwningReferences(at index: Int32) -> UInt64 { let o = _accessor.offset(VTOFFSET.vectorOfNonOwningReferences.v); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) }
public var vectorOfNonOwningReferences: [UInt64] { return _accessor.getVector(at: VTOFFSET.vectorOfNonOwningReferences.v) ?? [] }
@@ -1225,14 +1314,17 @@
public func anyUnique<T: FlatbuffersInitializable>(type: T.Type) -> T? { let o = _accessor.offset(VTOFFSET.anyUnique.v); return o == 0 ? nil : _accessor.union(o) }
public var anyAmbiguousType: MyGame_Example_AnyAmbiguousAliases { let o = _accessor.offset(VTOFFSET.anyAmbiguousType.v); return o == 0 ? .none_ : MyGame_Example_AnyAmbiguousAliases(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none_ }
public func anyAmbiguous<T: FlatbuffersInitializable>(type: T.Type) -> T? { let o = _accessor.offset(VTOFFSET.anyAmbiguous.v); return o == 0 ? nil : _accessor.union(o) }
+ public var hasVectorOfEnums: Bool { let o = _accessor.offset(VTOFFSET.vectorOfEnums.v); return o == 0 ? false : true }
public var vectorOfEnumsCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfEnums.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vectorOfEnums(at index: Int32) -> MyGame_Example_Color? { let o = _accessor.offset(VTOFFSET.vectorOfEnums.v); return o == 0 ? MyGame_Example_Color.red : MyGame_Example_Color(rawValue: _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1)) }
public var signedEnum: MyGame_Example_Race { let o = _accessor.offset(VTOFFSET.signedEnum.v); return o == 0 ? .none_ : MyGame_Example_Race(rawValue: _accessor.readBuffer(of: Int8.self, at: o)) ?? .none_ }
@discardableResult public func mutate(signedEnum: MyGame_Example_Race) -> Bool {let o = _accessor.offset(VTOFFSET.signedEnum.v); return _accessor.mutate(signedEnum.rawValue, index: o) }
+ public var hasTestrequirednestedflatbuffer: Bool { let o = _accessor.offset(VTOFFSET.testrequirednestedflatbuffer.v); return o == 0 ? false : true }
public var testrequirednestedflatbufferCount: Int32 { let o = _accessor.offset(VTOFFSET.testrequirednestedflatbuffer.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func testrequirednestedflatbuffer(at index: Int32) -> UInt8 { let o = _accessor.offset(VTOFFSET.testrequirednestedflatbuffer.v); return o == 0 ? 0 : _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1) }
public var testrequirednestedflatbuffer: [UInt8] { return _accessor.getVector(at: VTOFFSET.testrequirednestedflatbuffer.v) ?? [] }
public func mutate(testrequirednestedflatbuffer: UInt8, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.testrequirednestedflatbuffer.v); return _accessor.directMutate(testrequirednestedflatbuffer, index: _accessor.vector(at: o) + index * 1) }
+ public var hasScalarKeySortedTables: Bool { let o = _accessor.offset(VTOFFSET.scalarKeySortedTables.v); return o == 0 ? false : true }
public var scalarKeySortedTablesCount: Int32 { let o = _accessor.offset(VTOFFSET.scalarKeySortedTables.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func scalarKeySortedTables(at index: Int32) -> MyGame_Example_Stat? { let o = _accessor.offset(VTOFFSET.scalarKeySortedTables.v); return o == 0 ? nil : MyGame_Example_Stat(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) }
public func scalarKeySortedTablesBy(key: UInt16) -> MyGame_Example_Stat? { let o = _accessor.offset(VTOFFSET.scalarKeySortedTables.v); return o == 0 ? nil : MyGame_Example_Stat.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) }
@@ -1312,7 +1404,7 @@
pos: MyGame_Example_Vec3? = nil,
mana: Int16 = 150,
hp: Int16 = 100,
- nameOffset name: Offset = Offset(),
+ nameOffset name: Offset,
inventoryVectorOffset inventory: Offset = Offset(),
color: MyGame_Example_Color = .blue,
testType: MyGame_Example_Any_ = .none_,
@@ -2205,11 +2297,12 @@
}
public struct MyGame_Example_TypeAliases: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
+ public static var id: String { "MONS" }
+ public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example_TypeAliases.id, addPrefix: prefix) }
public static func getRootAsTypeAliases(bb: ByteBuffer) -> MyGame_Example_TypeAliases { return MyGame_Example_TypeAliases(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -2252,10 +2345,12 @@
@discardableResult public func mutate(f32: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.f32.v); return _accessor.mutate(f32, index: o) }
public var f64: Double { let o = _accessor.offset(VTOFFSET.f64.v); return o == 0 ? 0.0 : _accessor.readBuffer(of: Double.self, at: o) }
@discardableResult public func mutate(f64: Double) -> Bool {let o = _accessor.offset(VTOFFSET.f64.v); return _accessor.mutate(f64, index: o) }
+ public var hasV8: Bool { let o = _accessor.offset(VTOFFSET.v8.v); return o == 0 ? false : true }
public var v8Count: Int32 { let o = _accessor.offset(VTOFFSET.v8.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func v8(at index: Int32) -> Int8 { let o = _accessor.offset(VTOFFSET.v8.v); return o == 0 ? 0 : _accessor.directRead(of: Int8.self, offset: _accessor.vector(at: o) + index * 1) }
public var v8: [Int8] { return _accessor.getVector(at: VTOFFSET.v8.v) ?? [] }
public func mutate(v8: Int8, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.v8.v); return _accessor.directMutate(v8, index: _accessor.vector(at: o) + index * 1) }
+ public var hasVf64: Bool { let o = _accessor.offset(VTOFFSET.vf64.v); return o == 0 ? false : true }
public var vf64Count: Int32 { let o = _accessor.offset(VTOFFSET.vf64.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vf64(at index: Int32) -> Double { let o = _accessor.offset(VTOFFSET.vf64.v); return o == 0 ? 0 : _accessor.directRead(of: Double.self, offset: _accessor.vector(at: o) + index * 8) }
public var vf64: [Double] { return _accessor.getVector(at: VTOFFSET.vf64.v) ?? [] }
diff --git a/tests/FlatBuffers.Benchmarks.swift/Package.swift b/tests/swift/benchmarks/Package.swift
similarity index 73%
copy from tests/FlatBuffers.Benchmarks.swift/Package.swift
copy to tests/swift/benchmarks/Package.swift
index 2026247..d711493 100644
--- a/tests/FlatBuffers.Benchmarks.swift/Package.swift
+++ b/tests/swift/benchmarks/Package.swift
@@ -18,15 +18,17 @@
import PackageDescription
let package = Package(
- name: "FlatBuffers.Benchmarks.swift",
+ name: "benchmarks",
platforms: [
.macOS(.v10_14),
],
dependencies: [
- .package(path: "../../swift"),
+ .package(path: "../../../swift"),
+ .package(url: "https://github.com/google/swift-benchmark", from: "0.1.0"),
],
targets: [
.target(
- name: "FlatBuffers.Benchmarks.swift",
- dependencies: ["FlatBuffers"]),
+ name: "benchmarks",
+ dependencies: ["FlatBuffers",
+ .product(name: "Benchmark", package: "swift-benchmark")]),
])
diff --git a/tests/swift/benchmarks/Sources/benchmarks/main.swift b/tests/swift/benchmarks/Sources/benchmarks/main.swift
new file mode 100644
index 0000000..a25a646
--- /dev/null
+++ b/tests/swift/benchmarks/Sources/benchmarks/main.swift
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2021 Google Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Benchmark
+import CoreFoundation
+import FlatBuffers
+
+benchmark("10Strings") {
+ var fb = FlatBufferBuilder(initialSize: 1<<20)
+ for _ in 0..<1_000_000 {
+ _ = fb.create(string: "foobarbaz")
+ }
+}
+
+benchmark("100Strings") {
+ var fb = FlatBufferBuilder(initialSize: 1<<20)
+ for _ in 0..<1_000_000 {
+ _ = fb.create(string: str)
+ }
+}
+
+benchmark("FlatBufferBuilder.add") {
+ var fb = FlatBufferBuilder(initialSize: 1024 * 1024 * 32)
+ for _ in 0..<1_000_000 {
+ let off = fb.create(string: "T")
+ let s = fb.startTable(with: 4)
+ fb.add(element: 3.2, def: 0, at: 2)
+ fb.add(element: 4.2, def: 0, at: 4)
+ fb.add(element: 5.2, def: 0, at: 6)
+ fb.add(offset: off, at: 8)
+ _ = fb.endTable(at: s)
+ }
+}
+
+benchmark("structs") {
+ let structCount = 1_000_000
+
+ let rawSize = ((16 * 5) * structCount) / 1024
+
+ var fb = FlatBufferBuilder(initialSize: Int32(rawSize * 1600))
+
+ var offsets: [Offset] = []
+ for _ in 0..<structCount {
+ fb.startVector(
+ 5 * MemoryLayout<AA>.size,
+ elementSize: MemoryLayout<AA>.alignment)
+ for _ in 0..<5 {
+ _ = fb.create(struct: AA(a: 2.4, b: 2.4))
+ }
+ let vector = fb.endVector(len: 5)
+ let start = fb.startTable(with: 1)
+ fb.add(offset: vector, at: 4)
+ offsets.append(Offset(offset: fb.endTable(at: start)))
+ }
+ let vector = fb.createVector(ofOffsets: offsets)
+ let start = fb.startTable(with: 1)
+ fb.add(offset: vector, at: 4)
+ let root = Offset(offset: fb.endTable(at: start))
+ fb.finish(offset: root)
+}
+
+let str = (0...99).map { _ -> String in "x" }.joined()
+
+@usableFromInline
+struct AA: NativeStruct {
+ public init(a: Double, b: Double) {
+ self.a = a
+ self.b = b
+ }
+ var a: Double
+ var b: Double
+}
+
+Benchmark.main()
diff --git a/tests/swift/tests/CodeGenerationTests/test_import.fbs b/tests/swift/tests/CodeGenerationTests/test_import.fbs
new file mode 100644
index 0000000..0a43956
--- /dev/null
+++ b/tests/swift/tests/CodeGenerationTests/test_import.fbs
@@ -0,0 +1,3 @@
+table Message {
+ internal_message: string;
+}
\ No newline at end of file
diff --git a/tests/swift/tests/CodeGenerationTests/test_import_generated.swift b/tests/swift/tests/CodeGenerationTests/test_import_generated.swift
new file mode 100644
index 0000000..4e160ca
--- /dev/null
+++ b/tests/swift/tests/CodeGenerationTests/test_import_generated.swift
@@ -0,0 +1,91 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+// swiftlint:disable all
+// swiftformat:disable all
+
+@_implementationOnly import FlatBuffers
+
+internal struct Message: FlatBufferObject, Verifiable, ObjectAPIPacker {
+
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
+ internal var __buffer: ByteBuffer! { return _accessor.bb }
+ private var _accessor: Table
+
+ internal static func getRootAsMessage(bb: ByteBuffer) -> Message { return Message(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
+
+ private init(_ t: Table) { _accessor = t }
+ internal init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
+
+ private enum VTOFFSET: VOffset {
+ case internalMessage = 4
+ var v: Int32 { Int32(self.rawValue) }
+ var p: VOffset { self.rawValue }
+ }
+
+ internal var internalMessage: String? { let o = _accessor.offset(VTOFFSET.internalMessage.v); return o == 0 ? nil : _accessor.string(at: o) }
+ internal var internalMessageSegmentArray: [UInt8]? { return _accessor.getVector(at: VTOFFSET.internalMessage.v) }
+ internal static func startMessage(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 1) }
+ internal static func add(internalMessage: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: internalMessage, at: VTOFFSET.internalMessage.p) }
+ internal static func endMessage(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end }
+ internal static func createMessage(
+ _ fbb: inout FlatBufferBuilder,
+ internalMessageOffset internalMessage: Offset = Offset()
+ ) -> Offset {
+ let __start = Message.startMessage(&fbb)
+ Message.add(internalMessage: internalMessage, &fbb)
+ return Message.endMessage(&fbb, start: __start)
+ }
+
+
+ internal mutating func unpack() -> MessageT {
+ return MessageT(&self)
+ }
+ internal static func pack(_ builder: inout FlatBufferBuilder, obj: inout MessageT?) -> Offset {
+ guard var obj = obj else { return Offset() }
+ return pack(&builder, obj: &obj)
+ }
+
+ internal static func pack(_ builder: inout FlatBufferBuilder, obj: inout MessageT) -> Offset {
+ let __internalMessage: Offset
+ if let s = obj.internalMessage {
+ __internalMessage = builder.create(string: s)
+ } else {
+ __internalMessage = Offset()
+ }
+
+ let __root = Message.startMessage(&builder)
+ Message.add(internalMessage: __internalMessage, &builder)
+ return Message.endMessage(&builder, start: __root)
+ }
+
+ internal static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable {
+ var _v = try verifier.visitTable(at: position)
+ try _v.visit(field: VTOFFSET.internalMessage.p, fieldName: "internalMessage", required: false, type: ForwardOffset<String>.self)
+ _v.finish()
+ }
+}
+
+extension Message: Encodable {
+
+ enum CodingKeys: String, CodingKey {
+ case internalMessage = "internal_message"
+ }
+ internal func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(internalMessage, forKey: .internalMessage)
+ }
+}
+
+internal class MessageT: NativeObject {
+
+ internal var internalMessage: String?
+
+ internal init(_ _t: inout Message) {
+ internalMessage = _t.internalMessage
+ }
+
+ internal init() {
+ }
+
+ internal func serialize() -> ByteBuffer { return serialize(type: Message.self) }
+
+}
diff --git a/tests/swift/tests/CodeGenerationTests/test_no_include.fbs b/tests/swift/tests/CodeGenerationTests/test_no_include.fbs
new file mode 100644
index 0000000..2f95468
--- /dev/null
+++ b/tests/swift/tests/CodeGenerationTests/test_no_include.fbs
@@ -0,0 +1,13 @@
+struct BytesCount {
+ x: int64;
+}
+
+table InternalMessage {
+ str: string;
+}
+
+table Message {
+ id: int64;
+ position: BytesCount (required);
+ pointer: InternalMessage (required);
+}
\ No newline at end of file
diff --git a/tests/swift/tests/CodeGenerationTests/test_no_include_generated.swift b/tests/swift/tests/CodeGenerationTests/test_no_include_generated.swift
new file mode 100644
index 0000000..3348b05
--- /dev/null
+++ b/tests/swift/tests/CodeGenerationTests/test_no_include_generated.swift
@@ -0,0 +1,265 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+// swiftlint:disable all
+// swiftformat:disable all
+
+public struct BytesCount: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
+
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
+
+ private var _x: Int64
+
+ public init(_ bb: ByteBuffer, o: Int32) {
+ let _accessor = Struct(bb: bb, position: o)
+ _x = _accessor.readBuffer(of: Int64.self, at: 0)
+ }
+
+ public init(x: Int64) {
+ _x = x
+ }
+
+ public init() {
+ _x = 0
+ }
+
+ public init(_ _t: inout BytesCount_Mutable) {
+ _x = _t.x
+ }
+
+ public var x: Int64 { _x }
+
+ public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable {
+ try verifier.inBuffer(position: position, of: BytesCount.self)
+ }
+}
+
+extension BytesCount: Encodable {
+
+ enum CodingKeys: String, CodingKey {
+ case x = "x"
+ }
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ if x != 0 {
+ try container.encodeIfPresent(x, forKey: .x)
+ }
+ }
+}
+
+public struct BytesCount_Mutable: FlatBufferObject {
+
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
+ public var __buffer: ByteBuffer! { return _accessor.bb }
+ private var _accessor: Struct
+
+ public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) }
+
+ public var x: Int64 { return _accessor.readBuffer(of: Int64.self, at: 0) }
+ @discardableResult public func mutate(x: Int64) -> Bool { return _accessor.mutate(x, index: 0) }
+
+
+ public mutating func unpack() -> BytesCount {
+ return BytesCount(&self)
+ }
+ public static func pack(_ builder: inout FlatBufferBuilder, obj: inout BytesCount?) -> Offset {
+ guard var obj = obj else { return Offset() }
+ return pack(&builder, obj: &obj)
+ }
+
+ public static func pack(_ builder: inout FlatBufferBuilder, obj: inout BytesCount) -> Offset {
+ return builder.create(struct: obj)
+ }
+}
+
+public struct InternalMessage: FlatBufferObject, Verifiable, ObjectAPIPacker {
+
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
+ public var __buffer: ByteBuffer! { return _accessor.bb }
+ private var _accessor: Table
+
+ public static func getRootAsInternalMessage(bb: ByteBuffer) -> InternalMessage { return InternalMessage(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
+
+ private init(_ t: Table) { _accessor = t }
+ public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
+
+ private enum VTOFFSET: VOffset {
+ case str = 4
+ var v: Int32 { Int32(self.rawValue) }
+ var p: VOffset { self.rawValue }
+ }
+
+ public var str: String? { let o = _accessor.offset(VTOFFSET.str.v); return o == 0 ? nil : _accessor.string(at: o) }
+ public var strSegmentArray: [UInt8]? { return _accessor.getVector(at: VTOFFSET.str.v) }
+ public static func startInternalMessage(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 1) }
+ public static func add(str: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: str, at: VTOFFSET.str.p) }
+ public static func endInternalMessage(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end }
+ public static func createInternalMessage(
+ _ fbb: inout FlatBufferBuilder,
+ strOffset str: Offset = Offset()
+ ) -> Offset {
+ let __start = InternalMessage.startInternalMessage(&fbb)
+ InternalMessage.add(str: str, &fbb)
+ return InternalMessage.endInternalMessage(&fbb, start: __start)
+ }
+
+
+ public mutating func unpack() -> InternalMessageT {
+ return InternalMessageT(&self)
+ }
+ public static func pack(_ builder: inout FlatBufferBuilder, obj: inout InternalMessageT?) -> Offset {
+ guard var obj = obj else { return Offset() }
+ return pack(&builder, obj: &obj)
+ }
+
+ public static func pack(_ builder: inout FlatBufferBuilder, obj: inout InternalMessageT) -> Offset {
+ let __str: Offset
+ if let s = obj.str {
+ __str = builder.create(string: s)
+ } else {
+ __str = Offset()
+ }
+
+ let __root = InternalMessage.startInternalMessage(&builder)
+ InternalMessage.add(str: __str, &builder)
+ return InternalMessage.endInternalMessage(&builder, start: __root)
+ }
+
+ public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable {
+ var _v = try verifier.visitTable(at: position)
+ try _v.visit(field: VTOFFSET.str.p, fieldName: "str", required: false, type: ForwardOffset<String>.self)
+ _v.finish()
+ }
+}
+
+extension InternalMessage: Encodable {
+
+ enum CodingKeys: String, CodingKey {
+ case str = "str"
+ }
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(str, forKey: .str)
+ }
+}
+
+public class InternalMessageT: NativeObject {
+
+ public var str: String?
+
+ public init(_ _t: inout InternalMessage) {
+ str = _t.str
+ }
+
+ public init() {
+ }
+
+ public func serialize() -> ByteBuffer { return serialize(type: InternalMessage.self) }
+
+}
+public struct Message: FlatBufferObject, Verifiable, ObjectAPIPacker {
+
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
+ public var __buffer: ByteBuffer! { return _accessor.bb }
+ private var _accessor: Table
+
+ public static func getRootAsMessage(bb: ByteBuffer) -> Message { return Message(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
+
+ private init(_ t: Table) { _accessor = t }
+ public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
+
+ private enum VTOFFSET: VOffset {
+ case id = 4
+ case position = 6
+ case pointer = 8
+ var v: Int32 { Int32(self.rawValue) }
+ var p: VOffset { self.rawValue }
+ }
+
+ public var id: Int64 { let o = _accessor.offset(VTOFFSET.id.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int64.self, at: o) }
+ @discardableResult public func mutate(id: Int64) -> Bool {let o = _accessor.offset(VTOFFSET.id.v); return _accessor.mutate(id, index: o) }
+ public var position: BytesCount! { let o = _accessor.offset(VTOFFSET.position.v); return _accessor.readBuffer(of: BytesCount.self, at: o) }
+ public var mutablePosition: BytesCount_Mutable! { let o = _accessor.offset(VTOFFSET.position.v); return BytesCount_Mutable(_accessor.bb, o: o + _accessor.postion) }
+ public var pointer: InternalMessage! { let o = _accessor.offset(VTOFFSET.pointer.v); return InternalMessage(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) }
+ public static func startMessage(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 3) }
+ public static func add(id: Int64, _ fbb: inout FlatBufferBuilder) { fbb.add(element: id, def: 0, at: VTOFFSET.id.p) }
+ public static func add(position: BytesCount?, _ fbb: inout FlatBufferBuilder) { guard let position = position else { return }; fbb.create(struct: position, position: VTOFFSET.position.p) }
+ public static func add(pointer: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: pointer, at: VTOFFSET.pointer.p) }
+ public static func endMessage(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); fbb.require(table: end, fields: [6, 8]); return end }
+ public static func createMessage(
+ _ fbb: inout FlatBufferBuilder,
+ id: Int64 = 0,
+ position: BytesCount,
+ pointerOffset pointer: Offset
+ ) -> Offset {
+ let __start = Message.startMessage(&fbb)
+ Message.add(id: id, &fbb)
+ Message.add(position: position, &fbb)
+ Message.add(pointer: pointer, &fbb)
+ return Message.endMessage(&fbb, start: __start)
+ }
+
+
+ public mutating func unpack() -> MessageT {
+ return MessageT(&self)
+ }
+ public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MessageT?) -> Offset {
+ guard var obj = obj else { return Offset() }
+ return pack(&builder, obj: &obj)
+ }
+
+ public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MessageT) -> Offset {
+ let __pointer = InternalMessage.pack(&builder, obj: &obj.pointer)
+ let __root = Message.startMessage(&builder)
+ Message.add(id: obj.id, &builder)
+ Message.add(position: obj.position, &builder)
+ Message.add(pointer: __pointer, &builder)
+ return Message.endMessage(&builder, start: __root)
+ }
+
+ public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable {
+ var _v = try verifier.visitTable(at: position)
+ try _v.visit(field: VTOFFSET.id.p, fieldName: "id", required: false, type: Int64.self)
+ try _v.visit(field: VTOFFSET.position.p, fieldName: "position", required: true, type: BytesCount.self)
+ try _v.visit(field: VTOFFSET.pointer.p, fieldName: "pointer", required: true, type: ForwardOffset<InternalMessage>.self)
+ _v.finish()
+ }
+}
+
+extension Message: Encodable {
+
+ enum CodingKeys: String, CodingKey {
+ case id = "id"
+ case position = "position"
+ case pointer = "pointer"
+ }
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ if id != 0 {
+ try container.encodeIfPresent(id, forKey: .id)
+ }
+ try container.encodeIfPresent(position, forKey: .position)
+ try container.encodeIfPresent(pointer, forKey: .pointer)
+ }
+}
+
+public class MessageT: NativeObject {
+
+ public var id: Int64
+ public var position: BytesCount
+ public var pointer: InternalMessageT
+
+ public init(_ _t: inout Message) {
+ id = _t.id
+ position = _t.position
+ var __pointer = _t.pointer
+ pointer = __pointer!.unpack()
+ }
+
+ public init() {
+ id = 0
+ position = BytesCount()
+ pointer = InternalMessageT()
+ }
+
+ public func serialize() -> ByteBuffer { return serialize(type: Message.self) }
+
+}
diff --git a/tests/FlatBuffers.Test.Swift/Package.swift b/tests/swift/tests/Package.swift
similarity index 96%
rename from tests/FlatBuffers.Test.Swift/Package.swift
rename to tests/swift/tests/Package.swift
index e2a53df..64fcd54 100644
--- a/tests/FlatBuffers.Test.Swift/Package.swift
+++ b/tests/swift/tests/Package.swift
@@ -24,7 +24,7 @@
.macOS(.v10_14),
],
dependencies: [
- .package(path: "../../swift/"),
+ .package(path: "../../../swift"),
.package(url: "https://github.com/grpc/grpc-swift.git", from: "1.4.1"),
],
targets: [
diff --git a/tests/FlatBuffers.Test.Swift/Sources/SwiftFlatBuffers/fuzzer.fbs b/tests/swift/tests/Sources/SwiftFlatBuffers/fuzzer.fbs
similarity index 100%
rename from tests/FlatBuffers.Test.Swift/Sources/SwiftFlatBuffers/fuzzer.fbs
rename to tests/swift/tests/Sources/SwiftFlatBuffers/fuzzer.fbs
diff --git a/tests/FlatBuffers.Test.Swift/Sources/SwiftFlatBuffers/fuzzer_generated.swift b/tests/swift/tests/Sources/SwiftFlatBuffers/fuzzer_generated.swift
similarity index 95%
rename from tests/FlatBuffers.Test.Swift/Sources/SwiftFlatBuffers/fuzzer_generated.swift
rename to tests/swift/tests/Sources/SwiftFlatBuffers/fuzzer_generated.swift
index 7051380..fe7ca0b 100644
--- a/tests/FlatBuffers.Test.Swift/Sources/SwiftFlatBuffers/fuzzer_generated.swift
+++ b/tests/swift/tests/Sources/SwiftFlatBuffers/fuzzer_generated.swift
@@ -32,7 +32,7 @@
public struct Test: NativeStruct, Verifiable, FlatbuffersInitializable {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
private var _a: Int16
private var _b: Int8
@@ -81,7 +81,7 @@
public struct Test_Mutable: FlatBufferObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Struct
@@ -93,7 +93,7 @@
public struct Vec3: NativeStruct, Verifiable, FlatbuffersInitializable {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
private var _x: Float32
private var _y: Float32
@@ -178,7 +178,7 @@
public struct Vec3_Mutable: FlatBufferObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Struct
@@ -195,7 +195,7 @@
/// an example documentation comment: "monster object"
public struct Monster: FlatBufferObject, Verifiable {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
@@ -222,9 +222,11 @@
public var hp: Int16 { let o = _accessor.offset(VTOFFSET.hp.v); return o == 0 ? 100 : _accessor.readBuffer(of: Int16.self, at: o) }
public var name: String! { let o = _accessor.offset(VTOFFSET.name.v); return _accessor.string(at: o) }
public var nameSegmentArray: [UInt8]! { return _accessor.getVector(at: VTOFFSET.name.v) }
+ public var hasTestarrayoftables: Bool { let o = _accessor.offset(VTOFFSET.testarrayoftables.v); return o == 0 ? false : true }
public var testarrayoftablesCount: Int32 { let o = _accessor.offset(VTOFFSET.testarrayoftables.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func testarrayoftables(at index: Int32) -> Monster? { let o = _accessor.offset(VTOFFSET.testarrayoftables.v); return o == 0 ? nil : Monster(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) }
public func testarrayoftablesBy(key: String) -> Monster? { let o = _accessor.offset(VTOFFSET.testarrayoftables.v); return o == 0 ? nil : Monster.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) }
+ public var hasInventory: Bool { let o = _accessor.offset(VTOFFSET.inventory.v); return o == 0 ? false : true }
public var inventoryCount: Int32 { let o = _accessor.offset(VTOFFSET.inventory.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func inventory(at index: Int32) -> UInt8 { let o = _accessor.offset(VTOFFSET.inventory.v); return o == 0 ? 0 : _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1) }
public var inventory: [UInt8] { return _accessor.getVector(at: VTOFFSET.inventory.v) ?? [] }
@@ -243,7 +245,7 @@
pos: Vec3? = nil,
mana: Int16 = 150,
hp: Int16 = 100,
- nameOffset name: Offset = Offset(),
+ nameOffset name: Offset,
testarrayoftablesVectorOffset testarrayoftables: Offset = Offset(),
inventoryVectorOffset inventory: Offset = Offset(),
color: Color = .blue
diff --git a/tests/FlatBuffers.Test.Swift/Sources/SwiftFlatBuffers/main.swift b/tests/swift/tests/Sources/SwiftFlatBuffers/main.swift
similarity index 100%
rename from tests/FlatBuffers.Test.Swift/Sources/SwiftFlatBuffers/main.swift
rename to tests/swift/tests/Sources/SwiftFlatBuffers/main.swift
diff --git a/tests/swift/tests/SwiftTest.sh b/tests/swift/tests/SwiftTest.sh
new file mode 100755
index 0000000..37563d4
--- /dev/null
+++ b/tests/swift/tests/SwiftTest.sh
@@ -0,0 +1,39 @@
+current_dir=`pwd`
+cd ..
+swift_dir=`pwd`
+cd ..
+test_dir=`pwd`
+alias fbc='${test_dir}/../flatc'
+shopt -s expand_aliases
+
+cd ${current_dir}/Tests/FlatBuffers.Test.SwiftTests
+fbc --swift --gen-mutable --grpc --gen-json-emit --gen-object-api -I ${test_dir}/include_test ${test_dir}/monster_test.fbs ${test_dir}/union_vector/union_vector.fbs
+fbc --swift --gen-json-emit ${test_dir}/optional_scalars.fbs
+fbc --swift --gen-json-emit --gen-object-api ${test_dir}/more_defaults.fbs
+fbc --swift --gen-json-emit --gen-mutable --gen-object-api ${test_dir}/MutatingBool.fbs
+fbc --swift --gen-json-emit ${test_dir}/vector_has_test.fbs
+cd ${current_dir}
+
+# Goes into the code generation tests
+cd CodeGenerationTests
+fbc --swift --gen-mutable --grpc --gen-json-emit --gen-object-api --swift-implementation-only test_import.fbs
+fbc --swift --gen-mutable --grpc --gen-json-emit --gen-object-api --no-includes test_no_include.fbs
+cd ..
+
+cd ${current_dir}/Sources/SwiftFlatBuffers
+# create better fuzzing test file
+fbc --swift --gen-json-emit fuzzer.fbs
+cd ${current_dir}
+
+cd ${swift_dir}/Wasm.tests/Tests/FlatBuffers.Test.Swift.WasmTests
+fbc --swift --gen-mutable --gen-json-emit --gen-object-api -I ${test_dir}/include_test ${test_dir}/monster_test.fbs
+cd ${current_dir}
+
+swift build --build-tests
+swift test
+
+if [ $(uname -s) != Darwin ]; then
+ echo fuzzing
+ swift build -c debug -Xswiftc -sanitize=fuzzer,address -Xswiftc -parse-as-library
+ swift build -c release -Xswiftc -sanitize=fuzzer,address -Xswiftc -parse-as-library
+fi
diff --git a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersMonsterWriterTests.swift b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersMonsterWriterTests.swift
similarity index 100%
rename from tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersMonsterWriterTests.swift
rename to tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersMonsterWriterTests.swift
diff --git a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersStructsTests.swift b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersStructsTests.swift
similarity index 100%
rename from tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersStructsTests.swift
rename to tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersStructsTests.swift
diff --git a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersTests.swift b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersTests.swift
similarity index 100%
rename from tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersTests.swift
rename to tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersTests.swift
diff --git a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersUnionTests.swift b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersUnionTests.swift
similarity index 100%
rename from tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersUnionTests.swift
rename to tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersUnionTests.swift
diff --git a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersVectorsTests.swift b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersVectorsTests.swift
similarity index 85%
rename from tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersVectorsTests.swift
rename to tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersVectorsTests.swift
index 4cb245f..122facb 100644
--- a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersVectorsTests.swift
+++ b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatBuffersVectorsTests.swift
@@ -105,6 +105,27 @@
let number = Numbers.getRootAsNumbers(ByteBuffer(bytes: b.sizedByteArray))
XCTAssertEqual(number.vArrayDouble, [1, 2, 3, 4, 5])
}
+
+ func testHasForArray() {
+ var builder = FlatBufferBuilder(initialSize: 20)
+ let emptyVector = [UInt8]()
+ let emptyOffset = builder.createVector(emptyVector)
+ let nonEmptyVector = [1, 2, 3]
+ let nonEmptyVectorOffest = builder.createVector(nonEmptyVector)
+ let start = Swift_Tests_Vectors.startVectors(&builder)
+ Swift_Tests_Vectors.addVectorOf(empty: emptyOffset, &builder)
+ Swift_Tests_Vectors.addVectorOf(array: nonEmptyVectorOffest, &builder)
+ let finish = Swift_Tests_Vectors.endVectors(&builder, start: start)
+ builder.finish(offset: finish)
+
+ let msg = Swift_Tests_Vectors.getRootAsVectors(bb: ByteBuffer(bytes: builder.sizedByteArray))
+ XCTAssertEqual(msg.hasNone, false)
+ XCTAssertEqual(msg.hasEmpty, true)
+ XCTAssertEqual(msg.emptyCount, 0)
+ XCTAssertEqual(msg.hasArray, true)
+ XCTAssertEqual(msg.arrayCount, 3)
+ XCTAssertEqual(msg.array, [1, 2, 3])
+ }
}
struct Numbers {
diff --git a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatbuffersDoubleTests.swift b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatbuffersDoubleTests.swift
similarity index 100%
rename from tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatbuffersDoubleTests.swift
rename to tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatbuffersDoubleTests.swift
diff --git a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatbuffersMoreDefaults.swift b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatbuffersMoreDefaults.swift
similarity index 100%
rename from tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatbuffersMoreDefaults.swift
rename to tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatbuffersMoreDefaults.swift
diff --git a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatbuffersVerifierTests.swift b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatbuffersVerifierTests.swift
similarity index 89%
rename from tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatbuffersVerifierTests.swift
rename to tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatbuffersVerifierTests.swift
index 750f97b..cb26c27 100644
--- a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/FlatbuffersVerifierTests.swift
+++ b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/FlatbuffersVerifierTests.swift
@@ -201,12 +201,34 @@
XCTAssertNoThrow(try getCheckedRoot(byteBuffer: &byteBuffer) as Movie)
}
+ func testErrorWrongFileId() {
+ // swiftformat:disable all
+ var byteBuffer = ByteBuffer(bytes: [20, 0, 0, 0, 77, 79, 86, 73, 12, 0, 12, 0, 0, 0, 0, 0, 8, 0, 4, 0, 12, 0, 0, 0, 8, 0, 0, 0, 20, 0, 0, 0, 3, 0, 0, 0, 24, 0, 0, 0, 32, 0, 0, 0, 12, 0, 0, 0, 3, 0, 0, 0, 3, 1, 4, 0, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 6, 0, 8, 0, 4, 0, 6, 0, 0, 0, 8, 0, 0, 0])
+ // swiftformat:enable all
+ XCTAssertThrowsError(try getCheckedRoot(byteBuffer: &byteBuffer, fileId: "FLEX") as Movie)
+ }
+
+ func testVerifyPrefixedBuffer() {
+ // swiftformat:disable all
+ var byteBuffer = ByteBuffer(bytes: [0, 0, 0, 1, 20, 0, 0, 0, 77, 79, 86, 73, 12, 0, 12, 0, 0, 0, 0, 0, 8, 0, 4, 0, 12, 0, 0, 0, 8, 0, 0, 0, 20, 0, 0, 0, 3, 0, 0, 0, 24, 0, 0, 0, 32, 0, 0, 0, 12, 0, 0, 0, 3, 0, 0, 0, 3, 1, 4, 0, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 6, 0, 8, 0, 4, 0, 6, 0, 0, 0, 8, 0, 0, 0])
+ // swiftformat:enable all
+ XCTAssertThrowsError(
+ try getCheckedPrefixedSizeRoot(byteBuffer: &byteBuffer) as Movie)
+ }
+
func testFullVerifier() {
XCTAssertNoThrow(
try getCheckedRoot(
byteBuffer: &validFlatbuffersObject) as MyGame_Example_Monster)
}
+ func testFullVerifierWithFileId() {
+ XCTAssertNoThrow(
+ try getCheckedRoot(
+ byteBuffer: &validFlatbuffersObject,
+ fileId: MyGame_Example_Monster.id) as MyGame_Example_Monster)
+ }
+
func testInvalidBuffer() {
XCTAssertThrowsError(
try getCheckedRoot(
diff --git a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/MutatingBool_generated.swift b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/MutatingBool_generated.swift
similarity index 96%
rename from tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/MutatingBool_generated.swift
rename to tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/MutatingBool_generated.swift
index 155080a..4c243d9 100644
--- a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/MutatingBool_generated.swift
+++ b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/MutatingBool_generated.swift
@@ -6,7 +6,7 @@
public struct Property: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
private var _property: Bool
@@ -49,7 +49,7 @@
public struct Property_Mutable: FlatBufferObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Struct
@@ -74,7 +74,7 @@
public struct TestMutatingBool: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
diff --git a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/XCTestManifests.swift b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/XCTestManifests.swift
similarity index 98%
rename from tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/XCTestManifests.swift
rename to tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/XCTestManifests.swift
index 4134762..e15ea83 100644
--- a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/XCTestManifests.swift
+++ b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/XCTestManifests.swift
@@ -109,6 +109,7 @@
("testCreateSharedStringVector", testCreateSharedStringVector),
("testCreateVectorOfStrings", testCreateVectorOfStrings),
("testCreatingTwoCountries", testCreatingTwoCountries),
+ ("testHasForArray", testHasForArray),
("testReadDoubleArray", testReadDoubleArray),
("testReadInt32Array", testReadInt32Array),
]
diff --git a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/monster_test.grpc.swift b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/monster_test.grpc.swift
similarity index 100%
rename from tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/monster_test.grpc.swift
rename to tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/monster_test.grpc.swift
diff --git a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/monster_test_generated.swift b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/monster_test_generated.swift
similarity index 94%
copy from tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/monster_test_generated.swift
copy to tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/monster_test_generated.swift
index c8a0502..d37a5bb 100644
--- a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/monster_test_generated.swift
+++ b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/monster_test_generated.swift
@@ -237,7 +237,7 @@
}
public struct MyGame_Example_Test: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
private var _a: Int16
private var _b: Int8
@@ -291,7 +291,7 @@
public struct MyGame_Example_Test_Mutable: FlatBufferObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Struct
@@ -318,7 +318,7 @@
public struct MyGame_Example_Vec3: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
private var _x: Float32
private var _y: Float32
@@ -413,7 +413,7 @@
public struct MyGame_Example_Vec3_Mutable: FlatBufferObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Struct
@@ -447,7 +447,7 @@
public struct MyGame_Example_Ability: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
private var _id: UInt32
private var _distance: UInt32
@@ -500,7 +500,7 @@
public struct MyGame_Example_Ability_Mutable: FlatBufferObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Struct
@@ -527,7 +527,7 @@
public struct MyGame_Example_StructOfStructs: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
private var _a: MyGame_Example_Ability
private var _b: MyGame_Example_Test
@@ -587,7 +587,7 @@
public struct MyGame_Example_StructOfStructs_Mutable: FlatBufferObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Struct
@@ -611,13 +611,80 @@
}
}
+public struct MyGame_Example_StructOfStructsOfStructs: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
+
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
+
+ private var _a: MyGame_Example_StructOfStructs
+
+ public init(_ bb: ByteBuffer, o: Int32) {
+ let _accessor = Struct(bb: bb, position: o)
+ _a = MyGame_Example_StructOfStructs(_accessor.bb, o: _accessor.postion + 0)
+ }
+
+ public init(a: MyGame_Example_StructOfStructs) {
+ _a = a
+ }
+
+ public init() {
+ _a = MyGame_Example_StructOfStructs()
+ }
+
+ public init(_ _t: inout MyGame_Example_StructOfStructsOfStructs_Mutable) {
+ var _va = _t.a
+ _a = _va.unpack()
+ }
+
+ public var a: MyGame_Example_StructOfStructs { _a }
+
+ public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable {
+ try verifier.inBuffer(position: position, of: MyGame_Example_StructOfStructsOfStructs.self)
+ }
+}
+
+extension MyGame_Example_StructOfStructsOfStructs: Encodable {
+
+ enum CodingKeys: String, CodingKey {
+ case a = "a"
+ }
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(a, forKey: .a)
+ }
+}
+
+public struct MyGame_Example_StructOfStructsOfStructs_Mutable: FlatBufferObject {
+
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
+ public var __buffer: ByteBuffer! { return _accessor.bb }
+ private var _accessor: Struct
+
+ public init(_ bb: ByteBuffer, o: Int32) { _accessor = Struct(bb: bb, position: o) }
+
+ public var a: MyGame_Example_StructOfStructs_Mutable { return MyGame_Example_StructOfStructs_Mutable(_accessor.bb, o: _accessor.postion + 0) }
+
+
+ public mutating func unpack() -> MyGame_Example_StructOfStructsOfStructs {
+ return MyGame_Example_StructOfStructsOfStructs(&self)
+ }
+ public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_StructOfStructsOfStructs?) -> Offset {
+ guard var obj = obj else { return Offset() }
+ return pack(&builder, obj: &obj)
+ }
+
+ public static func pack(_ builder: inout FlatBufferBuilder, obj: inout MyGame_Example_StructOfStructsOfStructs) -> Offset {
+ return builder.create(struct: obj)
+ }
+}
+
public struct MyGame_InParentNamespace: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
+ public static var id: String { "MONS" }
+ public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_InParentNamespace.id, addPrefix: prefix) }
public static func getRootAsInParentNamespace(bb: ByteBuffer) -> MyGame_InParentNamespace { return MyGame_InParentNamespace(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -666,11 +733,12 @@
}
public struct MyGame_Example2_Monster: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
+ public static var id: String { "MONS" }
+ public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example2_Monster.id, addPrefix: prefix) }
public static func getRootAsMonster(bb: ByteBuffer) -> MyGame_Example2_Monster { return MyGame_Example2_Monster(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -719,11 +787,12 @@
}
internal struct MyGame_Example_TestSimpleTableWithEnum: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
internal var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- internal static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
+ internal static var id: String { "MONS" }
+ internal static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example_TestSimpleTableWithEnum.id, addPrefix: prefix) }
internal static func getRootAsTestSimpleTableWithEnum(bb: ByteBuffer) -> MyGame_Example_TestSimpleTableWithEnum { return MyGame_Example_TestSimpleTableWithEnum(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -764,7 +833,7 @@
return MyGame_Example_TestSimpleTableWithEnum.endTestSimpleTableWithEnum(&builder, start: __root)
}
- public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable {
+ internal static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable {
var _v = try verifier.visitTable(at: position)
try _v.visit(field: VTOFFSET.color.p, fieldName: "color", required: false, type: MyGame_Example_Color.self)
_v.finish()
@@ -776,7 +845,7 @@
enum CodingKeys: String, CodingKey {
case color = "color"
}
- public func encode(to encoder: Encoder) throws {
+ internal func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
if color != .green {
try container.encodeIfPresent(color, forKey: .color)
@@ -801,11 +870,12 @@
}
public struct MyGame_Example_Stat: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
+ public static var id: String { "MONS" }
+ public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example_Stat.id, addPrefix: prefix) }
public static func getRootAsStat(bb: ByteBuffer) -> MyGame_Example_Stat { return MyGame_Example_Stat(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -941,11 +1011,12 @@
}
public struct MyGame_Example_Referrable: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
+ public static var id: String { "MONS" }
+ public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example_Referrable.id, addPrefix: prefix) }
public static func getRootAsReferrable(bb: ByteBuffer) -> MyGame_Example_Referrable { return MyGame_Example_Referrable(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -1048,11 +1119,12 @@
/// an example documentation comment: "monster object"
public struct MyGame_Example_Monster: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
+ public static var id: String { "MONS" }
+ public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example_Monster.id, addPrefix: prefix) }
public static func getRootAsMonster(bb: ByteBuffer) -> MyGame_Example_Monster { return MyGame_Example_Monster(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -1124,6 +1196,7 @@
@discardableResult public func mutate(hp: Int16) -> Bool {let o = _accessor.offset(VTOFFSET.hp.v); return _accessor.mutate(hp, index: o) }
public var name: String! { let o = _accessor.offset(VTOFFSET.name.v); return _accessor.string(at: o) }
public var nameSegmentArray: [UInt8]! { return _accessor.getVector(at: VTOFFSET.name.v) }
+ public var hasInventory: Bool { let o = _accessor.offset(VTOFFSET.inventory.v); return o == 0 ? false : true }
public var inventoryCount: Int32 { let o = _accessor.offset(VTOFFSET.inventory.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func inventory(at index: Int32) -> UInt8 { let o = _accessor.offset(VTOFFSET.inventory.v); return o == 0 ? 0 : _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1) }
public var inventory: [UInt8] { return _accessor.getVector(at: VTOFFSET.inventory.v) ?? [] }
@@ -1132,17 +1205,21 @@
@discardableResult public func mutate(color: MyGame_Example_Color) -> Bool {let o = _accessor.offset(VTOFFSET.color.v); return _accessor.mutate(color.rawValue, index: o) }
public var testType: MyGame_Example_Any_ { let o = _accessor.offset(VTOFFSET.testType.v); return o == 0 ? .none_ : MyGame_Example_Any_(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none_ }
public func test<T: FlatbuffersInitializable>(type: T.Type) -> T? { let o = _accessor.offset(VTOFFSET.test.v); return o == 0 ? nil : _accessor.union(o) }
+ public var hasTest4: Bool { let o = _accessor.offset(VTOFFSET.test4.v); return o == 0 ? false : true }
public var test4Count: Int32 { let o = _accessor.offset(VTOFFSET.test4.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func test4(at index: Int32) -> MyGame_Example_Test? { let o = _accessor.offset(VTOFFSET.test4.v); return o == 0 ? nil : _accessor.directRead(of: MyGame_Example_Test.self, offset: _accessor.vector(at: o) + index * 4) }
public func mutableTest4(at index: Int32) -> MyGame_Example_Test_Mutable? { let o = _accessor.offset(VTOFFSET.test4.v); return o == 0 ? nil : MyGame_Example_Test_Mutable(_accessor.bb, o: _accessor.vector(at: o) + index * 4) }
+ public var hasTestarrayofstring: Bool { let o = _accessor.offset(VTOFFSET.testarrayofstring.v); return o == 0 ? false : true }
public var testarrayofstringCount: Int32 { let o = _accessor.offset(VTOFFSET.testarrayofstring.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func testarrayofstring(at index: Int32) -> String? { let o = _accessor.offset(VTOFFSET.testarrayofstring.v); return o == 0 ? nil : _accessor.directString(at: _accessor.vector(at: o) + index * 4) }
/// an example documentation comment: this will end up in the generated code
/// multiline too
+ public var hasTestarrayoftables: Bool { let o = _accessor.offset(VTOFFSET.testarrayoftables.v); return o == 0 ? false : true }
public var testarrayoftablesCount: Int32 { let o = _accessor.offset(VTOFFSET.testarrayoftables.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func testarrayoftables(at index: Int32) -> MyGame_Example_Monster? { let o = _accessor.offset(VTOFFSET.testarrayoftables.v); return o == 0 ? nil : MyGame_Example_Monster(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) }
public func testarrayoftablesBy(key: String) -> MyGame_Example_Monster? { let o = _accessor.offset(VTOFFSET.testarrayoftables.v); return o == 0 ? nil : MyGame_Example_Monster.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) }
public var enemy: MyGame_Example_Monster? { let o = _accessor.offset(VTOFFSET.enemy.v); return o == 0 ? nil : MyGame_Example_Monster(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) }
+ public var hasTestnestedflatbuffer: Bool { let o = _accessor.offset(VTOFFSET.testnestedflatbuffer.v); return o == 0 ? false : true }
public var testnestedflatbufferCount: Int32 { let o = _accessor.offset(VTOFFSET.testnestedflatbuffer.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func testnestedflatbuffer(at index: Int32) -> UInt8 { let o = _accessor.offset(VTOFFSET.testnestedflatbuffer.v); return o == 0 ? 0 : _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1) }
public var testnestedflatbuffer: [UInt8] { return _accessor.getVector(at: VTOFFSET.testnestedflatbuffer.v) ?? [] }
@@ -1166,6 +1243,7 @@
@discardableResult public func mutate(testhashs64Fnv1a: Int64) -> Bool {let o = _accessor.offset(VTOFFSET.testhashs64Fnv1a.v); return _accessor.mutate(testhashs64Fnv1a, index: o) }
public var testhashu64Fnv1a: UInt64 { let o = _accessor.offset(VTOFFSET.testhashu64Fnv1a.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
@discardableResult public func mutate(testhashu64Fnv1a: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.testhashu64Fnv1a.v); return _accessor.mutate(testhashu64Fnv1a, index: o) }
+ public var hasTestarrayofbools: Bool { let o = _accessor.offset(VTOFFSET.testarrayofbools.v); return o == 0 ? false : true }
public var testarrayofboolsCount: Int32 { let o = _accessor.offset(VTOFFSET.testarrayofbools.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func testarrayofbools(at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.testarrayofbools.v); return o == 0 ? true : _accessor.directRead(of: Bool.self, offset: _accessor.vector(at: o) + index * 1) }
public var testarrayofbools: [Bool] { return _accessor.getVector(at: VTOFFSET.testarrayofbools.v) ?? [] }
@@ -1176,47 +1254,58 @@
@discardableResult public func mutate(testf2: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.testf2.v); return _accessor.mutate(testf2, index: o) }
public var testf3: Float32 { let o = _accessor.offset(VTOFFSET.testf3.v); return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o) }
@discardableResult public func mutate(testf3: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.testf3.v); return _accessor.mutate(testf3, index: o) }
+ public var hasTestarrayofstring2: Bool { let o = _accessor.offset(VTOFFSET.testarrayofstring2.v); return o == 0 ? false : true }
public var testarrayofstring2Count: Int32 { let o = _accessor.offset(VTOFFSET.testarrayofstring2.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func testarrayofstring2(at index: Int32) -> String? { let o = _accessor.offset(VTOFFSET.testarrayofstring2.v); return o == 0 ? nil : _accessor.directString(at: _accessor.vector(at: o) + index * 4) }
+ public var hasTestarrayofsortedstruct: Bool { let o = _accessor.offset(VTOFFSET.testarrayofsortedstruct.v); return o == 0 ? false : true }
public var testarrayofsortedstructCount: Int32 { let o = _accessor.offset(VTOFFSET.testarrayofsortedstruct.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func testarrayofsortedstruct(at index: Int32) -> MyGame_Example_Ability? { let o = _accessor.offset(VTOFFSET.testarrayofsortedstruct.v); return o == 0 ? nil : _accessor.directRead(of: MyGame_Example_Ability.self, offset: _accessor.vector(at: o) + index * 8) }
public func mutableTestarrayofsortedstruct(at index: Int32) -> MyGame_Example_Ability_Mutable? { let o = _accessor.offset(VTOFFSET.testarrayofsortedstruct.v); return o == 0 ? nil : MyGame_Example_Ability_Mutable(_accessor.bb, o: _accessor.vector(at: o) + index * 8) }
+ public var hasFlex: Bool { let o = _accessor.offset(VTOFFSET.flex.v); return o == 0 ? false : true }
public var flexCount: Int32 { let o = _accessor.offset(VTOFFSET.flex.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func flex(at index: Int32) -> UInt8 { let o = _accessor.offset(VTOFFSET.flex.v); return o == 0 ? 0 : _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1) }
public var flex: [UInt8] { return _accessor.getVector(at: VTOFFSET.flex.v) ?? [] }
public func mutate(flex: UInt8, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.flex.v); return _accessor.directMutate(flex, index: _accessor.vector(at: o) + index * 1) }
+ public var hasTest5: Bool { let o = _accessor.offset(VTOFFSET.test5.v); return o == 0 ? false : true }
public var test5Count: Int32 { let o = _accessor.offset(VTOFFSET.test5.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func test5(at index: Int32) -> MyGame_Example_Test? { let o = _accessor.offset(VTOFFSET.test5.v); return o == 0 ? nil : _accessor.directRead(of: MyGame_Example_Test.self, offset: _accessor.vector(at: o) + index * 4) }
public func mutableTest5(at index: Int32) -> MyGame_Example_Test_Mutable? { let o = _accessor.offset(VTOFFSET.test5.v); return o == 0 ? nil : MyGame_Example_Test_Mutable(_accessor.bb, o: _accessor.vector(at: o) + index * 4) }
+ public var hasVectorOfLongs: Bool { let o = _accessor.offset(VTOFFSET.vectorOfLongs.v); return o == 0 ? false : true }
public var vectorOfLongsCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfLongs.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vectorOfLongs(at index: Int32) -> Int64 { let o = _accessor.offset(VTOFFSET.vectorOfLongs.v); return o == 0 ? 0 : _accessor.directRead(of: Int64.self, offset: _accessor.vector(at: o) + index * 8) }
public var vectorOfLongs: [Int64] { return _accessor.getVector(at: VTOFFSET.vectorOfLongs.v) ?? [] }
public func mutate(vectorOfLongs: Int64, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.vectorOfLongs.v); return _accessor.directMutate(vectorOfLongs, index: _accessor.vector(at: o) + index * 8) }
+ public var hasVectorOfDoubles: Bool { let o = _accessor.offset(VTOFFSET.vectorOfDoubles.v); return o == 0 ? false : true }
public var vectorOfDoublesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfDoubles.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vectorOfDoubles(at index: Int32) -> Double { let o = _accessor.offset(VTOFFSET.vectorOfDoubles.v); return o == 0 ? 0 : _accessor.directRead(of: Double.self, offset: _accessor.vector(at: o) + index * 8) }
public var vectorOfDoubles: [Double] { return _accessor.getVector(at: VTOFFSET.vectorOfDoubles.v) ?? [] }
public func mutate(vectorOfDoubles: Double, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.vectorOfDoubles.v); return _accessor.directMutate(vectorOfDoubles, index: _accessor.vector(at: o) + index * 8) }
public var parentNamespaceTest: MyGame_InParentNamespace? { let o = _accessor.offset(VTOFFSET.parentNamespaceTest.v); return o == 0 ? nil : MyGame_InParentNamespace(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) }
+ public var hasVectorOfReferrables: Bool { let o = _accessor.offset(VTOFFSET.vectorOfReferrables.v); return o == 0 ? false : true }
public var vectorOfReferrablesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfReferrables.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vectorOfReferrables(at index: Int32) -> MyGame_Example_Referrable? { let o = _accessor.offset(VTOFFSET.vectorOfReferrables.v); return o == 0 ? nil : MyGame_Example_Referrable(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) }
public func vectorOfReferrablesBy(key: UInt64) -> MyGame_Example_Referrable? { let o = _accessor.offset(VTOFFSET.vectorOfReferrables.v); return o == 0 ? nil : MyGame_Example_Referrable.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) }
public var singleWeakReference: UInt64 { let o = _accessor.offset(VTOFFSET.singleWeakReference.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
@discardableResult public func mutate(singleWeakReference: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.singleWeakReference.v); return _accessor.mutate(singleWeakReference, index: o) }
+ public var hasVectorOfWeakReferences: Bool { let o = _accessor.offset(VTOFFSET.vectorOfWeakReferences.v); return o == 0 ? false : true }
public var vectorOfWeakReferencesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfWeakReferences.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vectorOfWeakReferences(at index: Int32) -> UInt64 { let o = _accessor.offset(VTOFFSET.vectorOfWeakReferences.v); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) }
public var vectorOfWeakReferences: [UInt64] { return _accessor.getVector(at: VTOFFSET.vectorOfWeakReferences.v) ?? [] }
public func mutate(vectorOfWeakReferences: UInt64, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.vectorOfWeakReferences.v); return _accessor.directMutate(vectorOfWeakReferences, index: _accessor.vector(at: o) + index * 8) }
+ public var hasVectorOfStrongReferrables: Bool { let o = _accessor.offset(VTOFFSET.vectorOfStrongReferrables.v); return o == 0 ? false : true }
public var vectorOfStrongReferrablesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfStrongReferrables.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vectorOfStrongReferrables(at index: Int32) -> MyGame_Example_Referrable? { let o = _accessor.offset(VTOFFSET.vectorOfStrongReferrables.v); return o == 0 ? nil : MyGame_Example_Referrable(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) }
public func vectorOfStrongReferrablesBy(key: UInt64) -> MyGame_Example_Referrable? { let o = _accessor.offset(VTOFFSET.vectorOfStrongReferrables.v); return o == 0 ? nil : MyGame_Example_Referrable.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) }
public var coOwningReference: UInt64 { let o = _accessor.offset(VTOFFSET.coOwningReference.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
@discardableResult public func mutate(coOwningReference: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.coOwningReference.v); return _accessor.mutate(coOwningReference, index: o) }
+ public var hasVectorOfCoOwningReferences: Bool { let o = _accessor.offset(VTOFFSET.vectorOfCoOwningReferences.v); return o == 0 ? false : true }
public var vectorOfCoOwningReferencesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfCoOwningReferences.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vectorOfCoOwningReferences(at index: Int32) -> UInt64 { let o = _accessor.offset(VTOFFSET.vectorOfCoOwningReferences.v); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) }
public var vectorOfCoOwningReferences: [UInt64] { return _accessor.getVector(at: VTOFFSET.vectorOfCoOwningReferences.v) ?? [] }
public func mutate(vectorOfCoOwningReferences: UInt64, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.vectorOfCoOwningReferences.v); return _accessor.directMutate(vectorOfCoOwningReferences, index: _accessor.vector(at: o) + index * 8) }
public var nonOwningReference: UInt64 { let o = _accessor.offset(VTOFFSET.nonOwningReference.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt64.self, at: o) }
@discardableResult public func mutate(nonOwningReference: UInt64) -> Bool {let o = _accessor.offset(VTOFFSET.nonOwningReference.v); return _accessor.mutate(nonOwningReference, index: o) }
+ public var hasVectorOfNonOwningReferences: Bool { let o = _accessor.offset(VTOFFSET.vectorOfNonOwningReferences.v); return o == 0 ? false : true }
public var vectorOfNonOwningReferencesCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfNonOwningReferences.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vectorOfNonOwningReferences(at index: Int32) -> UInt64 { let o = _accessor.offset(VTOFFSET.vectorOfNonOwningReferences.v); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) }
public var vectorOfNonOwningReferences: [UInt64] { return _accessor.getVector(at: VTOFFSET.vectorOfNonOwningReferences.v) ?? [] }
@@ -1225,14 +1314,17 @@
public func anyUnique<T: FlatbuffersInitializable>(type: T.Type) -> T? { let o = _accessor.offset(VTOFFSET.anyUnique.v); return o == 0 ? nil : _accessor.union(o) }
public var anyAmbiguousType: MyGame_Example_AnyAmbiguousAliases { let o = _accessor.offset(VTOFFSET.anyAmbiguousType.v); return o == 0 ? .none_ : MyGame_Example_AnyAmbiguousAliases(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none_ }
public func anyAmbiguous<T: FlatbuffersInitializable>(type: T.Type) -> T? { let o = _accessor.offset(VTOFFSET.anyAmbiguous.v); return o == 0 ? nil : _accessor.union(o) }
+ public var hasVectorOfEnums: Bool { let o = _accessor.offset(VTOFFSET.vectorOfEnums.v); return o == 0 ? false : true }
public var vectorOfEnumsCount: Int32 { let o = _accessor.offset(VTOFFSET.vectorOfEnums.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vectorOfEnums(at index: Int32) -> MyGame_Example_Color? { let o = _accessor.offset(VTOFFSET.vectorOfEnums.v); return o == 0 ? MyGame_Example_Color.red : MyGame_Example_Color(rawValue: _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1)) }
public var signedEnum: MyGame_Example_Race { let o = _accessor.offset(VTOFFSET.signedEnum.v); return o == 0 ? .none_ : MyGame_Example_Race(rawValue: _accessor.readBuffer(of: Int8.self, at: o)) ?? .none_ }
@discardableResult public func mutate(signedEnum: MyGame_Example_Race) -> Bool {let o = _accessor.offset(VTOFFSET.signedEnum.v); return _accessor.mutate(signedEnum.rawValue, index: o) }
+ public var hasTestrequirednestedflatbuffer: Bool { let o = _accessor.offset(VTOFFSET.testrequirednestedflatbuffer.v); return o == 0 ? false : true }
public var testrequirednestedflatbufferCount: Int32 { let o = _accessor.offset(VTOFFSET.testrequirednestedflatbuffer.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func testrequirednestedflatbuffer(at index: Int32) -> UInt8 { let o = _accessor.offset(VTOFFSET.testrequirednestedflatbuffer.v); return o == 0 ? 0 : _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1) }
public var testrequirednestedflatbuffer: [UInt8] { return _accessor.getVector(at: VTOFFSET.testrequirednestedflatbuffer.v) ?? [] }
public func mutate(testrequirednestedflatbuffer: UInt8, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.testrequirednestedflatbuffer.v); return _accessor.directMutate(testrequirednestedflatbuffer, index: _accessor.vector(at: o) + index * 1) }
+ public var hasScalarKeySortedTables: Bool { let o = _accessor.offset(VTOFFSET.scalarKeySortedTables.v); return o == 0 ? false : true }
public var scalarKeySortedTablesCount: Int32 { let o = _accessor.offset(VTOFFSET.scalarKeySortedTables.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func scalarKeySortedTables(at index: Int32) -> MyGame_Example_Stat? { let o = _accessor.offset(VTOFFSET.scalarKeySortedTables.v); return o == 0 ? nil : MyGame_Example_Stat(_accessor.bb, o: _accessor.indirect(_accessor.vector(at: o) + index * 4)) }
public func scalarKeySortedTablesBy(key: UInt16) -> MyGame_Example_Stat? { let o = _accessor.offset(VTOFFSET.scalarKeySortedTables.v); return o == 0 ? nil : MyGame_Example_Stat.lookupByKey(vector: _accessor.vector(at: o), key: key, fbb: _accessor.bb) }
@@ -1312,7 +1404,7 @@
pos: MyGame_Example_Vec3? = nil,
mana: Int16 = 150,
hp: Int16 = 100,
- nameOffset name: Offset = Offset(),
+ nameOffset name: Offset,
inventoryVectorOffset inventory: Offset = Offset(),
color: MyGame_Example_Color = .blue,
testType: MyGame_Example_Any_ = .none_,
@@ -2205,11 +2297,12 @@
}
public struct MyGame_Example_TypeAliases: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MONS", addPrefix: prefix) }
+ public static var id: String { "MONS" }
+ public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: MyGame_Example_TypeAliases.id, addPrefix: prefix) }
public static func getRootAsTypeAliases(bb: ByteBuffer) -> MyGame_Example_TypeAliases { return MyGame_Example_TypeAliases(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -2252,10 +2345,12 @@
@discardableResult public func mutate(f32: Float32) -> Bool {let o = _accessor.offset(VTOFFSET.f32.v); return _accessor.mutate(f32, index: o) }
public var f64: Double { let o = _accessor.offset(VTOFFSET.f64.v); return o == 0 ? 0.0 : _accessor.readBuffer(of: Double.self, at: o) }
@discardableResult public func mutate(f64: Double) -> Bool {let o = _accessor.offset(VTOFFSET.f64.v); return _accessor.mutate(f64, index: o) }
+ public var hasV8: Bool { let o = _accessor.offset(VTOFFSET.v8.v); return o == 0 ? false : true }
public var v8Count: Int32 { let o = _accessor.offset(VTOFFSET.v8.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func v8(at index: Int32) -> Int8 { let o = _accessor.offset(VTOFFSET.v8.v); return o == 0 ? 0 : _accessor.directRead(of: Int8.self, offset: _accessor.vector(at: o) + index * 1) }
public var v8: [Int8] { return _accessor.getVector(at: VTOFFSET.v8.v) ?? [] }
public func mutate(v8: Int8, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.v8.v); return _accessor.directMutate(v8, index: _accessor.vector(at: o) + index * 1) }
+ public var hasVf64: Bool { let o = _accessor.offset(VTOFFSET.vf64.v); return o == 0 ? false : true }
public var vf64Count: Int32 { let o = _accessor.offset(VTOFFSET.vf64.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func vf64(at index: Int32) -> Double { let o = _accessor.offset(VTOFFSET.vf64.v); return o == 0 ? 0 : _accessor.directRead(of: Double.self, offset: _accessor.vector(at: o) + index * 8) }
public var vf64: [Double] { return _accessor.getVector(at: VTOFFSET.vf64.v) ?? [] }
diff --git a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/more_defaults_generated.swift b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/more_defaults_generated.swift
similarity index 94%
rename from tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/more_defaults_generated.swift
rename to tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/more_defaults_generated.swift
index 3ebaa2a..f6692c9 100644
--- a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/more_defaults_generated.swift
+++ b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/more_defaults_generated.swift
@@ -29,7 +29,7 @@
public struct MoreDefaults: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
@@ -49,9 +49,11 @@
var p: VOffset { self.rawValue }
}
+ public var hasInts: Bool { let o = _accessor.offset(VTOFFSET.ints.v); return o == 0 ? false : true }
public var intsCount: Int32 { let o = _accessor.offset(VTOFFSET.ints.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func ints(at index: Int32) -> Int32 { let o = _accessor.offset(VTOFFSET.ints.v); return o == 0 ? 0 : _accessor.directRead(of: Int32.self, offset: _accessor.vector(at: o) + index * 4) }
public var ints: [Int32] { return _accessor.getVector(at: VTOFFSET.ints.v) ?? [] }
+ public var hasFloats: Bool { let o = _accessor.offset(VTOFFSET.floats.v); return o == 0 ? false : true }
public var floatsCount: Int32 { let o = _accessor.offset(VTOFFSET.floats.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func floats(at index: Int32) -> Float32 { let o = _accessor.offset(VTOFFSET.floats.v); return o == 0 ? 0 : _accessor.directRead(of: Float32.self, offset: _accessor.vector(at: o) + index * 4) }
public var floats: [Float32] { return _accessor.getVector(at: VTOFFSET.floats.v) ?? [] }
@@ -59,8 +61,10 @@
public var emptyStringSegmentArray: [UInt8]? { return _accessor.getVector(at: VTOFFSET.emptyString.v) }
public var someString: String? { let o = _accessor.offset(VTOFFSET.someString.v); return o == 0 ? "some" : _accessor.string(at: o) }
public var someStringSegmentArray: [UInt8]? { return _accessor.getVector(at: VTOFFSET.someString.v) }
+ public var hasAbcs: Bool { let o = _accessor.offset(VTOFFSET.abcs.v); return o == 0 ? false : true }
public var abcsCount: Int32 { let o = _accessor.offset(VTOFFSET.abcs.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func abcs(at index: Int32) -> ABC? { let o = _accessor.offset(VTOFFSET.abcs.v); return o == 0 ? ABC.a : ABC(rawValue: _accessor.directRead(of: Int32.self, offset: _accessor.vector(at: o) + index * 4)) }
+ public var hasBools: Bool { let o = _accessor.offset(VTOFFSET.bools.v); return o == 0 ? false : true }
public var boolsCount: Int32 { let o = _accessor.offset(VTOFFSET.bools.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func bools(at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.bools.v); return o == 0 ? true : _accessor.directRead(of: Bool.self, offset: _accessor.vector(at: o) + index * 1) }
public var bools: [Bool] { return _accessor.getVector(at: VTOFFSET.bools.v) ?? [] }
diff --git a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/optional_scalars_generated.swift b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/optional_scalars_generated.swift
similarity index 99%
rename from tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/optional_scalars_generated.swift
rename to tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/optional_scalars_generated.swift
index 0f427c8..565bbd4 100644
--- a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/optional_scalars_generated.swift
+++ b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/optional_scalars_generated.swift
@@ -29,11 +29,12 @@
public struct optional_scalars_ScalarStuff: FlatBufferObject, Verifiable {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "NULL", addPrefix: prefix) }
+ public static var id: String { "NULL" }
+ public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: optional_scalars_ScalarStuff.id, addPrefix: prefix) }
public static func getRootAsScalarStuff(bb: ByteBuffer) -> optional_scalars_ScalarStuff { return optional_scalars_ScalarStuff(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
diff --git a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/union_vector_generated.swift b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/union_vector_generated.swift
similarity index 95%
rename from tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/union_vector_generated.swift
rename to tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/union_vector_generated.swift
index 59ed005..ce3d37f 100644
--- a/tests/FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests/union_vector_generated.swift
+++ b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/union_vector_generated.swift
@@ -120,7 +120,7 @@
}
public struct Rapunzel: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
private var _hairLength: Int32
@@ -163,7 +163,7 @@
public struct Rapunzel_Mutable: FlatBufferObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Struct
@@ -188,7 +188,7 @@
public struct BookReader: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
private var _booksRead: Int32
@@ -231,7 +231,7 @@
public struct BookReader_Mutable: FlatBufferObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Struct
@@ -256,7 +256,7 @@
public struct FallingTub: NativeStruct, Verifiable, FlatbuffersInitializable, NativeObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
private var _weight: Int32
@@ -299,7 +299,7 @@
public struct FallingTub_Mutable: FlatBufferObject {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Struct
@@ -324,11 +324,12 @@
public struct Attacker: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MOVI", addPrefix: prefix) }
+ public static var id: String { "MOVI" }
+ public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: Attacker.id, addPrefix: prefix) }
public static func getRootAsAttacker(bb: ByteBuffer) -> Attacker { return Attacker(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -406,11 +407,12 @@
}
public struct HandFan: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MOVI", addPrefix: prefix) }
+ public static var id: String { "MOVI" }
+ public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: HandFan.id, addPrefix: prefix) }
public static func getRootAsHandFan(bb: ByteBuffer) -> HandFan { return HandFan(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -488,11 +490,12 @@
}
public struct Movie: FlatBufferObject, Verifiable, ObjectAPIPacker {
- static func validateVersion() { FlatBuffersVersion_2_0_0() }
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table
- public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: "MOVI", addPrefix: prefix) }
+ public static var id: String { "MOVI" }
+ public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) { fbb.finish(offset: end, fileId: Movie.id, addPrefix: prefix) }
public static func getRootAsMovie(bb: ByteBuffer) -> Movie { return Movie(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
private init(_ t: Table) { _accessor = t }
@@ -509,8 +512,10 @@
public var mainCharacterType: Character { let o = _accessor.offset(VTOFFSET.mainCharacterType.v); return o == 0 ? .none_ : Character(rawValue: _accessor.readBuffer(of: UInt8.self, at: o)) ?? .none_ }
public func mainCharacter<T: FlatbuffersInitializable>(type: T.Type) -> T? { let o = _accessor.offset(VTOFFSET.mainCharacter.v); return o == 0 ? nil : _accessor.union(o) }
+ public var hasCharactersType: Bool { let o = _accessor.offset(VTOFFSET.charactersType.v); return o == 0 ? false : true }
public var charactersTypeCount: Int32 { let o = _accessor.offset(VTOFFSET.charactersType.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func charactersType(at index: Int32) -> Character? { let o = _accessor.offset(VTOFFSET.charactersType.v); return o == 0 ? Character.none_ : Character(rawValue: _accessor.directRead(of: UInt8.self, offset: _accessor.vector(at: o) + index * 1)) }
+ public var hasCharacters: Bool { let o = _accessor.offset(VTOFFSET.characters.v); return o == 0 ? false : true }
public var charactersCount: Int32 { let o = _accessor.offset(VTOFFSET.characters.v); return o == 0 ? 0 : _accessor.vector(count: o) }
public func characters<T: FlatbuffersInitializable>(at index: Int32, type: T.Type) -> T? { let o = _accessor.offset(VTOFFSET.characters.v); return o == 0 ? nil : _accessor.directUnion(_accessor.vector(at: o) + index * 4) }
public static func startMovie(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 4) }
diff --git a/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/vector_has_test_generated.swift b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/vector_has_test_generated.swift
new file mode 100644
index 0000000..dc292f3
--- /dev/null
+++ b/tests/swift/tests/Tests/FlatBuffers.Test.SwiftTests/vector_has_test_generated.swift
@@ -0,0 +1,85 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+// swiftlint:disable all
+// swiftformat:disable all
+
+import FlatBuffers
+
+public struct Swift_Tests_Vectors: FlatBufferObject, Verifiable {
+
+ static func validateVersion() { FlatBuffersVersion_2_0_8() }
+ public var __buffer: ByteBuffer! { return _accessor.bb }
+ private var _accessor: Table
+
+ public static func getRootAsVectors(bb: ByteBuffer) -> Swift_Tests_Vectors { return Swift_Tests_Vectors(Table(bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))) }
+
+ private init(_ t: Table) { _accessor = t }
+ public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }
+
+ private enum VTOFFSET: VOffset {
+ case none_ = 4
+ case empty = 6
+ case array = 8
+ var v: Int32 { Int32(self.rawValue) }
+ var p: VOffset { self.rawValue }
+ }
+
+ public var hasNone: Bool { let o = _accessor.offset(VTOFFSET.none_.v); return o == 0 ? false : true }
+ public var none_Count: Int32 { let o = _accessor.offset(VTOFFSET.none_.v); return o == 0 ? 0 : _accessor.vector(count: o) }
+ public func none_(at index: Int32) -> UInt64 { let o = _accessor.offset(VTOFFSET.none_.v); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) }
+ public var none_: [UInt64] { return _accessor.getVector(at: VTOFFSET.none_.v) ?? [] }
+ public var hasEmpty: Bool { let o = _accessor.offset(VTOFFSET.empty.v); return o == 0 ? false : true }
+ public var emptyCount: Int32 { let o = _accessor.offset(VTOFFSET.empty.v); return o == 0 ? 0 : _accessor.vector(count: o) }
+ public func empty(at index: Int32) -> UInt64 { let o = _accessor.offset(VTOFFSET.empty.v); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) }
+ public var empty: [UInt64] { return _accessor.getVector(at: VTOFFSET.empty.v) ?? [] }
+ public var hasArray: Bool { let o = _accessor.offset(VTOFFSET.array.v); return o == 0 ? false : true }
+ public var arrayCount: Int32 { let o = _accessor.offset(VTOFFSET.array.v); return o == 0 ? 0 : _accessor.vector(count: o) }
+ public func array(at index: Int32) -> UInt64 { let o = _accessor.offset(VTOFFSET.array.v); return o == 0 ? 0 : _accessor.directRead(of: UInt64.self, offset: _accessor.vector(at: o) + index * 8) }
+ public var array: [UInt64] { return _accessor.getVector(at: VTOFFSET.array.v) ?? [] }
+ public static func startVectors(_ fbb: inout FlatBufferBuilder) -> UOffset { fbb.startTable(with: 3) }
+ public static func addVectorOf(none_: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: none_, at: VTOFFSET.none_.p) }
+ public static func addVectorOf(empty: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: empty, at: VTOFFSET.empty.p) }
+ public static func addVectorOf(array: Offset, _ fbb: inout FlatBufferBuilder) { fbb.add(offset: array, at: VTOFFSET.array.p) }
+ public static func endVectors(_ fbb: inout FlatBufferBuilder, start: UOffset) -> Offset { let end = Offset(offset: fbb.endTable(at: start)); return end }
+ public static func createVectors(
+ _ fbb: inout FlatBufferBuilder,
+ none_VectorOffset none_: Offset = Offset(),
+ emptyVectorOffset empty: Offset = Offset(),
+ arrayVectorOffset array: Offset = Offset()
+ ) -> Offset {
+ let __start = Swift_Tests_Vectors.startVectors(&fbb)
+ Swift_Tests_Vectors.addVectorOf(none_: none_, &fbb)
+ Swift_Tests_Vectors.addVectorOf(empty: empty, &fbb)
+ Swift_Tests_Vectors.addVectorOf(array: array, &fbb)
+ return Swift_Tests_Vectors.endVectors(&fbb, start: __start)
+ }
+
+ public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws where T: Verifiable {
+ var _v = try verifier.visitTable(at: position)
+ try _v.visit(field: VTOFFSET.none_.p, fieldName: "none_", required: false, type: ForwardOffset<Vector<UInt64, UInt64>>.self)
+ try _v.visit(field: VTOFFSET.empty.p, fieldName: "empty", required: false, type: ForwardOffset<Vector<UInt64, UInt64>>.self)
+ try _v.visit(field: VTOFFSET.array.p, fieldName: "array", required: false, type: ForwardOffset<Vector<UInt64, UInt64>>.self)
+ _v.finish()
+ }
+}
+
+extension Swift_Tests_Vectors: Encodable {
+
+ enum CodingKeys: String, CodingKey {
+ case none_ = "none"
+ case empty = "empty"
+ case array = "array"
+ }
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ if none_Count > 0 {
+ try container.encodeIfPresent(none_, forKey: .none_)
+ }
+ if emptyCount > 0 {
+ try container.encodeIfPresent(empty, forKey: .empty)
+ }
+ if arrayCount > 0 {
+ try container.encodeIfPresent(array, forKey: .array)
+ }
+ }
+}
+
diff --git a/tests/FlatBuffers.Test.Swift/Tests/LinuxMain.swift b/tests/swift/tests/Tests/LinuxMain.swift
similarity index 100%
rename from tests/FlatBuffers.Test.Swift/Tests/LinuxMain.swift
rename to tests/swift/tests/Tests/LinuxMain.swift
diff --git a/tests/FlatBuffers.Test.Swift/monsterdata_test.mon b/tests/swift/tests/monsterdata_test.mon
similarity index 100%
rename from tests/FlatBuffers.Test.Swift/monsterdata_test.mon
rename to tests/swift/tests/monsterdata_test.mon
Binary files differ
diff --git a/tests/test.cpp b/tests/test.cpp
index 756c0ea..7e05c08 100644
--- a/tests/test.cpp
+++ b/tests/test.cpp
@@ -13,30 +13,44 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include <stdint.h>
+
#include <cmath>
+#include <memory>
#include <string>
+#include "evolution_test.h"
#include "flatbuffers/flatbuffers.h"
#include "flatbuffers/idl.h"
#include "flatbuffers/minireflect.h"
#include "flatbuffers/registry.h"
#include "flatbuffers/util.h"
+#include "fuzz_test.h"
+#include "json_test.h"
+#include "monster_test.h"
#include "monster_test_generated.h"
-#include "namespace_test/namespace_test1_generated.h"
-#include "namespace_test/namespace_test2_generated.h"
-#include "optional_scalars_generated.h"
+#include "optional_scalars_test.h"
+#include "native_inline_table_test_generated.h"
+#include "parser_test.h"
+#include "proto_test.h"
+#include "reflection_test.h"
#include "union_vector/union_vector_generated.h"
#if !defined(_MSC_VER) || _MSC_VER >= 1700
# include "arrays_test_generated.h"
-# include "evolution_test/evolution_v1_generated.h"
-# include "evolution_test/evolution_v2_generated.h"
-# include "monster_extra_generated.h"
#endif
-#include "flatbuffers/flexbuffers.h"
+#include "flexbuffers_test.h"
+#include "is_quiet_nan.h"
#include "monster_test_bfbs_generated.h" // Generated using --bfbs-comments --bfbs-builtins --cpp --bfbs-gen-embed
#include "native_type_test_generated.h"
#include "test_assert.h"
+#include "util_test.h"
+
+void FlatBufferBuilderTest();
+
+namespace flatbuffers {
+namespace tests {
+namespace {
// clang-format off
// Check that char* and uint8_t* are interoperable types.
@@ -53,573 +67,12 @@
#endif
// clang-format on
-// Shortcuts for the infinity.
-static const auto infinity_f = std::numeric_limits<float>::infinity();
-static const auto infinity_d = std::numeric_limits<double>::infinity();
-
using namespace MyGame::Example;
-void FlatBufferBuilderTest();
-
-// Include simple random number generator to ensure results will be the
-// same cross platform.
-// http://en.wikipedia.org/wiki/Park%E2%80%93Miller_random_number_generator
-uint32_t lcg_seed = 48271;
-uint32_t lcg_rand() {
- return lcg_seed =
- (static_cast<uint64_t>(lcg_seed) * 279470273UL) % 4294967291UL;
-}
-void lcg_reset() { lcg_seed = 48271; }
-
-std::string test_data_path =
-#ifdef BAZEL_TEST_DATA_PATH
- "../com_github_google_flatbuffers/tests/";
-#else
- "tests/";
-#endif
-
-// example of how to build up a serialized buffer algorithmically:
-flatbuffers::DetachedBuffer CreateFlatBufferTest(std::string &buffer) {
- flatbuffers::FlatBufferBuilder builder;
-
- auto vec = Vec3(1, 2, 3, 0, Color_Red, Test(10, 20));
-
- auto name = builder.CreateString("MyMonster");
-
- unsigned char inv_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
- auto inventory = builder.CreateVector(inv_data, 10);
-
- // Alternatively, create the vector first, and fill in data later:
- // unsigned char *inv_buf = nullptr;
- // auto inventory = builder.CreateUninitializedVector<unsigned char>(
- // 10, &inv_buf);
- // memcpy(inv_buf, inv_data, 10);
-
- Test tests[] = { Test(10, 20), Test(30, 40) };
- auto testv = builder.CreateVectorOfStructs(tests, 2);
-
- // Create a vector of structures from a lambda.
- auto testv2 = builder.CreateVectorOfStructs<Test>(
- 2, [&](size_t i, Test *s) -> void { *s = tests[i]; });
-
- // create monster with very few fields set:
- // (same functionality as CreateMonster below, but sets fields manually)
- flatbuffers::Offset<Monster> mlocs[3];
- auto fred = builder.CreateString("Fred");
- auto barney = builder.CreateString("Barney");
- auto wilma = builder.CreateString("Wilma");
- MonsterBuilder mb1(builder);
- mb1.add_name(fred);
- mlocs[0] = mb1.Finish();
- MonsterBuilder mb2(builder);
- mb2.add_name(barney);
- mb2.add_hp(1000);
- mlocs[1] = mb2.Finish();
- MonsterBuilder mb3(builder);
- mb3.add_name(wilma);
- mlocs[2] = mb3.Finish();
-
- // Create an array of strings. Also test string pooling, and lambdas.
- auto vecofstrings =
- builder.CreateVector<flatbuffers::Offset<flatbuffers::String>>(
- 4,
- [](size_t i, flatbuffers::FlatBufferBuilder *b)
- -> flatbuffers::Offset<flatbuffers::String> {
- static const char *names[] = { "bob", "fred", "bob", "fred" };
- return b->CreateSharedString(names[i]);
- },
- &builder);
-
- // Creating vectors of strings in one convenient call.
- std::vector<std::string> names2;
- names2.push_back("jane");
- names2.push_back("mary");
- auto vecofstrings2 = builder.CreateVectorOfStrings(names2);
-
- // Create many vectors of strings
- std::vector<std::string> manyNames;
- for (auto i = 0; i < 100; i++) { manyNames.push_back("john_doe"); }
- auto manyNamesVec = builder.CreateVectorOfStrings(manyNames);
- TEST_EQ(false, manyNamesVec.IsNull());
- auto manyNamesVec2 =
- builder.CreateVectorOfStrings(manyNames.cbegin(), manyNames.cend());
- TEST_EQ(false, manyNamesVec2.IsNull());
-
- // Create an array of sorted tables, can be used with binary search when read:
- auto vecoftables = builder.CreateVectorOfSortedTables(mlocs, 3);
-
- // Create an array of sorted structs,
- // can be used with binary search when read:
- std::vector<Ability> abilities;
- abilities.push_back(Ability(4, 40));
- abilities.push_back(Ability(3, 30));
- abilities.push_back(Ability(2, 20));
- abilities.push_back(Ability(0, 0));
- auto vecofstructs = builder.CreateVectorOfSortedStructs(&abilities);
-
- flatbuffers::Offset<Stat> mlocs_stats[1];
- auto miss = builder.CreateString("miss");
- StatBuilder mb_miss(builder);
- mb_miss.add_id(miss);
- mb_miss.add_val(0);
- mb_miss.add_count(0); // key
- mlocs_stats[0] = mb_miss.Finish();
- auto vec_of_stats = builder.CreateVectorOfSortedTables(mlocs_stats, 1);
-
- // Create a nested FlatBuffer.
- // Nested FlatBuffers are stored in a ubyte vector, which can be convenient
- // since they can be memcpy'd around much easier than other FlatBuffer
- // values. They have little overhead compared to storing the table directly.
- // As a test, create a mostly empty Monster buffer:
- flatbuffers::FlatBufferBuilder nested_builder;
- auto nmloc = CreateMonster(nested_builder, nullptr, 0, 0,
- nested_builder.CreateString("NestedMonster"));
- FinishMonsterBuffer(nested_builder, nmloc);
- // Now we can store the buffer in the parent. Note that by default, vectors
- // are only aligned to their elements or size field, so in this case if the
- // buffer contains 64-bit elements, they may not be correctly aligned. We fix
- // that with:
- builder.ForceVectorAlignment(nested_builder.GetSize(), sizeof(uint8_t),
- nested_builder.GetBufferMinAlignment());
- // If for whatever reason you don't have the nested_builder available, you
- // can substitute flatbuffers::largest_scalar_t (64-bit) for the alignment, or
- // the largest force_align value in your schema if you're using it.
- auto nested_flatbuffer_vector = builder.CreateVector(
- nested_builder.GetBufferPointer(), nested_builder.GetSize());
-
- // Test a nested FlexBuffer:
- flexbuffers::Builder flexbuild;
- flexbuild.Int(1234);
- flexbuild.Finish();
- auto flex = builder.CreateVector(flexbuild.GetBuffer());
- // Test vector of enums.
- Color colors[] = { Color_Blue, Color_Green };
- // We use this special creation function because we have an array of
- // pre-C++11 (enum class) enums whose size likely is int, yet its declared
- // type in the schema is byte.
- auto vecofcolors = builder.CreateVectorScalarCast<uint8_t, Color>(colors, 2);
-
- // shortcut for creating monster with all fields set:
- auto mloc = CreateMonster(
- builder, &vec, 150, 80, name, inventory, Color_Blue, Any_Monster,
- mlocs[1].Union(), // Store a union.
- testv, vecofstrings, vecoftables, 0, nested_flatbuffer_vector, 0, false,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 3.14159f, 3.0f, 0.0f, vecofstrings2,
- vecofstructs, flex, testv2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- AnyUniqueAliases_NONE, 0, AnyAmbiguousAliases_NONE, 0, vecofcolors,
- MyGame::Example::Race_None, 0, vec_of_stats);
-
- FinishMonsterBuffer(builder, mloc);
-
-// clang-format off
- #ifdef FLATBUFFERS_TEST_VERBOSE
- // print byte data for debugging:
- auto p = builder.GetBufferPointer();
- for (flatbuffers::uoffset_t i = 0; i < builder.GetSize(); i++)
- printf("%d ", p[i]);
- #endif
- // clang-format on
-
- // return the buffer for the caller to use.
- auto bufferpointer =
- reinterpret_cast<const char *>(builder.GetBufferPointer());
- buffer.assign(bufferpointer, bufferpointer + builder.GetSize());
-
- return builder.Release();
-}
-
-// example of accessing a buffer loaded in memory:
-void AccessFlatBufferTest(const uint8_t *flatbuf, size_t length,
- bool pooled = true) {
- // First, verify the buffers integrity (optional)
- flatbuffers::Verifier verifier(flatbuf, length);
- std::vector<uint8_t> flex_reuse_tracker;
- verifier.SetFlexReuseTracker(&flex_reuse_tracker);
- TEST_EQ(VerifyMonsterBuffer(verifier), true);
-
-// clang-format off
- #ifdef FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE
- std::vector<uint8_t> test_buff;
- test_buff.resize(length * 2);
- std::memcpy(&test_buff[0], flatbuf, length);
- std::memcpy(&test_buff[length], flatbuf, length);
-
- flatbuffers::Verifier verifier1(&test_buff[0], length);
- TEST_EQ(VerifyMonsterBuffer(verifier1), true);
- TEST_EQ(verifier1.GetComputedSize(), length);
-
- flatbuffers::Verifier verifier2(&test_buff[length], length);
- TEST_EQ(VerifyMonsterBuffer(verifier2), true);
- TEST_EQ(verifier2.GetComputedSize(), length);
- #endif
- // clang-format on
-
- TEST_EQ(strcmp(MonsterIdentifier(), "MONS"), 0);
- TEST_EQ(MonsterBufferHasIdentifier(flatbuf), true);
- TEST_EQ(strcmp(MonsterExtension(), "mon"), 0);
-
- // Access the buffer from the root.
- auto monster = GetMonster(flatbuf);
-
- TEST_EQ(monster->hp(), 80);
- TEST_EQ(monster->mana(), 150); // default
- TEST_EQ_STR(monster->name()->c_str(), "MyMonster");
- // Can't access the following field, it is deprecated in the schema,
- // which means accessors are not generated:
- // monster.friendly()
-
- auto pos = monster->pos();
- TEST_NOTNULL(pos);
- TEST_EQ(pos->z(), 3);
- TEST_EQ(pos->test3().a(), 10);
- TEST_EQ(pos->test3().b(), 20);
-
- auto inventory = monster->inventory();
- TEST_EQ(VectorLength(inventory), 10UL); // Works even if inventory is null.
- TEST_NOTNULL(inventory);
- unsigned char inv_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
- // Check compatibilty of iterators with STL.
- std::vector<unsigned char> inv_vec(inventory->begin(), inventory->end());
- size_t n = 0;
- for (auto it = inventory->begin(); it != inventory->end(); ++it, ++n) {
- auto indx = it - inventory->begin();
- TEST_EQ(*it, inv_vec.at(indx)); // Use bounds-check.
- TEST_EQ(*it, inv_data[indx]);
- }
- TEST_EQ(n, inv_vec.size());
-
- n = 0;
- for (auto it = inventory->cbegin(); it != inventory->cend(); ++it, ++n) {
- auto indx = it - inventory->cbegin();
- TEST_EQ(*it, inv_vec.at(indx)); // Use bounds-check.
- TEST_EQ(*it, inv_data[indx]);
- }
- TEST_EQ(n, inv_vec.size());
-
- n = 0;
- for (auto it = inventory->rbegin(); it != inventory->rend(); ++it, ++n) {
- auto indx = inventory->rend() - it - 1;
- TEST_EQ(*it, inv_vec.at(indx)); // Use bounds-check.
- TEST_EQ(*it, inv_data[indx]);
- }
- TEST_EQ(n, inv_vec.size());
-
- n = 0;
- for (auto it = inventory->crbegin(); it != inventory->crend(); ++it, ++n) {
- auto indx = inventory->crend() - it - 1;
- TEST_EQ(*it, inv_vec.at(indx)); // Use bounds-check.
- TEST_EQ(*it, inv_data[indx]);
- }
- TEST_EQ(n, inv_vec.size());
-
- TEST_EQ(monster->color(), Color_Blue);
-
- // Example of accessing a union:
- TEST_EQ(monster->test_type(), Any_Monster); // First make sure which it is.
- auto monster2 = reinterpret_cast<const Monster *>(monster->test());
- TEST_NOTNULL(monster2);
- TEST_EQ_STR(monster2->name()->c_str(), "Fred");
-
- // Example of accessing a vector of strings:
- auto vecofstrings = monster->testarrayofstring();
- TEST_EQ(vecofstrings->size(), 4U);
- TEST_EQ_STR(vecofstrings->Get(0)->c_str(), "bob");
- TEST_EQ_STR(vecofstrings->Get(1)->c_str(), "fred");
- if (pooled) {
- // These should have pointer equality because of string pooling.
- TEST_EQ(vecofstrings->Get(0)->c_str(), vecofstrings->Get(2)->c_str());
- TEST_EQ(vecofstrings->Get(1)->c_str(), vecofstrings->Get(3)->c_str());
- }
-
- auto vecofstrings2 = monster->testarrayofstring2();
- if (vecofstrings2) {
- TEST_EQ(vecofstrings2->size(), 2U);
- TEST_EQ_STR(vecofstrings2->Get(0)->c_str(), "jane");
- TEST_EQ_STR(vecofstrings2->Get(1)->c_str(), "mary");
- }
-
- // Example of accessing a vector of tables:
- auto vecoftables = monster->testarrayoftables();
- TEST_EQ(vecoftables->size(), 3U);
- for (auto it = vecoftables->begin(); it != vecoftables->end(); ++it) {
- TEST_EQ(strlen(it->name()->c_str()) >= 4, true);
- }
- TEST_EQ_STR(vecoftables->Get(0)->name()->c_str(), "Barney");
- TEST_EQ(vecoftables->Get(0)->hp(), 1000);
- TEST_EQ_STR(vecoftables->Get(1)->name()->c_str(), "Fred");
- TEST_EQ_STR(vecoftables->Get(2)->name()->c_str(), "Wilma");
- TEST_NOTNULL(vecoftables->LookupByKey("Barney"));
- TEST_NOTNULL(vecoftables->LookupByKey("Fred"));
- TEST_NOTNULL(vecoftables->LookupByKey("Wilma"));
-
- // Test accessing a vector of sorted structs
- auto vecofstructs = monster->testarrayofsortedstruct();
- if (vecofstructs) { // not filled in monster_test.bfbs
- for (flatbuffers::uoffset_t i = 0; i < vecofstructs->size() - 1; i++) {
- auto left = vecofstructs->Get(i);
- auto right = vecofstructs->Get(i + 1);
- TEST_EQ(true, (left->KeyCompareLessThan(right)));
- }
- TEST_NOTNULL(vecofstructs->LookupByKey(0)); // test default value
- TEST_NOTNULL(vecofstructs->LookupByKey(3));
- TEST_EQ(static_cast<const Ability *>(nullptr),
- vecofstructs->LookupByKey(5));
- }
-
- if (auto vec_of_stat = monster->scalar_key_sorted_tables()) {
- auto stat_0 = vec_of_stat->LookupByKey(static_cast<uint16_t>(0u));
- TEST_NOTNULL(stat_0);
- TEST_NOTNULL(stat_0->id());
- TEST_EQ(0, stat_0->count());
- TEST_EQ_STR("miss", stat_0->id()->c_str());
- }
-
- // Test nested FlatBuffers if available:
- auto nested_buffer = monster->testnestedflatbuffer();
- if (nested_buffer) {
- // nested_buffer is a vector of bytes you can memcpy. However, if you
- // actually want to access the nested data, this is a convenient
- // accessor that directly gives you the root table:
- auto nested_monster = monster->testnestedflatbuffer_nested_root();
- TEST_EQ_STR(nested_monster->name()->c_str(), "NestedMonster");
- }
-
- // Test flexbuffer if available:
- auto flex = monster->flex();
- // flex is a vector of bytes you can memcpy etc.
- TEST_EQ(flex->size(), 4); // Encoded FlexBuffer bytes.
- // However, if you actually want to access the nested data, this is a
- // convenient accessor that directly gives you the root value:
- TEST_EQ(monster->flex_flexbuffer_root().AsInt16(), 1234);
-
- // Test vector of enums:
- auto colors = monster->vector_of_enums();
- if (colors) {
- TEST_EQ(colors->size(), 2);
- TEST_EQ(colors->Get(0), Color_Blue);
- TEST_EQ(colors->Get(1), Color_Green);
- }
-
- // Since Flatbuffers uses explicit mechanisms to override the default
- // compiler alignment, double check that the compiler indeed obeys them:
- // (Test consists of a short and byte):
- TEST_EQ(flatbuffers::AlignOf<Test>(), 2UL);
- TEST_EQ(sizeof(Test), 4UL);
-
- const flatbuffers::Vector<const Test *> *tests_array[] = {
- monster->test4(),
- monster->test5(),
- };
- for (size_t i = 0; i < sizeof(tests_array) / sizeof(tests_array[0]); ++i) {
- auto tests = tests_array[i];
- TEST_NOTNULL(tests);
- auto test_0 = tests->Get(0);
- auto test_1 = tests->Get(1);
- TEST_EQ(test_0->a(), 10);
- TEST_EQ(test_0->b(), 20);
- TEST_EQ(test_1->a(), 30);
- TEST_EQ(test_1->b(), 40);
- for (auto it = tests->begin(); it != tests->end(); ++it) {
- TEST_EQ(it->a() == 10 || it->a() == 30, true); // Just testing iterators.
- }
- }
-
- // Checking for presence of fields:
- TEST_EQ(flatbuffers::IsFieldPresent(monster, Monster::VT_HP), true);
- TEST_EQ(flatbuffers::IsFieldPresent(monster, Monster::VT_MANA), false);
-
- // Obtaining a buffer from a root:
- TEST_EQ(GetBufferStartFromRootPointer(monster), flatbuf);
-}
-
-// Change a FlatBuffer in-place, after it has been constructed.
-void MutateFlatBuffersTest(uint8_t *flatbuf, std::size_t length) {
- // Get non-const pointer to root.
- auto monster = GetMutableMonster(flatbuf);
-
- // Each of these tests mutates, then tests, then set back to the original,
- // so we can test that the buffer in the end still passes our original test.
- auto hp_ok = monster->mutate_hp(10);
- TEST_EQ(hp_ok, true); // Field was present.
- TEST_EQ(monster->hp(), 10);
- // Mutate to default value
- auto hp_ok_default = monster->mutate_hp(100);
- TEST_EQ(hp_ok_default, true); // Field was present.
- TEST_EQ(monster->hp(), 100);
- // Test that mutate to default above keeps field valid for further mutations
- auto hp_ok_2 = monster->mutate_hp(20);
- TEST_EQ(hp_ok_2, true);
- TEST_EQ(monster->hp(), 20);
- monster->mutate_hp(80);
-
- // Monster originally at 150 mana (default value)
- auto mana_default_ok = monster->mutate_mana(150); // Mutate to default value.
- TEST_EQ(mana_default_ok,
- true); // Mutation should succeed, because default value.
- TEST_EQ(monster->mana(), 150);
- auto mana_ok = monster->mutate_mana(10);
- TEST_EQ(mana_ok, false); // Field was NOT present, because default value.
- TEST_EQ(monster->mana(), 150);
-
- // Mutate structs.
- auto pos = monster->mutable_pos();
- auto test3 = pos->mutable_test3(); // Struct inside a struct.
- test3.mutate_a(50); // Struct fields never fail.
- TEST_EQ(test3.a(), 50);
- test3.mutate_a(10);
-
- // Mutate vectors.
- auto inventory = monster->mutable_inventory();
- inventory->Mutate(9, 100);
- TEST_EQ(inventory->Get(9), 100);
- inventory->Mutate(9, 9);
-
- auto tables = monster->mutable_testarrayoftables();
- auto first = tables->GetMutableObject(0);
- TEST_EQ(first->hp(), 1000);
- first->mutate_hp(0);
- TEST_EQ(first->hp(), 0);
- first->mutate_hp(1000);
-
- // Mutate via LookupByKey
- TEST_NOTNULL(tables->MutableLookupByKey("Barney"));
- TEST_EQ(static_cast<Monster *>(nullptr),
- tables->MutableLookupByKey("DoesntExist"));
- TEST_EQ(tables->MutableLookupByKey("Barney")->hp(), 1000);
- TEST_EQ(tables->MutableLookupByKey("Barney")->mutate_hp(0), true);
- TEST_EQ(tables->LookupByKey("Barney")->hp(), 0);
- TEST_EQ(tables->MutableLookupByKey("Barney")->mutate_hp(1000), true);
-
- // Run the verifier and the regular test to make sure we didn't trample on
- // anything.
- AccessFlatBufferTest(flatbuf, length);
-}
-
-// Utility function to check a Monster object.
-void CheckMonsterObject(MonsterT *monster2) {
- TEST_EQ(monster2->hp, 80);
- TEST_EQ(monster2->mana, 150); // default
- TEST_EQ_STR(monster2->name.c_str(), "MyMonster");
-
- auto &pos = monster2->pos;
- TEST_NOTNULL(pos);
- TEST_EQ(pos->z(), 3);
- TEST_EQ(pos->test3().a(), 10);
- TEST_EQ(pos->test3().b(), 20);
-
- auto &inventory = monster2->inventory;
- TEST_EQ(inventory.size(), 10UL);
- unsigned char inv_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
- for (auto it = inventory.begin(); it != inventory.end(); ++it)
- TEST_EQ(*it, inv_data[it - inventory.begin()]);
-
- TEST_EQ(monster2->color, Color_Blue);
-
- auto monster3 = monster2->test.AsMonster();
- TEST_NOTNULL(monster3);
- TEST_EQ_STR(monster3->name.c_str(), "Fred");
-
- auto &vecofstrings = monster2->testarrayofstring;
- TEST_EQ(vecofstrings.size(), 4U);
- TEST_EQ_STR(vecofstrings[0].c_str(), "bob");
- TEST_EQ_STR(vecofstrings[1].c_str(), "fred");
-
- auto &vecofstrings2 = monster2->testarrayofstring2;
- TEST_EQ(vecofstrings2.size(), 2U);
- TEST_EQ_STR(vecofstrings2[0].c_str(), "jane");
- TEST_EQ_STR(vecofstrings2[1].c_str(), "mary");
-
- auto &vecoftables = monster2->testarrayoftables;
- TEST_EQ(vecoftables.size(), 3U);
- TEST_EQ_STR(vecoftables[0]->name.c_str(), "Barney");
- TEST_EQ(vecoftables[0]->hp, 1000);
- TEST_EQ_STR(vecoftables[1]->name.c_str(), "Fred");
- TEST_EQ_STR(vecoftables[2]->name.c_str(), "Wilma");
-
- auto &tests = monster2->test4;
- TEST_EQ(tests[0].a(), 10);
- TEST_EQ(tests[0].b(), 20);
- TEST_EQ(tests[1].a(), 30);
- TEST_EQ(tests[1].b(), 40);
-}
-
-// Unpack a FlatBuffer into objects.
-void ObjectFlatBuffersTest(uint8_t *flatbuf) {
- // Optional: we can specify resolver and rehasher functions to turn hashed
- // strings into object pointers and back, to implement remote references
- // and such.
- auto resolver = flatbuffers::resolver_function_t(
- [](void **pointer_adr, flatbuffers::hash_value_t hash) {
- (void)pointer_adr;
- (void)hash;
- // Don't actually do anything, leave variable null.
- });
- auto rehasher = flatbuffers::rehasher_function_t(
- [](void *pointer) -> flatbuffers::hash_value_t {
- (void)pointer;
- return 0;
- });
-
- // Turn a buffer into C++ objects.
- auto monster1 = UnPackMonster(flatbuf, &resolver);
-
- // Re-serialize the data.
- flatbuffers::FlatBufferBuilder fbb1;
- fbb1.Finish(CreateMonster(fbb1, monster1.get(), &rehasher),
- MonsterIdentifier());
-
- // Unpack again, and re-serialize again.
- auto monster2 = UnPackMonster(fbb1.GetBufferPointer(), &resolver);
- flatbuffers::FlatBufferBuilder fbb2;
- fbb2.Finish(CreateMonster(fbb2, monster2.get(), &rehasher),
- MonsterIdentifier());
-
- // Now we've gone full round-trip, the two buffers should match.
- const auto len1 = fbb1.GetSize();
- const auto len2 = fbb2.GetSize();
- TEST_EQ(len1, len2);
- TEST_EQ(memcmp(fbb1.GetBufferPointer(), fbb2.GetBufferPointer(), len1), 0);
-
- // Test it with the original buffer test to make sure all data survived.
- AccessFlatBufferTest(fbb2.GetBufferPointer(), len2, false);
-
- // Test accessing fields, similar to AccessFlatBufferTest above.
- CheckMonsterObject(monster2.get());
-
- // Test object copy.
- auto monster3 = *monster2;
- flatbuffers::FlatBufferBuilder fbb3;
- fbb3.Finish(CreateMonster(fbb3, &monster3, &rehasher), MonsterIdentifier());
- const auto len3 = fbb3.GetSize();
- TEST_EQ(len2, len3);
- TEST_EQ(memcmp(fbb2.GetBufferPointer(), fbb3.GetBufferPointer(), len2), 0);
- // Delete monster1 and monster2, then test accessing fields in monster3.
- monster1.reset();
- monster2.reset();
- CheckMonsterObject(&monster3);
-}
-
-// Prefix a FlatBuffer with a size field.
-void SizePrefixedTest() {
- // Create size prefixed buffer.
- flatbuffers::FlatBufferBuilder fbb;
- FinishSizePrefixedMonsterBuffer(
- fbb, CreateMonster(fbb, 0, 200, 300, fbb.CreateString("bob")));
-
- // Verify it.
- flatbuffers::Verifier verifier(fbb.GetBufferPointer(), fbb.GetSize());
- TEST_EQ(VerifySizePrefixedMonsterBuffer(verifier), true);
-
- // Access it.
- auto m = GetSizePrefixedMonster(fbb.GetBufferPointer());
- TEST_EQ(m->mana(), 200);
- TEST_EQ(m->hp(), 300);
- TEST_EQ_STR(m->name()->c_str(), "bob");
-}
-
void TriviallyCopyableTest() {
// clang-format off
- #if __GNUG__ && __GNUC__ < 5
+ #if __GNUG__ && __GNUC__ < 5 && \
+ !(defined(__clang__) && __clang_major__ >= 16)
TEST_EQ(__has_trivial_copy(Vec3), true);
#else
#if __cplusplus >= 201103L
@@ -629,1693 +82,18 @@
// clang-format on
}
-// Check stringify of an default enum value to json
-void JsonDefaultTest() {
- // load FlatBuffer schema (.fbs) from disk
- std::string schemafile;
- TEST_EQ(flatbuffers::LoadFile((test_data_path + "monster_test.fbs").c_str(),
- false, &schemafile),
- true);
- // parse schema first, so we can use it to parse the data after
- flatbuffers::Parser parser;
- auto include_test_path =
- flatbuffers::ConCatPathFileName(test_data_path, "include_test");
- const char *include_directories[] = { test_data_path.c_str(),
- include_test_path.c_str(), nullptr };
-
- TEST_EQ(parser.Parse(schemafile.c_str(), include_directories), true);
- // create incomplete monster and store to json
- parser.opts.output_default_scalars_in_json = true;
- parser.opts.output_enum_identifiers = true;
- flatbuffers::FlatBufferBuilder builder;
- auto name = builder.CreateString("default_enum");
- MonsterBuilder color_monster(builder);
- color_monster.add_name(name);
- FinishMonsterBuffer(builder, color_monster.Finish());
- std::string jsongen;
- auto result = GenerateText(parser, builder.GetBufferPointer(), &jsongen);
- TEST_EQ(result, true);
- // default value of the "color" field is Blue
- TEST_EQ(std::string::npos != jsongen.find("color: \"Blue\""), true);
- // default value of the "testf" field is 3.14159
- TEST_EQ(std::string::npos != jsongen.find("testf: 3.14159"), true);
-}
-
-void JsonEnumsTest() {
- // load FlatBuffer schema (.fbs) from disk
- std::string schemafile;
- TEST_EQ(flatbuffers::LoadFile((test_data_path + "monster_test.fbs").c_str(),
- false, &schemafile),
- true);
- // parse schema first, so we can use it to parse the data after
- flatbuffers::Parser parser;
- auto include_test_path =
- flatbuffers::ConCatPathFileName(test_data_path, "include_test");
- const char *include_directories[] = { test_data_path.c_str(),
- include_test_path.c_str(), nullptr };
- parser.opts.output_enum_identifiers = true;
- TEST_EQ(parser.Parse(schemafile.c_str(), include_directories), true);
- flatbuffers::FlatBufferBuilder builder;
- auto name = builder.CreateString("bitflag_enum");
- MonsterBuilder color_monster(builder);
- color_monster.add_name(name);
- color_monster.add_color(Color(Color_Blue | Color_Red));
- FinishMonsterBuffer(builder, color_monster.Finish());
- std::string jsongen;
- auto result = GenerateText(parser, builder.GetBufferPointer(), &jsongen);
- TEST_EQ(result, true);
- TEST_EQ(std::string::npos != jsongen.find("color: \"Red Blue\""), true);
- // Test forward compatibility with 'output_enum_identifiers = true'.
- // Current Color doesn't have '(1u << 2)' field, let's add it.
- builder.Clear();
- std::string future_json;
- auto future_name = builder.CreateString("future bitflag_enum");
- MonsterBuilder future_color(builder);
- future_color.add_name(future_name);
- future_color.add_color(
- static_cast<Color>((1u << 2) | Color_Blue | Color_Red));
- FinishMonsterBuffer(builder, future_color.Finish());
- result = GenerateText(parser, builder.GetBufferPointer(), &future_json);
- TEST_EQ(result, true);
- TEST_EQ(std::string::npos != future_json.find("color: 13"), true);
-}
-
-#if defined(FLATBUFFERS_HAS_NEW_STRTOD) && (FLATBUFFERS_HAS_NEW_STRTOD > 0)
-// The IEEE-754 quiet_NaN is not simple binary constant.
-// All binary NaN bit strings have all the bits of the biased exponent field E
-// set to 1. A quiet NaN bit string should be encoded with the first bit d[1]
-// of the trailing significand field T being 1 (d[0] is implicit bit).
-// It is assumed that endianness of floating-point is same as integer.
-template<typename T, typename U, U qnan_base> bool is_quiet_nan_impl(T v) {
- static_assert(sizeof(T) == sizeof(U), "unexpected");
- U b = 0;
- std::memcpy(&b, &v, sizeof(T));
- return ((b & qnan_base) == qnan_base);
-}
-# if defined(__mips__) || defined(__hppa__)
-static bool is_quiet_nan(float v) {
- return is_quiet_nan_impl<float, uint32_t, 0x7FC00000u>(v) ||
- is_quiet_nan_impl<float, uint32_t, 0x7FBFFFFFu>(v);
-}
-static bool is_quiet_nan(double v) {
- return is_quiet_nan_impl<double, uint64_t, 0x7FF8000000000000ul>(v) ||
- is_quiet_nan_impl<double, uint64_t, 0x7FF7FFFFFFFFFFFFu>(v);
-}
-# else
-static bool is_quiet_nan(float v) {
- return is_quiet_nan_impl<float, uint32_t, 0x7FC00000u>(v);
-}
-static bool is_quiet_nan(double v) {
- return is_quiet_nan_impl<double, uint64_t, 0x7FF8000000000000ul>(v);
-}
-# endif
-
-void TestMonsterExtraFloats() {
- TEST_EQ(is_quiet_nan(1.0), false);
- TEST_EQ(is_quiet_nan(infinity_d), false);
- TEST_EQ(is_quiet_nan(-infinity_f), false);
- TEST_EQ(is_quiet_nan(std::numeric_limits<float>::quiet_NaN()), true);
- TEST_EQ(is_quiet_nan(std::numeric_limits<double>::quiet_NaN()), true);
-
- using namespace flatbuffers;
- using namespace MyGame;
- // Load FlatBuffer schema (.fbs) from disk.
- std::string schemafile;
- TEST_EQ(LoadFile((test_data_path + "monster_extra.fbs").c_str(), false,
- &schemafile),
- true);
- // Parse schema first, so we can use it to parse the data after.
- Parser parser;
- auto include_test_path = ConCatPathFileName(test_data_path, "include_test");
- const char *include_directories[] = { test_data_path.c_str(),
- include_test_path.c_str(), nullptr };
- TEST_EQ(parser.Parse(schemafile.c_str(), include_directories), true);
- // Create empty extra and store to json.
- parser.opts.output_default_scalars_in_json = true;
- parser.opts.output_enum_identifiers = true;
- FlatBufferBuilder builder;
- const auto def_root = MonsterExtraBuilder(builder).Finish();
- FinishMonsterExtraBuffer(builder, def_root);
- const auto def_obj = builder.GetBufferPointer();
- const auto def_extra = GetMonsterExtra(def_obj);
- TEST_NOTNULL(def_extra);
- TEST_EQ(is_quiet_nan(def_extra->f0()), true);
- TEST_EQ(is_quiet_nan(def_extra->f1()), true);
- TEST_EQ(def_extra->f2(), +infinity_f);
- TEST_EQ(def_extra->f3(), -infinity_f);
- TEST_EQ(is_quiet_nan(def_extra->d0()), true);
- TEST_EQ(is_quiet_nan(def_extra->d1()), true);
- TEST_EQ(def_extra->d2(), +infinity_d);
- TEST_EQ(def_extra->d3(), -infinity_d);
- std::string jsongen;
- auto result = GenerateText(parser, def_obj, &jsongen);
- TEST_EQ(result, true);
- // Check expected default values.
- TEST_EQ(std::string::npos != jsongen.find("f0: nan"), true);
- TEST_EQ(std::string::npos != jsongen.find("f1: nan"), true);
- TEST_EQ(std::string::npos != jsongen.find("f2: inf"), true);
- TEST_EQ(std::string::npos != jsongen.find("f3: -inf"), true);
- TEST_EQ(std::string::npos != jsongen.find("d0: nan"), true);
- TEST_EQ(std::string::npos != jsongen.find("d1: nan"), true);
- TEST_EQ(std::string::npos != jsongen.find("d2: inf"), true);
- TEST_EQ(std::string::npos != jsongen.find("d3: -inf"), true);
- // Parse 'mosterdata_extra.json'.
- const auto extra_base = test_data_path + "monsterdata_extra";
- jsongen = "";
- TEST_EQ(LoadFile((extra_base + ".json").c_str(), false, &jsongen), true);
- TEST_EQ(parser.Parse(jsongen.c_str()), true);
- const auto test_file = parser.builder_.GetBufferPointer();
- const auto test_size = parser.builder_.GetSize();
- Verifier verifier(test_file, test_size);
- TEST_ASSERT(VerifyMonsterExtraBuffer(verifier));
- const auto extra = GetMonsterExtra(test_file);
- TEST_NOTNULL(extra);
- TEST_EQ(is_quiet_nan(extra->f0()), true);
- TEST_EQ(is_quiet_nan(extra->f1()), true);
- TEST_EQ(extra->f2(), +infinity_f);
- TEST_EQ(extra->f3(), -infinity_f);
- TEST_EQ(is_quiet_nan(extra->d0()), true);
- TEST_EQ(extra->d1(), +infinity_d);
- TEST_EQ(extra->d2(), -infinity_d);
- TEST_EQ(is_quiet_nan(extra->d3()), true);
- TEST_NOTNULL(extra->fvec());
- TEST_EQ(extra->fvec()->size(), 4);
- TEST_EQ(extra->fvec()->Get(0), 1.0f);
- TEST_EQ(extra->fvec()->Get(1), -infinity_f);
- TEST_EQ(extra->fvec()->Get(2), +infinity_f);
- TEST_EQ(is_quiet_nan(extra->fvec()->Get(3)), true);
- TEST_NOTNULL(extra->dvec());
- TEST_EQ(extra->dvec()->size(), 4);
- TEST_EQ(extra->dvec()->Get(0), 2.0);
- TEST_EQ(extra->dvec()->Get(1), +infinity_d);
- TEST_EQ(extra->dvec()->Get(2), -infinity_d);
- TEST_EQ(is_quiet_nan(extra->dvec()->Get(3)), true);
-}
-#else
-void TestMonsterExtraFloats() {}
-#endif
-
-// example of parsing text straight into a buffer, and generating
-// text back from it:
-void ParseAndGenerateTextTest(bool binary) {
- // load FlatBuffer schema (.fbs) and JSON from disk
- std::string schemafile;
- std::string jsonfile;
- TEST_EQ(flatbuffers::LoadFile(
- (test_data_path + "monster_test." + (binary ? "bfbs" : "fbs"))
- .c_str(),
- binary, &schemafile),
- true);
- TEST_EQ(flatbuffers::LoadFile(
- (test_data_path + "monsterdata_test.golden").c_str(), false,
- &jsonfile),
- true);
-
- auto include_test_path =
- flatbuffers::ConCatPathFileName(test_data_path, "include_test");
- const char *include_directories[] = { test_data_path.c_str(),
- include_test_path.c_str(), nullptr };
-
- // parse schema first, so we can use it to parse the data after
- flatbuffers::Parser parser;
- if (binary) {
- flatbuffers::Verifier verifier(
- reinterpret_cast<const uint8_t *>(schemafile.c_str()),
- schemafile.size());
- TEST_EQ(reflection::VerifySchemaBuffer(verifier), true);
- // auto schema = reflection::GetSchema(schemafile.c_str());
- TEST_EQ(parser.Deserialize((const uint8_t *)schemafile.c_str(),
- schemafile.size()),
- true);
- } else {
- TEST_EQ(parser.Parse(schemafile.c_str(), include_directories), true);
- }
- TEST_EQ(parser.ParseJson(jsonfile.c_str()), true);
-
- // here, parser.builder_ contains a binary buffer that is the parsed data.
-
- // First, verify it, just in case:
- flatbuffers::Verifier verifier(parser.builder_.GetBufferPointer(),
- parser.builder_.GetSize());
- TEST_EQ(VerifyMonsterBuffer(verifier), true);
-
- AccessFlatBufferTest(parser.builder_.GetBufferPointer(),
- parser.builder_.GetSize(), false);
-
- // to ensure it is correct, we now generate text back from the binary,
- // and compare the two:
- std::string jsongen;
- auto result =
- GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen);
- TEST_EQ(result, true);
- TEST_EQ_STR(jsongen.c_str(), jsonfile.c_str());
-
- // We can also do the above using the convenient Registry that knows about
- // a set of file_identifiers mapped to schemas.
- flatbuffers::Registry registry;
- // Make sure schemas can find their includes.
- registry.AddIncludeDirectory(test_data_path.c_str());
- registry.AddIncludeDirectory(include_test_path.c_str());
- // Call this with many schemas if possible.
- registry.Register(MonsterIdentifier(),
- (test_data_path + "monster_test.fbs").c_str());
- // Now we got this set up, we can parse by just specifying the identifier,
- // the correct schema will be loaded on the fly:
- auto buf = registry.TextToFlatBuffer(jsonfile.c_str(), MonsterIdentifier());
- // If this fails, check registry.lasterror_.
- TEST_NOTNULL(buf.data());
- // Test the buffer, to be sure:
- AccessFlatBufferTest(buf.data(), buf.size(), false);
- // We can use the registry to turn this back into text, in this case it
- // will get the file_identifier from the binary:
- std::string text;
- auto ok = registry.FlatBufferToText(buf.data(), buf.size(), &text);
- // If this fails, check registry.lasterror_.
- TEST_EQ(ok, true);
- TEST_EQ_STR(text.c_str(), jsonfile.c_str());
-
- // Generate text for UTF-8 strings without escapes.
- std::string jsonfile_utf8;
- TEST_EQ(flatbuffers::LoadFile((test_data_path + "unicode_test.json").c_str(),
- false, &jsonfile_utf8),
- true);
- TEST_EQ(parser.Parse(jsonfile_utf8.c_str(), include_directories), true);
- // To ensure it is correct, generate utf-8 text back from the binary.
- std::string jsongen_utf8;
- // request natural printing for utf-8 strings
- parser.opts.natural_utf8 = true;
- parser.opts.strict_json = true;
- TEST_EQ(
- GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen_utf8),
- true);
- TEST_EQ_STR(jsongen_utf8.c_str(), jsonfile_utf8.c_str());
-}
-
-void ReflectionTest(uint8_t *flatbuf, size_t length) {
- // Load a binary schema.
- std::string bfbsfile;
- TEST_EQ(flatbuffers::LoadFile((test_data_path + "monster_test.bfbs").c_str(),
- true, &bfbsfile),
- true);
-
- // Verify it, just in case:
- flatbuffers::Verifier verifier(
- reinterpret_cast<const uint8_t *>(bfbsfile.c_str()), bfbsfile.length());
- TEST_EQ(reflection::VerifySchemaBuffer(verifier), true);
-
- // Make sure the schema is what we expect it to be.
- auto &schema = *reflection::GetSchema(bfbsfile.c_str());
- auto root_table = schema.root_table();
-
- // Check the declaration files.
- TEST_EQ_STR(root_table->name()->c_str(), "MyGame.Example.Monster");
- TEST_EQ_STR(root_table->declaration_file()->c_str(), "//monster_test.fbs");
- TEST_EQ_STR(
- schema.objects()->LookupByKey("TableA")->declaration_file()->c_str(),
- "//include_test/include_test1.fbs");
- TEST_EQ_STR(schema.objects()
- ->LookupByKey("MyGame.OtherNameSpace.Unused")
- ->declaration_file()
- ->c_str(),
- "//include_test/sub/include_test2.fbs");
- TEST_EQ_STR(schema.enums()
- ->LookupByKey("MyGame.OtherNameSpace.FromInclude")
- ->declaration_file()
- ->c_str(),
- "//include_test/sub/include_test2.fbs");
-
- // Check scheam filenames and their includes.
- TEST_EQ(schema.fbs_files()->size(), 3);
-
- const auto fbs0 = schema.fbs_files()->Get(0);
- TEST_EQ_STR(fbs0->filename()->c_str(), "//include_test/include_test1.fbs");
- const auto fbs0_includes = fbs0->included_filenames();
- TEST_EQ(fbs0_includes->size(), 2);
-
- // TODO(caspern): Should we force or disallow inclusion of self?
- TEST_EQ_STR(fbs0_includes->Get(0)->c_str(),
- "//include_test/include_test1.fbs");
- TEST_EQ_STR(fbs0_includes->Get(1)->c_str(),
- "//include_test/sub/include_test2.fbs");
-
- const auto fbs1 = schema.fbs_files()->Get(1);
- TEST_EQ_STR(fbs1->filename()->c_str(),
- "//include_test/sub/include_test2.fbs");
- const auto fbs1_includes = fbs1->included_filenames();
- TEST_EQ(fbs1_includes->size(), 2);
- TEST_EQ_STR(fbs1_includes->Get(0)->c_str(),
- "//include_test/include_test1.fbs");
- TEST_EQ_STR(fbs1_includes->Get(1)->c_str(),
- "//include_test/sub/include_test2.fbs");
-
- const auto fbs2 = schema.fbs_files()->Get(2);
- TEST_EQ_STR(fbs2->filename()->c_str(), "//monster_test.fbs");
- const auto fbs2_includes = fbs2->included_filenames();
- TEST_EQ(fbs2_includes->size(), 1);
- TEST_EQ_STR(fbs2_includes->Get(0)->c_str(),
- "//include_test/include_test1.fbs");
-
- // Check Root table fields
- auto fields = root_table->fields();
- auto hp_field_ptr = fields->LookupByKey("hp");
- TEST_NOTNULL(hp_field_ptr);
- auto &hp_field = *hp_field_ptr;
- TEST_EQ_STR(hp_field.name()->c_str(), "hp");
- TEST_EQ(hp_field.id(), 2);
- TEST_EQ(hp_field.type()->base_type(), reflection::Short);
-
- auto friendly_field_ptr = fields->LookupByKey("friendly");
- TEST_NOTNULL(friendly_field_ptr);
- TEST_NOTNULL(friendly_field_ptr->attributes());
- TEST_NOTNULL(friendly_field_ptr->attributes()->LookupByKey("priority"));
-
- // Make sure the table index is what we expect it to be.
- auto pos_field_ptr = fields->LookupByKey("pos");
- TEST_NOTNULL(pos_field_ptr);
- TEST_EQ(pos_field_ptr->type()->base_type(), reflection::Obj);
- auto pos_table_ptr = schema.objects()->Get(pos_field_ptr->type()->index());
- TEST_NOTNULL(pos_table_ptr);
- TEST_EQ_STR(pos_table_ptr->name()->c_str(), "MyGame.Example.Vec3");
-
- // Test nullability of fields: hp is a 0-default scalar, pos is a struct =>
- // optional, and name is a required string => not optional.
- TEST_EQ(hp_field.optional(), false);
- TEST_EQ(pos_field_ptr->optional(), true);
- TEST_EQ(fields->LookupByKey("name")->optional(), false);
-
- // Now use it to dynamically access a buffer.
- auto &root = *flatbuffers::GetAnyRoot(flatbuf);
-
- // Verify the buffer first using reflection based verification
- TEST_EQ(flatbuffers::Verify(schema, *schema.root_table(), flatbuf, length),
- true);
-
- auto hp = flatbuffers::GetFieldI<uint16_t>(root, hp_field);
- TEST_EQ(hp, 80);
-
- // Rather than needing to know the type, we can also get the value of
- // any field as an int64_t/double/string, regardless of what it actually is.
- auto hp_int64 = flatbuffers::GetAnyFieldI(root, hp_field);
- TEST_EQ(hp_int64, 80);
- auto hp_double = flatbuffers::GetAnyFieldF(root, hp_field);
- TEST_EQ(hp_double, 80.0);
- auto hp_string = flatbuffers::GetAnyFieldS(root, hp_field, &schema);
- TEST_EQ_STR(hp_string.c_str(), "80");
-
- // Get struct field through reflection
- auto pos_struct = flatbuffers::GetFieldStruct(root, *pos_field_ptr);
- TEST_NOTNULL(pos_struct);
- TEST_EQ(flatbuffers::GetAnyFieldF(*pos_struct,
- *pos_table_ptr->fields()->LookupByKey("z")),
- 3.0f);
-
- auto test3_field = pos_table_ptr->fields()->LookupByKey("test3");
- auto test3_struct = flatbuffers::GetFieldStruct(*pos_struct, *test3_field);
- TEST_NOTNULL(test3_struct);
- auto test3_object = schema.objects()->Get(test3_field->type()->index());
-
- TEST_EQ(flatbuffers::GetAnyFieldF(*test3_struct,
- *test3_object->fields()->LookupByKey("a")),
- 10);
-
- // We can also modify it.
- flatbuffers::SetField<uint16_t>(&root, hp_field, 200);
- hp = flatbuffers::GetFieldI<uint16_t>(root, hp_field);
- TEST_EQ(hp, 200);
-
- // We can also set fields generically:
- flatbuffers::SetAnyFieldI(&root, hp_field, 300);
- hp_int64 = flatbuffers::GetAnyFieldI(root, hp_field);
- TEST_EQ(hp_int64, 300);
- flatbuffers::SetAnyFieldF(&root, hp_field, 300.5);
- hp_int64 = flatbuffers::GetAnyFieldI(root, hp_field);
- TEST_EQ(hp_int64, 300);
- flatbuffers::SetAnyFieldS(&root, hp_field, "300");
- hp_int64 = flatbuffers::GetAnyFieldI(root, hp_field);
- TEST_EQ(hp_int64, 300);
-
- // Test buffer is valid after the modifications
- TEST_EQ(flatbuffers::Verify(schema, *schema.root_table(), flatbuf, length),
- true);
-
- // Reset it, for further tests.
- flatbuffers::SetField<uint16_t>(&root, hp_field, 80);
-
- // More advanced functionality: changing the size of items in-line!
- // First we put the FlatBuffer inside an std::vector.
- std::vector<uint8_t> resizingbuf(flatbuf, flatbuf + length);
- // Find the field we want to modify.
- auto &name_field = *fields->LookupByKey("name");
- // Get the root.
- // This time we wrap the result from GetAnyRoot in a smartpointer that
- // will keep rroot valid as resizingbuf resizes.
- auto rroot = flatbuffers::piv(flatbuffers::GetAnyRoot(resizingbuf.data()),
- resizingbuf);
- SetString(schema, "totally new string", GetFieldS(**rroot, name_field),
- &resizingbuf);
- // Here resizingbuf has changed, but rroot is still valid.
- TEST_EQ_STR(GetFieldS(**rroot, name_field)->c_str(), "totally new string");
- // Now lets extend a vector by 100 elements (10 -> 110).
- auto &inventory_field = *fields->LookupByKey("inventory");
- auto rinventory = flatbuffers::piv(
- flatbuffers::GetFieldV<uint8_t>(**rroot, inventory_field), resizingbuf);
- flatbuffers::ResizeVector<uint8_t>(schema, 110, 50, *rinventory,
- &resizingbuf);
- // rinventory still valid, so lets read from it.
- TEST_EQ(rinventory->Get(10), 50);
-
- // For reflection uses not covered already, there is a more powerful way:
- // we can simply generate whatever object we want to add/modify in a
- // FlatBuffer of its own, then add that to an existing FlatBuffer:
- // As an example, let's add a string to an array of strings.
- // First, find our field:
- auto &testarrayofstring_field = *fields->LookupByKey("testarrayofstring");
- // Find the vector value:
- auto rtestarrayofstring = flatbuffers::piv(
- flatbuffers::GetFieldV<flatbuffers::Offset<flatbuffers::String>>(
- **rroot, testarrayofstring_field),
- resizingbuf);
- // It's a vector of 2 strings, to which we add one more, initialized to
- // offset 0.
- flatbuffers::ResizeVector<flatbuffers::Offset<flatbuffers::String>>(
- schema, 3, 0, *rtestarrayofstring, &resizingbuf);
- // Here we just create a buffer that contans a single string, but this
- // could also be any complex set of tables and other values.
- flatbuffers::FlatBufferBuilder stringfbb;
- stringfbb.Finish(stringfbb.CreateString("hank"));
- // Add the contents of it to our existing FlatBuffer.
- // We do this last, so the pointer doesn't get invalidated (since it is
- // at the end of the buffer):
- auto string_ptr = flatbuffers::AddFlatBuffer(
- resizingbuf, stringfbb.GetBufferPointer(), stringfbb.GetSize());
- // Finally, set the new value in the vector.
- rtestarrayofstring->MutateOffset(2, string_ptr);
- TEST_EQ_STR(rtestarrayofstring->Get(0)->c_str(), "bob");
- TEST_EQ_STR(rtestarrayofstring->Get(2)->c_str(), "hank");
- // Test integrity of all resize operations above.
- flatbuffers::Verifier resize_verifier(
- reinterpret_cast<const uint8_t *>(resizingbuf.data()),
- resizingbuf.size());
- TEST_EQ(VerifyMonsterBuffer(resize_verifier), true);
-
- // Test buffer is valid using reflection as well
- TEST_EQ(flatbuffers::Verify(schema, *schema.root_table(), resizingbuf.data(),
- resizingbuf.size()),
- true);
-
- // As an additional test, also set it on the name field.
- // Note: unlike the name change above, this just overwrites the offset,
- // rather than changing the string in-place.
- SetFieldT(*rroot, name_field, string_ptr);
- TEST_EQ_STR(GetFieldS(**rroot, name_field)->c_str(), "hank");
-
- // Using reflection, rather than mutating binary FlatBuffers, we can also copy
- // tables and other things out of other FlatBuffers into a FlatBufferBuilder,
- // either part or whole.
- flatbuffers::FlatBufferBuilder fbb;
- auto root_offset = flatbuffers::CopyTable(
- fbb, schema, *root_table, *flatbuffers::GetAnyRoot(flatbuf), true);
- fbb.Finish(root_offset, MonsterIdentifier());
- // Test that it was copied correctly:
- AccessFlatBufferTest(fbb.GetBufferPointer(), fbb.GetSize());
-
- // Test buffer is valid using reflection as well
- TEST_EQ(flatbuffers::Verify(schema, *schema.root_table(),
- fbb.GetBufferPointer(), fbb.GetSize()),
- true);
-}
-
-void MiniReflectFlatBuffersTest(uint8_t *flatbuf) {
- auto s =
- flatbuffers::FlatBufferToString(flatbuf, Monster::MiniReflectTypeTable());
- TEST_EQ_STR(
- s.c_str(),
- "{ "
- "pos: { x: 1.0, y: 2.0, z: 3.0, test1: 0.0, test2: Red, test3: "
- "{ a: 10, b: 20 } }, "
- "hp: 80, "
- "name: \"MyMonster\", "
- "inventory: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], "
- "test_type: Monster, "
- "test: { name: \"Fred\" }, "
- "test4: [ { a: 10, b: 20 }, { a: 30, b: 40 } ], "
- "testarrayofstring: [ \"bob\", \"fred\", \"bob\", \"fred\" ], "
- "testarrayoftables: [ { hp: 1000, name: \"Barney\" }, { name: \"Fred\" "
- "}, "
- "{ name: \"Wilma\" } ], "
- // TODO(wvo): should really print this nested buffer correctly.
- "testnestedflatbuffer: [ 20, 0, 0, 0, 77, 79, 78, 83, 12, 0, 12, 0, 0, "
- "0, "
- "4, 0, 6, 0, 8, 0, 12, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 13, 0, 0, 0, 78, "
- "101, 115, 116, 101, 100, 77, 111, 110, 115, 116, 101, 114, 0, 0, 0 ], "
- "testarrayofstring2: [ \"jane\", \"mary\" ], "
- "testarrayofsortedstruct: [ { id: 0, distance: 0 }, "
- "{ id: 2, distance: 20 }, { id: 3, distance: 30 }, "
- "{ id: 4, distance: 40 } ], "
- "flex: [ 210, 4, 5, 2 ], "
- "test5: [ { a: 10, b: 20 }, { a: 30, b: 40 } ], "
- "vector_of_enums: [ Blue, Green ], "
- "scalar_key_sorted_tables: [ { id: \"miss\" } ] "
- "}");
-
- Test test(16, 32);
- Vec3 vec(1, 2, 3, 1.5, Color_Red, test);
- flatbuffers::FlatBufferBuilder vec_builder;
- vec_builder.Finish(vec_builder.CreateStruct(vec));
- auto vec_buffer = vec_builder.Release();
- auto vec_str = flatbuffers::FlatBufferToString(vec_buffer.data(),
- Vec3::MiniReflectTypeTable());
- TEST_EQ_STR(vec_str.c_str(),
- "{ x: 1.0, y: 2.0, z: 3.0, test1: 1.5, test2: Red, test3: { a: "
- "16, b: 32 } }");
-}
-
-void MiniReflectFixedLengthArrayTest() {
- // VS10 does not support typed enums, exclude from tests
-#if !defined(_MSC_VER) || _MSC_VER >= 1700
- flatbuffers::FlatBufferBuilder fbb;
- MyGame::Example::ArrayStruct aStruct(2, 12, 1);
- auto aTable = MyGame::Example::CreateArrayTable(fbb, &aStruct);
- fbb.Finish(aTable);
-
- auto flatbuf = fbb.Release();
- auto s = flatbuffers::FlatBufferToString(
- flatbuf.data(), MyGame::Example::ArrayTableTypeTable());
- TEST_EQ_STR(
- "{ "
- "a: { a: 2.0, "
- "b: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], "
- "c: 12, "
- "d: [ { a: [ 0, 0 ], b: A, c: [ A, A ], d: [ 0, 0 ] }, "
- "{ a: [ 0, 0 ], b: A, c: [ A, A ], d: [ 0, 0 ] } ], "
- "e: 1, f: [ 0, 0 ] } "
- "}",
- s.c_str());
-#endif
-}
-
-// Parse a .proto schema, output as .fbs
-void ParseProtoTest() {
- // load the .proto and the golden file from disk
- std::string protofile;
- std::string goldenfile;
- std::string goldenunionfile;
- TEST_EQ(
- flatbuffers::LoadFile((test_data_path + "prototest/test.proto").c_str(),
- false, &protofile),
- true);
- TEST_EQ(
- flatbuffers::LoadFile((test_data_path + "prototest/test.golden").c_str(),
- false, &goldenfile),
- true);
- TEST_EQ(flatbuffers::LoadFile(
- (test_data_path + "prototest/test_union.golden").c_str(), false,
- &goldenunionfile),
- true);
-
- flatbuffers::IDLOptions opts;
- opts.include_dependence_headers = false;
- opts.proto_mode = true;
-
- // Parse proto.
- flatbuffers::Parser parser(opts);
- auto protopath = test_data_path + "prototest/";
- const char *include_directories[] = { protopath.c_str(), nullptr };
- TEST_EQ(parser.Parse(protofile.c_str(), include_directories), true);
-
- // Generate fbs.
- auto fbs = flatbuffers::GenerateFBS(parser, "test");
-
- // Ensure generated file is parsable.
- flatbuffers::Parser parser2;
- TEST_EQ(parser2.Parse(fbs.c_str(), nullptr), true);
- TEST_EQ_STR(fbs.c_str(), goldenfile.c_str());
-
- // Parse proto with --oneof-union option.
- opts.proto_oneof_union = true;
- flatbuffers::Parser parser3(opts);
- TEST_EQ(parser3.Parse(protofile.c_str(), include_directories), true);
-
- // Generate fbs.
- auto fbs_union = flatbuffers::GenerateFBS(parser3, "test");
-
- // Ensure generated file is parsable.
- flatbuffers::Parser parser4;
- TEST_EQ(parser4.Parse(fbs_union.c_str(), nullptr), true);
- TEST_EQ_STR(fbs_union.c_str(), goldenunionfile.c_str());
-}
-
-// Parse a .proto schema, output as .fbs
-void ParseProtoTestWithSuffix() {
- // load the .proto and the golden file from disk
- std::string protofile;
- std::string goldenfile;
- std::string goldenunionfile;
- TEST_EQ(
- flatbuffers::LoadFile((test_data_path + "prototest/test.proto").c_str(),
- false, &protofile),
- true);
- TEST_EQ(flatbuffers::LoadFile(
- (test_data_path + "prototest/test_suffix.golden").c_str(), false,
- &goldenfile),
- true);
- TEST_EQ(flatbuffers::LoadFile(
- (test_data_path + "prototest/test_union_suffix.golden").c_str(),
- false, &goldenunionfile),
- true);
-
- flatbuffers::IDLOptions opts;
- opts.include_dependence_headers = false;
- opts.proto_mode = true;
- opts.proto_namespace_suffix = "test_namespace_suffix";
-
- // Parse proto.
- flatbuffers::Parser parser(opts);
- auto protopath = test_data_path + "prototest/";
- const char *include_directories[] = { protopath.c_str(), nullptr };
- TEST_EQ(parser.Parse(protofile.c_str(), include_directories), true);
-
- // Generate fbs.
- auto fbs = flatbuffers::GenerateFBS(parser, "test");
-
- // Ensure generated file is parsable.
- flatbuffers::Parser parser2;
- TEST_EQ(parser2.Parse(fbs.c_str(), nullptr), true);
- TEST_EQ_STR(fbs.c_str(), goldenfile.c_str());
-
- // Parse proto with --oneof-union option.
- opts.proto_oneof_union = true;
- flatbuffers::Parser parser3(opts);
- TEST_EQ(parser3.Parse(protofile.c_str(), include_directories), true);
-
- // Generate fbs.
- auto fbs_union = flatbuffers::GenerateFBS(parser3, "test");
-
- // Ensure generated file is parsable.
- flatbuffers::Parser parser4;
- TEST_EQ(parser4.Parse(fbs_union.c_str(), nullptr), true);
- TEST_EQ_STR(fbs_union.c_str(), goldenunionfile.c_str());
-}
-
-// Parse a .proto schema, output as .fbs
-void ParseProtoTestWithIncludes() {
- // load the .proto and the golden file from disk
- std::string protofile;
- std::string goldenfile;
- std::string goldenunionfile;
- std::string importprotofile;
- TEST_EQ(
- flatbuffers::LoadFile((test_data_path + "prototest/test.proto").c_str(),
- false, &protofile),
- true);
- TEST_EQ(flatbuffers::LoadFile(
- (test_data_path + "prototest/imported.proto").c_str(), false,
- &importprotofile),
- true);
- TEST_EQ(flatbuffers::LoadFile(
- (test_data_path + "prototest/test_include.golden").c_str(), false,
- &goldenfile),
- true);
- TEST_EQ(flatbuffers::LoadFile(
- (test_data_path + "prototest/test_union_include.golden").c_str(),
- false, &goldenunionfile),
- true);
-
- flatbuffers::IDLOptions opts;
- opts.include_dependence_headers = true;
- opts.proto_mode = true;
-
- // Parse proto.
- flatbuffers::Parser parser(opts);
- auto protopath = test_data_path + "prototest/";
- const char *include_directories[] = { protopath.c_str(), nullptr };
- TEST_EQ(parser.Parse(protofile.c_str(), include_directories), true);
-
- // Generate fbs.
- auto fbs = flatbuffers::GenerateFBS(parser, "test");
-
- // Generate fbs from import.proto
- flatbuffers::Parser import_parser(opts);
- TEST_EQ(import_parser.Parse(importprotofile.c_str(), include_directories),
- true);
- auto import_fbs = flatbuffers::GenerateFBS(import_parser, "test");
-
- // Ensure generated file is parsable.
- flatbuffers::Parser parser2;
- // Since `imported.fbs` isn't in the filesystem AbsolutePath can't figure it
- // out by itself. We manually construct it so Parser works.
- std::string imported_fbs = flatbuffers::PosixPath(
- flatbuffers::AbsolutePath(protopath) + "/imported.fbs");
- TEST_EQ(parser2.Parse(import_fbs.c_str(), include_directories,
- imported_fbs.c_str()),
- true);
- TEST_EQ(parser2.Parse(fbs.c_str(), nullptr), true);
- TEST_EQ_STR(fbs.c_str(), goldenfile.c_str());
-
- // Parse proto with --oneof-union option.
- opts.proto_oneof_union = true;
- flatbuffers::Parser parser3(opts);
- TEST_EQ(parser3.Parse(protofile.c_str(), include_directories), true);
-
- // Generate fbs.
- auto fbs_union = flatbuffers::GenerateFBS(parser3, "test");
-
- // Ensure generated file is parsable.
- flatbuffers::Parser parser4;
- TEST_EQ(parser4.Parse(import_fbs.c_str(), nullptr, imported_fbs.c_str()),
- true);
- TEST_EQ(parser4.Parse(fbs_union.c_str(), nullptr), true);
- TEST_EQ_STR(fbs_union.c_str(), goldenunionfile.c_str());
-}
-
-template<typename T>
-void CompareTableFieldValue(flatbuffers::Table *table,
- flatbuffers::voffset_t voffset, T val) {
- T read = table->GetField(voffset, static_cast<T>(0));
- TEST_EQ(read, val);
-}
-
-void UtilConvertCase() {
- {
- std::vector<std::tuple<std::string, flatbuffers::Case, std::string>>
- cases = {
- // Tests for the common cases
- { "the_quick_brown_fox", flatbuffers::Case::kUpperCamel,
- "TheQuickBrownFox" },
- { "the_quick_brown_fox", flatbuffers::Case::kLowerCamel,
- "theQuickBrownFox" },
- { "the_quick_brown_fox", flatbuffers::Case::kSnake,
- "the_quick_brown_fox" },
- { "the_quick_brown_fox", flatbuffers::Case::kScreamingSnake,
- "THE_QUICK_BROWN_FOX" },
- { "the_quick_brown_fox", flatbuffers::Case::kAllLower,
- "the_quick_brown_fox" },
- { "the_quick_brown_fox", flatbuffers::Case::kAllUpper,
- "THE_QUICK_BROWN_FOX" },
- { "the_quick_brown_fox", flatbuffers::Case::kUnknown,
- "the_quick_brown_fox" },
- { "the_quick_brown_fox", flatbuffers::Case::kKeep,
- "the_quick_brown_fox" },
-
- // Tests for some snake_cases where the _ is oddly placed or missing.
- { "single", flatbuffers::Case::kUpperCamel, "Single" },
- { "Single", flatbuffers::Case::kUpperCamel, "Single" },
- { "_leading", flatbuffers::Case::kUpperCamel, "_leading" },
- { "trailing_", flatbuffers::Case::kUpperCamel, "Trailing_" },
- { "double__underscore", flatbuffers::Case::kUpperCamel,
- "Double_underscore" },
- { "single", flatbuffers::Case::kLowerCamel, "single" },
- { "Single", flatbuffers::Case::kLowerCamel, "Single" },
- { "_leading", flatbuffers::Case::kLowerCamel, "Leading" },
- { "trailing_", flatbuffers::Case::kLowerCamel, "trailing_" },
- { "double__underscore", flatbuffers::Case::kLowerCamel,
- "double_underscore" },
-
- // Tests for some output snake_cases
- { "single", flatbuffers::Case::kSnake, "single" },
- { "single", flatbuffers::Case::kScreamingSnake, "SINGLE" },
- { "_leading", flatbuffers::Case::kScreamingSnake, "_LEADING" },
- { "trailing_", flatbuffers::Case::kScreamingSnake, "TRAILING_" },
- { "double__underscore", flatbuffers::Case::kScreamingSnake,
- "DOUBLE__UNDERSCORE" },
- };
-
- for (auto &test_case : cases) {
- TEST_EQ(std::get<2>(test_case),
- flatbuffers::ConvertCase(std::get<0>(test_case),
- std::get<1>(test_case)));
- }
- }
-
- // Tests for the non snake_case inputs.
- {
- std::vector<std::tuple<flatbuffers::Case, std::string, flatbuffers::Case,
- std::string>>
- cases = {
- { flatbuffers::Case::kUpperCamel, "TheQuickBrownFox",
- flatbuffers::Case::kSnake, "the_quick_brown_fox" },
- { flatbuffers::Case::kLowerCamel, "theQuickBrownFox",
- flatbuffers::Case::kSnake, "the_quick_brown_fox" },
- { flatbuffers::Case::kSnake, "the_quick_brown_fox",
- flatbuffers::Case::kSnake, "the_quick_brown_fox" },
- { flatbuffers::Case::kScreamingSnake, "THE_QUICK_BROWN_FOX",
- flatbuffers::Case::kSnake, "THE_QUICK_BROWN_FOX" },
- { flatbuffers::Case::kAllUpper, "SINGLE", flatbuffers::Case::kSnake,
- "SINGLE" },
- { flatbuffers::Case::kAllLower, "single", flatbuffers::Case::kSnake,
- "single" },
- { flatbuffers::Case::kUpperCamel, "ABCtest",
- flatbuffers::Case::kSnake, "abctest" },
- { flatbuffers::Case::kUpperCamel, "tHe_qUiCk_BrOwN_fOx",
- flatbuffers::Case::kKeep, "tHe_qUiCk_BrOwN_fOx" },
- };
-
- for (auto &test_case : cases) {
- TEST_EQ(std::get<3>(test_case),
- flatbuffers::ConvertCase(std::get<1>(test_case),
- std::get<2>(test_case),
- std::get<0>(test_case)));
- }
- }
-}
-
-// Low level stress/fuzz test: serialize/deserialize a variety of
-// different kinds of data in different combinations
-void FuzzTest1() {
- // Values we're testing against: chosen to ensure no bits get chopped
- // off anywhere, and also be different from eachother.
- const uint8_t bool_val = true;
- const int8_t char_val = -127; // 0x81
- const uint8_t uchar_val = 0xFF;
- const int16_t short_val = -32222; // 0x8222;
- const uint16_t ushort_val = 0xFEEE;
- const int32_t int_val = 0x83333333;
- const uint32_t uint_val = 0xFDDDDDDD;
- const int64_t long_val = 0x8444444444444444LL;
- const uint64_t ulong_val = 0xFCCCCCCCCCCCCCCCULL;
- const float float_val = 3.14159f;
- const double double_val = 3.14159265359;
-
- const int test_values_max = 11;
- const flatbuffers::voffset_t fields_per_object = 4;
- const int num_fuzz_objects = 10000; // The higher, the more thorough :)
-
- flatbuffers::FlatBufferBuilder builder;
-
- lcg_reset(); // Keep it deterministic.
-
- flatbuffers::uoffset_t objects[num_fuzz_objects];
-
- // Generate num_fuzz_objects random objects each consisting of
- // fields_per_object fields, each of a random type.
- for (int i = 0; i < num_fuzz_objects; i++) {
- auto start = builder.StartTable();
- for (flatbuffers::voffset_t f = 0; f < fields_per_object; f++) {
- int choice = lcg_rand() % test_values_max;
- auto off = flatbuffers::FieldIndexToOffset(f);
- switch (choice) {
- case 0: builder.AddElement<uint8_t>(off, bool_val, 0); break;
- case 1: builder.AddElement<int8_t>(off, char_val, 0); break;
- case 2: builder.AddElement<uint8_t>(off, uchar_val, 0); break;
- case 3: builder.AddElement<int16_t>(off, short_val, 0); break;
- case 4: builder.AddElement<uint16_t>(off, ushort_val, 0); break;
- case 5: builder.AddElement<int32_t>(off, int_val, 0); break;
- case 6: builder.AddElement<uint32_t>(off, uint_val, 0); break;
- case 7: builder.AddElement<int64_t>(off, long_val, 0); break;
- case 8: builder.AddElement<uint64_t>(off, ulong_val, 0); break;
- case 9: builder.AddElement<float>(off, float_val, 0); break;
- case 10: builder.AddElement<double>(off, double_val, 0); break;
- }
- }
- objects[i] = builder.EndTable(start);
- }
- builder.PreAlign<flatbuffers::largest_scalar_t>(0); // Align whole buffer.
-
- lcg_reset(); // Reset.
-
- uint8_t *eob = builder.GetCurrentBufferPointer() + builder.GetSize();
-
- // Test that all objects we generated are readable and return the
- // expected values. We generate random objects in the same order
- // so this is deterministic.
- for (int i = 0; i < num_fuzz_objects; i++) {
- auto table = reinterpret_cast<flatbuffers::Table *>(eob - objects[i]);
- for (flatbuffers::voffset_t f = 0; f < fields_per_object; f++) {
- int choice = lcg_rand() % test_values_max;
- flatbuffers::voffset_t off = flatbuffers::FieldIndexToOffset(f);
- switch (choice) {
- case 0: CompareTableFieldValue(table, off, bool_val); break;
- case 1: CompareTableFieldValue(table, off, char_val); break;
- case 2: CompareTableFieldValue(table, off, uchar_val); break;
- case 3: CompareTableFieldValue(table, off, short_val); break;
- case 4: CompareTableFieldValue(table, off, ushort_val); break;
- case 5: CompareTableFieldValue(table, off, int_val); break;
- case 6: CompareTableFieldValue(table, off, uint_val); break;
- case 7: CompareTableFieldValue(table, off, long_val); break;
- case 8: CompareTableFieldValue(table, off, ulong_val); break;
- case 9: CompareTableFieldValue(table, off, float_val); break;
- case 10: CompareTableFieldValue(table, off, double_val); break;
- }
- }
- }
-}
-
-// High level stress/fuzz test: generate a big schema and
-// matching json data in random combinations, then parse both,
-// generate json back from the binary, and compare with the original.
-void FuzzTest2() {
- lcg_reset(); // Keep it deterministic.
-
- const int num_definitions = 30;
- const int num_struct_definitions = 5; // Subset of num_definitions.
- const int fields_per_definition = 15;
- const int instances_per_definition = 5;
- const int deprecation_rate = 10; // 1 in deprecation_rate fields will
- // be deprecated.
-
- std::string schema = "namespace test;\n\n";
-
- struct RndDef {
- std::string instances[instances_per_definition];
-
- // Since we're generating schema and corresponding data in tandem,
- // this convenience function adds strings to both at once.
- static void Add(RndDef (&definitions_l)[num_definitions],
- std::string &schema_l, const int instances_per_definition_l,
- const char *schema_add, const char *instance_add,
- int definition) {
- schema_l += schema_add;
- for (int i = 0; i < instances_per_definition_l; i++)
- definitions_l[definition].instances[i] += instance_add;
- }
- };
-
-// clang-format off
- #define AddToSchemaAndInstances(schema_add, instance_add) \
- RndDef::Add(definitions, schema, instances_per_definition, \
- schema_add, instance_add, definition)
-
- #define Dummy() \
- RndDef::Add(definitions, schema, instances_per_definition, \
- "byte", "1", definition)
- // clang-format on
-
- RndDef definitions[num_definitions];
-
- // We are going to generate num_definitions, the first
- // num_struct_definitions will be structs, the rest tables. For each
- // generate random fields, some of which may be struct/table types
- // referring to previously generated structs/tables.
- // Simultanenously, we generate instances_per_definition JSON data
- // definitions, which will have identical structure to the schema
- // being generated. We generate multiple instances such that when creating
- // hierarchy, we get some variety by picking one randomly.
- for (int definition = 0; definition < num_definitions; definition++) {
- std::string definition_name = "D" + flatbuffers::NumToString(definition);
-
- bool is_struct = definition < num_struct_definitions;
-
- AddToSchemaAndInstances(
- ((is_struct ? "struct " : "table ") + definition_name + " {\n").c_str(),
- "{\n");
-
- for (int field = 0; field < fields_per_definition; field++) {
- const bool is_last_field = field == fields_per_definition - 1;
-
- // Deprecate 1 in deprecation_rate fields. Only table fields can be
- // deprecated.
- // Don't deprecate the last field to avoid dangling commas in JSON.
- const bool deprecated =
- !is_struct && !is_last_field && (lcg_rand() % deprecation_rate == 0);
-
- std::string field_name = "f" + flatbuffers::NumToString(field);
- AddToSchemaAndInstances((" " + field_name + ":").c_str(),
- deprecated ? "" : (field_name + ": ").c_str());
- // Pick random type:
- auto base_type = static_cast<flatbuffers::BaseType>(
- lcg_rand() % (flatbuffers::BASE_TYPE_UNION + 1));
- switch (base_type) {
- case flatbuffers::BASE_TYPE_STRING:
- if (is_struct) {
- Dummy(); // No strings in structs.
- } else {
- AddToSchemaAndInstances("string", deprecated ? "" : "\"hi\"");
- }
- break;
- case flatbuffers::BASE_TYPE_VECTOR:
- if (is_struct) {
- Dummy(); // No vectors in structs.
- } else {
- AddToSchemaAndInstances("[ubyte]",
- deprecated ? "" : "[\n0,\n1,\n255\n]");
- }
- break;
- case flatbuffers::BASE_TYPE_NONE:
- case flatbuffers::BASE_TYPE_UTYPE:
- case flatbuffers::BASE_TYPE_STRUCT:
- case flatbuffers::BASE_TYPE_UNION:
- if (definition) {
- // Pick a random previous definition and random data instance of
- // that definition.
- int defref = lcg_rand() % definition;
- int instance = lcg_rand() % instances_per_definition;
- AddToSchemaAndInstances(
- ("D" + flatbuffers::NumToString(defref)).c_str(),
- deprecated ? ""
- : definitions[defref].instances[instance].c_str());
- } else {
- // If this is the first definition, we have no definition we can
- // refer to.
- Dummy();
- }
- break;
- case flatbuffers::BASE_TYPE_BOOL:
- AddToSchemaAndInstances(
- "bool", deprecated ? "" : (lcg_rand() % 2 ? "true" : "false"));
- break;
- case flatbuffers::BASE_TYPE_ARRAY:
- if (!is_struct) {
- AddToSchemaAndInstances(
- "ubyte",
- deprecated ? "" : "255"); // No fixed-length arrays in tables.
- } else {
- AddToSchemaAndInstances("[int:3]", deprecated ? "" : "[\n,\n,\n]");
- }
- break;
- default:
- // All the scalar types.
- schema += flatbuffers::kTypeNames[base_type];
-
- if (!deprecated) {
- // We want each instance to use its own random value.
- for (int inst = 0; inst < instances_per_definition; inst++)
- definitions[definition].instances[inst] +=
- flatbuffers::IsFloat(base_type)
- ? flatbuffers::NumToString<double>(lcg_rand() % 128)
- .c_str()
- : flatbuffers::NumToString<int>(lcg_rand() % 128).c_str();
- }
- }
- AddToSchemaAndInstances(deprecated ? "(deprecated);\n" : ";\n",
- deprecated ? ""
- : is_last_field ? "\n"
- : ",\n");
- }
- AddToSchemaAndInstances("}\n\n", "}");
- }
-
- schema += "root_type D" + flatbuffers::NumToString(num_definitions - 1);
- schema += ";\n";
-
- flatbuffers::Parser parser;
-
- // Will not compare against the original if we don't write defaults
- parser.builder_.ForceDefaults(true);
-
- // Parse the schema, parse the generated data, then generate text back
- // from the binary and compare against the original.
- TEST_EQ(parser.Parse(schema.c_str()), true);
-
- const std::string &json =
- definitions[num_definitions - 1].instances[0] + "\n";
-
- TEST_EQ(parser.Parse(json.c_str()), true);
-
- std::string jsongen;
- parser.opts.indent_step = 0;
- auto result =
- GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen);
- TEST_EQ(result, true);
-
- if (jsongen != json) {
- // These strings are larger than a megabyte, so we show the bytes around
- // the first bytes that are different rather than the whole string.
- size_t len = std::min(json.length(), jsongen.length());
- for (size_t i = 0; i < len; i++) {
- if (json[i] != jsongen[i]) {
- i -= std::min(static_cast<size_t>(10), i); // show some context;
- size_t end = std::min(len, i + 20);
- for (; i < end; i++)
- TEST_OUTPUT_LINE("at %d: found \"%c\", expected \"%c\"\n",
- static_cast<int>(i), jsongen[i], json[i]);
- break;
- }
- }
- TEST_NOTNULL(nullptr); //-V501 (this comment supresses CWE-570 warning)
- }
-
-// clang-format off
- #ifdef FLATBUFFERS_TEST_VERBOSE
- TEST_OUTPUT_LINE("%dk schema tested with %dk of json\n",
- static_cast<int>(schema.length() / 1024),
- static_cast<int>(json.length() / 1024));
- #endif
- // clang-format on
-}
-
-// Test that parser errors are actually generated.
-void TestError_(const char *src, const char *error_substr, bool strict_json,
- const char *file, int line, const char *func) {
- flatbuffers::IDLOptions opts;
- opts.strict_json = strict_json;
- flatbuffers::Parser parser(opts);
- if (parser.Parse(src)) {
- TestFail("true", "false",
- ("parser.Parse(\"" + std::string(src) + "\")").c_str(), file, line,
- func);
- } else if (!strstr(parser.error_.c_str(), error_substr)) {
- TestFail(error_substr, parser.error_.c_str(),
- ("parser.Parse(\"" + std::string(src) + "\")").c_str(), file, line,
- func);
- }
-}
-
-void TestError_(const char *src, const char *error_substr, const char *file,
- int line, const char *func) {
- TestError_(src, error_substr, false, file, line, func);
-}
-
-#ifdef _WIN32
-# define TestError(src, ...) \
- TestError_(src, __VA_ARGS__, __FILE__, __LINE__, __FUNCTION__)
-#else
-# define TestError(src, ...) \
- TestError_(src, __VA_ARGS__, __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#endif
-
-// Test that parsing errors occur as we'd expect.
-// Also useful for coverage, making sure these paths are run.
-void ErrorTest() {
- // In order they appear in idl_parser.cpp
- TestError("table X { Y:byte; } root_type X; { Y: 999 }", "does not fit");
- TestError("\"\0", "illegal");
- TestError("\"\\q", "escape code");
- TestError("table ///", "documentation");
- TestError("@", "illegal");
- TestError("table 1", "expecting");
- TestError("table X { Y:[[int]]; }", "nested vector");
- TestError("table X { Y:1; }", "illegal type");
- TestError("table X { Y:int; Y:int; }", "field already");
- TestError("table Y {} table X { Y:int; }", "same as table");
- TestError("struct X { Y:string; }", "only scalar");
- TestError("struct X { a:uint = 42; }", "default values");
- TestError("enum Y:byte { Z = 1 } table X { y:Y; }", "not part of enum");
- TestError("struct X { Y:int (deprecated); }", "deprecate");
- TestError("union Z { X } table X { Y:Z; } root_type X; { Y: {}, A:1 }",
- "missing type field");
- TestError("union Z { X } table X { Y:Z; } root_type X; { Y_type: 99, Y: {",
- "type id");
- TestError("table X { Y:int; } root_type X; { Z:", "unknown field");
- TestError("table X { Y:int; } root_type X; { Y:", "string constant", true);
- TestError("table X { Y:int; } root_type X; { \"Y\":1, }", "string constant",
- true);
- TestError(
- "struct X { Y:int; Z:int; } table W { V:X; } root_type W; "
- "{ V:{ Y:1 } }",
- "wrong number");
- TestError("enum E:byte { A } table X { Y:E; } root_type X; { Y:U }",
- "unknown enum value");
- TestError("table X { Y:byte; } root_type X; { Y:; }", "starting");
- TestError("enum X:byte { Y } enum X {", "enum already");
- TestError("enum X:float {}", "underlying");
- TestError("enum X:byte { Y, Y }", "value already");
- TestError("enum X:byte { Y=2, Z=2 }", "unique");
- TestError("table X { Y:int; } table X {", "datatype already");
- TestError("table X { } union X { }", "datatype already");
- TestError("union X { } table X { }", "datatype already");
- TestError("namespace A; table X { } namespace A; union X { }",
- "datatype already");
- TestError("namespace A; union X { } namespace A; table X { }",
- "datatype already");
- TestError("struct X (force_align: 7) { Y:int; }", "force_align");
- TestError("struct X {}", "size 0");
- TestError("{}", "no root");
- TestError("table X { Y:byte; } root_type X; { Y:1 } { Y:1 }", "end of file");
- TestError("table X { Y:byte; } root_type X; { Y:1 } table Y{ Z:int }",
- "end of file");
- TestError("root_type X;", "unknown root");
- TestError("struct X { Y:int; } root_type X;", "a table");
- TestError("union X { Y }", "referenced");
- TestError("union Z { X } struct X { Y:int; }", "only tables");
- TestError("table X { Y:[int]; YLength:int; }", "clash");
- TestError("table X { Y:byte; } root_type X; { Y:1, Y:2 }", "more than once");
- // float to integer conversion is forbidden
- TestError("table X { Y:int; } root_type X; { Y:1.0 }", "float");
- TestError("table X { Y:bool; } root_type X; { Y:1.0 }", "float");
- TestError("enum X:bool { Y = true }", "must be integral");
- // Array of non-scalar
- TestError("table X { x:int; } struct Y { y:[X:2]; }",
- "may contain only scalar or struct fields");
- // Non-snake case field names
- TestError("table X { Y: int; } root_type Y: {Y:1.0}", "snake_case");
- // Complex defaults
- TestError("table X { y: string = 1; }", "expecting: string");
- TestError("table X { y: string = []; }", " Cannot assign token");
- TestError("table X { y: [int] = [1]; }", "Expected `]`");
- TestError("table X { y: [int] = [; }", "Expected `]`");
- TestError("table X { y: [int] = \"\"; }", "type mismatch");
- // An identifier can't start from sign (+|-)
- TestError("table X { -Y: int; } root_type Y: {Y:1.0}", "identifier");
- TestError("table X { +Y: int; } root_type Y: {Y:1.0}", "identifier");
-}
-
-template<typename T>
-T TestValue(const char *json, const char *type_name,
- const char *decls = nullptr) {
- flatbuffers::Parser parser;
- parser.builder_.ForceDefaults(true); // return defaults
- auto check_default = json ? false : true;
- if (check_default) { parser.opts.output_default_scalars_in_json = true; }
- // Simple schema.
- std::string schema = std::string(decls ? decls : "") + "\n" +
- "table X { y:" + std::string(type_name) +
- "; } root_type X;";
- auto schema_done = parser.Parse(schema.c_str());
- TEST_EQ_STR(parser.error_.c_str(), "");
- TEST_EQ(schema_done, true);
-
- auto done = parser.Parse(check_default ? "{}" : json);
- TEST_EQ_STR(parser.error_.c_str(), "");
- TEST_EQ(done, true);
-
- // Check with print.
- std::string print_back;
- parser.opts.indent_step = -1;
- TEST_EQ(GenerateText(parser, parser.builder_.GetBufferPointer(), &print_back),
- true);
- // restore value from its default
- if (check_default) { TEST_EQ(parser.Parse(print_back.c_str()), true); }
-
- auto root = flatbuffers::GetRoot<flatbuffers::Table>(
- parser.builder_.GetBufferPointer());
- return root->GetField<T>(flatbuffers::FieldIndexToOffset(0), 0);
-}
-
-bool FloatCompare(float a, float b) { return fabs(a - b) < 0.001; }
-
-// Additional parser testing not covered elsewhere.
-void ValueTest() {
- // Test scientific notation numbers.
- TEST_EQ(
- FloatCompare(TestValue<float>("{ y:0.0314159e+2 }", "float"), 3.14159f),
- true);
- // number in string
- TEST_EQ(FloatCompare(TestValue<float>("{ y:\"0.0314159e+2\" }", "float"),
- 3.14159f),
- true);
-
- // Test conversion functions.
- TEST_EQ(FloatCompare(TestValue<float>("{ y:cos(rad(180)) }", "float"), -1),
- true);
-
- // int embedded to string
- TEST_EQ(TestValue<int>("{ y:\"-876\" }", "int=-123"), -876);
- TEST_EQ(TestValue<int>("{ y:\"876\" }", "int=-123"), 876);
-
- // Test negative hex constant.
- TEST_EQ(TestValue<int>("{ y:-0x8ea0 }", "int=-0x8ea0"), -36512);
- TEST_EQ(TestValue<int>(nullptr, "int=-0x8ea0"), -36512);
-
- // positive hex constant
- TEST_EQ(TestValue<int>("{ y:0x1abcdef }", "int=0x1"), 0x1abcdef);
- // with optional '+' sign
- TEST_EQ(TestValue<int>("{ y:+0x1abcdef }", "int=+0x1"), 0x1abcdef);
- // hex in string
- TEST_EQ(TestValue<int>("{ y:\"0x1abcdef\" }", "int=+0x1"), 0x1abcdef);
-
- // Make sure we do unsigned 64bit correctly.
- TEST_EQ(TestValue<uint64_t>("{ y:12335089644688340133 }", "ulong"),
- 12335089644688340133ULL);
-
- // bool in string
- TEST_EQ(TestValue<bool>("{ y:\"false\" }", "bool=true"), false);
- TEST_EQ(TestValue<bool>("{ y:\"true\" }", "bool=\"true\""), true);
- TEST_EQ(TestValue<bool>("{ y:'false' }", "bool=true"), false);
- TEST_EQ(TestValue<bool>("{ y:'true' }", "bool=\"true\""), true);
-
- // check comments before and after json object
- TEST_EQ(TestValue<int>("/*before*/ { y:1 } /*after*/", "int"), 1);
- TEST_EQ(TestValue<int>("//before \n { y:1 } //after", "int"), 1);
-}
-
-void NestedListTest() {
- flatbuffers::Parser parser1;
- TEST_EQ(parser1.Parse("struct Test { a:short; b:byte; } table T { F:[Test]; }"
- "root_type T;"
- "{ F:[ [10,20], [30,40]] }"),
- true);
-}
-
-void EnumStringsTest() {
- flatbuffers::Parser parser1;
- TEST_EQ(parser1.Parse("enum E:byte { A, B, C } table T { F:[E]; }"
- "root_type T;"
- "{ F:[ A, B, \"C\", \"A B C\" ] }"),
- true);
- flatbuffers::Parser parser2;
- TEST_EQ(parser2.Parse("enum E:byte { A, B, C } table T { F:[int]; }"
- "root_type T;"
- "{ F:[ \"E.C\", \"E.A E.B E.C\" ] }"),
- true);
- // unsigned bit_flags
- flatbuffers::Parser parser3;
- TEST_EQ(
- parser3.Parse("enum E:uint16 (bit_flags) { F0, F07=7, F08, F14=14, F15 }"
- " table T { F: E = \"F15 F08\"; }"
- "root_type T;"),
- true);
-}
-
-void EnumNamesTest() {
- TEST_EQ_STR("Red", EnumNameColor(Color_Red));
- TEST_EQ_STR("Green", EnumNameColor(Color_Green));
- TEST_EQ_STR("Blue", EnumNameColor(Color_Blue));
- // Check that Color to string don't crash while decode a mixture of Colors.
- // 1) Example::Color enum is enum with unfixed underlying type.
- // 2) Valid enum range: [0; 2^(ceil(log2(Color_ANY))) - 1].
- // Consequence: A value is out of this range will lead to UB (since C++17).
- // For details see C++17 standard or explanation on the SO:
- // stackoverflow.com/questions/18195312/what-happens-if-you-static-cast-invalid-value-to-enum-class
- TEST_EQ_STR("", EnumNameColor(static_cast<Color>(0)));
- TEST_EQ_STR("", EnumNameColor(static_cast<Color>(Color_ANY - 1)));
- TEST_EQ_STR("", EnumNameColor(static_cast<Color>(Color_ANY + 1)));
-}
-
-void EnumOutOfRangeTest() {
- TestError("enum X:byte { Y = 128 }", "enum value does not fit");
- TestError("enum X:byte { Y = -129 }", "enum value does not fit");
- TestError("enum X:byte { Y = 126, Z0, Z1 }", "enum value does not fit");
- TestError("enum X:ubyte { Y = -1 }", "enum value does not fit");
- TestError("enum X:ubyte { Y = 256 }", "enum value does not fit");
- TestError("enum X:ubyte { Y = 255, Z }", "enum value does not fit");
- TestError("table Y{} union X { Y = -1 }", "enum value does not fit");
- TestError("table Y{} union X { Y = 256 }", "enum value does not fit");
- TestError("table Y{} union X { Y = 255, Z:Y }", "enum value does not fit");
- TestError("enum X:int { Y = -2147483649 }", "enum value does not fit");
- TestError("enum X:int { Y = 2147483648 }", "enum value does not fit");
- TestError("enum X:uint { Y = -1 }", "enum value does not fit");
- TestError("enum X:uint { Y = 4294967297 }", "enum value does not fit");
- TestError("enum X:long { Y = 9223372036854775808 }", "does not fit");
- TestError("enum X:long { Y = 9223372036854775807, Z }",
- "enum value does not fit");
- TestError("enum X:ulong { Y = -1 }", "does not fit");
- TestError("enum X:ubyte (bit_flags) { Y=8 }", "bit flag out");
- TestError("enum X:byte (bit_flags) { Y=7 }", "must be unsigned"); // -128
- // bit_flgs out of range
- TestError("enum X:ubyte (bit_flags) { Y0,Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8 }",
- "out of range");
-}
-
-void EnumValueTest() {
- // json: "{ Y:0 }", schema: table X { y: "E"}
- // 0 in enum (V=0) E then Y=0 is valid.
- TEST_EQ(TestValue<int>("{ y:0 }", "E", "enum E:int { V }"), 0);
- TEST_EQ(TestValue<int>("{ y:V }", "E", "enum E:int { V }"), 0);
- // A default value of Y is 0.
- TEST_EQ(TestValue<int>("{ }", "E", "enum E:int { V }"), 0);
- TEST_EQ(TestValue<int>("{ y:5 }", "E=V", "enum E:int { V=5 }"), 5);
- // Generate json with defaults and check.
- TEST_EQ(TestValue<int>(nullptr, "E=V", "enum E:int { V=5 }"), 5);
- // 5 in enum
- TEST_EQ(TestValue<int>("{ y:5 }", "E", "enum E:int { Z, V=5 }"), 5);
- TEST_EQ(TestValue<int>("{ y:5 }", "E=V", "enum E:int { Z, V=5 }"), 5);
- // Generate json with defaults and check.
- TEST_EQ(TestValue<int>(nullptr, "E", "enum E:int { Z, V=5 }"), 0);
- TEST_EQ(TestValue<int>(nullptr, "E=V", "enum E:int { Z, V=5 }"), 5);
- // u84 test
- TEST_EQ(TestValue<uint64_t>(nullptr, "E=V",
- "enum E:ulong { V = 13835058055282163712 }"),
- 13835058055282163712ULL);
- TEST_EQ(TestValue<uint64_t>(nullptr, "E=V",
- "enum E:ulong { V = 18446744073709551615 }"),
- 18446744073709551615ULL);
- // Assign non-enum value to enum field. Is it right?
- TEST_EQ(TestValue<int>("{ y:7 }", "E", "enum E:int { V = 0 }"), 7);
- // Check that non-ascending values are valid.
- TEST_EQ(TestValue<int>("{ y:5 }", "E=V", "enum E:int { Z=10, V=5 }"), 5);
-}
-
-void IntegerOutOfRangeTest() {
- TestError("table T { F:byte; } root_type T; { F:128 }",
- "constant does not fit");
- TestError("table T { F:byte; } root_type T; { F:-129 }",
- "constant does not fit");
- TestError("table T { F:ubyte; } root_type T; { F:256 }",
- "constant does not fit");
- TestError("table T { F:ubyte; } root_type T; { F:-1 }",
- "constant does not fit");
- TestError("table T { F:short; } root_type T; { F:32768 }",
- "constant does not fit");
- TestError("table T { F:short; } root_type T; { F:-32769 }",
- "constant does not fit");
- TestError("table T { F:ushort; } root_type T; { F:65536 }",
- "constant does not fit");
- TestError("table T { F:ushort; } root_type T; { F:-1 }",
- "constant does not fit");
- TestError("table T { F:int; } root_type T; { F:2147483648 }",
- "constant does not fit");
- TestError("table T { F:int; } root_type T; { F:-2147483649 }",
- "constant does not fit");
- TestError("table T { F:uint; } root_type T; { F:4294967296 }",
- "constant does not fit");
- TestError("table T { F:uint; } root_type T; { F:-1 }",
- "constant does not fit");
- // Check fixed width aliases
- TestError("table X { Y:uint8; } root_type X; { Y: -1 }", "does not fit");
- TestError("table X { Y:uint8; } root_type X; { Y: 256 }", "does not fit");
- TestError("table X { Y:uint16; } root_type X; { Y: -1 }", "does not fit");
- TestError("table X { Y:uint16; } root_type X; { Y: 65536 }", "does not fit");
- TestError("table X { Y:uint32; } root_type X; { Y: -1 }", "");
- TestError("table X { Y:uint32; } root_type X; { Y: 4294967296 }",
- "does not fit");
- TestError("table X { Y:uint64; } root_type X; { Y: -1 }", "");
- TestError("table X { Y:uint64; } root_type X; { Y: -9223372036854775809 }",
- "does not fit");
- TestError("table X { Y:uint64; } root_type X; { Y: 18446744073709551616 }",
- "does not fit");
-
- TestError("table X { Y:int8; } root_type X; { Y: -129 }", "does not fit");
- TestError("table X { Y:int8; } root_type X; { Y: 128 }", "does not fit");
- TestError("table X { Y:int16; } root_type X; { Y: -32769 }", "does not fit");
- TestError("table X { Y:int16; } root_type X; { Y: 32768 }", "does not fit");
- TestError("table X { Y:int32; } root_type X; { Y: -2147483649 }", "");
- TestError("table X { Y:int32; } root_type X; { Y: 2147483648 }",
- "does not fit");
- TestError("table X { Y:int64; } root_type X; { Y: -9223372036854775809 }",
- "does not fit");
- TestError("table X { Y:int64; } root_type X; { Y: 9223372036854775808 }",
- "does not fit");
- // check out-of-int64 as int8
- TestError("table X { Y:int8; } root_type X; { Y: -9223372036854775809 }",
- "does not fit");
- TestError("table X { Y:int8; } root_type X; { Y: 9223372036854775808 }",
- "does not fit");
-
- // Check default values
- TestError("table X { Y:int64=-9223372036854775809; } root_type X; {}",
- "does not fit");
- TestError("table X { Y:int64= 9223372036854775808; } root_type X; {}",
- "does not fit");
- TestError("table X { Y:uint64; } root_type X; { Y: -1 }", "");
- TestError("table X { Y:uint64=-9223372036854775809; } root_type X; {}",
- "does not fit");
- TestError("table X { Y:uint64= 18446744073709551616; } root_type X; {}",
- "does not fit");
-}
-
-void IntegerBoundaryTest() {
- // Check numerical compatibility with non-C++ languages.
- // By the C++ standard, std::numerical_limits<int64_t>::min() ==
- // -9223372036854775807 (-2^63+1) or less* The Flatbuffers grammar and most of
- // the languages (C#, Java, Rust) expect that minimum values are: -128,
- // -32768,.., -9223372036854775808. Since C++20,
- // static_cast<int64>(0x8000000000000000ULL) is well-defined two's complement
- // cast. Therefore -9223372036854775808 should be valid negative value.
- TEST_EQ(flatbuffers::numeric_limits<int8_t>::min(), -128);
- TEST_EQ(flatbuffers::numeric_limits<int8_t>::max(), 127);
- TEST_EQ(flatbuffers::numeric_limits<int16_t>::min(), -32768);
- TEST_EQ(flatbuffers::numeric_limits<int16_t>::max(), 32767);
- TEST_EQ(flatbuffers::numeric_limits<int32_t>::min() + 1, -2147483647);
- TEST_EQ(flatbuffers::numeric_limits<int32_t>::max(), 2147483647ULL);
- TEST_EQ(flatbuffers::numeric_limits<int64_t>::min() + 1LL,
- -9223372036854775807LL);
- TEST_EQ(flatbuffers::numeric_limits<int64_t>::max(), 9223372036854775807ULL);
- TEST_EQ(flatbuffers::numeric_limits<uint8_t>::max(), 255);
- TEST_EQ(flatbuffers::numeric_limits<uint16_t>::max(), 65535);
- TEST_EQ(flatbuffers::numeric_limits<uint32_t>::max(), 4294967295ULL);
- TEST_EQ(flatbuffers::numeric_limits<uint64_t>::max(),
- 18446744073709551615ULL);
-
- TEST_EQ(TestValue<int8_t>("{ y:127 }", "byte"), 127);
- TEST_EQ(TestValue<int8_t>("{ y:-128 }", "byte"), -128);
- TEST_EQ(TestValue<uint8_t>("{ y:255 }", "ubyte"), 255);
- TEST_EQ(TestValue<uint8_t>("{ y:0 }", "ubyte"), 0);
- TEST_EQ(TestValue<int16_t>("{ y:32767 }", "short"), 32767);
- TEST_EQ(TestValue<int16_t>("{ y:-32768 }", "short"), -32768);
- TEST_EQ(TestValue<uint16_t>("{ y:65535 }", "ushort"), 65535);
- TEST_EQ(TestValue<uint16_t>("{ y:0 }", "ushort"), 0);
- TEST_EQ(TestValue<int32_t>("{ y:2147483647 }", "int"), 2147483647);
- TEST_EQ(TestValue<int32_t>("{ y:-2147483648 }", "int") + 1, -2147483647);
- TEST_EQ(TestValue<uint32_t>("{ y:4294967295 }", "uint"), 4294967295);
- TEST_EQ(TestValue<uint32_t>("{ y:0 }", "uint"), 0);
- TEST_EQ(TestValue<int64_t>("{ y:9223372036854775807 }", "long"),
- 9223372036854775807LL);
- TEST_EQ(TestValue<int64_t>("{ y:-9223372036854775808 }", "long") + 1LL,
- -9223372036854775807LL);
- TEST_EQ(TestValue<uint64_t>("{ y:18446744073709551615 }", "ulong"),
- 18446744073709551615ULL);
- TEST_EQ(TestValue<uint64_t>("{ y:0 }", "ulong"), 0);
- TEST_EQ(TestValue<uint64_t>("{ y: 18446744073709551615 }", "uint64"),
- 18446744073709551615ULL);
- // check that the default works
- TEST_EQ(TestValue<uint64_t>(nullptr, "uint64 = 18446744073709551615"),
- 18446744073709551615ULL);
-}
-
-void ValidFloatTest() {
- // check rounding to infinity
- TEST_EQ(TestValue<float>("{ y:+3.4029e+38 }", "float"), +infinity_f);
- TEST_EQ(TestValue<float>("{ y:-3.4029e+38 }", "float"), -infinity_f);
- TEST_EQ(TestValue<double>("{ y:+1.7977e+308 }", "double"), +infinity_d);
- TEST_EQ(TestValue<double>("{ y:-1.7977e+308 }", "double"), -infinity_d);
-
- TEST_EQ(
- FloatCompare(TestValue<float>("{ y:0.0314159e+2 }", "float"), 3.14159f),
- true);
- // float in string
- TEST_EQ(FloatCompare(TestValue<float>("{ y:\" 0.0314159e+2 \" }", "float"),
- 3.14159f),
- true);
-
- TEST_EQ(TestValue<float>("{ y:1 }", "float"), 1.0f);
- TEST_EQ(TestValue<float>("{ y:1.0 }", "float"), 1.0f);
- TEST_EQ(TestValue<float>("{ y:1. }", "float"), 1.0f);
- TEST_EQ(TestValue<float>("{ y:+1. }", "float"), 1.0f);
- TEST_EQ(TestValue<float>("{ y:-1. }", "float"), -1.0f);
- TEST_EQ(TestValue<float>("{ y:1.e0 }", "float"), 1.0f);
- TEST_EQ(TestValue<float>("{ y:1.e+0 }", "float"), 1.0f);
- TEST_EQ(TestValue<float>("{ y:1.e-0 }", "float"), 1.0f);
- TEST_EQ(TestValue<float>("{ y:0.125 }", "float"), 0.125f);
- TEST_EQ(TestValue<float>("{ y:.125 }", "float"), 0.125f);
- TEST_EQ(TestValue<float>("{ y:-.125 }", "float"), -0.125f);
- TEST_EQ(TestValue<float>("{ y:+.125 }", "float"), +0.125f);
- TEST_EQ(TestValue<float>("{ y:5 }", "float"), 5.0f);
- TEST_EQ(TestValue<float>("{ y:\"5\" }", "float"), 5.0f);
-
-#if defined(FLATBUFFERS_HAS_NEW_STRTOD) && (FLATBUFFERS_HAS_NEW_STRTOD > 0)
- // Old MSVC versions may have problem with this check.
- // https://www.exploringbinary.com/visual-c-plus-plus-strtod-still-broken/
- TEST_EQ(TestValue<double>("{ y:6.9294956446009195e15 }", "double"),
- 6929495644600920.0);
- // check nan's
- TEST_EQ(std::isnan(TestValue<double>("{ y:nan }", "double")), true);
- TEST_EQ(std::isnan(TestValue<float>("{ y:nan }", "float")), true);
- TEST_EQ(std::isnan(TestValue<float>("{ y:\"nan\" }", "float")), true);
- TEST_EQ(std::isnan(TestValue<float>("{ y:\"+nan\" }", "float")), true);
- TEST_EQ(std::isnan(TestValue<float>("{ y:\"-nan\" }", "float")), true);
- TEST_EQ(std::isnan(TestValue<float>("{ y:+nan }", "float")), true);
- TEST_EQ(std::isnan(TestValue<float>("{ y:-nan }", "float")), true);
- TEST_EQ(std::isnan(TestValue<float>(nullptr, "float=nan")), true);
- TEST_EQ(std::isnan(TestValue<float>(nullptr, "float=-nan")), true);
- // check inf
- TEST_EQ(TestValue<float>("{ y:inf }", "float"), infinity_f);
- TEST_EQ(TestValue<float>("{ y:\"inf\" }", "float"), infinity_f);
- TEST_EQ(TestValue<float>("{ y:\"-inf\" }", "float"), -infinity_f);
- TEST_EQ(TestValue<float>("{ y:\"+inf\" }", "float"), infinity_f);
- TEST_EQ(TestValue<float>("{ y:+inf }", "float"), infinity_f);
- TEST_EQ(TestValue<float>("{ y:-inf }", "float"), -infinity_f);
- TEST_EQ(TestValue<float>(nullptr, "float=inf"), infinity_f);
- TEST_EQ(TestValue<float>(nullptr, "float=-inf"), -infinity_f);
- TestValue<double>(
- "{ y: [0.2, .2, 1.0, -1.0, -2., 2., 1e0, -1e0, 1.0e0, -1.0e0, -3.e2, "
- "3.0e2] }",
- "[double]");
- TestValue<float>(
- "{ y: [0.2, .2, 1.0, -1.0, -2., 2., 1e0, -1e0, 1.0e0, -1.0e0, -3.e2, "
- "3.0e2] }",
- "[float]");
-
- // Test binary format of float point.
- // https://en.cppreference.com/w/cpp/language/floating_literal
- // 0x11.12p-1 = (1*16^1 + 2*16^0 + 3*16^-1 + 4*16^-2) * 2^-1 =
- TEST_EQ(TestValue<double>("{ y:0x12.34p-1 }", "double"), 9.1015625);
- // hex fraction 1.2 (decimal 1.125) scaled by 2^3, that is 9.0
- TEST_EQ(TestValue<float>("{ y:-0x0.2p0 }", "float"), -0.125f);
- TEST_EQ(TestValue<float>("{ y:-0x.2p1 }", "float"), -0.25f);
- TEST_EQ(TestValue<float>("{ y:0x1.2p3 }", "float"), 9.0f);
- TEST_EQ(TestValue<float>("{ y:0x10.1p0 }", "float"), 16.0625f);
- TEST_EQ(TestValue<double>("{ y:0x1.2p3 }", "double"), 9.0);
- TEST_EQ(TestValue<double>("{ y:0x10.1p0 }", "double"), 16.0625);
- TEST_EQ(TestValue<double>("{ y:0xC.68p+2 }", "double"), 49.625);
- TestValue<double>("{ y: [0x20.4ep1, +0x20.4ep1, -0x20.4ep1] }", "[double]");
- TestValue<float>("{ y: [0x20.4ep1, +0x20.4ep1, -0x20.4ep1] }", "[float]");
-
-#else // FLATBUFFERS_HAS_NEW_STRTOD
- TEST_OUTPUT_LINE("FLATBUFFERS_HAS_NEW_STRTOD tests skipped");
-#endif // !FLATBUFFERS_HAS_NEW_STRTOD
-}
-
-void InvalidFloatTest() {
- auto invalid_msg = "invalid number";
- auto comma_msg = "expecting: ,";
- TestError("table T { F:float; } root_type T; { F:1,0 }", "");
- TestError("table T { F:float; } root_type T; { F:. }", "");
- TestError("table T { F:float; } root_type T; { F:- }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:+ }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:-. }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:+. }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:.e }", "");
- TestError("table T { F:float; } root_type T; { F:-e }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:+e }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:-.e }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:+.e }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:-e1 }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:+e1 }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:1.0e+ }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:1.0e- }", invalid_msg);
- // exponent pP is mandatory for hex-float
- TestError("table T { F:float; } root_type T; { F:0x0 }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:-0x. }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:0x. }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:0Xe }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:\"0Xe\" }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:\"nan(1)\" }", invalid_msg);
- // eE not exponent in hex-float!
- TestError("table T { F:float; } root_type T; { F:0x0.0e+ }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:0x0.0e- }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:0x0.0p }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:0x0.0p+ }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:0x0.0p- }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:0x0.0pa1 }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:0x0.0e+ }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:0x0.0e- }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:0x0.0e+0 }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:0x0.0e-0 }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:0x0.0ep+ }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:0x0.0ep- }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:1.2.3 }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:1.2.e3 }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:1.2e.3 }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:1.2e0.3 }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:1.2e3. }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:1.2e3.0 }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:+-1.0 }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:1.0e+-1 }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:\"1.0e+-1\" }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:1.e0e }", comma_msg);
- TestError("table T { F:float; } root_type T; { F:0x1.p0e }", comma_msg);
- TestError("table T { F:float; } root_type T; { F:\" 0x10 \" }", invalid_msg);
- // floats in string
- TestError("table T { F:float; } root_type T; { F:\"1,2.\" }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:\"1.2e3.\" }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:\"0x1.p0e\" }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:\"0x1.0\" }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:\" 0x1.0\" }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:\"+ 0\" }", invalid_msg);
- // disable escapes for "number-in-string"
- TestError("table T { F:float; } root_type T; { F:\"\\f1.2e3.\" }", "invalid");
- TestError("table T { F:float; } root_type T; { F:\"\\t1.2e3.\" }", "invalid");
- TestError("table T { F:float; } root_type T; { F:\"\\n1.2e3.\" }", "invalid");
- TestError("table T { F:float; } root_type T; { F:\"\\r1.2e3.\" }", "invalid");
- TestError("table T { F:float; } root_type T; { F:\"4\\x005\" }", "invalid");
- TestError("table T { F:float; } root_type T; { F:\"\'12\'\" }", invalid_msg);
- // null is not a number constant!
- TestError("table T { F:float; } root_type T; { F:\"null\" }", invalid_msg);
- TestError("table T { F:float; } root_type T; { F:null }", invalid_msg);
-}
-
-void GenerateTableTextTest() {
+void GenerateTableTextTest(const std::string &tests_data_path) {
std::string schemafile;
std::string jsonfile;
bool ok =
- flatbuffers::LoadFile((test_data_path + "monster_test.fbs").c_str(),
+ flatbuffers::LoadFile((tests_data_path + "monster_test.fbs").c_str(),
false, &schemafile) &&
- flatbuffers::LoadFile((test_data_path + "monsterdata_test.json").c_str(),
+ flatbuffers::LoadFile((tests_data_path + "monsterdata_test.json").c_str(),
false, &jsonfile);
TEST_EQ(ok, true);
auto include_test_path =
- flatbuffers::ConCatPathFileName(test_data_path, "include_test");
- const char *include_directories[] = { test_data_path.c_str(),
+ flatbuffers::ConCatPathFileName(tests_data_path, "include_test");
+ const char *include_directories[] = { tests_data_path.c_str(),
include_test_path.c_str(), nullptr };
flatbuffers::IDLOptions opt;
opt.indent_step = -1;
@@ -2360,338 +138,9 @@
TEST_EQ_STR(jsongen.c_str(), "{a: 10,b: 20}");
}
-template<typename T>
-void NumericUtilsTestInteger(const char *lower, const char *upper) {
- T x;
- TEST_EQ(flatbuffers::StringToNumber("1q", &x), false);
- TEST_EQ(x, 0);
- TEST_EQ(flatbuffers::StringToNumber(upper, &x), false);
- TEST_EQ(x, flatbuffers::numeric_limits<T>::max());
- TEST_EQ(flatbuffers::StringToNumber(lower, &x), false);
- auto expval = flatbuffers::is_unsigned<T>::value
- ? flatbuffers::numeric_limits<T>::max()
- : flatbuffers::numeric_limits<T>::lowest();
- TEST_EQ(x, expval);
-}
-
-template<typename T>
-void NumericUtilsTestFloat(const char *lower, const char *upper) {
- T f;
- TEST_EQ(flatbuffers::StringToNumber("", &f), false);
- TEST_EQ(flatbuffers::StringToNumber("1q", &f), false);
- TEST_EQ(f, 0);
- TEST_EQ(flatbuffers::StringToNumber(upper, &f), true);
- TEST_EQ(f, +flatbuffers::numeric_limits<T>::infinity());
- TEST_EQ(flatbuffers::StringToNumber(lower, &f), true);
- TEST_EQ(f, -flatbuffers::numeric_limits<T>::infinity());
-}
-
-void NumericUtilsTest() {
- NumericUtilsTestInteger<uint64_t>("-1", "18446744073709551616");
- NumericUtilsTestInteger<uint8_t>("-1", "256");
- NumericUtilsTestInteger<int64_t>("-9223372036854775809",
- "9223372036854775808");
- NumericUtilsTestInteger<int8_t>("-129", "128");
- NumericUtilsTestFloat<float>("-3.4029e+38", "+3.4029e+38");
- NumericUtilsTestFloat<float>("-1.7977e+308", "+1.7977e+308");
-}
-
-void IsAsciiUtilsTest() {
- char c = -128;
- for (int cnt = 0; cnt < 256; cnt++) {
- auto alpha = (('a' <= c) && (c <= 'z')) || (('A' <= c) && (c <= 'Z'));
- auto dec = (('0' <= c) && (c <= '9'));
- auto hex = (('a' <= c) && (c <= 'f')) || (('A' <= c) && (c <= 'F'));
- TEST_EQ(flatbuffers::is_alpha(c), alpha);
- TEST_EQ(flatbuffers::is_alnum(c), alpha || dec);
- TEST_EQ(flatbuffers::is_digit(c), dec);
- TEST_EQ(flatbuffers::is_xdigit(c), dec || hex);
- c += 1;
- }
-}
-
-void UnicodeTest() {
- flatbuffers::Parser parser;
- // Without setting allow_non_utf8 = true, we treat \x sequences as byte
- // sequences which are then validated as UTF-8.
- TEST_EQ(parser.Parse("table T { F:string; }"
- "root_type T;"
- "{ F:\"\\u20AC\\u00A2\\u30E6\\u30FC\\u30B6\\u30FC"
- "\\u5225\\u30B5\\u30A4\\u30C8\\xE2\\x82\\xAC\\u0080\\uD8"
- "3D\\uDE0E\" }"),
- true);
- std::string jsongen;
- parser.opts.indent_step = -1;
- auto result =
- GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen);
- TEST_EQ(result, true);
- TEST_EQ_STR(jsongen.c_str(),
- "{F: \"\\u20AC\\u00A2\\u30E6\\u30FC\\u30B6\\u30FC"
- "\\u5225\\u30B5\\u30A4\\u30C8\\u20AC\\u0080\\uD83D\\uDE0E\"}");
-}
-
-void UnicodeTestAllowNonUTF8() {
- flatbuffers::Parser parser;
- parser.opts.allow_non_utf8 = true;
- TEST_EQ(
- parser.Parse(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\\u20AC\\u00A2\\u30E6\\u30FC\\u30B6\\u30FC"
- "\\u5225\\u30B5\\u30A4\\u30C8\\x01\\x80\\u0080\\uD83D\\uDE0E\" }"),
- true);
- std::string jsongen;
- parser.opts.indent_step = -1;
- auto result =
- GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen);
- TEST_EQ(result, true);
- TEST_EQ_STR(
- jsongen.c_str(),
- "{F: \"\\u20AC\\u00A2\\u30E6\\u30FC\\u30B6\\u30FC"
- "\\u5225\\u30B5\\u30A4\\u30C8\\u0001\\x80\\u0080\\uD83D\\uDE0E\"}");
-}
-
-void UnicodeTestGenerateTextFailsOnNonUTF8() {
- flatbuffers::Parser parser;
- // Allow non-UTF-8 initially to model what happens when we load a binary
- // flatbuffer from disk which contains non-UTF-8 strings.
- parser.opts.allow_non_utf8 = true;
- TEST_EQ(
- parser.Parse(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\\u20AC\\u00A2\\u30E6\\u30FC\\u30B6\\u30FC"
- "\\u5225\\u30B5\\u30A4\\u30C8\\x01\\x80\\u0080\\uD83D\\uDE0E\" }"),
- true);
- std::string jsongen;
- parser.opts.indent_step = -1;
- // Now, disallow non-UTF-8 (the default behavior) so GenerateText indicates
- // failure.
- parser.opts.allow_non_utf8 = false;
- auto result =
- GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen);
- TEST_EQ(result, false);
-}
-
-void UnicodeSurrogatesTest() {
- flatbuffers::Parser parser;
-
- TEST_EQ(parser.Parse("table T { F:string (id: 0); }"
- "root_type T;"
- "{ F:\"\\uD83D\\uDCA9\"}"),
- true);
- auto root = flatbuffers::GetRoot<flatbuffers::Table>(
- parser.builder_.GetBufferPointer());
- auto string = root->GetPointer<flatbuffers::String *>(
- flatbuffers::FieldIndexToOffset(0));
- TEST_EQ_STR(string->c_str(), "\xF0\x9F\x92\xA9");
-}
-
-void UnicodeInvalidSurrogatesTest() {
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\\uD800\"}",
- "unpaired high surrogate");
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\\uD800abcd\"}",
- "unpaired high surrogate");
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\\uD800\\n\"}",
- "unpaired high surrogate");
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\\uD800\\uD800\"}",
- "multiple high surrogates");
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\\uDC00\"}",
- "unpaired low surrogate");
-}
-
-void InvalidUTF8Test() {
- // "1 byte" pattern, under min length of 2 bytes
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\x80\"}",
- "illegal UTF-8 sequence");
- // 2 byte pattern, string too short
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\xDF\"}",
- "illegal UTF-8 sequence");
- // 3 byte pattern, string too short
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\xEF\xBF\"}",
- "illegal UTF-8 sequence");
- // 4 byte pattern, string too short
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\xF7\xBF\xBF\"}",
- "illegal UTF-8 sequence");
- // "5 byte" pattern, string too short
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\xFB\xBF\xBF\xBF\"}",
- "illegal UTF-8 sequence");
- // "6 byte" pattern, string too short
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\xFD\xBF\xBF\xBF\xBF\"}",
- "illegal UTF-8 sequence");
- // "7 byte" pattern, string too short
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\xFE\xBF\xBF\xBF\xBF\xBF\"}",
- "illegal UTF-8 sequence");
- // "5 byte" pattern, over max length of 4 bytes
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\xFB\xBF\xBF\xBF\xBF\"}",
- "illegal UTF-8 sequence");
- // "6 byte" pattern, over max length of 4 bytes
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\xFD\xBF\xBF\xBF\xBF\xBF\"}",
- "illegal UTF-8 sequence");
- // "7 byte" pattern, over max length of 4 bytes
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\xFE\xBF\xBF\xBF\xBF\xBF\xBF\"}",
- "illegal UTF-8 sequence");
-
- // Three invalid encodings for U+000A (\n, aka NEWLINE)
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\xC0\x8A\"}",
- "illegal UTF-8 sequence");
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\xE0\x80\x8A\"}",
- "illegal UTF-8 sequence");
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\xF0\x80\x80\x8A\"}",
- "illegal UTF-8 sequence");
-
- // Two invalid encodings for U+00A9 (COPYRIGHT SYMBOL)
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\xE0\x81\xA9\"}",
- "illegal UTF-8 sequence");
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\xF0\x80\x81\xA9\"}",
- "illegal UTF-8 sequence");
-
- // Invalid encoding for U+20AC (EURO SYMBOL)
- TestError(
- "table T { F:string; }"
- "root_type T;"
- "{ F:\"\xF0\x82\x82\xAC\"}",
- "illegal UTF-8 sequence");
-
- // UTF-16 surrogate values between U+D800 and U+DFFF cannot be encoded in
- // UTF-8
- TestError(
- "table T { F:string; }"
- "root_type T;"
- // U+10400 "encoded" as U+D801 U+DC00
- "{ F:\"\xED\xA0\x81\xED\xB0\x80\"}",
- "illegal UTF-8 sequence");
-
- // Check independence of identifier from locale.
- std::string locale_ident;
- locale_ident += "table T { F";
- locale_ident += static_cast<char>(-32); // unsigned 0xE0
- locale_ident += " :string; }";
- locale_ident += "root_type T;";
- locale_ident += "{}";
- TestError(locale_ident.c_str(), "");
-}
-
-void UnknownFieldsTest() {
- flatbuffers::IDLOptions opts;
- opts.skip_unexpected_fields_in_json = true;
- flatbuffers::Parser parser(opts);
-
- TEST_EQ(parser.Parse("table T { str:string; i:int;}"
- "root_type T;"
- "{ str:\"test\","
- "unknown_string:\"test\","
- "\"unknown_string\":\"test\","
- "unknown_int:10,"
- "unknown_float:1.0,"
- "unknown_array: [ 1, 2, 3, 4],"
- "unknown_object: { i: 10 },"
- "\"unknown_object\": { \"i\": 10 },"
- "i:10}"),
- true);
-
- std::string jsongen;
- parser.opts.indent_step = -1;
- auto result =
- GenerateText(parser, parser.builder_.GetBufferPointer(), &jsongen);
- TEST_EQ(result, true);
- TEST_EQ_STR(jsongen.c_str(), "{str: \"test\",i: 10}");
-}
-
-void ParseUnionTest() {
- // Unions must be parseable with the type field following the object.
- flatbuffers::Parser parser;
- TEST_EQ(parser.Parse("table T { A:int; }"
- "union U { T }"
- "table V { X:U; }"
- "root_type V;"
- "{ X:{ A:1 }, X_type: T }"),
- true);
- // Unions must be parsable with prefixed namespace.
- flatbuffers::Parser parser2;
- TEST_EQ(parser2.Parse("namespace N; table A {} namespace; union U { N.A }"
- "table B { e:U; } root_type B;"
- "{ e_type: N_A, e: {} }"),
- true);
-}
-
-void ValidSameNameDifferentNamespaceTest() {
- // Duplicate table names in different namespaces must be parsable
- TEST_ASSERT(flatbuffers::Parser().Parse(
- "namespace A; table X {} namespace B; table X {}"));
- // Duplicate union names in different namespaces must be parsable
- TEST_ASSERT(flatbuffers::Parser().Parse(
- "namespace A; union X {} namespace B; union X {}"));
- // Clashing table and union names in different namespaces must be parsable
- TEST_ASSERT(flatbuffers::Parser().Parse(
- "namespace A; table X {} namespace B; union X {}"));
- TEST_ASSERT(flatbuffers::Parser().Parse(
- "namespace A; union X {} namespace B; table X {}"));
-}
-
-void MultiFileNameClashTest() {
+void MultiFileNameClashTest(const std::string &tests_data_path) {
const auto name_clash_path =
- flatbuffers::ConCatPathFileName(test_data_path, "name_clash_test");
+ flatbuffers::ConCatPathFileName(tests_data_path, "name_clash_test");
const char *include_directories[] = { name_clash_path.c_str() };
// Load valid 2 file Flatbuffer schema
@@ -2718,15 +167,15 @@
false);
}
-void InvalidNestedFlatbufferTest() {
+void InvalidNestedFlatbufferTest(const std::string &tests_data_path) {
// First, load and parse FlatBuffer schema (.fbs)
std::string schemafile;
- TEST_EQ(flatbuffers::LoadFile((test_data_path + "monster_test.fbs").c_str(),
+ TEST_EQ(flatbuffers::LoadFile((tests_data_path + "monster_test.fbs").c_str(),
false, &schemafile),
true);
auto include_test_path =
- flatbuffers::ConCatPathFileName(test_data_path, "include_test");
- const char *include_directories[] = { test_data_path.c_str(),
+ flatbuffers::ConCatPathFileName(tests_data_path, "include_test");
+ const char *include_directories[] = { tests_data_path.c_str(),
include_test_path.c_str(), nullptr };
flatbuffers::Parser parser1;
TEST_EQ(parser1.Parse(schemafile.c_str(), include_directories), true);
@@ -2737,122 +186,15 @@
false);
}
-void EvolutionTest() {
- // VS10 does not support typed enums, exclude from tests
-#if !defined(_MSC_VER) || _MSC_VER >= 1700
- const int NUM_VERSIONS = 2;
- std::string schemas[NUM_VERSIONS];
- std::string jsonfiles[NUM_VERSIONS];
- std::vector<uint8_t> binaries[NUM_VERSIONS];
-
- flatbuffers::IDLOptions idl_opts;
- idl_opts.lang_to_generate |= flatbuffers::IDLOptions::kBinary;
- flatbuffers::Parser parser(idl_opts);
-
- // Load all the schema versions and their associated data.
- for (int i = 0; i < NUM_VERSIONS; ++i) {
- std::string schema = test_data_path + "evolution_test/evolution_v" +
- flatbuffers::NumToString(i + 1) + ".fbs";
- TEST_ASSERT(flatbuffers::LoadFile(schema.c_str(), false, &schemas[i]));
- std::string json = test_data_path + "evolution_test/evolution_v" +
- flatbuffers::NumToString(i + 1) + ".json";
- TEST_ASSERT(flatbuffers::LoadFile(json.c_str(), false, &jsonfiles[i]));
-
- TEST_ASSERT(parser.Parse(schemas[i].c_str()));
- TEST_ASSERT(parser.Parse(jsonfiles[i].c_str()));
-
- auto bufLen = parser.builder_.GetSize();
- auto buf = parser.builder_.GetBufferPointer();
- binaries[i].reserve(bufLen);
- std::copy(buf, buf + bufLen, std::back_inserter(binaries[i]));
- }
-
- // Assert that all the verifiers for the different schema versions properly
- // verify any version data.
- for (int i = 0; i < NUM_VERSIONS; ++i) {
- flatbuffers::Verifier verifier(&binaries[i].front(), binaries[i].size());
- TEST_ASSERT(Evolution::V1::VerifyRootBuffer(verifier));
- TEST_ASSERT(Evolution::V2::VerifyRootBuffer(verifier));
- }
-
- // Test backwards compatibility by reading old data with an evolved schema.
- auto root_v1_viewed_from_v2 = Evolution::V2::GetRoot(&binaries[0].front());
- // field 'k' is new in version 2, so it should be null.
- TEST_ASSERT(nullptr == root_v1_viewed_from_v2->k());
- // field 'l' is new in version 2 with a default of 56.
- TEST_EQ(root_v1_viewed_from_v2->l(), 56);
- // field 'c' of 'TableA' is new in version 2, so it should be null.
- TEST_ASSERT(nullptr == root_v1_viewed_from_v2->e()->c());
- // 'TableC' was added to field 'c' union in version 2, so it should be null.
- TEST_ASSERT(nullptr == root_v1_viewed_from_v2->c_as_TableC());
- // The field 'c' union should be of type 'TableB' regardless of schema version
- TEST_ASSERT(root_v1_viewed_from_v2->c_type() == Evolution::V2::Union::TableB);
- // The field 'f' was renamed to 'ff' in version 2, it should still be
- // readable.
- TEST_EQ(root_v1_viewed_from_v2->ff()->a(), 16);
-
- // Test forwards compatibility by reading new data with an old schema.
- auto root_v2_viewed_from_v1 = Evolution::V1::GetRoot(&binaries[1].front());
- // The field 'c' union in version 2 is a new table (index = 3) and should
- // still be accessible, but not interpretable.
- TEST_EQ(static_cast<uint8_t>(root_v2_viewed_from_v1->c_type()), 3);
- TEST_NOTNULL(root_v2_viewed_from_v1->c());
- // The field 'd' enum in verison 2 has new members and should still be
- // accessible, but not interpretable.
- TEST_EQ(static_cast<int8_t>(root_v2_viewed_from_v1->d()), 3);
- // The field 'a' in version 2 is deprecated and should return the default
- // value (0) instead of the value stored in the in the buffer (42).
- TEST_EQ(root_v2_viewed_from_v1->a(), 0);
- // The field 'ff' was originally named 'f' in version 1, it should still be
- // readable.
- TEST_EQ(root_v2_viewed_from_v1->f()->a(), 35);
-#endif
-}
-
-void UnionDeprecationTest() {
- const int NUM_VERSIONS = 2;
- std::string schemas[NUM_VERSIONS];
- std::string jsonfiles[NUM_VERSIONS];
- std::vector<uint8_t> binaries[NUM_VERSIONS];
-
- flatbuffers::IDLOptions idl_opts;
- idl_opts.lang_to_generate |= flatbuffers::IDLOptions::kBinary;
- flatbuffers::Parser parser(idl_opts);
-
- // Load all the schema versions and their associated data.
- for (int i = 0; i < NUM_VERSIONS; ++i) {
- std::string schema = test_data_path + "evolution_test/evolution_v" +
- flatbuffers::NumToString(i + 1) + ".fbs";
- TEST_ASSERT(flatbuffers::LoadFile(schema.c_str(), false, &schemas[i]));
- std::string json = test_data_path + "evolution_test/evolution_v" +
- flatbuffers::NumToString(i + 1) + ".json";
- TEST_ASSERT(flatbuffers::LoadFile(json.c_str(), false, &jsonfiles[i]));
-
- TEST_ASSERT(parser.Parse(schemas[i].c_str()));
- TEST_ASSERT(parser.Parse(jsonfiles[i].c_str()));
-
- auto bufLen = parser.builder_.GetSize();
- auto buf = parser.builder_.GetBufferPointer();
- binaries[i].reserve(bufLen);
- std::copy(buf, buf + bufLen, std::back_inserter(binaries[i]));
- }
-
- auto v2 = parser.LookupStruct("Evolution.V2.Root");
- TEST_NOTNULL(v2);
- auto j_type_field = v2->fields.Lookup("j_type");
- TEST_NOTNULL(j_type_field);
- TEST_ASSERT(j_type_field->deprecated);
-}
-
-void UnionVectorTest() {
+void UnionVectorTest(const std::string &tests_data_path) {
// load FlatBuffer fbs schema and json.
std::string schemafile, jsonfile;
TEST_EQ(flatbuffers::LoadFile(
- (test_data_path + "union_vector/union_vector.fbs").c_str(), false,
- &schemafile),
+ (tests_data_path + "union_vector/union_vector.fbs").c_str(),
+ false, &schemafile),
true);
TEST_EQ(flatbuffers::LoadFile(
- (test_data_path + "union_vector/union_vector.json").c_str(),
+ (tests_data_path + "union_vector/union_vector.json").c_str(),
false, &jsonfile),
true);
@@ -3035,339 +377,6 @@
TEST_EQ(parser2.Parse("{a_type:Bool,a:{b:true}}"), true);
}
-void StructUnionTest() {
- GadgetUnion gadget;
- gadget.Set(FallingTub(100));
-
- HandFanT fan;
- fan.length = 10;
- gadget.Set(fan);
-}
-
-void WarningsAsErrorsTest() {
- {
- flatbuffers::IDLOptions opts;
- // opts.warnings_as_errors should default to false
- flatbuffers::Parser parser(opts);
- TEST_EQ(parser.Parse("table T { THIS_NAME_CAUSES_A_WARNING:string;}\n"
- "root_type T;"),
- true);
- }
- {
- flatbuffers::IDLOptions opts;
- opts.warnings_as_errors = true;
- flatbuffers::Parser parser(opts);
- TEST_EQ(parser.Parse("table T { THIS_NAME_CAUSES_A_WARNING:string;}\n"
- "root_type T;"),
- false);
- }
-}
-
-void ConformTest() {
- flatbuffers::Parser parser;
- TEST_EQ(parser.Parse("table T { A:int; } enum E:byte { A }"), true);
-
- auto test_conform = [](flatbuffers::Parser &parser1, const char *test,
- const char *expected_err) {
- flatbuffers::Parser parser2;
- TEST_EQ(parser2.Parse(test), true);
- auto err = parser2.ConformTo(parser1);
- TEST_NOTNULL(strstr(err.c_str(), expected_err));
- };
-
- test_conform(parser, "table T { A:byte; }", "types differ for field");
- test_conform(parser, "table T { B:int; A:int; }", "offsets differ for field");
- test_conform(parser, "table T { A:int = 1; }", "defaults differ for field");
- test_conform(parser, "table T { B:float; }",
- "field renamed to different type");
- test_conform(parser, "enum E:byte { B, A }", "values differ for enum");
-}
-
-void ParseProtoBufAsciiTest() {
- // We can put the parser in a mode where it will accept JSON that looks more
- // like Protobuf ASCII, for users that have data in that format.
- // This uses no "" for field names (which we already support by default,
- // omits `,`, `:` before `{` and a couple of other features.
- flatbuffers::Parser parser;
- parser.opts.protobuf_ascii_alike = true;
- TEST_EQ(
- parser.Parse("table S { B:int; } table T { A:[int]; C:S; } root_type T;"),
- true);
- TEST_EQ(parser.Parse("{ A [1 2] C { B:2 }}"), true);
- // Similarly, in text output, it should omit these.
- std::string text;
- auto ok = flatbuffers::GenerateText(
- parser, parser.builder_.GetBufferPointer(), &text);
- TEST_EQ(ok, true);
- TEST_EQ_STR(text.c_str(),
- "{\n A [\n 1\n 2\n ]\n C {\n B: 2\n }\n}\n");
-}
-
-void FlexBuffersTest() {
- flexbuffers::Builder slb(512,
- flexbuffers::BUILDER_FLAG_SHARE_KEYS_AND_STRINGS);
-
- // Write the equivalent of:
- // { vec: [ -100, "Fred", 4.0, false ], bar: [ 1, 2, 3 ], bar3: [ 1, 2, 3 ],
- // foo: 100, bool: true, mymap: { foo: "Fred" } }
-
- // It's possible to do this without std::function support as well.
- slb.Map([&]() {
- slb.Vector("vec", [&]() {
- slb += -100; // Equivalent to slb.Add(-100) or slb.Int(-100);
- slb += "Fred";
- slb.IndirectFloat(4.0f);
- auto i_f = slb.LastValue();
- uint8_t blob[] = { 77 };
- slb.Blob(blob, 1);
- slb += false;
- slb.ReuseValue(i_f);
- });
- int ints[] = { 1, 2, 3 };
- slb.Vector("bar", ints, 3);
- slb.FixedTypedVector("bar3", ints, 3);
- bool bools[] = { true, false, true, false };
- slb.Vector("bools", bools, 4);
- slb.Bool("bool", true);
- slb.Double("foo", 100);
- slb.Map("mymap", [&]() {
- slb.String("foo", "Fred"); // Testing key and string reuse.
- });
- });
- slb.Finish();
-
-// clang-format off
- #ifdef FLATBUFFERS_TEST_VERBOSE
- for (size_t i = 0; i < slb.GetBuffer().size(); i++)
- printf("%d ", slb.GetBuffer().data()[i]);
- printf("\n");
- #endif
- // clang-format on
-
- std::vector<uint8_t> reuse_tracker;
- TEST_EQ(flexbuffers::VerifyBuffer(slb.GetBuffer().data(),
- slb.GetBuffer().size(), &reuse_tracker),
- true);
-
- auto map = flexbuffers::GetRoot(slb.GetBuffer()).AsMap();
- TEST_EQ(map.size(), 7);
- auto vec = map["vec"].AsVector();
- TEST_EQ(vec.size(), 6);
- TEST_EQ(vec[0].AsInt64(), -100);
- TEST_EQ_STR(vec[1].AsString().c_str(), "Fred");
- TEST_EQ(vec[1].AsInt64(), 0); // Number parsing failed.
- TEST_EQ(vec[2].AsDouble(), 4.0);
- TEST_EQ(vec[2].AsString().IsTheEmptyString(), true); // Wrong Type.
- TEST_EQ_STR(vec[2].AsString().c_str(), ""); // This still works though.
- TEST_EQ_STR(vec[2].ToString().c_str(), "4.0"); // Or have it converted.
- // Few tests for templated version of As.
- TEST_EQ(vec[0].As<int64_t>(), -100);
- TEST_EQ_STR(vec[1].As<std::string>().c_str(), "Fred");
- TEST_EQ(vec[1].As<int64_t>(), 0); // Number parsing failed.
- TEST_EQ(vec[2].As<double>(), 4.0);
- // Test that the blob can be accessed.
- TEST_EQ(vec[3].IsBlob(), true);
- auto blob = vec[3].AsBlob();
- TEST_EQ(blob.size(), 1);
- TEST_EQ(blob.data()[0], 77);
- TEST_EQ(vec[4].IsBool(), true); // Check if type is a bool
- TEST_EQ(vec[4].AsBool(), false); // Check if value is false
- TEST_EQ(vec[5].AsDouble(), 4.0); // This is shared with vec[2] !
- auto tvec = map["bar"].AsTypedVector();
- TEST_EQ(tvec.size(), 3);
- TEST_EQ(tvec[2].AsInt8(), 3);
- auto tvec3 = map["bar3"].AsFixedTypedVector();
- TEST_EQ(tvec3.size(), 3);
- TEST_EQ(tvec3[2].AsInt8(), 3);
- TEST_EQ(map["bool"].AsBool(), true);
- auto tvecb = map["bools"].AsTypedVector();
- TEST_EQ(tvecb.ElementType(), flexbuffers::FBT_BOOL);
- TEST_EQ(map["foo"].AsUInt8(), 100);
- TEST_EQ(map["unknown"].IsNull(), true);
- auto mymap = map["mymap"].AsMap();
- // These should be equal by pointer equality, since key and value are shared.
- TEST_EQ(mymap.Keys()[0].AsKey(), map.Keys()[4].AsKey());
- TEST_EQ(mymap.Values()[0].AsString().c_str(), vec[1].AsString().c_str());
- // We can mutate values in the buffer.
- TEST_EQ(vec[0].MutateInt(-99), true);
- TEST_EQ(vec[0].AsInt64(), -99);
- TEST_EQ(vec[1].MutateString("John"), true); // Size must match.
- TEST_EQ_STR(vec[1].AsString().c_str(), "John");
- TEST_EQ(vec[1].MutateString("Alfred"), false); // Too long.
- TEST_EQ(vec[2].MutateFloat(2.0f), true);
- TEST_EQ(vec[2].AsFloat(), 2.0f);
- TEST_EQ(vec[2].MutateFloat(3.14159), false); // Double does not fit in float.
- TEST_EQ(vec[4].AsBool(), false); // Is false before change
- TEST_EQ(vec[4].MutateBool(true), true); // Can change a bool
- TEST_EQ(vec[4].AsBool(), true); // Changed bool is now true
-
- // Parse from JSON:
- flatbuffers::Parser parser;
- slb.Clear();
- auto jsontest = "{ a: [ 123, 456.0 ], b: \"hello\", c: true, d: false }";
- TEST_EQ(parser.ParseFlexBuffer(jsontest, nullptr, &slb), true);
- TEST_EQ(flexbuffers::VerifyBuffer(slb.GetBuffer().data(),
- slb.GetBuffer().size(), &reuse_tracker),
- true);
- auto jroot = flexbuffers::GetRoot(slb.GetBuffer());
- auto jmap = jroot.AsMap();
- auto jvec = jmap["a"].AsVector();
- TEST_EQ(jvec[0].AsInt64(), 123);
- TEST_EQ(jvec[1].AsDouble(), 456.0);
- TEST_EQ_STR(jmap["b"].AsString().c_str(), "hello");
- TEST_EQ(jmap["c"].IsBool(), true); // Parsed correctly to a bool
- TEST_EQ(jmap["c"].AsBool(), true); // Parsed correctly to true
- TEST_EQ(jmap["d"].IsBool(), true); // Parsed correctly to a bool
- TEST_EQ(jmap["d"].AsBool(), false); // Parsed correctly to false
- // And from FlexBuffer back to JSON:
- auto jsonback = jroot.ToString();
- TEST_EQ_STR(jsontest, jsonback.c_str());
-
- slb.Clear();
- slb.Vector([&]() {
- for (int i = 0; i < 130; ++i) slb.Add(static_cast<uint8_t>(255));
- slb.Vector([&]() {
- for (int i = 0; i < 130; ++i) slb.Add(static_cast<uint8_t>(255));
- slb.Vector([] {});
- });
- });
- slb.Finish();
- TEST_EQ(slb.GetSize(), 664);
-}
-
-void FlexBuffersFloatingPointTest() {
-#if defined(FLATBUFFERS_HAS_NEW_STRTOD) && (FLATBUFFERS_HAS_NEW_STRTOD > 0)
- flexbuffers::Builder slb(512,
- flexbuffers::BUILDER_FLAG_SHARE_KEYS_AND_STRINGS);
- // Parse floating-point values from JSON:
- flatbuffers::Parser parser;
- slb.Clear();
- auto jsontest =
- "{ a: [1.0, nan, inf, infinity, -inf, +inf, -infinity, 8.0] }";
- TEST_EQ(parser.ParseFlexBuffer(jsontest, nullptr, &slb), true);
- auto jroot = flexbuffers::GetRoot(slb.GetBuffer());
- TEST_EQ(flexbuffers::VerifyBuffer(slb.GetBuffer().data(),
- slb.GetBuffer().size(), nullptr),
- true);
- auto jmap = jroot.AsMap();
- auto jvec = jmap["a"].AsVector();
- TEST_EQ(8, jvec.size());
- TEST_EQ(1.0, jvec[0].AsDouble());
- TEST_ASSERT(is_quiet_nan(jvec[1].AsDouble()));
- TEST_EQ(infinity_d, jvec[2].AsDouble());
- TEST_EQ(infinity_d, jvec[3].AsDouble());
- TEST_EQ(-infinity_d, jvec[4].AsDouble());
- TEST_EQ(+infinity_d, jvec[5].AsDouble());
- TEST_EQ(-infinity_d, jvec[6].AsDouble());
- TEST_EQ(8.0, jvec[7].AsDouble());
-#endif
-}
-
-void FlexBuffersDeprecatedTest() {
- // FlexBuffers as originally designed had a flaw involving the
- // FBT_VECTOR_STRING datatype, and this test documents/tests the fix for it.
- // Discussion: https://github.com/google/flatbuffers/issues/5627
- flexbuffers::Builder slb;
- // FBT_VECTOR_* are "typed vectors" where all elements are of the same type.
- // Problem is, when storing FBT_STRING elements, it relies on that type to
- // get the bit-width for the size field of the string, which in this case
- // isn't present, and instead defaults to 8-bit. This means that any strings
- // stored inside such a vector, when accessed thru the old API that returns
- // a String reference, will appear to be truncated if the string stored is
- // actually >=256 bytes.
- std::string test_data(300, 'A');
- auto start = slb.StartVector();
- // This one will have a 16-bit size field.
- slb.String(test_data);
- // This one will have an 8-bit size field.
- slb.String("hello");
- // We're asking this to be serialized as a typed vector (true), but not
- // fixed size (false). The type will be FBT_VECTOR_STRING with a bit-width
- // of whatever the offsets in the vector need, the bit-widths of the strings
- // are not stored(!) <- the actual design flaw.
- // Note that even in the fixed code, we continue to serialize the elements of
- // FBT_VECTOR_STRING as FBT_STRING, since there may be old code out there
- // reading new data that we want to continue to function.
- // Thus, FBT_VECTOR_STRING, while deprecated, will always be represented the
- // same way, the fix lies on the reading side.
- slb.EndVector(start, true, false);
- slb.Finish();
- // Verify because why not.
- TEST_EQ(flexbuffers::VerifyBuffer(slb.GetBuffer().data(),
- slb.GetBuffer().size(), nullptr),
- true);
- // So now lets read this data back.
- // For existing data, since we have no way of knowing what the actual
- // bit-width of the size field of the string is, we are going to ignore this
- // field, and instead treat these strings as FBT_KEY (null-terminated), so we
- // can deal with strings of arbitrary length. This of course truncates strings
- // with embedded nulls, but we think that that is preferrable over truncating
- // strings >= 256 bytes.
- auto vec = flexbuffers::GetRoot(slb.GetBuffer()).AsTypedVector();
- // Even though this was serialized as FBT_VECTOR_STRING, it is read as
- // FBT_VECTOR_KEY:
- TEST_EQ(vec.ElementType(), flexbuffers::FBT_KEY);
- // Access the long string. Previously, this would return a string of size 1,
- // since it would read the high-byte of the 16-bit length.
- // This should now correctly test the full 300 bytes, using AsKey():
- TEST_EQ_STR(vec[0].AsKey(), test_data.c_str());
- // Old code that called AsString will continue to work, as the String
- // accessor objects now use a cached size that can come from a key as well.
- TEST_EQ_STR(vec[0].AsString().c_str(), test_data.c_str());
- // Short strings work as before:
- TEST_EQ_STR(vec[1].AsKey(), "hello");
- TEST_EQ_STR(vec[1].AsString().c_str(), "hello");
- // So, while existing code and data mostly "just work" with the fixes applied
- // to AsTypedVector and AsString, what do you do going forward?
- // Code accessing existing data doesn't necessarily need to change, though
- // you could consider using AsKey instead of AsString for a) documenting
- // that you are accessing keys, or b) a speedup if you don't actually use
- // the string size.
- // For new data, or data that doesn't need to be backwards compatible,
- // instead serialize as FBT_VECTOR (call EndVector with typed = false, then
- // read elements with AsString), or, for maximum compactness, use
- // FBT_VECTOR_KEY (call slb.Key above instead, read with AsKey or AsString).
-}
-
-void TypeAliasesTest() {
- flatbuffers::FlatBufferBuilder builder;
-
- builder.Finish(CreateTypeAliases(
- builder, flatbuffers::numeric_limits<int8_t>::min(),
- flatbuffers::numeric_limits<uint8_t>::max(),
- flatbuffers::numeric_limits<int16_t>::min(),
- flatbuffers::numeric_limits<uint16_t>::max(),
- flatbuffers::numeric_limits<int32_t>::min(),
- flatbuffers::numeric_limits<uint32_t>::max(),
- flatbuffers::numeric_limits<int64_t>::min(),
- flatbuffers::numeric_limits<uint64_t>::max(), 2.3f, 2.3));
-
- auto p = builder.GetBufferPointer();
- auto ta = flatbuffers::GetRoot<TypeAliases>(p);
-
- TEST_EQ(ta->i8(), flatbuffers::numeric_limits<int8_t>::min());
- TEST_EQ(ta->u8(), flatbuffers::numeric_limits<uint8_t>::max());
- TEST_EQ(ta->i16(), flatbuffers::numeric_limits<int16_t>::min());
- TEST_EQ(ta->u16(), flatbuffers::numeric_limits<uint16_t>::max());
- TEST_EQ(ta->i32(), flatbuffers::numeric_limits<int32_t>::min());
- TEST_EQ(ta->u32(), flatbuffers::numeric_limits<uint32_t>::max());
- TEST_EQ(ta->i64(), flatbuffers::numeric_limits<int64_t>::min());
- TEST_EQ(ta->u64(), flatbuffers::numeric_limits<uint64_t>::max());
- TEST_EQ(ta->f32(), 2.3f);
- TEST_EQ(ta->f64(), 2.3);
- using namespace flatbuffers; // is_same
- static_assert(is_same<decltype(ta->i8()), int8_t>::value, "invalid type");
- static_assert(is_same<decltype(ta->i16()), int16_t>::value, "invalid type");
- static_assert(is_same<decltype(ta->i32()), int32_t>::value, "invalid type");
- static_assert(is_same<decltype(ta->i64()), int64_t>::value, "invalid type");
- static_assert(is_same<decltype(ta->u8()), uint8_t>::value, "invalid type");
- static_assert(is_same<decltype(ta->u16()), uint16_t>::value, "invalid type");
- static_assert(is_same<decltype(ta->u32()), uint32_t>::value, "invalid type");
- static_assert(is_same<decltype(ta->u64()), uint64_t>::value, "invalid type");
- static_assert(is_same<decltype(ta->f32()), float>::value, "invalid type");
- static_assert(is_same<decltype(ta->f64()), double>::value, "invalid type");
-}
-
void EndianSwapTest() {
TEST_EQ(flatbuffers::EndianSwap(static_cast<int16_t>(0x1234)), 0x3412);
TEST_EQ(flatbuffers::EndianSwap(static_cast<int32_t>(0x12345678)),
@@ -3455,17 +464,47 @@
b.test.type = Any_Monster;
TEST_EQ(b == a, false);
TEST_EQ(b != a, true);
-}
-// For testing any binaries, e.g. from fuzzing.
-void LoadVerifyBinaryTest() {
- std::string binary;
- if (flatbuffers::LoadFile(
- (test_data_path + "fuzzer/your-filename-here").c_str(), true,
- &binary)) {
- flatbuffers::Verifier verifier(
- reinterpret_cast<const uint8_t *>(binary.data()), binary.size());
- TEST_EQ(VerifyMonsterBuffer(verifier), true);
+ // Test that vector of tables are compared by value and not by reference.
+ {
+ // Two tables are equal by default.
+ MonsterT a, b;
+ TEST_EQ(a == b, true);
+
+ // Adding only a table to one of the monster vectors should make it not
+ // equal (due to size mistmatch).
+ a.testarrayoftables.push_back(
+ flatbuffers::unique_ptr<MonsterT>(new MonsterT));
+ TEST_EQ(a == b, false);
+
+ // Adding an equalivant table to the other monster vector should make it
+ // equal again.
+ b.testarrayoftables.push_back(
+ flatbuffers::unique_ptr<MonsterT>(new MonsterT));
+ TEST_EQ(a == b, true);
+
+ // Create two new monsters that are different.
+ auto c = flatbuffers::unique_ptr<MonsterT>(new MonsterT);
+ auto d = flatbuffers::unique_ptr<MonsterT>(new MonsterT);
+ c->hp = 1;
+ d->hp = 2;
+ TEST_EQ(c == d, false);
+
+ // Adding them to the original monsters should also make them different.
+ a.testarrayoftables.push_back(std::move(c));
+ b.testarrayoftables.push_back(std::move(d));
+ TEST_EQ(a == b, false);
+
+ // Remove the mismatching monsters to get back to equality
+ a.testarrayoftables.pop_back();
+ b.testarrayoftables.pop_back();
+ TEST_EQ(a == b, true);
+
+ // Check that nullptr are OK.
+ a.testarrayoftables.push_back(nullptr);
+ b.testarrayoftables.push_back(
+ flatbuffers::unique_ptr<MonsterT>(new MonsterT));
+ TEST_EQ(a == b, false);
}
}
@@ -3526,17 +565,17 @@
TEST_EQ((*a[6]) < (*a[5]), true);
}
-#if !defined(FLATBUFFERS_SPAN_MINIMAL)
+#if !defined(FLATBUFFERS_USE_STD_SPAN) && !defined(FLATBUFFERS_SPAN_MINIMAL)
void FlatbuffersSpanTest() {
// Compile-time checking of non-const [] to const [] conversions.
- using flatbuffers::internal::is_span_convertable;
- (void)is_span_convertable<int, 1, int, 1>::type(123);
- (void)is_span_convertable<const int, 1, int, 1>::type(123);
- (void)is_span_convertable<const int64_t, 1, int64_t, 1>::type(123);
- (void)is_span_convertable<const uint64_t, 1, uint64_t, 1>::type(123);
- (void)is_span_convertable<const int, 1, const int, 1>::type(123);
- (void)is_span_convertable<const int64_t, 1, const int64_t, 1>::type(123);
- (void)is_span_convertable<const uint64_t, 1, const uint64_t, 1>::type(123);
+ using flatbuffers::internal::is_span_convertible;
+ (void)is_span_convertible<int, 1, int, 1>::type(123);
+ (void)is_span_convertible<const int, 1, int, 1>::type(123);
+ (void)is_span_convertible<const int64_t, 1, int64_t, 1>::type(123);
+ (void)is_span_convertible<const uint64_t, 1, uint64_t, 1>::type(123);
+ (void)is_span_convertible<const int, 1, const int, 1>::type(123);
+ (void)is_span_convertible<const int64_t, 1, const int64_t, 1>::type(123);
+ (void)is_span_convertible<const uint64_t, 1, const uint64_t, 1>::type(123);
using flatbuffers::span;
span<char, 0> c1;
@@ -3803,18 +842,19 @@
// VS10 does not support typed enums, exclude from tests
#if !defined(_MSC_VER) || _MSC_VER >= 1700
-void FixedLengthArrayJsonTest(bool binary) {
+void FixedLengthArrayJsonTest(const std::string &tests_data_path, bool binary) {
// load FlatBuffer schema (.fbs) and JSON from disk
std::string schemafile;
std::string jsonfile;
- TEST_EQ(
- flatbuffers::LoadFile(
- (test_data_path + "arrays_test." + (binary ? "bfbs" : "fbs")).c_str(),
- binary, &schemafile),
- true);
- TEST_EQ(flatbuffers::LoadFile((test_data_path + "arrays_test.golden").c_str(),
- false, &jsonfile),
+ TEST_EQ(flatbuffers::LoadFile(
+ (tests_data_path + "arrays_test." + (binary ? "bfbs" : "fbs"))
+ .c_str(),
+ binary, &schemafile),
true);
+ TEST_EQ(
+ flatbuffers::LoadFile((tests_data_path + "arrays_test.golden").c_str(),
+ false, &jsonfile),
+ true);
// parse schema first, so we can use it to parse the data after
flatbuffers::Parser parserOrg, parserGen;
@@ -3823,11 +863,13 @@
reinterpret_cast<const uint8_t *>(schemafile.c_str()),
schemafile.size());
TEST_EQ(reflection::VerifySchemaBuffer(verifier), true);
- TEST_EQ(parserOrg.Deserialize((const uint8_t *)schemafile.c_str(),
- schemafile.size()),
+ TEST_EQ(parserOrg.Deserialize(
+ reinterpret_cast<const uint8_t *>(schemafile.c_str()),
+ schemafile.size()),
true);
- TEST_EQ(parserGen.Deserialize((const uint8_t *)schemafile.c_str(),
- schemafile.size()),
+ TEST_EQ(parserGen.Deserialize(
+ reinterpret_cast<const uint8_t *>(schemafile.c_str()),
+ schemafile.size()),
true);
} else {
TEST_EQ(parserOrg.Parse(schemafile.c_str()), true);
@@ -3862,16 +904,17 @@
0);
}
-void FixedLengthArraySpanTest() {
+void FixedLengthArraySpanTest(const std::string &tests_data_path) {
// load FlatBuffer schema (.fbs) and JSON from disk
std::string schemafile;
std::string jsonfile;
- TEST_EQ(flatbuffers::LoadFile((test_data_path + "arrays_test.fbs").c_str(),
+ TEST_EQ(flatbuffers::LoadFile((tests_data_path + "arrays_test.fbs").c_str(),
false, &schemafile),
true);
- TEST_EQ(flatbuffers::LoadFile((test_data_path + "arrays_test.golden").c_str(),
- false, &jsonfile),
- true);
+ TEST_EQ(
+ flatbuffers::LoadFile((tests_data_path + "arrays_test.golden").c_str(),
+ false, &jsonfile),
+ true);
// parse schema first, so we can use it to parse the data after
flatbuffers::Parser parser;
@@ -3911,11 +954,11 @@
TEST_EQ(2, mutable_d_c.size());
TEST_EQ(MyGame::Example::TestEnum::C, const_d_c[0]);
TEST_EQ(MyGame::Example::TestEnum::B, const_d_c[1]);
- TEST_ASSERT(mutable_d_c.end() == std::copy(const_d_c.cbegin(),
- const_d_c.cend(),
+ TEST_ASSERT(mutable_d_c.end() == std::copy(const_d_c.begin(),
+ const_d_c.end(),
mutable_d_c.begin()));
TEST_ASSERT(
- std::equal(const_d_c.cbegin(), const_d_c.cend(), mutable_d_c.cbegin()));
+ std::equal(const_d_c.begin(), const_d_c.end(), mutable_d_c.begin()));
}
// test little endian array of int32
# if FLATBUFFERS_LITTLEENDIAN
@@ -3927,11 +970,11 @@
TEST_EQ(2, mutable_d_a.size());
TEST_EQ(-1, const_d_a[0]);
TEST_EQ(2, const_d_a[1]);
- TEST_ASSERT(mutable_d_a.end() == std::copy(const_d_a.cbegin(),
- const_d_a.cend(),
+ TEST_ASSERT(mutable_d_a.end() == std::copy(const_d_a.begin(),
+ const_d_a.end(),
mutable_d_a.begin()));
TEST_ASSERT(
- std::equal(const_d_a.cbegin(), const_d_a.cend(), mutable_d_a.cbegin()));
+ std::equal(const_d_a.begin(), const_d_a.end(), mutable_d_a.begin()));
}
# endif
}
@@ -3940,11 +983,11 @@
void FixedLengthArraySpanTest() {}
#endif
-void TestEmbeddedBinarySchema() {
+void TestEmbeddedBinarySchema(const std::string &tests_data_path) {
// load JSON from disk
std::string jsonfile;
TEST_EQ(flatbuffers::LoadFile(
- (test_data_path + "monsterdata_test.golden").c_str(), false,
+ (tests_data_path + "monsterdata_test.golden").c_str(), false,
&jsonfile),
true);
@@ -3988,192 +1031,93 @@
0);
}
-void StringVectorDefaultsTest() {
- std::vector<std::string> schemas;
- schemas.push_back("table Monster { mana: string = \"\"; }");
- schemas.push_back("table Monster { mana: string = \"mystr\"; }");
- schemas.push_back("table Monster { mana: string = \" \"; }");
- schemas.push_back("table Monster { mana: string = \"null\"; }");
- schemas.push_back("table Monster { mana: [int] = []; }");
- schemas.push_back("table Monster { mana: [uint] = [ ]; }");
- schemas.push_back("table Monster { mana: [byte] = [\t\t\n]; }");
- schemas.push_back("enum E:int{}table Monster{mana:[E]=[];}");
- for (auto s = schemas.begin(); s < schemas.end(); s++) {
- flatbuffers::Parser parser;
- TEST_ASSERT(parser.Parse(s->c_str()));
- const auto *mana = parser.structs_.Lookup("Monster")->fields.Lookup("mana");
- TEST_EQ(mana->IsDefault(), true);
- }
-}
+void NestedVerifierTest() {
+ // Create a nested monster.
+ flatbuffers::FlatBufferBuilder nested_builder;
+ FinishMonsterBuffer(
+ nested_builder,
+ CreateMonster(nested_builder, nullptr, 0, 0,
+ nested_builder.CreateString("NestedMonster")));
-void OptionalScalarsTest() {
- // Simple schemas and a "has optional scalar" sentinal.
- std::vector<std::string> schemas;
- schemas.push_back("table Monster { mana : int; }");
- schemas.push_back("table Monster { mana : int = 42; }");
- schemas.push_back("table Monster { mana : int = null; }");
- schemas.push_back("table Monster { mana : long; }");
- schemas.push_back("table Monster { mana : long = 42; }");
- schemas.push_back("table Monster { mana : long = null; }");
- schemas.push_back("table Monster { mana : float; }");
- schemas.push_back("table Monster { mana : float = 42; }");
- schemas.push_back("table Monster { mana : float = null; }");
- schemas.push_back("table Monster { mana : double; }");
- schemas.push_back("table Monster { mana : double = 42; }");
- schemas.push_back("table Monster { mana : double = null; }");
- schemas.push_back("table Monster { mana : bool; }");
- schemas.push_back("table Monster { mana : bool = 42; }");
- schemas.push_back("table Monster { mana : bool = null; }");
- schemas.push_back(
- "enum Enum: int {A=0, B=1} "
- "table Monster { mana : Enum; }");
- schemas.push_back(
- "enum Enum: int {A=0, B=1} "
- "table Monster { mana : Enum = B; }");
- schemas.push_back(
- "enum Enum: int {A=0, B=1} "
- "table Monster { mana : Enum = null; }");
+ // Verify the nested monster
+ flatbuffers::Verifier verifier(nested_builder.GetBufferPointer(),
+ nested_builder.GetSize());
+ TEST_EQ(true, VerifyMonsterBuffer(verifier));
- // Check the FieldDef is correctly set.
- for (auto schema = schemas.begin(); schema < schemas.end(); schema++) {
- const bool has_null = schema->find("null") != std::string::npos;
- flatbuffers::Parser parser;
- TEST_ASSERT(parser.Parse(schema->c_str()));
- const auto *mana = parser.structs_.Lookup("Monster")->fields.Lookup("mana");
- TEST_EQ(mana->IsOptional(), has_null);
- }
-
- // Test if nullable scalars are allowed for each language.
- for (unsigned lang = 1; lang < flatbuffers::IDLOptions::kMAX; lang <<= 1) {
- flatbuffers::IDLOptions opts;
- opts.lang_to_generate = lang;
- if (false == flatbuffers::Parser::SupportsOptionalScalars(opts)) {
- continue;
- }
- for (auto schema = schemas.begin(); schema < schemas.end(); schema++) {
- flatbuffers::Parser parser(opts);
- auto done = parser.Parse(schema->c_str());
- TEST_EQ_STR(parser.error_.c_str(), "");
- TEST_ASSERT(done);
- }
- }
-
- // test C++ nullable
- flatbuffers::FlatBufferBuilder fbb;
- FinishScalarStuffBuffer(
- fbb, optional_scalars::CreateScalarStuff(fbb, 1, static_cast<int8_t>(2)));
- auto opts = optional_scalars::GetMutableScalarStuff(fbb.GetBufferPointer());
- TEST_ASSERT(!opts->maybe_bool());
- TEST_ASSERT(!opts->maybe_f32().has_value());
- TEST_ASSERT(opts->maybe_i8().has_value());
- TEST_EQ(opts->maybe_i8().value(), 2);
- TEST_ASSERT(opts->mutate_maybe_i8(3));
- TEST_ASSERT(opts->maybe_i8().has_value());
- TEST_EQ(opts->maybe_i8().value(), 3);
- TEST_ASSERT(!opts->mutate_maybe_i16(-10));
-
- optional_scalars::ScalarStuffT obj;
- TEST_ASSERT(!obj.maybe_bool);
- TEST_ASSERT(!obj.maybe_f32.has_value());
- opts->UnPackTo(&obj);
- TEST_ASSERT(!obj.maybe_bool);
- TEST_ASSERT(!obj.maybe_f32.has_value());
- TEST_ASSERT(obj.maybe_i8.has_value() && obj.maybe_i8.value() == 3);
- TEST_ASSERT(obj.maybe_i8 && *obj.maybe_i8 == 3);
- obj.maybe_i32 = -1;
- obj.maybe_enum = optional_scalars::OptionalByte_Two;
-
- fbb.Clear();
- FinishScalarStuffBuffer(fbb, optional_scalars::ScalarStuff::Pack(fbb, &obj));
- opts = optional_scalars::GetMutableScalarStuff(fbb.GetBufferPointer());
- TEST_ASSERT(opts->maybe_i8().has_value());
- TEST_EQ(opts->maybe_i8().value(), 3);
- TEST_ASSERT(opts->maybe_i32().has_value());
- TEST_EQ(opts->maybe_i32().value(), -1);
- TEST_EQ(opts->maybe_enum().value(), optional_scalars::OptionalByte_Two);
- TEST_ASSERT(opts->maybe_i32() == flatbuffers::Optional<int64_t>(-1));
-}
-
-void ParseFlexbuffersFromJsonWithNullTest() {
- // Test nulls are handled appropriately through flexbuffers to exercise other
- // code paths of ParseSingleValue in the optional scalars change.
- // TODO(cneo): Json -> Flatbuffers test once some language can generate code
- // with optional scalars.
{
- char json[] = "{\"opt_field\": 123 }";
- flatbuffers::Parser parser;
- flexbuffers::Builder flexbuild;
- parser.ParseFlexBuffer(json, nullptr, &flexbuild);
- auto root = flexbuffers::GetRoot(flexbuild.GetBuffer());
- TEST_EQ(root.AsMap()["opt_field"].AsInt64(), 123);
+ // Create the outer monster.
+ flatbuffers::FlatBufferBuilder builder;
+
+ // Add the nested monster as a vector of bytes.
+ auto nested_monster_bytes = builder.CreateVector(
+ nested_builder.GetBufferPointer(), nested_builder.GetSize());
+
+ auto name = builder.CreateString("OuterMonster");
+
+ MonsterBuilder mon_builder(builder);
+ mon_builder.add_name(name);
+ mon_builder.add_testnestedflatbuffer(nested_monster_bytes);
+ FinishMonsterBuffer(builder, mon_builder.Finish());
+
+ // Verify the root monster, which includes verifing the nested monster
+ flatbuffers::Verifier verifier(builder.GetBufferPointer(),
+ builder.GetSize());
+ TEST_EQ(true, VerifyMonsterBuffer(verifier));
}
+
{
- char json[] = "{\"opt_field\": 123.4 }";
- flatbuffers::Parser parser;
- flexbuffers::Builder flexbuild;
- parser.ParseFlexBuffer(json, nullptr, &flexbuild);
- auto root = flexbuffers::GetRoot(flexbuild.GetBuffer());
- TEST_EQ(root.AsMap()["opt_field"].AsDouble(), 123.4);
+ // Create the outer monster.
+ flatbuffers::FlatBufferBuilder builder;
+
+ // Purposely invalidate the nested flatbuffer setting its length to 1, an
+ // invalid length.
+ uint8_t invalid_nested_buffer[1];
+ auto nested_monster_bytes = builder.CreateVector(invalid_nested_buffer, 1);
+
+ auto name = builder.CreateString("OuterMonster");
+
+ MonsterBuilder mon_builder(builder);
+ mon_builder.add_name(name);
+ mon_builder.add_testnestedflatbuffer(nested_monster_bytes);
+ FinishMonsterBuffer(builder, mon_builder.Finish());
+
+ // Verify the root monster fails, since the included nested monster fails.
+ flatbuffers::Verifier verifier(builder.GetBufferPointer(),
+ builder.GetSize());
+ TEST_EQ(false, VerifyMonsterBuffer(verifier));
+
+ // Verify the root monster succeeds, since we've disabled checking nested
+ // flatbuffers
+ flatbuffers::Verifier::Options options;
+ options.check_nested_flatbuffers = false;
+ flatbuffers::Verifier no_check_nested(builder.GetBufferPointer(),
+ builder.GetSize(), options);
+ TEST_EQ(true, VerifyMonsterBuffer(no_check_nested));
}
+
{
- char json[] = "{\"opt_field\": null }";
- flatbuffers::Parser parser;
- flexbuffers::Builder flexbuild;
- parser.ParseFlexBuffer(json, nullptr, &flexbuild);
- auto root = flexbuffers::GetRoot(flexbuild.GetBuffer());
- TEST_ASSERT(!root.AsMap().IsTheEmptyMap());
- TEST_ASSERT(root.AsMap()["opt_field"].IsNull());
- TEST_EQ(root.ToString(), std::string("{ opt_field: null }"));
+ // Create the outer monster.
+ flatbuffers::FlatBufferBuilder builder;
+
+ // Purposely invalidate the nested flatbuffer setting its length to 0, an
+ // invalid length.
+ uint8_t *invalid_nested_buffer = nullptr;
+ auto nested_monster_bytes = builder.CreateVector(invalid_nested_buffer, 0);
+
+ auto name = builder.CreateString("OuterMonster");
+
+ MonsterBuilder mon_builder(builder);
+ mon_builder.add_name(name);
+ mon_builder.add_testnestedflatbuffer(nested_monster_bytes);
+ FinishMonsterBuffer(builder, mon_builder.Finish());
+
+ // Verify the root monster fails, since the included nested monster fails.
+ flatbuffers::Verifier verifier(builder.GetBufferPointer(),
+ builder.GetSize());
+ TEST_EQ(false, VerifyMonsterBuffer(verifier));
}
}
-void FieldIdentifierTest() {
- using flatbuffers::Parser;
- TEST_EQ(true, Parser().Parse("table T{ f: int (id:0); }"));
- // non-integer `id` should be rejected
- TEST_EQ(false, Parser().Parse("table T{ f: int (id:text); }"));
- TEST_EQ(false, Parser().Parse("table T{ f: int (id:\"text\"); }"));
- TEST_EQ(false, Parser().Parse("table T{ f: int (id:0text); }"));
- TEST_EQ(false, Parser().Parse("table T{ f: int (id:1.0); }"));
- TEST_EQ(false, Parser().Parse("table T{ f: int (id:-1); g: int (id:0); }"));
- TEST_EQ(false, Parser().Parse("table T{ f: int (id:129496726); }"));
- // A unuion filed occupys two ids: enumerator + pointer (offset).
- TEST_EQ(false,
- Parser().Parse("union X{} table T{ u: X(id:0); table F{x:int;\n}"));
- // Positive tests for unions
- TEST_EQ(true, Parser().Parse("union X{} table T{ u: X (id:1); }"));
- TEST_EQ(true, Parser().Parse("union X{} table T{ u: X; }"));
- // Test using 'inf' and 'nan' words both as identifiers and as default values.
- TEST_EQ(true, Parser().Parse("table T{ nan: string; }"));
- TEST_EQ(true, Parser().Parse("table T{ inf: string; }"));
-#if defined(FLATBUFFERS_HAS_NEW_STRTOD) && (FLATBUFFERS_HAS_NEW_STRTOD > 0)
- TEST_EQ(true, Parser().Parse("table T{ inf: float = inf; }"));
- TEST_EQ(true, Parser().Parse("table T{ nan: float = inf; }"));
-#endif
-}
-
-void ParseIncorrectMonsterJsonTest() {
- std::string schemafile;
- TEST_EQ(flatbuffers::LoadFile((test_data_path + "monster_test.bfbs").c_str(),
- true, &schemafile),
- true);
- flatbuffers::Parser parser;
- flatbuffers::Verifier verifier(
- reinterpret_cast<const uint8_t *>(schemafile.c_str()), schemafile.size());
- TEST_EQ(reflection::VerifySchemaBuffer(verifier), true);
- TEST_EQ(parser.Deserialize((const uint8_t *)schemafile.c_str(),
- schemafile.size()),
- true);
- TEST_EQ(parser.ParseJson("{name:\"monster\"}"), true);
- TEST_EQ(parser.ParseJson(""), false);
- TEST_EQ(parser.ParseJson("{name: 1}"), false);
- TEST_EQ(parser.ParseJson("{name:+1}"), false);
- TEST_EQ(parser.ParseJson("{name:-1}"), false);
- TEST_EQ(parser.ParseJson("{name:-f}"), false);
- TEST_EQ(parser.ParseJson("{name:+f}"), false);
-}
-
-#if !defined(_MSC_VER) || _MSC_VER >= 1700
template<class T, class Container>
void TestIterators(const std::vector<T> &expected, const Container &tested) {
TEST_ASSERT(tested.rbegin().base() == tested.end());
@@ -4232,21 +1176,232 @@
TestIterators(std::vector<int>(15, 0), int_15);
}
}
-#else
-void FlatbuffersIteratorsTest() {}
-#endif
-int FlatBufferTests() {
- // clang-format off
+void PrivateAnnotationsLeaks() {
+ // Simple schemas and a "has optional scalar" sentinal.
+ std::vector<std::string> schemas;
+ std::vector<std::string> failure_schemas;
+ // (private) (table/struct)
+ schemas.push_back(
+ "table Monster (private) { mana: int; }"
+ "struct ABC (private) { mana: int; }");
+
+ // (public) (table/struct)
+ schemas.push_back(
+ "table Monster { mana: int; }"
+ "struct ABC { mana: int; }");
+
+ // (private) (union) containing (private) (table/struct)
+ schemas.push_back(
+ "table Monster (private) { mana: int; } "
+ "struct ABC (private) { mana: int; } "
+ "union Any (private) { Monster, ABC } ");
+
+ // (public) (union) containing (public) (table/struct)
+ schemas.push_back(
+ "table Monster { mana: int; }"
+ "struct ABC { mana: int; }"
+ "union Any { Monster, ABC }");
+
+ // (private) (table/struct/enum)
+ schemas.push_back(
+ "table Monster (private) { mana: int; }"
+ "struct ABC (private) { mana: int; }"
+ "enum Race:byte (private) { None = -1, Human = 0, }");
+
+ // (public) (table/struct/enum)
+ schemas.push_back(
+ "table Monster { mana: int; }"
+ "struct ABC { mana: int; }"
+ "enum Race:byte { None = -1, Human = 0, }");
+
+ // (private) (union) containing (private) (table/struct)
+ schemas.push_back(
+ "table Monster (private) { mana: int; }"
+ "struct ABC (private) { mana: int; }"
+ "enum Race:byte (private) { None = -1, Human = 0, }"
+ "union Any (private) { Monster, ABC }");
+
+ // (public) (union) containing (public) (table/struct)
+ schemas.push_back(
+ "table Monster { mana: int; }"
+ "struct ABC { mana: int; }"
+ "enum Race:byte { None = -1, Human = 0, }"
+ "union Any { Monster, ABC }");
+
+ // (private) (table), (public struct)
+ schemas.push_back(
+ "table Monster (private) { mana: int; }"
+ "struct ABC { mana: int; }");
+
+ // (private) (table), (public) (struct/enum)
+ schemas.push_back(
+ "table Monster (private) { mana: int; }"
+ "struct ABC { mana: int; }"
+ "enum Race:byte { None = -1, Human = 0, }");
+
+ // (public) (struct) containing (public) (enum)
+ schemas.push_back(
+ "enum Race:byte { None = -1, Human = 0, }"
+ "table Monster { mana: int; }"
+ "struct ABC { mana: int; type: Race; }");
+
+ // (public) (union) containing (private) (table) & (public) (struct)
+ failure_schemas.push_back(
+ "table Monster (private) { mana: int; }"
+ "struct ABC { mana: int; }"
+ "union Any { Monster, ABC }");
+
+ // (public) (union) containing (private) (table/struct)
+ failure_schemas.push_back(
+ "table Monster (private) { mana: int; }"
+ "struct ABC (private) { mana: int; }"
+ "enum Race:byte { None = -1, Human = 0, }"
+ "union Any { Monster, ABC }");
+
+ // (public) (table) containing (private) (struct)
+ failure_schemas.push_back(
+ "table Monster { mana: int; ab: ABC; }"
+ "struct ABC (private) { mana: int; }");
+
+ // (public) (struct) containing (private) (enum)
+ failure_schemas.push_back(
+ "enum Race:byte (private) { None = -1, Human = 0, }"
+ "table Monster { mana: int; }"
+ "struct ABC { mana: int; type: Race; }");
+
+ flatbuffers::IDLOptions opts;
+ opts.lang_to_generate = flatbuffers::IDLOptions::Language::kSwift;
+ opts.no_leak_private_annotations = true;
+
+ for (auto schema = schemas.begin(); schema < schemas.end(); schema++) {
+ flatbuffers::Parser parser(opts);
+ TEST_ASSERT(parser.Parse(schema->c_str()));
+ }
+
+ for (auto schema = failure_schemas.begin(); schema < failure_schemas.end();
+ schema++) {
+ flatbuffers::Parser parser(opts);
+ TEST_EQ(false, parser.Parse(schema->c_str()));
+ }
+
+ opts.no_leak_private_annotations = false;
+
+ for (auto schema = schemas.begin(); schema < schemas.end(); schema++) {
+ flatbuffers::Parser parser(opts);
+ TEST_ASSERT(parser.Parse(schema->c_str()));
+ }
+
+ for (auto schema = failure_schemas.begin(); schema < failure_schemas.end();
+ schema++) {
+ flatbuffers::Parser parser(opts);
+ TEST_ASSERT(parser.Parse(schema->c_str()));
+ }
+}
+
+void VectorSpanTest() {
+ flatbuffers::FlatBufferBuilder builder;
+
+ auto mloc = CreateMonster(
+ builder, nullptr, 0, 0, builder.CreateString("Monster"),
+ builder.CreateVector<uint8_t>({ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }));
+
+ FinishMonsterBuffer(builder, mloc);
+
+ auto monster = GetMonster(builder.GetBufferPointer());
+ auto mutable_monster = GetMutableMonster(builder.GetBufferPointer());
+
+ { // using references
+ TEST_NOTNULL(monster->inventory());
+
+ flatbuffers::span<const uint8_t> const_inventory =
+ flatbuffers::make_span(*monster->inventory());
+ TEST_EQ(const_inventory.size(), 10);
+ TEST_EQ(const_inventory[0], 0);
+ TEST_EQ(const_inventory[9], 9);
+
+ flatbuffers::span<uint8_t> mutable_inventory =
+ flatbuffers::make_span(*mutable_monster->mutable_inventory());
+ TEST_EQ(mutable_inventory.size(), 10);
+ TEST_EQ(mutable_inventory[0], 0);
+ TEST_EQ(mutable_inventory[9], 9);
+
+ mutable_inventory[0] = 42;
+ TEST_EQ(mutable_inventory[0], 42);
+
+ mutable_inventory[0] = 0;
+ TEST_EQ(mutable_inventory[0], 0);
+ }
+
+ { // using pointers
+ TEST_EQ(flatbuffers::VectorLength(monster->inventory()), 10);
+
+ flatbuffers::span<const uint8_t> const_inventory =
+ flatbuffers::make_span(monster->inventory());
+ TEST_EQ(const_inventory.size(), 10);
+ TEST_EQ(const_inventory[0], 0);
+ TEST_EQ(const_inventory[9], 9);
+
+ flatbuffers::span<uint8_t> mutable_inventory =
+ flatbuffers::make_span(mutable_monster->mutable_inventory());
+ TEST_EQ(mutable_inventory.size(), 10);
+ TEST_EQ(mutable_inventory[0], 0);
+ TEST_EQ(mutable_inventory[9], 9);
+
+ mutable_inventory[0] = 42;
+ TEST_EQ(mutable_inventory[0], 42);
+
+ mutable_inventory[0] = 0;
+ TEST_EQ(mutable_inventory[0], 0);
+ }
+
+ {
+ TEST_ASSERT(nullptr == monster->testnestedflatbuffer());
+
+ TEST_EQ(flatbuffers::VectorLength(monster->testnestedflatbuffer()), 0);
+
+ flatbuffers::span<const uint8_t> const_nested =
+ flatbuffers::make_span(monster->testnestedflatbuffer());
+ TEST_ASSERT(const_nested.empty());
+
+ flatbuffers::span<uint8_t> mutable_nested =
+ flatbuffers::make_span(mutable_monster->mutable_testnestedflatbuffer());
+ TEST_ASSERT(mutable_nested.empty());
+ }
+}
+
+void NativeInlineTableVectorTest() {
+ TestNativeInlineTableT test;
+ for (int i = 0; i < 10; ++i) {
+ NativeInlineTableT t;
+ t.a = i;
+ test.t.push_back(t);
+ }
+
+ flatbuffers::FlatBufferBuilder fbb;
+ auto offset = TestNativeInlineTable::Pack(fbb, &test);
+ fbb.Finish(offset);
+
+ auto *root =
+ flatbuffers::GetRoot<TestNativeInlineTable>(fbb.GetBufferPointer());
+ TestNativeInlineTableT unpacked;
+ root->UnPackTo(&unpacked);
+
+ for (int i = 0; i < 10; ++i) {
+ TEST_ASSERT(unpacked.t[i] == test.t[i]);
+ }
+
+ TEST_ASSERT(unpacked.t == test.t);
+}
+
+int FlatBufferTests(const std::string &tests_data_path) {
// Run our various test suites:
std::string rawbuf;
auto flatbuf1 = CreateFlatBufferTest(rawbuf);
auto flatbuf = std::move(flatbuf1); // Test move assignment.
- TriviallyCopyableTest();
-
AccessFlatBufferTest(reinterpret_cast<const uint8_t *>(rawbuf.c_str()),
rawbuf.length());
AccessFlatBufferTest(flatbuf.data(), flatbuf.size());
@@ -4254,42 +1409,48 @@
MutateFlatBuffersTest(flatbuf.data(), flatbuf.size());
ObjectFlatBuffersTest(flatbuf.data());
+ UnPackTo(flatbuf.data());
MiniReflectFlatBuffersTest(flatbuf.data());
MiniReflectFixedLengthArrayTest();
SizePrefixedTest();
- #ifndef FLATBUFFERS_NO_FILE_TESTS
- #ifdef FLATBUFFERS_TEST_PATH_PREFIX
- test_data_path = FLATBUFFERS_STRING(FLATBUFFERS_TEST_PATH_PREFIX) +
- test_data_path;
- #endif
- ParseAndGenerateTextTest(false);
- ParseAndGenerateTextTest(true);
- FixedLengthArrayJsonTest(false);
- FixedLengthArrayJsonTest(true);
- ReflectionTest(flatbuf.data(), flatbuf.size());
- ParseProtoTest();
- ParseProtoTestWithSuffix();
- ParseProtoTestWithIncludes();
- EvolutionTest();
- UnionDeprecationTest();
- UnionVectorTest();
- LoadVerifyBinaryTest();
- GenerateTableTextTest();
- TestEmbeddedBinarySchema();
- #endif
- // clang-format on
+#ifndef FLATBUFFERS_NO_FILE_TESTS
+ ParseAndGenerateTextTest(tests_data_path, false);
+ ParseAndGenerateTextTest(tests_data_path, true);
+ FixedLengthArrayJsonTest(tests_data_path, false);
+ FixedLengthArrayJsonTest(tests_data_path, true);
+ ReflectionTest(tests_data_path, flatbuf.data(), flatbuf.size());
+ ParseProtoTest(tests_data_path);
+ ParseProtoTestWithSuffix(tests_data_path);
+ ParseProtoTestWithIncludes(tests_data_path);
+ EvolutionTest(tests_data_path);
+ UnionDeprecationTest(tests_data_path);
+ UnionVectorTest(tests_data_path);
+ GenerateTableTextTest(tests_data_path);
+ TestEmbeddedBinarySchema(tests_data_path);
+ JsonOptionalTest(tests_data_path, false);
+ JsonOptionalTest(tests_data_path, true);
+ MultiFileNameClashTest(tests_data_path);
+ InvalidNestedFlatbufferTest(tests_data_path);
+ JsonDefaultTest(tests_data_path);
+ JsonEnumsTest(tests_data_path);
+ TestMonsterExtraFloats(tests_data_path);
+ ParseIncorrectMonsterJsonTest(tests_data_path);
+ FixedLengthArraySpanTest(tests_data_path);
+#endif
UtilConvertCase();
FuzzTest1();
FuzzTest2();
+ TriviallyCopyableTest();
ErrorTest();
ValueTest();
EnumValueTest();
+ NestedListTest();
EnumStringsTest();
EnumNamesTest();
EnumOutOfRangeTest();
@@ -4304,16 +1465,13 @@
UnknownFieldsTest();
ParseUnionTest();
ValidSameNameDifferentNamespaceTest();
- MultiFileNameClashTest();
- InvalidNestedFlatbufferTest();
ConformTest();
ParseProtoBufAsciiTest();
TypeAliasesTest();
EndianSwapTest();
CreateSharedStringTest();
- JsonDefaultTest();
- JsonEnumsTest();
FlexBuffersTest();
+ FlexBuffersReuseBugTest();
FlexBuffersDeprecatedTest();
UninitializedVectorTest();
EqualOperatorTest();
@@ -4321,7 +1479,6 @@
IsAsciiUtilsTest();
ValidFloatTest();
InvalidFloatTest();
- TestMonsterExtraFloats();
FixedLengthArrayTest();
NativeTypeTest();
OptionalScalarsTest();
@@ -4330,16 +1487,28 @@
FixedLengthArrayConstructorTest();
FieldIdentifierTest();
StringVectorDefaultsTest();
- ParseIncorrectMonsterJsonTest();
FlexBuffersFloatingPointTest();
FlatbuffersIteratorsTest();
- FixedLengthArraySpanTest();
- StructUnionTest();
WarningsAsErrorsTest();
+ NestedVerifierTest();
+ PrivateAnnotationsLeaks();
+ JsonUnsortedArrayTest();
+ VectorSpanTest();
+ NativeInlineTableVectorTest();
return 0;
}
+} // namespace
+} // namespace tests
+} // namespace flatbuffers
int main(int argc, const char *argv[]) {
+ std::string tests_data_path =
+#ifdef BAZEL_TEST_DATA_PATH
+ "../com_github_google_flatbuffers/tests/";
+#else
+ "tests/";
+#endif
+
for (int argi = 1; argi < argc; argi++) {
std::string arg = argv[argi];
if (arg == "--test_path") {
@@ -4347,7 +1516,9 @@
fprintf(stderr, "error: missing path following: %s\n", arg.c_str());
exit(1);
}
- test_data_path = argv[argi];
+ // Override default path if provided one.
+ tests_data_path = argv[argi];
+
} else {
fprintf(stderr, "error: Unknown argument: %s\n", arg.c_str());
exit(1);
@@ -4368,7 +1539,12 @@
TEST_OUTPUT_LINE("The global C-locale changed: %s", the_locale.c_str());
}
- FlatBufferTests();
+#ifdef FLATBUFFERS_TEST_PATH_PREFIX
+ tests_data_path =
+ FLATBUFFERS_STRING(FLATBUFFERS_TEST_PATH_PREFIX) + tests_data_path;
+#endif
+
+ flatbuffers::tests::FlatBufferTests(tests_data_path);
FlatBufferBuilderTest();
if (!testing_fails) {
diff --git a/tests/test_assert.cpp b/tests/test_assert.cpp
index e2b43a7..32dece9 100644
--- a/tests/test_assert.cpp
+++ b/tests/test_assert.cpp
@@ -40,10 +40,8 @@
testing_fails = 0;
// Disable stdout buffering to prevent information lost on assertion or core
// dump.
- setvbuf(stdout, NULL, _IONBF, 0);
- setvbuf(stderr, NULL, _IONBF, 0);
-
- flatbuffers::SetupDefaultCRTReportMode();
+ setvbuf(stdout, nullptr, _IONBF, 0);
+ setvbuf(stderr, nullptr, _IONBF, 0);
// clang-format off
diff --git a/tests/test_assert.h b/tests/test_assert.h
index e6140cc..9d5f780 100644
--- a/tests/test_assert.h
+++ b/tests/test_assert.h
@@ -51,10 +51,10 @@
// Write captured state to a log and terminate test run.
void TestFail(const char *expval, const char *val, const char *exp,
- const char *file, int line, const char *func = 0);
+ const char *file, int line, const char *func = nullptr);
void TestEqStr(const char *expval, const char *val, const char *exp,
- const char *file, int line, const char *func = 0);
+ const char *file, int line, const char *func = nullptr);
// Workaround for `enum class` printing.
// There is an issue with the printing of enums with a fixed underlying type.
diff --git a/tests/test_builder.cpp b/tests/test_builder.cpp
index ae67076..047a380 100644
--- a/tests/test_builder.cpp
+++ b/tests/test_builder.cpp
@@ -117,6 +117,9 @@
return verify(buf, expected_name, color);
}
+// forward-declared in test.cpp
+void FlatBufferBuilderTest();
+
void FlatBufferBuilderTest() {
using flatbuffers::FlatBufferBuilder;
@@ -138,5 +141,8 @@
TestSelector(tests, tests + 4));
}
+// forward-declared in test_builder.h
+void CheckTestGeneratedIsValid(const MyGame::Example::Color&);
+
// Link-time check using pointer type.
void CheckTestGeneratedIsValid(const MyGame::Example::Color &) {}
diff --git a/tests/ts/BUILD.bazel b/tests/ts/BUILD.bazel
new file mode 100644
index 0000000..054011a
--- /dev/null
+++ b/tests/ts/BUILD.bazel
@@ -0,0 +1,12 @@
+load("//:typescript.bzl", "flatbuffer_ts_library")
+
+package(default_visibility = ["//visibility:private"])
+
+flatbuffer_ts_library(
+ name = "typescript_ts_fbs",
+ srcs = ["typescript_keywords.fbs"],
+ deps = [
+ "//tests/ts/test_dir:include_ts_fbs",
+ "//tests/ts/test_dir:typescript_transitive_ts_fbs",
+ ],
+)
diff --git a/tests/JavaScriptFlexBuffersTest.js b/tests/ts/JavaScriptFlexBuffersTest.js
similarity index 98%
rename from tests/JavaScriptFlexBuffersTest.js
rename to tests/ts/JavaScriptFlexBuffersTest.js
index d2462c6..04e670c 100644
--- a/tests/JavaScriptFlexBuffersTest.js
+++ b/tests/ts/JavaScriptFlexBuffersTest.js
@@ -1,7 +1,7 @@
// Run this using JavaScriptTest.sh
import assert from 'assert'
import fs from 'fs'
-import * as flexbuffers from 'flatbuffers/js/flexbuffers'
+import * as flexbuffers from 'flatbuffers/js/flexbuffers.js'
function main() {
testSingleValueBuffers();
@@ -264,6 +264,7 @@
_assert(example);
_assert(0x100000001n);
+ _assert({ test_number: 72.6 })
}
function testRoundTripWithBuilder() {
@@ -340,7 +341,7 @@
}
function testGoldBuffer() {
- const data = new Uint8Array(fs.readFileSync('gold_flexbuffer_example.bin')).buffer;
+ const data = new Uint8Array(fs.readFileSync('../gold_flexbuffer_example.bin')).buffer;
const b1 = flexbuffers.toReference(data).get("bools").get(1);
assert.strictEqual(b1.isBool(), true);
assert.strictEqual(b1.boolValue(), false);
diff --git a/tests/JavaScriptTest.js b/tests/ts/JavaScriptTest.js
similarity index 93%
rename from tests/JavaScriptTest.js
rename to tests/ts/JavaScriptTest.js
index f1fdc69..b76dd2e 100644
--- a/tests/JavaScriptTest.js
+++ b/tests/ts/JavaScriptTest.js
@@ -3,18 +3,18 @@
import fs from 'fs'
import * as flatbuffers from 'flatbuffers'
-import { Monster, MonsterT } from './my-game/example/monster'
-import { Test } from './my-game/example/test'
-import { Stat } from './my-game/example/stat'
-import { Vec3 } from './my-game/example/vec3'
-import { Color } from './my-game/example/color';
-import { Any } from './my-game/example/any';
+import { Monster, MonsterT } from './my-game/example/monster.js'
+import { Test, TestT } from './my-game/example/test.js'
+import { Stat } from './my-game/example/stat.js'
+import { Vec3 } from './my-game/example/vec3.js'
+import { Color } from './my-game/example/color.js';
+import { Any } from './my-game/example/any.js';
function main() {
// First, let's test reading a FlatBuffer generated by C++ code:
// This file was generated from monsterdata_test.json
- var data = new Uint8Array(fs.readFileSync('monsterdata_test.mon'));
+ var data = new Uint8Array(fs.readFileSync('../monsterdata_test.mon'));
// Now test it:
@@ -47,6 +47,7 @@
fuzzTest1();
testNullStrings();
testSharedStrings();
+ testVectorOfStructs();
console.log('FlatBuffers test: completed successfully');
}
@@ -284,8 +285,8 @@
}
function testUnicode() {
- var correct = fs.readFileSync('unicode_test.mon');
- var json = JSON.parse(fs.readFileSync('unicode_test.json', 'utf8'));
+ var correct = fs.readFileSync('../unicode_test.mon');
+ var json = JSON.parse(fs.readFileSync('../unicode_test.json', 'utf8'));
// Test reading
function testReadingUnicode(bb) {
@@ -458,4 +459,22 @@
assert.strictEqual(builder.createSharedString(undefined), 0);
}
+function testVectorOfStructs() {
+ let monster = new MonsterT();
+ monster.name = 'testVectorOfStructs';
+ monster.test4 = [
+ new TestT(1, 2),
+ new TestT(3, 4)
+ ];
+
+ let builder = new flatbuffers.Builder();
+ builder.finish(monster.pack(builder));
+
+ let decodedMonster = Monster.getRootAsMonster(builder.dataBuffer()).unpack();
+ assert.strictEqual(decodedMonster.test4[0].a, 1);
+ assert.strictEqual(decodedMonster.test4[0].b, 2);
+ assert.strictEqual(decodedMonster.test4[1].a, 3);
+ assert.strictEqual(decodedMonster.test4[1].b, 4);
+}
+
main();
diff --git a/tests/JavaScriptUnionVectorTest.js b/tests/ts/JavaScriptUnionVectorTest.js
similarity index 94%
rename from tests/JavaScriptUnionVectorTest.js
rename to tests/ts/JavaScriptUnionVectorTest.js
index b80e37f..18857d6 100644
--- a/tests/JavaScriptUnionVectorTest.js
+++ b/tests/ts/JavaScriptUnionVectorTest.js
@@ -1,10 +1,10 @@
import assert from 'assert'
import * as flatbuffers from 'flatbuffers'
-import { Character } from './union_vector/character'
-import { BookReader, BookReaderT } from './union_vector/book-reader'
-import { Attacker, AttackerT } from './union_vector/attacker'
-import { Movie, MovieT } from './union_vector/movie'
+import { Character } from './union_vector/character.js'
+import { BookReader, BookReaderT } from './union_vector/book-reader.js'
+import { Attacker, AttackerT } from './union_vector/attacker.js'
+import { Movie, MovieT } from './union_vector/movie.js'
var charTypes = [
Character.Belle,
diff --git a/tests/ts/TypeScriptTest.py b/tests/ts/TypeScriptTest.py
new file mode 100755
index 0000000..c95ed72
--- /dev/null
+++ b/tests/ts/TypeScriptTest.py
@@ -0,0 +1,123 @@
+#!/usr/bin/env python3
+#
+# Copyright 2022 Google Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import platform
+import shutil
+import subprocess
+import sys
+from pathlib import Path
+
+# Get the path where this script is located so we can invoke the script from
+# any directory and have the paths work correctly.
+tests_path = Path(__file__).parent.resolve()
+
+# Get the root path as an absolute path, so all derived paths are absolute.
+root_path = tests_path.parent.parent.absolute()
+
+# Windows works with subprocess.run a bit differently.
+is_windows = platform.system() == "Windows"
+
+# Get the location of the flatc executable
+flatc_exe = Path("flatc.exe" if is_windows else "flatc")
+
+# Find and assert flatc compiler is present.
+if root_path in flatc_exe.parents:
+ flatc_exe = flatc_exe.relative_to(root_path)
+flatc_path = Path(root_path, flatc_exe)
+assert flatc_path.exists(), "Cannot find the flatc compiler " + str(flatc_path)
+
+def check_call(args, cwd=tests_path):
+ subprocess.check_call(args, cwd=str(cwd), shell=is_windows)
+
+# Execute the flatc compiler with the specified parameters
+def flatc(options, schema, prefix=None, include=None, data=None, cwd=tests_path):
+ cmd = [str(flatc_path)] + options
+ if prefix:
+ cmd += ["-o"] + [prefix]
+ if include:
+ cmd += ["-I"] + [include]
+ cmd += [schema] if isinstance(schema, str) else schema
+ if data:
+ cmd += [data] if isinstance(data, str) else data
+ check_call(cmd)
+
+print("Removing node_modules/ directory...")
+shutil.rmtree(Path(tests_path, "node_modules"), ignore_errors=True)
+
+check_call(["npm", "install", "--silent"])
+
+print("Invoking flatc...")
+flatc(
+ options=["--ts", "--gen-name-strings", "--gen-mutable", "--gen-object-api"],
+ schema="../monster_test.fbs",
+ include="../include_test",
+)
+
+flatc(
+ options=["--gen-object-api", "-b"],
+ schema="../monster_test.fbs",
+ include="../include_test",
+ data="../unicode_test.json",
+)
+
+flatc(
+ options=["--ts", "--gen-name-strings", "--gen-mutable", "--gen-object-api"],
+ schema="../union_vector/union_vector.fbs",
+ prefix="union_vector",
+)
+
+flatc(
+ options=["--ts", "--gen-name-strings"],
+ schema="../optional_scalars.fbs",
+)
+
+flatc(
+ options=["--ts", "--gen-name-strings", "--gen-mutable", "--gen-object-api"],
+ schema=[
+ "typescript_keywords.fbs",
+ "test_dir/typescript_include.fbs",
+ "test_dir/typescript_transitive_include.fbs",
+ "../../reflection/reflection.fbs",
+ ],
+ include="../../",
+)
+
+flatc(
+ options=[
+ "--ts",
+ "--gen-name-strings",
+ "--gen-mutable",
+ "--gen-object-api",
+ "--ts-flat-files",
+ ],
+ schema=[
+ "typescript_keywords.fbs",
+ "test_dir/typescript_include.fbs",
+ "test_dir/typescript_transitive_include.fbs",
+ "../../reflection/reflection.fbs",
+ ],
+ include="../../",
+)
+
+print("Running TypeScript Compiler...")
+check_call(["tsc"])
+
+NODE_CMD = ["node"]
+
+print("Running TypeScript Tests...")
+check_call(NODE_CMD + ["JavaScriptTest"])
+check_call(NODE_CMD + ["JavaScriptUnionVectorTest"])
+check_call(NODE_CMD + ["JavaScriptFlexBuffersTest"])
\ No newline at end of file
diff --git a/tests/ts/foobar/abc.js b/tests/ts/foobar/abc.js
new file mode 100644
index 0000000..cdef988
--- /dev/null
+++ b/tests/ts/foobar/abc.js
@@ -0,0 +1,5 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+export var Abc;
+(function (Abc) {
+ Abc[Abc["a"] = 0] = "a";
+})(Abc || (Abc = {}));
diff --git a/tests/ts/foobar/abc.ts b/tests/ts/foobar/abc.ts
new file mode 100644
index 0000000..ef8842b
--- /dev/null
+++ b/tests/ts/foobar/abc.ts
@@ -0,0 +1,5 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+export enum Abc {
+ a = 0
+}
diff --git a/tests/ts/foobar/class.js b/tests/ts/foobar/class.js
new file mode 100644
index 0000000..e0e1df1
--- /dev/null
+++ b/tests/ts/foobar/class.js
@@ -0,0 +1,5 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+export var class_;
+(function (class_) {
+ class_[class_["arguments_"] = 0] = "arguments_";
+})(class_ || (class_ = {}));
diff --git a/tests/ts/foobar/class.ts b/tests/ts/foobar/class.ts
new file mode 100644
index 0000000..d26fb28
--- /dev/null
+++ b/tests/ts/foobar/class.ts
@@ -0,0 +1,5 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+export enum class_ {
+ arguments_ = 0
+}
diff --git a/tests/monster_test.js b/tests/ts/monster_test.js
similarity index 91%
rename from tests/monster_test.js
rename to tests/ts/monster_test.js
index b4e13d1..afc333e 100644
--- a/tests/monster_test.js
+++ b/tests/ts/monster_test.js
@@ -9,6 +9,7 @@
export { Referrable, ReferrableT } from './my-game/example/referrable';
export { Stat, StatT } from './my-game/example/stat';
export { StructOfStructs, StructOfStructsT } from './my-game/example/struct-of-structs';
+export { StructOfStructsOfStructs, StructOfStructsOfStructsT } from './my-game/example/struct-of-structs-of-structs';
export { Test, TestT } from './my-game/example/test';
export { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from './my-game/example/test-simple-table-with-enum';
export { TypeAliases, TypeAliasesT } from './my-game/example/type-aliases';
diff --git a/tests/monster_test.ts b/tests/ts/monster_test.ts
similarity index 91%
rename from tests/monster_test.ts
rename to tests/ts/monster_test.ts
index b4e13d1..afc333e 100644
--- a/tests/monster_test.ts
+++ b/tests/ts/monster_test.ts
@@ -9,6 +9,7 @@
export { Referrable, ReferrableT } from './my-game/example/referrable';
export { Stat, StatT } from './my-game/example/stat';
export { StructOfStructs, StructOfStructsT } from './my-game/example/struct-of-structs';
+export { StructOfStructsOfStructs, StructOfStructsOfStructsT } from './my-game/example/struct-of-structs-of-structs';
export { Test, TestT } from './my-game/example/test';
export { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from './my-game/example/test-simple-table-with-enum';
export { TypeAliases, TypeAliasesT } from './my-game/example/type-aliases';
diff --git a/tests/ts/monster_test_generated.ts b/tests/ts/monster_test_generated.ts
new file mode 100644
index 0000000..18aec07
--- /dev/null
+++ b/tests/ts/monster_test_generated.ts
@@ -0,0 +1,19 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+export { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from './my-game/example2/monster.js';
+export { Ability, AbilityT } from './my-game/example/ability.js';
+export { Any, unionToAny, unionListToAny } from './my-game/example/any.js';
+export { AnyAmbiguousAliases, unionToAnyAmbiguousAliases, unionListToAnyAmbiguousAliases } from './my-game/example/any-ambiguous-aliases.js';
+export { AnyUniqueAliases, unionToAnyUniqueAliases, unionListToAnyUniqueAliases } from './my-game/example/any-unique-aliases.js';
+export { Color } from './my-game/example/color.js';
+export { Monster, MonsterT } from './my-game/example/monster.js';
+export { Race } from './my-game/example/race.js';
+export { Referrable, ReferrableT } from './my-game/example/referrable.js';
+export { Stat, StatT } from './my-game/example/stat.js';
+export { StructOfStructs, StructOfStructsT } from './my-game/example/struct-of-structs.js';
+export { StructOfStructsOfStructs, StructOfStructsOfStructsT } from './my-game/example/struct-of-structs-of-structs.js';
+export { Test, TestT } from './my-game/example/test.js';
+export { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from './my-game/example/test-simple-table-with-enum.js';
+export { TypeAliases, TypeAliasesT } from './my-game/example/type-aliases.js';
+export { Vec3, Vec3T } from './my-game/example/vec3.js';
+export { InParentNamespace, InParentNamespaceT } from './my-game/in-parent-namespace.js';
diff --git a/tests/monster_test_grpc.d.ts b/tests/ts/monster_test_grpc.d.ts
similarity index 100%
rename from tests/monster_test_grpc.d.ts
rename to tests/ts/monster_test_grpc.d.ts
diff --git a/tests/monster_test_grpc.js b/tests/ts/monster_test_grpc.js
similarity index 100%
rename from tests/monster_test_grpc.js
rename to tests/ts/monster_test_grpc.js
diff --git a/tests/ts/monsterdata_javascript_wire.mon b/tests/ts/monsterdata_javascript_wire.mon
new file mode 100644
index 0000000..c6020a2
--- /dev/null
+++ b/tests/ts/monsterdata_javascript_wire.mon
Binary files differ
diff --git a/tests/ts/my-game/example/ability.js b/tests/ts/my-game/example/ability.js
new file mode 100644
index 0000000..4d7d3db
--- /dev/null
+++ b/tests/ts/my-game/example/ability.js
@@ -0,0 +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();
+ }
+}
+export class AbilityT {
+ constructor(id = 0, distance = 0) {
+ this.id = id;
+ this.distance = distance;
+ }
+ pack(builder) {
+ return Ability.createAbility(builder, this.id, this.distance);
+ }
+}
diff --git a/tests/ts/my-game/example/ability.ts b/tests/ts/my-game/example/ability.ts
new file mode 100644
index 0000000..36b0eb8
--- /dev/null
+++ b/tests/ts/my-game/example/ability.ts
@@ -0,0 +1,77 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+
+export class Ability {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Ability {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+id():number {
+ return this.bb!.readUint32(this.bb_pos);
+}
+
+mutate_id(value:number):boolean {
+ this.bb!.writeUint32(this.bb_pos + 0, value);
+ return true;
+}
+
+distance():number {
+ return this.bb!.readUint32(this.bb_pos + 4);
+}
+
+mutate_distance(value:number):boolean {
+ this.bb!.writeUint32(this.bb_pos + 4, value);
+ return true;
+}
+
+static getFullyQualifiedName():string {
+ return 'MyGame_Example_Ability';
+}
+
+static sizeOf():number {
+ return 8;
+}
+
+static createAbility(builder:flatbuffers.Builder, id: number, distance: number):flatbuffers.Offset {
+ builder.prep(4, 8);
+ builder.writeInt32(distance);
+ builder.writeInt32(id);
+ return builder.offset();
+}
+
+
+unpack(): AbilityT {
+ return new AbilityT(
+ this.id(),
+ this.distance()
+ );
+}
+
+
+unpackTo(_o: AbilityT): void {
+ _o.id = this.id();
+ _o.distance = this.distance();
+}
+}
+
+export class AbilityT {
+constructor(
+ public id: number = 0,
+ public distance: number = 0
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ return Ability.createAbility(builder,
+ this.id,
+ this.distance
+ );
+}
+}
diff --git a/tests/ts/my-game/example/any-ambiguous-aliases.js b/tests/ts/my-game/example/any-ambiguous-aliases.js
new file mode 100644
index 0000000..ca81908
--- /dev/null
+++ b/tests/ts/my-game/example/any-ambiguous-aliases.js
@@ -0,0 +1,27 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+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";
+})(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;
+ }
+}
+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;
+ }
+}
diff --git a/tests/ts/my-game/example/any-ambiguous-aliases.ts b/tests/ts/my-game/example/any-ambiguous-aliases.ts
new file mode 100644
index 0000000..a7a63b7
--- /dev/null
+++ b/tests/ts/my-game/example/any-ambiguous-aliases.ts
@@ -0,0 +1,38 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import { Monster, MonsterT } from '../../my-game/example/monster.js';
+
+
+export enum AnyAmbiguousAliases {
+ NONE = 0,
+ M1 = 1,
+ M2 = 2,
+ M3 = 3
+}
+
+export function unionToAnyAmbiguousAliases(
+ type: AnyAmbiguousAliases,
+ accessor: (obj:Monster) => Monster|null
+): Monster|null {
+ switch(AnyAmbiguousAliases[type]) {
+ case 'NONE': return null;
+ case 'M1': return accessor(new Monster())! as Monster;
+ case 'M2': return accessor(new Monster())! as Monster;
+ case 'M3': return accessor(new Monster())! as Monster;
+ default: return null;
+ }
+}
+
+export function unionListToAnyAmbiguousAliases(
+ type: AnyAmbiguousAliases,
+ accessor: (index: number, obj:Monster) => Monster|null,
+ index: number
+): Monster|null {
+ switch(AnyAmbiguousAliases[type]) {
+ case 'NONE': return null;
+ case 'M1': return accessor(index, new Monster())! as Monster;
+ case 'M2': return accessor(index, new Monster())! as Monster;
+ case 'M3': return accessor(index, new Monster())! as Monster;
+ default: return null;
+ }
+}
diff --git a/tests/ts/my-game/example/any-unique-aliases.js b/tests/ts/my-game/example/any-unique-aliases.js
new file mode 100644
index 0000000..d1ac6bf
--- /dev/null
+++ b/tests/ts/my-game/example/any-unique-aliases.js
@@ -0,0 +1,29 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import { Monster as MyGame_Example2_Monster } from '../../my-game/example2/monster.js';
+import { Monster } from '../../my-game/example/monster.js';
+import { TestSimpleTableWithEnum } from '../../my-game/example/test-simple-table-with-enum.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";
+})(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;
+ }
+}
+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;
+ }
+}
diff --git a/tests/ts/my-game/example/any-unique-aliases.ts b/tests/ts/my-game/example/any-unique-aliases.ts
new file mode 100644
index 0000000..16aa378
--- /dev/null
+++ b/tests/ts/my-game/example/any-unique-aliases.ts
@@ -0,0 +1,40 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from '../../my-game/example2/monster.js';
+import { Monster, MonsterT } from '../../my-game/example/monster.js';
+import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from '../../my-game/example/test-simple-table-with-enum.js';
+
+
+export enum AnyUniqueAliases {
+ NONE = 0,
+ M = 1,
+ TS = 2,
+ M2 = 3
+}
+
+export function unionToAnyUniqueAliases(
+ type: AnyUniqueAliases,
+ accessor: (obj:Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum) => Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null
+): Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null {
+ switch(AnyUniqueAliases[type]) {
+ case 'NONE': return null;
+ case 'M': return accessor(new Monster())! as Monster;
+ case 'TS': return accessor(new TestSimpleTableWithEnum())! as TestSimpleTableWithEnum;
+ case 'M2': return accessor(new MyGame_Example2_Monster())! as MyGame_Example2_Monster;
+ default: return null;
+ }
+}
+
+export 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 {
+ switch(AnyUniqueAliases[type]) {
+ case 'NONE': return null;
+ case 'M': return accessor(index, new Monster())! as Monster;
+ case 'TS': return accessor(index, new TestSimpleTableWithEnum())! as TestSimpleTableWithEnum;
+ case 'M2': return accessor(index, new MyGame_Example2_Monster())! as MyGame_Example2_Monster;
+ default: return null;
+ }
+}
diff --git a/tests/ts/my-game/example/any.js b/tests/ts/my-game/example/any.js
new file mode 100644
index 0000000..27be8f4
--- /dev/null
+++ b/tests/ts/my-game/example/any.js
@@ -0,0 +1,29 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import { Monster as MyGame_Example2_Monster } from '../../my-game/example2/monster.js';
+import { Monster } from '../../my-game/example/monster.js';
+import { TestSimpleTableWithEnum } from '../../my-game/example/test-simple-table-with-enum.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";
+})(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;
+ }
+}
+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;
+ }
+}
diff --git a/tests/ts/my-game/example/any.ts b/tests/ts/my-game/example/any.ts
new file mode 100644
index 0000000..de1cbfd
--- /dev/null
+++ b/tests/ts/my-game/example/any.ts
@@ -0,0 +1,40 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from '../../my-game/example2/monster.js';
+import { Monster, MonsterT } from '../../my-game/example/monster.js';
+import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from '../../my-game/example/test-simple-table-with-enum.js';
+
+
+export enum Any {
+ NONE = 0,
+ Monster = 1,
+ TestSimpleTableWithEnum = 2,
+ MyGame_Example2_Monster = 3
+}
+
+export function unionToAny(
+ type: Any,
+ accessor: (obj:Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum) => Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null
+): Monster|MyGame_Example2_Monster|TestSimpleTableWithEnum|null {
+ switch(Any[type]) {
+ case 'NONE': return null;
+ case 'Monster': return accessor(new Monster())! as Monster;
+ case 'TestSimpleTableWithEnum': return accessor(new TestSimpleTableWithEnum())! as TestSimpleTableWithEnum;
+ case 'MyGame_Example2_Monster': return accessor(new MyGame_Example2_Monster())! as MyGame_Example2_Monster;
+ default: return null;
+ }
+}
+
+export 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 {
+ switch(Any[type]) {
+ case 'NONE': return null;
+ case 'Monster': return accessor(index, new Monster())! as Monster;
+ case 'TestSimpleTableWithEnum': return accessor(index, new TestSimpleTableWithEnum())! as TestSimpleTableWithEnum;
+ case 'MyGame_Example2_Monster': return accessor(index, new MyGame_Example2_Monster())! as MyGame_Example2_Monster;
+ default: return null;
+ }
+}
diff --git a/tests/ts/my-game/example/color.js b/tests/ts/my-game/example/color.js
new file mode 100644
index 0000000..f95f75e
--- /dev/null
+++ b/tests/ts/my-game/example/color.js
@@ -0,0 +1,17 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+/**
+ * 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";
+})(Color || (Color = {}));
diff --git a/tests/ts/my-game/example/color.ts b/tests/ts/my-game/example/color.ts
new file mode 100644
index 0000000..8ce58da
--- /dev/null
+++ b/tests/ts/my-game/example/color.ts
@@ -0,0 +1,19 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+/**
+ * Composite components of Monster color.
+ */
+export enum Color {
+ Red = 1,
+
+ /**
+ * \brief color Green
+ * Green is bit_flag with value (1u << 1)
+ */
+ Green = 2,
+
+ /**
+ * \brief color Blue (1u << 3)
+ */
+ Blue = 8
+}
diff --git a/tests/ts/my-game/example/long-enum.js b/tests/ts/my-game/example/long-enum.js
new file mode 100644
index 0000000..040d8a6
--- /dev/null
+++ b/tests/ts/my-game/example/long-enum.js
@@ -0,0 +1,7 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+export var LongEnum;
+(function (LongEnum) {
+ LongEnum["LongOne"] = "2";
+ LongEnum["LongTwo"] = "4";
+ LongEnum["LongBig"] = "1099511627776";
+})(LongEnum || (LongEnum = {}));
diff --git a/tests/ts/my-game/example/long-enum.ts b/tests/ts/my-game/example/long-enum.ts
new file mode 100644
index 0000000..31ea188
--- /dev/null
+++ b/tests/ts/my-game/example/long-enum.ts
@@ -0,0 +1,7 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+export enum LongEnum {
+ LongOne = '2',
+ LongTwo = '4',
+ LongBig = '1099511627776'
+}
diff --git a/tests/ts/my-game/example/monster.js b/tests/ts/my-game/example/monster.js
new file mode 100644
index 0000000..e4ef970
--- /dev/null
+++ b/tests/ts/my-game/example/monster.js
@@ -0,0 +1,1125 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { Ability } from '../../my-game/example/ability.js';
+import { Any, unionToAny } from '../../my-game/example/any.js';
+import { AnyAmbiguousAliases, unionToAnyAmbiguousAliases } from '../../my-game/example/any-ambiguous-aliases.js';
+import { AnyUniqueAliases, unionToAnyUniqueAliases } from '../../my-game/example/any-unique-aliases.js';
+import { Color } from '../../my-game/example/color.js';
+import { Race } from '../../my-game/example/race.js';
+import { Referrable } from '../../my-game/example/referrable.js';
+import { Stat } from '../../my-game/example/stat.js';
+import { Test } from '../../my-game/example/test.js';
+import { Vec3 } from '../../my-game/example/vec3.js';
+import { InParentNamespace } from '../../my-game/in-parent-namespace.js';
+/**
+ * an example documentation comment: "monster object"
+ */
+export class Monster {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsMonster(bb, obj) {
+ return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsMonster(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static bufferHasIdentifier(bb) {
+ return bb.__has_identifier('MONS');
+ }
+ pos(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? (obj || new Vec3()).__init(this.bb_pos + offset, this.bb) : null;
+ }
+ mana() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.readInt16(this.bb_pos + offset) : 150;
+ }
+ mutate_mana(value) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt16(this.bb_pos + offset, value);
+ return true;
+ }
+ hp() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? this.bb.readInt16(this.bb_pos + offset) : 100;
+ }
+ mutate_hp(value) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt16(this.bb_pos + offset, value);
+ return true;
+ }
+ name(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ inventory(index) {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
+ }
+ inventoryLength() {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ inventoryArray() {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ 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;
+ }
+ color() {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ return offset ? this.bb.readUint8(this.bb_pos + offset) : Color.Blue;
+ }
+ mutate_color(value) {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint8(this.bb_pos + offset, value);
+ return true;
+ }
+ testType() {
+ const offset = this.bb.__offset(this.bb_pos, 18);
+ return offset ? this.bb.readUint8(this.bb_pos + offset) : Any.NONE;
+ }
+ test(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 20);
+ return offset ? this.bb.__union(obj, this.bb_pos + offset) : null;
+ }
+ test4(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 22);
+ return offset ? (obj || new Test()).__init(this.bb.__vector(this.bb_pos + offset) + index * 4, this.bb) : null;
+ }
+ test4Length() {
+ const offset = this.bb.__offset(this.bb_pos, 22);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ testarrayofstring(index, optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 24);
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+ }
+ testarrayofstringLength() {
+ const offset = this.bb.__offset(this.bb_pos, 24);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ /**
+ * an example documentation comment: this will end up in the generated code
+ * multiline too
+ */
+ testarrayoftables(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 26);
+ return offset ? (obj || new Monster()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ testarrayoftablesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 26);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ enemy(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 28);
+ return offset ? (obj || new Monster()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ testnestedflatbuffer(index) {
+ const offset = this.bb.__offset(this.bb_pos, 30);
+ return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
+ }
+ testnestedflatbufferLength() {
+ const offset = this.bb.__offset(this.bb_pos, 30);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ testnestedflatbufferArray() {
+ const offset = this.bb.__offset(this.bb_pos, 30);
+ 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;
+ }
+ testempty(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 32);
+ return offset ? (obj || new Stat()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ testbool() {
+ const offset = this.bb.__offset(this.bb_pos, 34);
+ return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+ }
+ mutate_testbool(value) {
+ const offset = this.bb.__offset(this.bb_pos, 34);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, +value);
+ return true;
+ }
+ testhashs32Fnv1() {
+ const offset = this.bb.__offset(this.bb_pos, 36);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+ }
+ mutate_testhashs32_fnv1(value) {
+ const offset = this.bb.__offset(this.bb_pos, 36);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ testhashu32Fnv1() {
+ const offset = this.bb.__offset(this.bb_pos, 38);
+ return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
+ }
+ mutate_testhashu32_fnv1(value) {
+ const offset = this.bb.__offset(this.bb_pos, 38);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint32(this.bb_pos + offset, value);
+ return true;
+ }
+ testhashs64Fnv1() {
+ const offset = this.bb.__offset(this.bb_pos, 40);
+ return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
+ }
+ mutate_testhashs64_fnv1(value) {
+ const offset = this.bb.__offset(this.bb_pos, 40);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt64(this.bb_pos + offset, value);
+ return true;
+ }
+ testhashu64Fnv1() {
+ const offset = this.bb.__offset(this.bb_pos, 42);
+ return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
+ }
+ mutate_testhashu64_fnv1(value) {
+ const offset = this.bb.__offset(this.bb_pos, 42);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint64(this.bb_pos + offset, value);
+ return true;
+ }
+ testhashs32Fnv1a() {
+ const offset = this.bb.__offset(this.bb_pos, 44);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+ }
+ mutate_testhashs32_fnv1a(value) {
+ const offset = this.bb.__offset(this.bb_pos, 44);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ testhashu32Fnv1a() {
+ const offset = this.bb.__offset(this.bb_pos, 46);
+ return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
+ }
+ mutate_testhashu32_fnv1a(value) {
+ const offset = this.bb.__offset(this.bb_pos, 46);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint32(this.bb_pos + offset, value);
+ return true;
+ }
+ testhashs64Fnv1a() {
+ const offset = this.bb.__offset(this.bb_pos, 48);
+ return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
+ }
+ mutate_testhashs64_fnv1a(value) {
+ const offset = this.bb.__offset(this.bb_pos, 48);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt64(this.bb_pos + offset, value);
+ return true;
+ }
+ testhashu64Fnv1a() {
+ const offset = this.bb.__offset(this.bb_pos, 50);
+ return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
+ }
+ mutate_testhashu64_fnv1a(value) {
+ const offset = this.bb.__offset(this.bb_pos, 50);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint64(this.bb_pos + offset, value);
+ return true;
+ }
+ testarrayofbools(index) {
+ const offset = this.bb.__offset(this.bb_pos, 52);
+ return offset ? !!this.bb.readInt8(this.bb.__vector(this.bb_pos + offset) + index) : false;
+ }
+ testarrayofboolsLength() {
+ const offset = this.bb.__offset(this.bb_pos, 52);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ testarrayofboolsArray() {
+ const offset = this.bb.__offset(this.bb_pos, 52);
+ 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)) : null;
+ }
+ testf() {
+ const offset = this.bb.__offset(this.bb_pos, 54);
+ return offset ? this.bb.readFloat32(this.bb_pos + offset) : 3.14159;
+ }
+ mutate_testf(value) {
+ const offset = this.bb.__offset(this.bb_pos, 54);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeFloat32(this.bb_pos + offset, value);
+ return true;
+ }
+ testf2() {
+ const offset = this.bb.__offset(this.bb_pos, 56);
+ return offset ? this.bb.readFloat32(this.bb_pos + offset) : 3.0;
+ }
+ mutate_testf2(value) {
+ const offset = this.bb.__offset(this.bb_pos, 56);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeFloat32(this.bb_pos + offset, value);
+ return true;
+ }
+ testf3() {
+ const offset = this.bb.__offset(this.bb_pos, 58);
+ return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;
+ }
+ mutate_testf3(value) {
+ const offset = this.bb.__offset(this.bb_pos, 58);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeFloat32(this.bb_pos + offset, value);
+ return true;
+ }
+ testarrayofstring2(index, optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 60);
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+ }
+ testarrayofstring2Length() {
+ const offset = this.bb.__offset(this.bb_pos, 60);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ testarrayofsortedstruct(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 62);
+ return offset ? (obj || new Ability()).__init(this.bb.__vector(this.bb_pos + offset) + index * 8, this.bb) : null;
+ }
+ testarrayofsortedstructLength() {
+ const offset = this.bb.__offset(this.bb_pos, 62);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ flex(index) {
+ const offset = this.bb.__offset(this.bb_pos, 64);
+ return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
+ }
+ flexLength() {
+ const offset = this.bb.__offset(this.bb_pos, 64);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ flexArray() {
+ const offset = this.bb.__offset(this.bb_pos, 64);
+ 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;
+ }
+ test5(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 66);
+ return offset ? (obj || new Test()).__init(this.bb.__vector(this.bb_pos + offset) + index * 4, this.bb) : null;
+ }
+ test5Length() {
+ const offset = this.bb.__offset(this.bb_pos, 66);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ vectorOfLongs(index) {
+ const offset = this.bb.__offset(this.bb_pos, 68);
+ return offset ? this.bb.readInt64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
+ }
+ vectorOfLongsLength() {
+ const offset = this.bb.__offset(this.bb_pos, 68);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ vectorOfDoubles(index) {
+ const offset = this.bb.__offset(this.bb_pos, 70);
+ return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
+ }
+ vectorOfDoublesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 70);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ vectorOfDoublesArray() {
+ const offset = this.bb.__offset(this.bb_pos, 70);
+ return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
+ }
+ parentNamespaceTest(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 72);
+ return offset ? (obj || new InParentNamespace()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ vectorOfReferrables(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 74);
+ return offset ? (obj || new Referrable()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ vectorOfReferrablesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 74);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ singleWeakReference() {
+ const offset = this.bb.__offset(this.bb_pos, 76);
+ return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
+ }
+ mutate_single_weak_reference(value) {
+ const offset = this.bb.__offset(this.bb_pos, 76);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint64(this.bb_pos + offset, value);
+ return true;
+ }
+ vectorOfWeakReferences(index) {
+ const offset = this.bb.__offset(this.bb_pos, 78);
+ return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
+ }
+ vectorOfWeakReferencesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 78);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ vectorOfStrongReferrables(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 80);
+ return offset ? (obj || new Referrable()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ vectorOfStrongReferrablesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 80);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ coOwningReference() {
+ const offset = this.bb.__offset(this.bb_pos, 82);
+ return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
+ }
+ mutate_co_owning_reference(value) {
+ const offset = this.bb.__offset(this.bb_pos, 82);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint64(this.bb_pos + offset, value);
+ return true;
+ }
+ vectorOfCoOwningReferences(index) {
+ const offset = this.bb.__offset(this.bb_pos, 84);
+ return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
+ }
+ vectorOfCoOwningReferencesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 84);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ nonOwningReference() {
+ const offset = this.bb.__offset(this.bb_pos, 86);
+ return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
+ }
+ mutate_non_owning_reference(value) {
+ const offset = this.bb.__offset(this.bb_pos, 86);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint64(this.bb_pos + offset, value);
+ return true;
+ }
+ vectorOfNonOwningReferences(index) {
+ const offset = this.bb.__offset(this.bb_pos, 88);
+ return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
+ }
+ vectorOfNonOwningReferencesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 88);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ anyUniqueType() {
+ const offset = this.bb.__offset(this.bb_pos, 90);
+ return offset ? this.bb.readUint8(this.bb_pos + offset) : AnyUniqueAliases.NONE;
+ }
+ anyUnique(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 92);
+ return offset ? this.bb.__union(obj, this.bb_pos + offset) : null;
+ }
+ anyAmbiguousType() {
+ const offset = this.bb.__offset(this.bb_pos, 94);
+ return offset ? this.bb.readUint8(this.bb_pos + offset) : AnyAmbiguousAliases.NONE;
+ }
+ anyAmbiguous(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 96);
+ return offset ? this.bb.__union(obj, this.bb_pos + offset) : null;
+ }
+ vectorOfEnums(index) {
+ const offset = this.bb.__offset(this.bb_pos, 98);
+ return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
+ }
+ vectorOfEnumsLength() {
+ const offset = this.bb.__offset(this.bb_pos, 98);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ vectorOfEnumsArray() {
+ const offset = this.bb.__offset(this.bb_pos, 98);
+ 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;
+ }
+ signedEnum() {
+ const offset = this.bb.__offset(this.bb_pos, 100);
+ return offset ? this.bb.readInt8(this.bb_pos + offset) : Race.None;
+ }
+ mutate_signed_enum(value) {
+ const offset = this.bb.__offset(this.bb_pos, 100);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, value);
+ return true;
+ }
+ testrequirednestedflatbuffer(index) {
+ const offset = this.bb.__offset(this.bb_pos, 102);
+ return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
+ }
+ testrequirednestedflatbufferLength() {
+ const offset = this.bb.__offset(this.bb_pos, 102);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ testrequirednestedflatbufferArray() {
+ const offset = this.bb.__offset(this.bb_pos, 102);
+ 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;
+ }
+ scalarKeySortedTables(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 104);
+ return offset ? (obj || new Stat()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ scalarKeySortedTablesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 104);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ nativeInline(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 106);
+ return offset ? (obj || new Test()).__init(this.bb_pos + offset, this.bb) : null;
+ }
+ longEnumNonEnumDefault() {
+ const offset = this.bb.__offset(this.bb_pos, 108);
+ return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
+ }
+ mutate_long_enum_non_enum_default(value) {
+ const offset = this.bb.__offset(this.bb_pos, 108);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint64(this.bb_pos + offset, value);
+ return true;
+ }
+ longEnumNormalDefault() {
+ const offset = this.bb.__offset(this.bb_pos, 110);
+ return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('2');
+ }
+ mutate_long_enum_normal_default(value) {
+ const offset = this.bb.__offset(this.bb_pos, 110);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint64(this.bb_pos + offset, value);
+ return true;
+ }
+ static getFullyQualifiedName() {
+ return 'MyGame_Example_Monster';
+ }
+ static startMonster(builder) {
+ builder.startObject(54);
+ }
+ static addPos(builder, posOffset) {
+ builder.addFieldStruct(0, posOffset, 0);
+ }
+ static addMana(builder, mana) {
+ builder.addFieldInt16(1, mana, 150);
+ }
+ static addHp(builder, hp) {
+ builder.addFieldInt16(2, hp, 100);
+ }
+ static addName(builder, nameOffset) {
+ builder.addFieldOffset(3, nameOffset, 0);
+ }
+ static addInventory(builder, inventoryOffset) {
+ builder.addFieldOffset(5, inventoryOffset, 0);
+ }
+ static createInventoryVector(builder, data) {
+ builder.startVector(1, data.length, 1);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt8(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startInventoryVector(builder, numElems) {
+ builder.startVector(1, numElems, 1);
+ }
+ static addColor(builder, color) {
+ builder.addFieldInt8(6, color, Color.Blue);
+ }
+ static addTestType(builder, testType) {
+ builder.addFieldInt8(7, testType, Any.NONE);
+ }
+ static addTest(builder, testOffset) {
+ builder.addFieldOffset(8, testOffset, 0);
+ }
+ static addTest4(builder, test4Offset) {
+ builder.addFieldOffset(9, test4Offset, 0);
+ }
+ static startTest4Vector(builder, numElems) {
+ builder.startVector(4, numElems, 2);
+ }
+ static addTestarrayofstring(builder, testarrayofstringOffset) {
+ builder.addFieldOffset(10, testarrayofstringOffset, 0);
+ }
+ static createTestarrayofstringVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startTestarrayofstringVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addTestarrayoftables(builder, testarrayoftablesOffset) {
+ builder.addFieldOffset(11, testarrayoftablesOffset, 0);
+ }
+ static createTestarrayoftablesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startTestarrayoftablesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addEnemy(builder, enemyOffset) {
+ builder.addFieldOffset(12, enemyOffset, 0);
+ }
+ static addTestnestedflatbuffer(builder, testnestedflatbufferOffset) {
+ builder.addFieldOffset(13, testnestedflatbufferOffset, 0);
+ }
+ static createTestnestedflatbufferVector(builder, data) {
+ builder.startVector(1, data.length, 1);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt8(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startTestnestedflatbufferVector(builder, numElems) {
+ builder.startVector(1, numElems, 1);
+ }
+ static addTestempty(builder, testemptyOffset) {
+ builder.addFieldOffset(14, testemptyOffset, 0);
+ }
+ static addTestbool(builder, testbool) {
+ builder.addFieldInt8(15, +testbool, +false);
+ }
+ static addTesthashs32Fnv1(builder, testhashs32Fnv1) {
+ builder.addFieldInt32(16, testhashs32Fnv1, 0);
+ }
+ static addTesthashu32Fnv1(builder, testhashu32Fnv1) {
+ builder.addFieldInt32(17, testhashu32Fnv1, 0);
+ }
+ static addTesthashs64Fnv1(builder, testhashs64Fnv1) {
+ builder.addFieldInt64(18, testhashs64Fnv1, BigInt('0'));
+ }
+ static addTesthashu64Fnv1(builder, testhashu64Fnv1) {
+ builder.addFieldInt64(19, testhashu64Fnv1, BigInt('0'));
+ }
+ static addTesthashs32Fnv1a(builder, testhashs32Fnv1a) {
+ builder.addFieldInt32(20, testhashs32Fnv1a, 0);
+ }
+ static addTesthashu32Fnv1a(builder, testhashu32Fnv1a) {
+ builder.addFieldInt32(21, testhashu32Fnv1a, 0);
+ }
+ static addTesthashs64Fnv1a(builder, testhashs64Fnv1a) {
+ builder.addFieldInt64(22, testhashs64Fnv1a, BigInt('0'));
+ }
+ static addTesthashu64Fnv1a(builder, testhashu64Fnv1a) {
+ builder.addFieldInt64(23, testhashu64Fnv1a, BigInt('0'));
+ }
+ static addTestarrayofbools(builder, testarrayofboolsOffset) {
+ builder.addFieldOffset(24, testarrayofboolsOffset, 0);
+ }
+ static createTestarrayofboolsVector(builder, data) {
+ builder.startVector(1, data.length, 1);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt8(+data[i]);
+ }
+ return builder.endVector();
+ }
+ static startTestarrayofboolsVector(builder, numElems) {
+ builder.startVector(1, numElems, 1);
+ }
+ static addTestf(builder, testf) {
+ builder.addFieldFloat32(25, testf, 3.14159);
+ }
+ static addTestf2(builder, testf2) {
+ builder.addFieldFloat32(26, testf2, 3.0);
+ }
+ static addTestf3(builder, testf3) {
+ builder.addFieldFloat32(27, testf3, 0.0);
+ }
+ static addTestarrayofstring2(builder, testarrayofstring2Offset) {
+ builder.addFieldOffset(28, testarrayofstring2Offset, 0);
+ }
+ static createTestarrayofstring2Vector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startTestarrayofstring2Vector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addTestarrayofsortedstruct(builder, testarrayofsortedstructOffset) {
+ builder.addFieldOffset(29, testarrayofsortedstructOffset, 0);
+ }
+ static startTestarrayofsortedstructVector(builder, numElems) {
+ builder.startVector(8, numElems, 4);
+ }
+ static addFlex(builder, flexOffset) {
+ builder.addFieldOffset(30, flexOffset, 0);
+ }
+ static createFlexVector(builder, data) {
+ builder.startVector(1, data.length, 1);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt8(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startFlexVector(builder, numElems) {
+ builder.startVector(1, numElems, 1);
+ }
+ static addTest5(builder, test5Offset) {
+ builder.addFieldOffset(31, test5Offset, 0);
+ }
+ static startTest5Vector(builder, numElems) {
+ builder.startVector(4, numElems, 2);
+ }
+ static addVectorOfLongs(builder, vectorOfLongsOffset) {
+ builder.addFieldOffset(32, vectorOfLongsOffset, 0);
+ }
+ static createVectorOfLongsVector(builder, data) {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt64(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startVectorOfLongsVector(builder, numElems) {
+ builder.startVector(8, numElems, 8);
+ }
+ static addVectorOfDoubles(builder, vectorOfDoublesOffset) {
+ builder.addFieldOffset(33, vectorOfDoublesOffset, 0);
+ }
+ static createVectorOfDoublesVector(builder, data) {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addFloat64(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startVectorOfDoublesVector(builder, numElems) {
+ builder.startVector(8, numElems, 8);
+ }
+ static addParentNamespaceTest(builder, parentNamespaceTestOffset) {
+ builder.addFieldOffset(34, parentNamespaceTestOffset, 0);
+ }
+ static addVectorOfReferrables(builder, vectorOfReferrablesOffset) {
+ builder.addFieldOffset(35, vectorOfReferrablesOffset, 0);
+ }
+ static createVectorOfReferrablesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startVectorOfReferrablesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addSingleWeakReference(builder, singleWeakReference) {
+ builder.addFieldInt64(36, singleWeakReference, BigInt('0'));
+ }
+ static addVectorOfWeakReferences(builder, vectorOfWeakReferencesOffset) {
+ builder.addFieldOffset(37, vectorOfWeakReferencesOffset, 0);
+ }
+ static createVectorOfWeakReferencesVector(builder, data) {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt64(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startVectorOfWeakReferencesVector(builder, numElems) {
+ builder.startVector(8, numElems, 8);
+ }
+ static addVectorOfStrongReferrables(builder, vectorOfStrongReferrablesOffset) {
+ builder.addFieldOffset(38, vectorOfStrongReferrablesOffset, 0);
+ }
+ static createVectorOfStrongReferrablesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startVectorOfStrongReferrablesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addCoOwningReference(builder, coOwningReference) {
+ builder.addFieldInt64(39, coOwningReference, BigInt('0'));
+ }
+ static addVectorOfCoOwningReferences(builder, vectorOfCoOwningReferencesOffset) {
+ builder.addFieldOffset(40, vectorOfCoOwningReferencesOffset, 0);
+ }
+ static createVectorOfCoOwningReferencesVector(builder, data) {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt64(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startVectorOfCoOwningReferencesVector(builder, numElems) {
+ builder.startVector(8, numElems, 8);
+ }
+ static addNonOwningReference(builder, nonOwningReference) {
+ builder.addFieldInt64(41, nonOwningReference, BigInt('0'));
+ }
+ static addVectorOfNonOwningReferences(builder, vectorOfNonOwningReferencesOffset) {
+ builder.addFieldOffset(42, vectorOfNonOwningReferencesOffset, 0);
+ }
+ static createVectorOfNonOwningReferencesVector(builder, data) {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt64(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startVectorOfNonOwningReferencesVector(builder, numElems) {
+ builder.startVector(8, numElems, 8);
+ }
+ static addAnyUniqueType(builder, anyUniqueType) {
+ builder.addFieldInt8(43, anyUniqueType, AnyUniqueAliases.NONE);
+ }
+ static addAnyUnique(builder, anyUniqueOffset) {
+ builder.addFieldOffset(44, anyUniqueOffset, 0);
+ }
+ static addAnyAmbiguousType(builder, anyAmbiguousType) {
+ builder.addFieldInt8(45, anyAmbiguousType, AnyAmbiguousAliases.NONE);
+ }
+ static addAnyAmbiguous(builder, anyAmbiguousOffset) {
+ builder.addFieldOffset(46, anyAmbiguousOffset, 0);
+ }
+ static addVectorOfEnums(builder, vectorOfEnumsOffset) {
+ builder.addFieldOffset(47, vectorOfEnumsOffset, 0);
+ }
+ static createVectorOfEnumsVector(builder, data) {
+ builder.startVector(1, data.length, 1);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt8(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startVectorOfEnumsVector(builder, numElems) {
+ builder.startVector(1, numElems, 1);
+ }
+ static addSignedEnum(builder, signedEnum) {
+ builder.addFieldInt8(48, signedEnum, Race.None);
+ }
+ static addTestrequirednestedflatbuffer(builder, testrequirednestedflatbufferOffset) {
+ builder.addFieldOffset(49, testrequirednestedflatbufferOffset, 0);
+ }
+ static createTestrequirednestedflatbufferVector(builder, data) {
+ builder.startVector(1, data.length, 1);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt8(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startTestrequirednestedflatbufferVector(builder, numElems) {
+ builder.startVector(1, numElems, 1);
+ }
+ static addScalarKeySortedTables(builder, scalarKeySortedTablesOffset) {
+ builder.addFieldOffset(50, scalarKeySortedTablesOffset, 0);
+ }
+ static createScalarKeySortedTablesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startScalarKeySortedTablesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addNativeInline(builder, nativeInlineOffset) {
+ builder.addFieldStruct(51, nativeInlineOffset, 0);
+ }
+ static addLongEnumNonEnumDefault(builder, longEnumNonEnumDefault) {
+ builder.addFieldInt64(52, longEnumNonEnumDefault, BigInt('0'));
+ }
+ static addLongEnumNormalDefault(builder, longEnumNormalDefault) {
+ builder.addFieldInt64(53, longEnumNormalDefault, BigInt('2'));
+ }
+ static endMonster(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 10); // name
+ return offset;
+ }
+ static finishMonsterBuffer(builder, offset) {
+ builder.finish(offset, 'MONS');
+ }
+ static finishSizePrefixedMonsterBuffer(builder, offset) {
+ builder.finish(offset, 'MONS', true);
+ }
+ serialize() {
+ return this.bb.bytes();
+ }
+ static deserialize(buffer) {
+ return Monster.getRootAsMonster(new flatbuffers.ByteBuffer(buffer));
+ }
+ unpack() {
+ return new MonsterT((this.pos() !== null ? this.pos().unpack() : null), this.mana(), this.hp(), this.name(), this.bb.createScalarList(this.inventory.bind(this), this.inventoryLength()), this.color(), this.testType(), (() => {
+ let temp = unionToAny(this.testType(), this.test.bind(this));
+ if (temp === null) {
+ return null;
+ }
+ return temp.unpack();
+ })(), this.bb.createObjList(this.test4.bind(this), this.test4Length()), this.bb.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength()), this.bb.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength()), (this.enemy() !== null ? this.enemy().unpack() : null), this.bb.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength()), (this.testempty() !== null ? this.testempty().unpack() : null), this.testbool(), this.testhashs32Fnv1(), this.testhashu32Fnv1(), this.testhashs64Fnv1(), this.testhashu64Fnv1(), this.testhashs32Fnv1a(), this.testhashu32Fnv1a(), this.testhashs64Fnv1a(), this.testhashu64Fnv1a(), this.bb.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength()), this.testf(), this.testf2(), this.testf3(), this.bb.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length()), this.bb.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength()), this.bb.createScalarList(this.flex.bind(this), this.flexLength()), this.bb.createObjList(this.test5.bind(this), this.test5Length()), this.bb.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength()), this.bb.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength()), (this.parentNamespaceTest() !== null ? this.parentNamespaceTest().unpack() : null), this.bb.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength()), this.singleWeakReference(), this.bb.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength()), this.bb.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength()), this.coOwningReference(), this.bb.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength()), this.nonOwningReference(), this.bb.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength()), this.anyUniqueType(), (() => {
+ let temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this));
+ if (temp === null) {
+ return null;
+ }
+ return temp.unpack();
+ })(), this.anyAmbiguousType(), (() => {
+ let temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this));
+ if (temp === null) {
+ return null;
+ }
+ return temp.unpack();
+ })(), this.bb.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength()), this.signedEnum(), this.bb.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength()), this.bb.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength()), (this.nativeInline() !== null ? this.nativeInline().unpack() : null), this.longEnumNonEnumDefault(), this.longEnumNormalDefault());
+ }
+ unpackTo(_o) {
+ _o.pos = (this.pos() !== null ? this.pos().unpack() : null);
+ _o.mana = this.mana();
+ _o.hp = this.hp();
+ _o.name = this.name();
+ _o.inventory = this.bb.createScalarList(this.inventory.bind(this), this.inventoryLength());
+ _o.color = this.color();
+ _o.testType = this.testType();
+ _o.test = (() => {
+ let temp = unionToAny(this.testType(), this.test.bind(this));
+ if (temp === null) {
+ return null;
+ }
+ return temp.unpack();
+ })();
+ _o.test4 = this.bb.createObjList(this.test4.bind(this), this.test4Length());
+ _o.testarrayofstring = this.bb.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength());
+ _o.testarrayoftables = this.bb.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength());
+ _o.enemy = (this.enemy() !== null ? this.enemy().unpack() : null);
+ _o.testnestedflatbuffer = this.bb.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength());
+ _o.testempty = (this.testempty() !== null ? this.testempty().unpack() : null);
+ _o.testbool = this.testbool();
+ _o.testhashs32Fnv1 = this.testhashs32Fnv1();
+ _o.testhashu32Fnv1 = this.testhashu32Fnv1();
+ _o.testhashs64Fnv1 = this.testhashs64Fnv1();
+ _o.testhashu64Fnv1 = this.testhashu64Fnv1();
+ _o.testhashs32Fnv1a = this.testhashs32Fnv1a();
+ _o.testhashu32Fnv1a = this.testhashu32Fnv1a();
+ _o.testhashs64Fnv1a = this.testhashs64Fnv1a();
+ _o.testhashu64Fnv1a = this.testhashu64Fnv1a();
+ _o.testarrayofbools = this.bb.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength());
+ _o.testf = this.testf();
+ _o.testf2 = this.testf2();
+ _o.testf3 = this.testf3();
+ _o.testarrayofstring2 = this.bb.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length());
+ _o.testarrayofsortedstruct = this.bb.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength());
+ _o.flex = this.bb.createScalarList(this.flex.bind(this), this.flexLength());
+ _o.test5 = this.bb.createObjList(this.test5.bind(this), this.test5Length());
+ _o.vectorOfLongs = this.bb.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength());
+ _o.vectorOfDoubles = this.bb.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength());
+ _o.parentNamespaceTest = (this.parentNamespaceTest() !== null ? this.parentNamespaceTest().unpack() : null);
+ _o.vectorOfReferrables = this.bb.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength());
+ _o.singleWeakReference = this.singleWeakReference();
+ _o.vectorOfWeakReferences = this.bb.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength());
+ _o.vectorOfStrongReferrables = this.bb.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength());
+ _o.coOwningReference = this.coOwningReference();
+ _o.vectorOfCoOwningReferences = this.bb.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength());
+ _o.nonOwningReference = this.nonOwningReference();
+ _o.vectorOfNonOwningReferences = this.bb.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength());
+ _o.anyUniqueType = this.anyUniqueType();
+ _o.anyUnique = (() => {
+ let temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this));
+ if (temp === null) {
+ return null;
+ }
+ return temp.unpack();
+ })();
+ _o.anyAmbiguousType = this.anyAmbiguousType();
+ _o.anyAmbiguous = (() => {
+ let temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this));
+ if (temp === null) {
+ return null;
+ }
+ return temp.unpack();
+ })();
+ _o.vectorOfEnums = this.bb.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength());
+ _o.signedEnum = this.signedEnum();
+ _o.testrequirednestedflatbuffer = this.bb.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength());
+ _o.scalarKeySortedTables = this.bb.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength());
+ _o.nativeInline = (this.nativeInline() !== null ? this.nativeInline().unpack() : null);
+ _o.longEnumNonEnumDefault = this.longEnumNonEnumDefault();
+ _o.longEnumNormalDefault = this.longEnumNormalDefault();
+ }
+}
+export class MonsterT {
+ constructor(pos = null, mana = 150, hp = 100, name = null, inventory = [], color = Color.Blue, testType = Any.NONE, test = null, test4 = [], testarrayofstring = [], testarrayoftables = [], enemy = null, testnestedflatbuffer = [], testempty = null, testbool = false, testhashs32Fnv1 = 0, testhashu32Fnv1 = 0, testhashs64Fnv1 = BigInt('0'), testhashu64Fnv1 = BigInt('0'), testhashs32Fnv1a = 0, testhashu32Fnv1a = 0, testhashs64Fnv1a = BigInt('0'), testhashu64Fnv1a = BigInt('0'), testarrayofbools = [], testf = 3.14159, testf2 = 3.0, testf3 = 0.0, testarrayofstring2 = [], testarrayofsortedstruct = [], flex = [], test5 = [], vectorOfLongs = [], vectorOfDoubles = [], parentNamespaceTest = null, vectorOfReferrables = [], singleWeakReference = BigInt('0'), vectorOfWeakReferences = [], vectorOfStrongReferrables = [], coOwningReference = BigInt('0'), vectorOfCoOwningReferences = [], nonOwningReference = BigInt('0'), vectorOfNonOwningReferences = [], anyUniqueType = AnyUniqueAliases.NONE, anyUnique = null, anyAmbiguousType = AnyAmbiguousAliases.NONE, anyAmbiguous = null, vectorOfEnums = [], signedEnum = Race.None, testrequirednestedflatbuffer = [], scalarKeySortedTables = [], nativeInline = null, longEnumNonEnumDefault = BigInt('0'), longEnumNormalDefault = BigInt('2')) {
+ this.pos = pos;
+ this.mana = mana;
+ this.hp = hp;
+ this.name = name;
+ this.inventory = inventory;
+ this.color = color;
+ this.testType = testType;
+ this.test = test;
+ this.test4 = test4;
+ this.testarrayofstring = testarrayofstring;
+ this.testarrayoftables = testarrayoftables;
+ this.enemy = enemy;
+ this.testnestedflatbuffer = testnestedflatbuffer;
+ this.testempty = testempty;
+ this.testbool = testbool;
+ this.testhashs32Fnv1 = testhashs32Fnv1;
+ this.testhashu32Fnv1 = testhashu32Fnv1;
+ this.testhashs64Fnv1 = testhashs64Fnv1;
+ this.testhashu64Fnv1 = testhashu64Fnv1;
+ this.testhashs32Fnv1a = testhashs32Fnv1a;
+ this.testhashu32Fnv1a = testhashu32Fnv1a;
+ this.testhashs64Fnv1a = testhashs64Fnv1a;
+ this.testhashu64Fnv1a = testhashu64Fnv1a;
+ this.testarrayofbools = testarrayofbools;
+ this.testf = testf;
+ this.testf2 = testf2;
+ this.testf3 = testf3;
+ this.testarrayofstring2 = testarrayofstring2;
+ this.testarrayofsortedstruct = testarrayofsortedstruct;
+ this.flex = flex;
+ this.test5 = test5;
+ this.vectorOfLongs = vectorOfLongs;
+ this.vectorOfDoubles = vectorOfDoubles;
+ this.parentNamespaceTest = parentNamespaceTest;
+ this.vectorOfReferrables = vectorOfReferrables;
+ this.singleWeakReference = singleWeakReference;
+ this.vectorOfWeakReferences = vectorOfWeakReferences;
+ this.vectorOfStrongReferrables = vectorOfStrongReferrables;
+ this.coOwningReference = coOwningReference;
+ this.vectorOfCoOwningReferences = vectorOfCoOwningReferences;
+ this.nonOwningReference = nonOwningReference;
+ this.vectorOfNonOwningReferences = vectorOfNonOwningReferences;
+ this.anyUniqueType = anyUniqueType;
+ this.anyUnique = anyUnique;
+ this.anyAmbiguousType = anyAmbiguousType;
+ this.anyAmbiguous = anyAmbiguous;
+ this.vectorOfEnums = vectorOfEnums;
+ this.signedEnum = signedEnum;
+ this.testrequirednestedflatbuffer = testrequirednestedflatbuffer;
+ this.scalarKeySortedTables = scalarKeySortedTables;
+ this.nativeInline = nativeInline;
+ this.longEnumNonEnumDefault = longEnumNonEnumDefault;
+ this.longEnumNormalDefault = longEnumNormalDefault;
+ }
+ pack(builder) {
+ const name = (this.name !== null ? builder.createString(this.name) : 0);
+ const inventory = Monster.createInventoryVector(builder, this.inventory);
+ const test = builder.createObjectOffset(this.test);
+ const test4 = builder.createStructOffsetList(this.test4, Monster.startTest4Vector);
+ const testarrayofstring = Monster.createTestarrayofstringVector(builder, builder.createObjectOffsetList(this.testarrayofstring));
+ const testarrayoftables = Monster.createTestarrayoftablesVector(builder, builder.createObjectOffsetList(this.testarrayoftables));
+ const enemy = (this.enemy !== null ? this.enemy.pack(builder) : 0);
+ const testnestedflatbuffer = Monster.createTestnestedflatbufferVector(builder, this.testnestedflatbuffer);
+ const testempty = (this.testempty !== null ? this.testempty.pack(builder) : 0);
+ const testarrayofbools = Monster.createTestarrayofboolsVector(builder, this.testarrayofbools);
+ const testarrayofstring2 = Monster.createTestarrayofstring2Vector(builder, builder.createObjectOffsetList(this.testarrayofstring2));
+ const testarrayofsortedstruct = builder.createStructOffsetList(this.testarrayofsortedstruct, Monster.startTestarrayofsortedstructVector);
+ const flex = Monster.createFlexVector(builder, this.flex);
+ const test5 = builder.createStructOffsetList(this.test5, Monster.startTest5Vector);
+ const vectorOfLongs = Monster.createVectorOfLongsVector(builder, this.vectorOfLongs);
+ const vectorOfDoubles = Monster.createVectorOfDoublesVector(builder, this.vectorOfDoubles);
+ const parentNamespaceTest = (this.parentNamespaceTest !== null ? this.parentNamespaceTest.pack(builder) : 0);
+ const vectorOfReferrables = Monster.createVectorOfReferrablesVector(builder, builder.createObjectOffsetList(this.vectorOfReferrables));
+ const vectorOfWeakReferences = Monster.createVectorOfWeakReferencesVector(builder, this.vectorOfWeakReferences);
+ const vectorOfStrongReferrables = Monster.createVectorOfStrongReferrablesVector(builder, builder.createObjectOffsetList(this.vectorOfStrongReferrables));
+ const vectorOfCoOwningReferences = Monster.createVectorOfCoOwningReferencesVector(builder, this.vectorOfCoOwningReferences);
+ const vectorOfNonOwningReferences = Monster.createVectorOfNonOwningReferencesVector(builder, this.vectorOfNonOwningReferences);
+ const anyUnique = builder.createObjectOffset(this.anyUnique);
+ const anyAmbiguous = builder.createObjectOffset(this.anyAmbiguous);
+ const vectorOfEnums = Monster.createVectorOfEnumsVector(builder, this.vectorOfEnums);
+ const testrequirednestedflatbuffer = Monster.createTestrequirednestedflatbufferVector(builder, this.testrequirednestedflatbuffer);
+ const scalarKeySortedTables = Monster.createScalarKeySortedTablesVector(builder, builder.createObjectOffsetList(this.scalarKeySortedTables));
+ Monster.startMonster(builder);
+ Monster.addPos(builder, (this.pos !== null ? this.pos.pack(builder) : 0));
+ Monster.addMana(builder, this.mana);
+ Monster.addHp(builder, this.hp);
+ Monster.addName(builder, name);
+ Monster.addInventory(builder, inventory);
+ Monster.addColor(builder, this.color);
+ Monster.addTestType(builder, this.testType);
+ Monster.addTest(builder, test);
+ Monster.addTest4(builder, test4);
+ Monster.addTestarrayofstring(builder, testarrayofstring);
+ Monster.addTestarrayoftables(builder, testarrayoftables);
+ Monster.addEnemy(builder, enemy);
+ Monster.addTestnestedflatbuffer(builder, testnestedflatbuffer);
+ Monster.addTestempty(builder, testempty);
+ Monster.addTestbool(builder, this.testbool);
+ Monster.addTesthashs32Fnv1(builder, this.testhashs32Fnv1);
+ Monster.addTesthashu32Fnv1(builder, this.testhashu32Fnv1);
+ Monster.addTesthashs64Fnv1(builder, this.testhashs64Fnv1);
+ Monster.addTesthashu64Fnv1(builder, this.testhashu64Fnv1);
+ Monster.addTesthashs32Fnv1a(builder, this.testhashs32Fnv1a);
+ Monster.addTesthashu32Fnv1a(builder, this.testhashu32Fnv1a);
+ Monster.addTesthashs64Fnv1a(builder, this.testhashs64Fnv1a);
+ Monster.addTesthashu64Fnv1a(builder, this.testhashu64Fnv1a);
+ Monster.addTestarrayofbools(builder, testarrayofbools);
+ Monster.addTestf(builder, this.testf);
+ Monster.addTestf2(builder, this.testf2);
+ Monster.addTestf3(builder, this.testf3);
+ Monster.addTestarrayofstring2(builder, testarrayofstring2);
+ Monster.addTestarrayofsortedstruct(builder, testarrayofsortedstruct);
+ Monster.addFlex(builder, flex);
+ Monster.addTest5(builder, test5);
+ Monster.addVectorOfLongs(builder, vectorOfLongs);
+ Monster.addVectorOfDoubles(builder, vectorOfDoubles);
+ Monster.addParentNamespaceTest(builder, parentNamespaceTest);
+ Monster.addVectorOfReferrables(builder, vectorOfReferrables);
+ Monster.addSingleWeakReference(builder, this.singleWeakReference);
+ Monster.addVectorOfWeakReferences(builder, vectorOfWeakReferences);
+ Monster.addVectorOfStrongReferrables(builder, vectorOfStrongReferrables);
+ Monster.addCoOwningReference(builder, this.coOwningReference);
+ Monster.addVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences);
+ Monster.addNonOwningReference(builder, this.nonOwningReference);
+ Monster.addVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences);
+ Monster.addAnyUniqueType(builder, this.anyUniqueType);
+ Monster.addAnyUnique(builder, anyUnique);
+ Monster.addAnyAmbiguousType(builder, this.anyAmbiguousType);
+ Monster.addAnyAmbiguous(builder, anyAmbiguous);
+ Monster.addVectorOfEnums(builder, vectorOfEnums);
+ Monster.addSignedEnum(builder, this.signedEnum);
+ Monster.addTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer);
+ Monster.addScalarKeySortedTables(builder, scalarKeySortedTables);
+ Monster.addNativeInline(builder, (this.nativeInline !== null ? this.nativeInline.pack(builder) : 0));
+ Monster.addLongEnumNonEnumDefault(builder, this.longEnumNonEnumDefault);
+ Monster.addLongEnumNormalDefault(builder, this.longEnumNormalDefault);
+ return Monster.endMonster(builder);
+ }
+}
diff --git a/tests/ts/my-game/example/monster.ts b/tests/ts/my-game/example/monster.ts
new file mode 100644
index 0000000..63e5768
--- /dev/null
+++ b/tests/ts/my-game/example/monster.ts
@@ -0,0 +1,1434 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { Monster as MyGame_Example2_Monster, MonsterT as MyGame_Example2_MonsterT } from '../../my-game/example2/monster.js';
+import { Ability, AbilityT } from '../../my-game/example/ability.js';
+import { Any, unionToAny, unionListToAny } from '../../my-game/example/any.js';
+import { AnyAmbiguousAliases, unionToAnyAmbiguousAliases, unionListToAnyAmbiguousAliases } from '../../my-game/example/any-ambiguous-aliases.js';
+import { AnyUniqueAliases, unionToAnyUniqueAliases, unionListToAnyUniqueAliases } from '../../my-game/example/any-unique-aliases.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 { Test, TestT } from '../../my-game/example/test.js';
+import { TestSimpleTableWithEnum, TestSimpleTableWithEnumT } from '../../my-game/example/test-simple-table-with-enum.js';
+import { Vec3, Vec3T } from '../../my-game/example/vec3.js';
+import { InParentNamespace, InParentNamespaceT } from '../../my-game/in-parent-namespace.js';
+
+
+/**
+ * an example documentation comment: "monster object"
+ */
+export class Monster {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Monster {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:Monster):Monster {
+ return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:Monster):Monster {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
+ return bb.__has_identifier('MONS');
+}
+
+pos(obj?:Vec3):Vec3|null {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? (obj || new Vec3()).__init(this.bb_pos + offset, this.bb!) : null;
+}
+
+mana():number {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.readInt16(this.bb_pos + offset) : 150;
+}
+
+mutate_mana(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt16(this.bb_pos + offset, value);
+ return true;
+}
+
+hp():number {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.readInt16(this.bb_pos + offset) : 100;
+}
+
+mutate_hp(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt16(this.bb_pos + offset, value);
+ return true;
+}
+
+name():string|null
+name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+name(optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+inventory(index: number):number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
+}
+
+inventoryLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+inventoryArray():Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ 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;
+}
+
+color():Color {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : Color.Blue;
+}
+
+mutate_color(value:Color):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint8(this.bb_pos + offset, value);
+ return true;
+}
+
+testType():Any {
+ const offset = this.bb!.__offset(this.bb_pos, 18);
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : Any.NONE;
+}
+
+test<T extends flatbuffers.Table>(obj:any):any|null {
+ const offset = this.bb!.__offset(this.bb_pos, 20);
+ return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;
+}
+
+test4(index: number, obj?:Test):Test|null {
+ const offset = this.bb!.__offset(this.bb_pos, 22);
+ return offset ? (obj || new Test()).__init(this.bb!.__vector(this.bb_pos + offset) + index * 4, this.bb!) : null;
+}
+
+test4Length():number {
+ const offset = this.bb!.__offset(this.bb_pos, 22);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+testarrayofstring(index: number):string
+testarrayofstring(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+testarrayofstring(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 24);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+testarrayofstringLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 24);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+/**
+ * an example documentation comment: this will end up in the generated code
+ * multiline too
+ */
+testarrayoftables(index: number, obj?:Monster):Monster|null {
+ const offset = this.bb!.__offset(this.bb_pos, 26);
+ return offset ? (obj || new Monster()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+testarrayoftablesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 26);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+enemy(obj?:Monster):Monster|null {
+ const offset = this.bb!.__offset(this.bb_pos, 28);
+ return offset ? (obj || new Monster()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+testnestedflatbuffer(index: number):number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 30);
+ return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
+}
+
+testnestedflatbufferLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 30);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+testnestedflatbufferArray():Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 30);
+ 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;
+}
+
+testempty(obj?:Stat):Stat|null {
+ const offset = this.bb!.__offset(this.bb_pos, 32);
+ return offset ? (obj || new Stat()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+testbool():boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 34);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_testbool(value:boolean):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 34);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, +value);
+ return true;
+}
+
+testhashs32Fnv1():number {
+ const offset = this.bb!.__offset(this.bb_pos, 36);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_testhashs32_fnv1(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 36);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+testhashu32Fnv1():number {
+ const offset = this.bb!.__offset(this.bb_pos, 38);
+ return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
+}
+
+mutate_testhashu32_fnv1(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 38);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint32(this.bb_pos + offset, value);
+ return true;
+}
+
+testhashs64Fnv1():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 40);
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_testhashs64_fnv1(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 40);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt64(this.bb_pos + offset, value);
+ return true;
+}
+
+testhashu64Fnv1():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 42);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_testhashu64_fnv1(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 42);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint64(this.bb_pos + offset, value);
+ return true;
+}
+
+testhashs32Fnv1a():number {
+ const offset = this.bb!.__offset(this.bb_pos, 44);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_testhashs32_fnv1a(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 44);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+testhashu32Fnv1a():number {
+ const offset = this.bb!.__offset(this.bb_pos, 46);
+ return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
+}
+
+mutate_testhashu32_fnv1a(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 46);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint32(this.bb_pos + offset, value);
+ return true;
+}
+
+testhashs64Fnv1a():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 48);
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_testhashs64_fnv1a(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 48);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt64(this.bb_pos + offset, value);
+ return true;
+}
+
+testhashu64Fnv1a():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 50);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_testhashu64_fnv1a(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 50);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint64(this.bb_pos + offset, value);
+ return true;
+}
+
+testarrayofbools(index: number):boolean|null {
+ const offset = this.bb!.__offset(this.bb_pos, 52);
+ return offset ? !!this.bb!.readInt8(this.bb!.__vector(this.bb_pos + offset) + index) : false;
+}
+
+testarrayofboolsLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 52);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+testarrayofboolsArray():Int8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 52);
+ 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)) : null;
+}
+
+testf():number {
+ const offset = this.bb!.__offset(this.bb_pos, 54);
+ return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 3.14159;
+}
+
+mutate_testf(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 54);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeFloat32(this.bb_pos + offset, value);
+ return true;
+}
+
+testf2():number {
+ const offset = this.bb!.__offset(this.bb_pos, 56);
+ return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 3.0;
+}
+
+mutate_testf2(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 56);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeFloat32(this.bb_pos + offset, value);
+ return true;
+}
+
+testf3():number {
+ const offset = this.bb!.__offset(this.bb_pos, 58);
+ return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
+}
+
+mutate_testf3(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 58);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeFloat32(this.bb_pos + offset, value);
+ return true;
+}
+
+testarrayofstring2(index: number):string
+testarrayofstring2(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+testarrayofstring2(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 60);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+testarrayofstring2Length():number {
+ const offset = this.bb!.__offset(this.bb_pos, 60);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+testarrayofsortedstruct(index: number, obj?:Ability):Ability|null {
+ const offset = this.bb!.__offset(this.bb_pos, 62);
+ return offset ? (obj || new Ability()).__init(this.bb!.__vector(this.bb_pos + offset) + index * 8, this.bb!) : null;
+}
+
+testarrayofsortedstructLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 62);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+flex(index: number):number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 64);
+ return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
+}
+
+flexLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 64);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+flexArray():Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 64);
+ 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;
+}
+
+test5(index: number, obj?:Test):Test|null {
+ const offset = this.bb!.__offset(this.bb_pos, 66);
+ return offset ? (obj || new Test()).__init(this.bb!.__vector(this.bb_pos + offset) + index * 4, this.bb!) : null;
+}
+
+test5Length():number {
+ const offset = this.bb!.__offset(this.bb_pos, 66);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+vectorOfLongs(index: number):bigint|null {
+ const offset = this.bb!.__offset(this.bb_pos, 68);
+ return offset ? this.bb!.readInt64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
+}
+
+vectorOfLongsLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 68);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+vectorOfDoubles(index: number):number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 70);
+ return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0;
+}
+
+vectorOfDoublesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 70);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+vectorOfDoublesArray():Float64Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 70);
+ return offset ? new Float64Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
+}
+
+parentNamespaceTest(obj?:InParentNamespace):InParentNamespace|null {
+ const offset = this.bb!.__offset(this.bb_pos, 72);
+ return offset ? (obj || new InParentNamespace()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+vectorOfReferrables(index: number, obj?:Referrable):Referrable|null {
+ const offset = this.bb!.__offset(this.bb_pos, 74);
+ return offset ? (obj || new Referrable()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+vectorOfReferrablesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 74);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+singleWeakReference():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 76);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_single_weak_reference(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 76);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint64(this.bb_pos + offset, value);
+ return true;
+}
+
+vectorOfWeakReferences(index: number):bigint|null {
+ const offset = this.bb!.__offset(this.bb_pos, 78);
+ return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
+}
+
+vectorOfWeakReferencesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 78);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+vectorOfStrongReferrables(index: number, obj?:Referrable):Referrable|null {
+ const offset = this.bb!.__offset(this.bb_pos, 80);
+ return offset ? (obj || new Referrable()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+vectorOfStrongReferrablesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 80);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+coOwningReference():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 82);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_co_owning_reference(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 82);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint64(this.bb_pos + offset, value);
+ return true;
+}
+
+vectorOfCoOwningReferences(index: number):bigint|null {
+ const offset = this.bb!.__offset(this.bb_pos, 84);
+ return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
+}
+
+vectorOfCoOwningReferencesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 84);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+nonOwningReference():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 86);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_non_owning_reference(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 86);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint64(this.bb_pos + offset, value);
+ return true;
+}
+
+vectorOfNonOwningReferences(index: number):bigint|null {
+ const offset = this.bb!.__offset(this.bb_pos, 88);
+ return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
+}
+
+vectorOfNonOwningReferencesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 88);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+anyUniqueType():AnyUniqueAliases {
+ const offset = this.bb!.__offset(this.bb_pos, 90);
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : AnyUniqueAliases.NONE;
+}
+
+anyUnique<T extends flatbuffers.Table>(obj:any):any|null {
+ const offset = this.bb!.__offset(this.bb_pos, 92);
+ return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;
+}
+
+anyAmbiguousType():AnyAmbiguousAliases {
+ const offset = this.bb!.__offset(this.bb_pos, 94);
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : AnyAmbiguousAliases.NONE;
+}
+
+anyAmbiguous<T extends flatbuffers.Table>(obj:any):any|null {
+ const offset = this.bb!.__offset(this.bb_pos, 96);
+ return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;
+}
+
+vectorOfEnums(index: number):Color|null {
+ const offset = this.bb!.__offset(this.bb_pos, 98);
+ return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
+}
+
+vectorOfEnumsLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 98);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+vectorOfEnumsArray():Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 98);
+ 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;
+}
+
+signedEnum():Race {
+ const offset = this.bb!.__offset(this.bb_pos, 100);
+ return offset ? this.bb!.readInt8(this.bb_pos + offset) : Race.None;
+}
+
+mutate_signed_enum(value:Race):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 100);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, value);
+ return true;
+}
+
+testrequirednestedflatbuffer(index: number):number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 102);
+ return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
+}
+
+testrequirednestedflatbufferLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 102);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+testrequirednestedflatbufferArray():Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 102);
+ 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;
+}
+
+scalarKeySortedTables(index: number, obj?:Stat):Stat|null {
+ const offset = this.bb!.__offset(this.bb_pos, 104);
+ return offset ? (obj || new Stat()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+scalarKeySortedTablesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 104);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+nativeInline(obj?:Test):Test|null {
+ const offset = this.bb!.__offset(this.bb_pos, 106);
+ return offset ? (obj || new Test()).__init(this.bb_pos + offset, this.bb!) : null;
+}
+
+longEnumNonEnumDefault():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 108);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_long_enum_non_enum_default(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 108);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint64(this.bb_pos + offset, value);
+ return true;
+}
+
+longEnumNormalDefault():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 110);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('2');
+}
+
+mutate_long_enum_normal_default(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 110);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint64(this.bb_pos + offset, value);
+ return true;
+}
+
+static getFullyQualifiedName():string {
+ return 'MyGame_Example_Monster';
+}
+
+static startMonster(builder:flatbuffers.Builder) {
+ builder.startObject(54);
+}
+
+static addPos(builder:flatbuffers.Builder, posOffset:flatbuffers.Offset) {
+ builder.addFieldStruct(0, posOffset, 0);
+}
+
+static addMana(builder:flatbuffers.Builder, mana:number) {
+ builder.addFieldInt16(1, mana, 150);
+}
+
+static addHp(builder:flatbuffers.Builder, hp:number) {
+ builder.addFieldInt16(2, hp, 100);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(3, nameOffset, 0);
+}
+
+static addInventory(builder:flatbuffers.Builder, inventoryOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(5, inventoryOffset, 0);
+}
+
+static createInventoryVector(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 startInventoryVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(1, numElems, 1);
+}
+
+static addColor(builder:flatbuffers.Builder, color:Color) {
+ builder.addFieldInt8(6, color, Color.Blue);
+}
+
+static addTestType(builder:flatbuffers.Builder, testType:Any) {
+ builder.addFieldInt8(7, testType, Any.NONE);
+}
+
+static addTest(builder:flatbuffers.Builder, testOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(8, testOffset, 0);
+}
+
+static addTest4(builder:flatbuffers.Builder, test4Offset:flatbuffers.Offset) {
+ builder.addFieldOffset(9, test4Offset, 0);
+}
+
+static startTest4Vector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 2);
+}
+
+static addTestarrayofstring(builder:flatbuffers.Builder, testarrayofstringOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(10, testarrayofstringOffset, 0);
+}
+
+static createTestarrayofstringVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startTestarrayofstringVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addTestarrayoftables(builder:flatbuffers.Builder, testarrayoftablesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(11, testarrayoftablesOffset, 0);
+}
+
+static createTestarrayoftablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startTestarrayoftablesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addEnemy(builder:flatbuffers.Builder, enemyOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(12, enemyOffset, 0);
+}
+
+static addTestnestedflatbuffer(builder:flatbuffers.Builder, testnestedflatbufferOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(13, testnestedflatbufferOffset, 0);
+}
+
+static createTestnestedflatbufferVector(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 startTestnestedflatbufferVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(1, numElems, 1);
+}
+
+static addTestempty(builder:flatbuffers.Builder, testemptyOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(14, testemptyOffset, 0);
+}
+
+static addTestbool(builder:flatbuffers.Builder, testbool:boolean) {
+ builder.addFieldInt8(15, +testbool, +false);
+}
+
+static addTesthashs32Fnv1(builder:flatbuffers.Builder, testhashs32Fnv1:number) {
+ builder.addFieldInt32(16, testhashs32Fnv1, 0);
+}
+
+static addTesthashu32Fnv1(builder:flatbuffers.Builder, testhashu32Fnv1:number) {
+ builder.addFieldInt32(17, testhashu32Fnv1, 0);
+}
+
+static addTesthashs64Fnv1(builder:flatbuffers.Builder, testhashs64Fnv1:bigint) {
+ builder.addFieldInt64(18, testhashs64Fnv1, BigInt('0'));
+}
+
+static addTesthashu64Fnv1(builder:flatbuffers.Builder, testhashu64Fnv1:bigint) {
+ builder.addFieldInt64(19, testhashu64Fnv1, BigInt('0'));
+}
+
+static addTesthashs32Fnv1a(builder:flatbuffers.Builder, testhashs32Fnv1a:number) {
+ builder.addFieldInt32(20, testhashs32Fnv1a, 0);
+}
+
+static addTesthashu32Fnv1a(builder:flatbuffers.Builder, testhashu32Fnv1a:number) {
+ builder.addFieldInt32(21, testhashu32Fnv1a, 0);
+}
+
+static addTesthashs64Fnv1a(builder:flatbuffers.Builder, testhashs64Fnv1a:bigint) {
+ builder.addFieldInt64(22, testhashs64Fnv1a, BigInt('0'));
+}
+
+static addTesthashu64Fnv1a(builder:flatbuffers.Builder, testhashu64Fnv1a:bigint) {
+ builder.addFieldInt64(23, testhashu64Fnv1a, BigInt('0'));
+}
+
+static addTestarrayofbools(builder:flatbuffers.Builder, testarrayofboolsOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(24, testarrayofboolsOffset, 0);
+}
+
+static createTestarrayofboolsVector(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 startTestarrayofboolsVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(1, numElems, 1);
+}
+
+static addTestf(builder:flatbuffers.Builder, testf:number) {
+ builder.addFieldFloat32(25, testf, 3.14159);
+}
+
+static addTestf2(builder:flatbuffers.Builder, testf2:number) {
+ builder.addFieldFloat32(26, testf2, 3.0);
+}
+
+static addTestf3(builder:flatbuffers.Builder, testf3:number) {
+ builder.addFieldFloat32(27, testf3, 0.0);
+}
+
+static addTestarrayofstring2(builder:flatbuffers.Builder, testarrayofstring2Offset:flatbuffers.Offset) {
+ builder.addFieldOffset(28, testarrayofstring2Offset, 0);
+}
+
+static createTestarrayofstring2Vector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startTestarrayofstring2Vector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addTestarrayofsortedstruct(builder:flatbuffers.Builder, testarrayofsortedstructOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(29, testarrayofsortedstructOffset, 0);
+}
+
+static startTestarrayofsortedstructVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(8, numElems, 4);
+}
+
+static addFlex(builder:flatbuffers.Builder, flexOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(30, flexOffset, 0);
+}
+
+static createFlexVector(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 startFlexVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(1, numElems, 1);
+}
+
+static addTest5(builder:flatbuffers.Builder, test5Offset:flatbuffers.Offset) {
+ builder.addFieldOffset(31, test5Offset, 0);
+}
+
+static startTest5Vector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 2);
+}
+
+static addVectorOfLongs(builder:flatbuffers.Builder, vectorOfLongsOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(32, vectorOfLongsOffset, 0);
+}
+
+static createVectorOfLongsVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt64(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startVectorOfLongsVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(8, numElems, 8);
+}
+
+static addVectorOfDoubles(builder:flatbuffers.Builder, vectorOfDoublesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(33, vectorOfDoublesOffset, 0);
+}
+
+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 createVectorOfDoublesVector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addFloat64(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startVectorOfDoublesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(8, numElems, 8);
+}
+
+static addParentNamespaceTest(builder:flatbuffers.Builder, parentNamespaceTestOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(34, parentNamespaceTestOffset, 0);
+}
+
+static addVectorOfReferrables(builder:flatbuffers.Builder, vectorOfReferrablesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(35, vectorOfReferrablesOffset, 0);
+}
+
+static createVectorOfReferrablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startVectorOfReferrablesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addSingleWeakReference(builder:flatbuffers.Builder, singleWeakReference:bigint) {
+ builder.addFieldInt64(36, singleWeakReference, BigInt('0'));
+}
+
+static addVectorOfWeakReferences(builder:flatbuffers.Builder, vectorOfWeakReferencesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(37, vectorOfWeakReferencesOffset, 0);
+}
+
+static createVectorOfWeakReferencesVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt64(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startVectorOfWeakReferencesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(8, numElems, 8);
+}
+
+static addVectorOfStrongReferrables(builder:flatbuffers.Builder, vectorOfStrongReferrablesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(38, vectorOfStrongReferrablesOffset, 0);
+}
+
+static createVectorOfStrongReferrablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startVectorOfStrongReferrablesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addCoOwningReference(builder:flatbuffers.Builder, coOwningReference:bigint) {
+ builder.addFieldInt64(39, coOwningReference, BigInt('0'));
+}
+
+static addVectorOfCoOwningReferences(builder:flatbuffers.Builder, vectorOfCoOwningReferencesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(40, vectorOfCoOwningReferencesOffset, 0);
+}
+
+static createVectorOfCoOwningReferencesVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt64(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startVectorOfCoOwningReferencesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(8, numElems, 8);
+}
+
+static addNonOwningReference(builder:flatbuffers.Builder, nonOwningReference:bigint) {
+ builder.addFieldInt64(41, nonOwningReference, BigInt('0'));
+}
+
+static addVectorOfNonOwningReferences(builder:flatbuffers.Builder, vectorOfNonOwningReferencesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(42, vectorOfNonOwningReferencesOffset, 0);
+}
+
+static createVectorOfNonOwningReferencesVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt64(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startVectorOfNonOwningReferencesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(8, numElems, 8);
+}
+
+static addAnyUniqueType(builder:flatbuffers.Builder, anyUniqueType:AnyUniqueAliases) {
+ builder.addFieldInt8(43, anyUniqueType, AnyUniqueAliases.NONE);
+}
+
+static addAnyUnique(builder:flatbuffers.Builder, anyUniqueOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(44, anyUniqueOffset, 0);
+}
+
+static addAnyAmbiguousType(builder:flatbuffers.Builder, anyAmbiguousType:AnyAmbiguousAliases) {
+ builder.addFieldInt8(45, anyAmbiguousType, AnyAmbiguousAliases.NONE);
+}
+
+static addAnyAmbiguous(builder:flatbuffers.Builder, anyAmbiguousOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(46, anyAmbiguousOffset, 0);
+}
+
+static addVectorOfEnums(builder:flatbuffers.Builder, vectorOfEnumsOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(47, vectorOfEnumsOffset, 0);
+}
+
+static createVectorOfEnumsVector(builder:flatbuffers.Builder, data:Color[]):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 startVectorOfEnumsVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(1, numElems, 1);
+}
+
+static addSignedEnum(builder:flatbuffers.Builder, signedEnum:Race) {
+ builder.addFieldInt8(48, signedEnum, Race.None);
+}
+
+static addTestrequirednestedflatbuffer(builder:flatbuffers.Builder, testrequirednestedflatbufferOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(49, testrequirednestedflatbufferOffset, 0);
+}
+
+static createTestrequirednestedflatbufferVector(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 startTestrequirednestedflatbufferVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(1, numElems, 1);
+}
+
+static addScalarKeySortedTables(builder:flatbuffers.Builder, scalarKeySortedTablesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(50, scalarKeySortedTablesOffset, 0);
+}
+
+static createScalarKeySortedTablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startScalarKeySortedTablesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addNativeInline(builder:flatbuffers.Builder, nativeInlineOffset:flatbuffers.Offset) {
+ builder.addFieldStruct(51, nativeInlineOffset, 0);
+}
+
+static addLongEnumNonEnumDefault(builder:flatbuffers.Builder, longEnumNonEnumDefault:bigint) {
+ builder.addFieldInt64(52, longEnumNonEnumDefault, BigInt('0'));
+}
+
+static addLongEnumNormalDefault(builder:flatbuffers.Builder, longEnumNormalDefault:bigint) {
+ builder.addFieldInt64(53, longEnumNormalDefault, BigInt('2'));
+}
+
+static endMonster(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 10) // name
+ return offset;
+}
+
+static finishMonsterBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
+ builder.finish(offset, 'MONS');
+}
+
+static finishSizePrefixedMonsterBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
+ builder.finish(offset, 'MONS', true);
+}
+
+
+serialize():Uint8Array {
+ return this.bb!.bytes();
+}
+
+static deserialize(buffer: Uint8Array):Monster {
+ return Monster.getRootAsMonster(new flatbuffers.ByteBuffer(buffer))
+}
+
+unpack(): MonsterT {
+ return new MonsterT(
+ (this.pos() !== null ? this.pos()!.unpack() : null),
+ this.mana(),
+ this.hp(),
+ this.name(),
+ this.bb!.createScalarList(this.inventory.bind(this), this.inventoryLength()),
+ this.color(),
+ this.testType(),
+ (() => {
+ let temp = unionToAny(this.testType(), this.test.bind(this));
+ if(temp === null) { return null; }
+ return temp.unpack()
+ })(),
+ this.bb!.createObjList(this.test4.bind(this), this.test4Length()),
+ this.bb!.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength()),
+ this.bb!.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength()),
+ (this.enemy() !== null ? this.enemy()!.unpack() : null),
+ this.bb!.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength()),
+ (this.testempty() !== null ? this.testempty()!.unpack() : null),
+ this.testbool(),
+ this.testhashs32Fnv1(),
+ this.testhashu32Fnv1(),
+ this.testhashs64Fnv1(),
+ this.testhashu64Fnv1(),
+ this.testhashs32Fnv1a(),
+ this.testhashu32Fnv1a(),
+ this.testhashs64Fnv1a(),
+ this.testhashu64Fnv1a(),
+ this.bb!.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength()),
+ this.testf(),
+ this.testf2(),
+ this.testf3(),
+ this.bb!.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length()),
+ this.bb!.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength()),
+ this.bb!.createScalarList(this.flex.bind(this), this.flexLength()),
+ this.bb!.createObjList(this.test5.bind(this), this.test5Length()),
+ this.bb!.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength()),
+ this.bb!.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength()),
+ (this.parentNamespaceTest() !== null ? this.parentNamespaceTest()!.unpack() : null),
+ this.bb!.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength()),
+ this.singleWeakReference(),
+ this.bb!.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength()),
+ this.bb!.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength()),
+ this.coOwningReference(),
+ this.bb!.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength()),
+ this.nonOwningReference(),
+ this.bb!.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength()),
+ this.anyUniqueType(),
+ (() => {
+ let temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this));
+ if(temp === null) { return null; }
+ return temp.unpack()
+ })(),
+ this.anyAmbiguousType(),
+ (() => {
+ let temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this));
+ if(temp === null) { return null; }
+ return temp.unpack()
+ })(),
+ this.bb!.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength()),
+ this.signedEnum(),
+ this.bb!.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength()),
+ this.bb!.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength()),
+ (this.nativeInline() !== null ? this.nativeInline()!.unpack() : null),
+ this.longEnumNonEnumDefault(),
+ this.longEnumNormalDefault()
+ );
+}
+
+
+unpackTo(_o: MonsterT): void {
+ _o.pos = (this.pos() !== null ? this.pos()!.unpack() : null);
+ _o.mana = this.mana();
+ _o.hp = this.hp();
+ _o.name = this.name();
+ _o.inventory = this.bb!.createScalarList(this.inventory.bind(this), this.inventoryLength());
+ _o.color = this.color();
+ _o.testType = this.testType();
+ _o.test = (() => {
+ let temp = unionToAny(this.testType(), this.test.bind(this));
+ if(temp === null) { return null; }
+ return temp.unpack()
+ })();
+ _o.test4 = this.bb!.createObjList(this.test4.bind(this), this.test4Length());
+ _o.testarrayofstring = this.bb!.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength());
+ _o.testarrayoftables = this.bb!.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength());
+ _o.enemy = (this.enemy() !== null ? this.enemy()!.unpack() : null);
+ _o.testnestedflatbuffer = this.bb!.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength());
+ _o.testempty = (this.testempty() !== null ? this.testempty()!.unpack() : null);
+ _o.testbool = this.testbool();
+ _o.testhashs32Fnv1 = this.testhashs32Fnv1();
+ _o.testhashu32Fnv1 = this.testhashu32Fnv1();
+ _o.testhashs64Fnv1 = this.testhashs64Fnv1();
+ _o.testhashu64Fnv1 = this.testhashu64Fnv1();
+ _o.testhashs32Fnv1a = this.testhashs32Fnv1a();
+ _o.testhashu32Fnv1a = this.testhashu32Fnv1a();
+ _o.testhashs64Fnv1a = this.testhashs64Fnv1a();
+ _o.testhashu64Fnv1a = this.testhashu64Fnv1a();
+ _o.testarrayofbools = this.bb!.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength());
+ _o.testf = this.testf();
+ _o.testf2 = this.testf2();
+ _o.testf3 = this.testf3();
+ _o.testarrayofstring2 = this.bb!.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length());
+ _o.testarrayofsortedstruct = this.bb!.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength());
+ _o.flex = this.bb!.createScalarList(this.flex.bind(this), this.flexLength());
+ _o.test5 = this.bb!.createObjList(this.test5.bind(this), this.test5Length());
+ _o.vectorOfLongs = this.bb!.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength());
+ _o.vectorOfDoubles = this.bb!.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength());
+ _o.parentNamespaceTest = (this.parentNamespaceTest() !== null ? this.parentNamespaceTest()!.unpack() : null);
+ _o.vectorOfReferrables = this.bb!.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength());
+ _o.singleWeakReference = this.singleWeakReference();
+ _o.vectorOfWeakReferences = this.bb!.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength());
+ _o.vectorOfStrongReferrables = this.bb!.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength());
+ _o.coOwningReference = this.coOwningReference();
+ _o.vectorOfCoOwningReferences = this.bb!.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength());
+ _o.nonOwningReference = this.nonOwningReference();
+ _o.vectorOfNonOwningReferences = this.bb!.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength());
+ _o.anyUniqueType = this.anyUniqueType();
+ _o.anyUnique = (() => {
+ let temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this));
+ if(temp === null) { return null; }
+ return temp.unpack()
+ })();
+ _o.anyAmbiguousType = this.anyAmbiguousType();
+ _o.anyAmbiguous = (() => {
+ let temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this));
+ if(temp === null) { return null; }
+ return temp.unpack()
+ })();
+ _o.vectorOfEnums = this.bb!.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength());
+ _o.signedEnum = this.signedEnum();
+ _o.testrequirednestedflatbuffer = this.bb!.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength());
+ _o.scalarKeySortedTables = this.bb!.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength());
+ _o.nativeInline = (this.nativeInline() !== null ? this.nativeInline()!.unpack() : null);
+ _o.longEnumNonEnumDefault = this.longEnumNonEnumDefault();
+ _o.longEnumNormalDefault = this.longEnumNormalDefault();
+}
+}
+
+export class MonsterT {
+constructor(
+ public pos: Vec3T|null = null,
+ public mana: number = 150,
+ public hp: number = 100,
+ public name: string|Uint8Array|null = null,
+ public inventory: (number)[] = [],
+ public color: Color = Color.Blue,
+ public testType: Any = Any.NONE,
+ public test: MonsterT|MyGame_Example2_MonsterT|TestSimpleTableWithEnumT|null = null,
+ public test4: (TestT)[] = [],
+ public testarrayofstring: (string)[] = [],
+ public testarrayoftables: (MonsterT)[] = [],
+ public enemy: MonsterT|null = null,
+ public testnestedflatbuffer: (number)[] = [],
+ public testempty: StatT|null = null,
+ public testbool: boolean = false,
+ public testhashs32Fnv1: number = 0,
+ public testhashu32Fnv1: number = 0,
+ public testhashs64Fnv1: bigint = BigInt('0'),
+ public testhashu64Fnv1: bigint = BigInt('0'),
+ public testhashs32Fnv1a: number = 0,
+ public testhashu32Fnv1a: number = 0,
+ public testhashs64Fnv1a: bigint = BigInt('0'),
+ public testhashu64Fnv1a: bigint = BigInt('0'),
+ public testarrayofbools: (boolean)[] = [],
+ public testf: number = 3.14159,
+ public testf2: number = 3.0,
+ public testf3: number = 0.0,
+ public testarrayofstring2: (string)[] = [],
+ public testarrayofsortedstruct: (AbilityT)[] = [],
+ public flex: (number)[] = [],
+ public test5: (TestT)[] = [],
+ public vectorOfLongs: (bigint)[] = [],
+ public vectorOfDoubles: (number)[] = [],
+ public parentNamespaceTest: InParentNamespaceT|null = null,
+ public vectorOfReferrables: (ReferrableT)[] = [],
+ public singleWeakReference: bigint = BigInt('0'),
+ public vectorOfWeakReferences: (bigint)[] = [],
+ public vectorOfStrongReferrables: (ReferrableT)[] = [],
+ public coOwningReference: bigint = BigInt('0'),
+ public vectorOfCoOwningReferences: (bigint)[] = [],
+ public nonOwningReference: bigint = BigInt('0'),
+ public vectorOfNonOwningReferences: (bigint)[] = [],
+ public anyUniqueType: AnyUniqueAliases = AnyUniqueAliases.NONE,
+ public anyUnique: MonsterT|MyGame_Example2_MonsterT|TestSimpleTableWithEnumT|null = null,
+ public anyAmbiguousType: AnyAmbiguousAliases = AnyAmbiguousAliases.NONE,
+ public anyAmbiguous: MonsterT|null = null,
+ public vectorOfEnums: (Color)[] = [],
+ public signedEnum: Race = Race.None,
+ public testrequirednestedflatbuffer: (number)[] = [],
+ public scalarKeySortedTables: (StatT)[] = [],
+ public nativeInline: TestT|null = null,
+ public longEnumNonEnumDefault: bigint = BigInt('0'),
+ public longEnumNormalDefault: bigint = BigInt('2')
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const name = (this.name !== null ? builder.createString(this.name!) : 0);
+ const inventory = Monster.createInventoryVector(builder, this.inventory);
+ const test = builder.createObjectOffset(this.test);
+ const test4 = builder.createStructOffsetList(this.test4, Monster.startTest4Vector);
+ const testarrayofstring = Monster.createTestarrayofstringVector(builder, builder.createObjectOffsetList(this.testarrayofstring));
+ const testarrayoftables = Monster.createTestarrayoftablesVector(builder, builder.createObjectOffsetList(this.testarrayoftables));
+ const enemy = (this.enemy !== null ? this.enemy!.pack(builder) : 0);
+ const testnestedflatbuffer = Monster.createTestnestedflatbufferVector(builder, this.testnestedflatbuffer);
+ const testempty = (this.testempty !== null ? this.testempty!.pack(builder) : 0);
+ const testarrayofbools = Monster.createTestarrayofboolsVector(builder, this.testarrayofbools);
+ const testarrayofstring2 = Monster.createTestarrayofstring2Vector(builder, builder.createObjectOffsetList(this.testarrayofstring2));
+ const testarrayofsortedstruct = builder.createStructOffsetList(this.testarrayofsortedstruct, Monster.startTestarrayofsortedstructVector);
+ const flex = Monster.createFlexVector(builder, this.flex);
+ const test5 = builder.createStructOffsetList(this.test5, Monster.startTest5Vector);
+ const vectorOfLongs = Monster.createVectorOfLongsVector(builder, this.vectorOfLongs);
+ const vectorOfDoubles = Monster.createVectorOfDoublesVector(builder, this.vectorOfDoubles);
+ const parentNamespaceTest = (this.parentNamespaceTest !== null ? this.parentNamespaceTest!.pack(builder) : 0);
+ const vectorOfReferrables = Monster.createVectorOfReferrablesVector(builder, builder.createObjectOffsetList(this.vectorOfReferrables));
+ const vectorOfWeakReferences = Monster.createVectorOfWeakReferencesVector(builder, this.vectorOfWeakReferences);
+ const vectorOfStrongReferrables = Monster.createVectorOfStrongReferrablesVector(builder, builder.createObjectOffsetList(this.vectorOfStrongReferrables));
+ const vectorOfCoOwningReferences = Monster.createVectorOfCoOwningReferencesVector(builder, this.vectorOfCoOwningReferences);
+ const vectorOfNonOwningReferences = Monster.createVectorOfNonOwningReferencesVector(builder, this.vectorOfNonOwningReferences);
+ const anyUnique = builder.createObjectOffset(this.anyUnique);
+ const anyAmbiguous = builder.createObjectOffset(this.anyAmbiguous);
+ const vectorOfEnums = Monster.createVectorOfEnumsVector(builder, this.vectorOfEnums);
+ const testrequirednestedflatbuffer = Monster.createTestrequirednestedflatbufferVector(builder, this.testrequirednestedflatbuffer);
+ const scalarKeySortedTables = Monster.createScalarKeySortedTablesVector(builder, builder.createObjectOffsetList(this.scalarKeySortedTables));
+
+ Monster.startMonster(builder);
+ Monster.addPos(builder, (this.pos !== null ? this.pos!.pack(builder) : 0));
+ Monster.addMana(builder, this.mana);
+ Monster.addHp(builder, this.hp);
+ Monster.addName(builder, name);
+ Monster.addInventory(builder, inventory);
+ Monster.addColor(builder, this.color);
+ Monster.addTestType(builder, this.testType);
+ Monster.addTest(builder, test);
+ Monster.addTest4(builder, test4);
+ Monster.addTestarrayofstring(builder, testarrayofstring);
+ Monster.addTestarrayoftables(builder, testarrayoftables);
+ Monster.addEnemy(builder, enemy);
+ Monster.addTestnestedflatbuffer(builder, testnestedflatbuffer);
+ Monster.addTestempty(builder, testempty);
+ Monster.addTestbool(builder, this.testbool);
+ Monster.addTesthashs32Fnv1(builder, this.testhashs32Fnv1);
+ Monster.addTesthashu32Fnv1(builder, this.testhashu32Fnv1);
+ Monster.addTesthashs64Fnv1(builder, this.testhashs64Fnv1);
+ Monster.addTesthashu64Fnv1(builder, this.testhashu64Fnv1);
+ Monster.addTesthashs32Fnv1a(builder, this.testhashs32Fnv1a);
+ Monster.addTesthashu32Fnv1a(builder, this.testhashu32Fnv1a);
+ Monster.addTesthashs64Fnv1a(builder, this.testhashs64Fnv1a);
+ Monster.addTesthashu64Fnv1a(builder, this.testhashu64Fnv1a);
+ Monster.addTestarrayofbools(builder, testarrayofbools);
+ Monster.addTestf(builder, this.testf);
+ Monster.addTestf2(builder, this.testf2);
+ Monster.addTestf3(builder, this.testf3);
+ Monster.addTestarrayofstring2(builder, testarrayofstring2);
+ Monster.addTestarrayofsortedstruct(builder, testarrayofsortedstruct);
+ Monster.addFlex(builder, flex);
+ Monster.addTest5(builder, test5);
+ Monster.addVectorOfLongs(builder, vectorOfLongs);
+ Monster.addVectorOfDoubles(builder, vectorOfDoubles);
+ Monster.addParentNamespaceTest(builder, parentNamespaceTest);
+ Monster.addVectorOfReferrables(builder, vectorOfReferrables);
+ Monster.addSingleWeakReference(builder, this.singleWeakReference);
+ Monster.addVectorOfWeakReferences(builder, vectorOfWeakReferences);
+ Monster.addVectorOfStrongReferrables(builder, vectorOfStrongReferrables);
+ Monster.addCoOwningReference(builder, this.coOwningReference);
+ Monster.addVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences);
+ Monster.addNonOwningReference(builder, this.nonOwningReference);
+ Monster.addVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences);
+ Monster.addAnyUniqueType(builder, this.anyUniqueType);
+ Monster.addAnyUnique(builder, anyUnique);
+ Monster.addAnyAmbiguousType(builder, this.anyAmbiguousType);
+ Monster.addAnyAmbiguous(builder, anyAmbiguous);
+ Monster.addVectorOfEnums(builder, vectorOfEnums);
+ Monster.addSignedEnum(builder, this.signedEnum);
+ Monster.addTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer);
+ Monster.addScalarKeySortedTables(builder, scalarKeySortedTables);
+ Monster.addNativeInline(builder, (this.nativeInline !== null ? this.nativeInline!.pack(builder) : 0));
+ Monster.addLongEnumNonEnumDefault(builder, this.longEnumNonEnumDefault);
+ Monster.addLongEnumNormalDefault(builder, this.longEnumNormalDefault);
+
+ return Monster.endMonster(builder);
+}
+}
diff --git a/tests/ts/my-game/example/race.js b/tests/ts/my-game/example/race.js
new file mode 100644
index 0000000..74f5105
--- /dev/null
+++ b/tests/ts/my-game/example/race.js
@@ -0,0 +1,8 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+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";
+})(Race || (Race = {}));
diff --git a/tests/ts/my-game/example/race.ts b/tests/ts/my-game/example/race.ts
new file mode 100644
index 0000000..8cb9654
--- /dev/null
+++ b/tests/ts/my-game/example/race.ts
@@ -0,0 +1,8 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+export enum Race {
+ None = -1,
+ Human = 0,
+ Dwarf = 1,
+ Elf = 2
+}
diff --git a/tests/ts/my-game/example/referrable.js b/tests/ts/my-game/example/referrable.js
new file mode 100644
index 0000000..367034b
--- /dev/null
+++ b/tests/ts/my-game/example/referrable.js
@@ -0,0 +1,70 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+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();
+ }
+}
+export class ReferrableT {
+ constructor(id = BigInt('0')) {
+ this.id = id;
+ }
+ pack(builder) {
+ return Referrable.createReferrable(builder, this.id);
+ }
+}
diff --git a/tests/ts/my-game/example/referrable.ts b/tests/ts/my-game/example/referrable.ts
new file mode 100644
index 0000000..ec02980
--- /dev/null
+++ b/tests/ts/my-game/example/referrable.ts
@@ -0,0 +1,95 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+
+export class Referrable {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Referrable {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsReferrable(bb:flatbuffers.ByteBuffer, obj?:Referrable):Referrable {
+ return (obj || new Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsReferrable(bb:flatbuffers.ByteBuffer, obj?:Referrable):Referrable {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+id():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_id(value:bigint):boolean {
+ 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():string {
+ return 'MyGame_Example_Referrable';
+}
+
+static startReferrable(builder:flatbuffers.Builder) {
+ builder.startObject(1);
+}
+
+static addId(builder:flatbuffers.Builder, id:bigint) {
+ builder.addFieldInt64(0, id, BigInt('0'));
+}
+
+static endReferrable(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createReferrable(builder:flatbuffers.Builder, id:bigint):flatbuffers.Offset {
+ Referrable.startReferrable(builder);
+ Referrable.addId(builder, id);
+ return Referrable.endReferrable(builder);
+}
+
+serialize():Uint8Array {
+ return this.bb!.bytes();
+}
+
+static deserialize(buffer: Uint8Array):Referrable {
+ return Referrable.getRootAsReferrable(new flatbuffers.ByteBuffer(buffer))
+}
+
+unpack(): ReferrableT {
+ return new ReferrableT(
+ this.id()
+ );
+}
+
+
+unpackTo(_o: ReferrableT): void {
+ _o.id = this.id();
+}
+}
+
+export class ReferrableT {
+constructor(
+ public id: bigint = BigInt('0')
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ return Referrable.createReferrable(builder,
+ this.id
+ );
+}
+}
diff --git a/tests/ts/my-game/example/stat.js b/tests/ts/my-game/example/stat.js
new file mode 100644
index 0000000..43b569f
--- /dev/null
+++ b/tests/ts/my-game/example/stat.js
@@ -0,0 +1,99 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+export class Stat {
+ 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;
+ }
+ 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);
+ }
+}
diff --git a/tests/ts/my-game/example/stat.ts b/tests/ts/my-game/example/stat.ts
new file mode 100644
index 0000000..e452599
--- /dev/null
+++ b/tests/ts/my-game/example/stat.ts
@@ -0,0 +1,138 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+
+export class Stat {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Stat {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsStat(bb:flatbuffers.ByteBuffer, obj?:Stat):Stat {
+ return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsStat(bb:flatbuffers.ByteBuffer, obj?:Stat):Stat {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+id():string|null
+id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+id(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;
+}
+
+val():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_val(value:bigint):boolean {
+ 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():number {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+mutate_count(value:number):boolean {
+ 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():string {
+ return 'MyGame_Example_Stat';
+}
+
+static startStat(builder:flatbuffers.Builder) {
+ builder.startObject(3);
+}
+
+static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, idOffset, 0);
+}
+
+static addVal(builder:flatbuffers.Builder, val:bigint) {
+ builder.addFieldInt64(1, val, BigInt('0'));
+}
+
+static addCount(builder:flatbuffers.Builder, count:number) {
+ builder.addFieldInt16(2, count, 0);
+}
+
+static endStat(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createStat(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset, val:bigint, count:number):flatbuffers.Offset {
+ Stat.startStat(builder);
+ Stat.addId(builder, idOffset);
+ Stat.addVal(builder, val);
+ Stat.addCount(builder, count);
+ return Stat.endStat(builder);
+}
+
+serialize():Uint8Array {
+ return this.bb!.bytes();
+}
+
+static deserialize(buffer: Uint8Array):Stat {
+ return Stat.getRootAsStat(new flatbuffers.ByteBuffer(buffer))
+}
+
+unpack(): StatT {
+ return new StatT(
+ this.id(),
+ this.val(),
+ this.count()
+ );
+}
+
+
+unpackTo(_o: StatT): void {
+ _o.id = this.id();
+ _o.val = this.val();
+ _o.count = this.count();
+}
+}
+
+export class StatT {
+constructor(
+ public id: string|Uint8Array|null = null,
+ public val: bigint = BigInt('0'),
+ public count: number = 0
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const id = (this.id !== null ? builder.createString(this.id!) : 0);
+
+ return Stat.createStat(builder,
+ id,
+ this.val,
+ this.count
+ );
+}
+}
diff --git a/tests/ts/my-game/example/struct-of-structs-of-structs.js b/tests/ts/my-game/example/struct-of-structs-of-structs.js
new file mode 100644
index 0000000..a5fbc66
--- /dev/null
+++ b/tests/ts/my-game/example/struct-of-structs-of-structs.js
@@ -0,0 +1,52 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+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);
+ }
+}
+export class StructOfStructsOfStructsT {
+ constructor(a = null) {
+ this.a = a;
+ }
+ pack(builder) {
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _p, _q, _r, _s, _t, _u;
+ return StructOfStructsOfStructs.createStructOfStructsOfStructs(builder, ((_c = (_b = (_a = this.a) === null || _a === void 0 ? void 0 : _a.a) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : 0), ((_f = (_e = (_d = this.a) === null || _d === void 0 ? void 0 : _d.a) === null || _e === void 0 ? void 0 : _e.distance) !== null && _f !== void 0 ? _f : 0), ((_j = (_h = (_g = this.a) === null || _g === void 0 ? void 0 : _g.b) === null || _h === void 0 ? void 0 : _h.a) !== null && _j !== void 0 ? _j : 0), ((_m = (_l = (_k = this.a) === null || _k === void 0 ? void 0 : _k.b) === null || _l === void 0 ? void 0 : _l.b) !== null && _m !== void 0 ? _m : 0), ((_r = (_q = (_p = this.a) === null || _p === void 0 ? void 0 : _p.c) === null || _q === void 0 ? void 0 : _q.id) !== null && _r !== void 0 ? _r : 0), ((_u = (_t = (_s = this.a) === null || _s === void 0 ? void 0 : _s.c) === null || _t === void 0 ? void 0 : _t.distance) !== null && _u !== void 0 ? _u : 0));
+ }
+}
diff --git a/tests/ts/my-game/example/struct-of-structs-of-structs.ts b/tests/ts/my-game/example/struct-of-structs-of-structs.ts
new file mode 100644
index 0000000..52efc12
--- /dev/null
+++ b/tests/ts/my-game/example/struct-of-structs-of-structs.ts
@@ -0,0 +1,74 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { StructOfStructs, StructOfStructsT } from '../../my-game/example/struct-of-structs.js';
+
+
+export class StructOfStructsOfStructs {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructsOfStructs {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+a(obj?:StructOfStructs):StructOfStructs|null {
+ return (obj || new StructOfStructs()).__init(this.bb_pos, this.bb!);
+}
+
+static getFullyQualifiedName():string {
+ return 'MyGame_Example_StructOfStructsOfStructs';
+}
+
+static sizeOf():number {
+ return 20;
+}
+
+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 {
+ 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(): StructOfStructsOfStructsT {
+ return new StructOfStructsOfStructsT(
+ (this.a() !== null ? this.a()!.unpack() : null)
+ );
+}
+
+
+unpackTo(_o: StructOfStructsOfStructsT): void {
+ _o.a = (this.a() !== null ? this.a()!.unpack() : null);
+}
+}
+
+export class StructOfStructsOfStructsT {
+constructor(
+ public a: StructOfStructsT|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ 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)
+ );
+}
+}
diff --git a/tests/ts/my-game/example/struct-of-structs.js b/tests/ts/my-game/example/struct-of-structs.js
new file mode 100644
index 0000000..66aadc8
--- /dev/null
+++ b/tests/ts/my-game/example/struct-of-structs.js
@@ -0,0 +1,62 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+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);
+ }
+}
+export class StructOfStructsT {
+ constructor(a = null, b = null, c = null) {
+ this.a = a;
+ this.b = b;
+ this.c = c;
+ }
+ pack(builder) {
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
+ return StructOfStructs.createStructOfStructs(builder, ((_b = (_a = this.a) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : 0), ((_d = (_c = this.a) === null || _c === void 0 ? void 0 : _c.distance) !== null && _d !== void 0 ? _d : 0), ((_f = (_e = this.b) === null || _e === void 0 ? void 0 : _e.a) !== null && _f !== void 0 ? _f : 0), ((_h = (_g = this.b) === null || _g === void 0 ? void 0 : _g.b) !== null && _h !== void 0 ? _h : 0), ((_k = (_j = this.c) === null || _j === void 0 ? void 0 : _j.id) !== null && _k !== void 0 ? _k : 0), ((_m = (_l = this.c) === null || _l === void 0 ? void 0 : _l.distance) !== null && _m !== void 0 ? _m : 0));
+ }
+}
diff --git a/tests/ts/my-game/example/struct-of-structs.ts b/tests/ts/my-game/example/struct-of-structs.ts
new file mode 100644
index 0000000..749a73c
--- /dev/null
+++ b/tests/ts/my-game/example/struct-of-structs.ts
@@ -0,0 +1,88 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { Ability, AbilityT } from '../../my-game/example/ability.js';
+import { Test, TestT } from '../../my-game/example/test.js';
+
+
+export class StructOfStructs {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):StructOfStructs {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+a(obj?:Ability):Ability|null {
+ return (obj || new Ability()).__init(this.bb_pos, this.bb!);
+}
+
+b(obj?:Test):Test|null {
+ return (obj || new Test()).__init(this.bb_pos + 8, this.bb!);
+}
+
+c(obj?:Ability):Ability|null {
+ return (obj || new Ability()).__init(this.bb_pos + 12, this.bb!);
+}
+
+static getFullyQualifiedName():string {
+ return 'MyGame_Example_StructOfStructs';
+}
+
+static sizeOf():number {
+ return 20;
+}
+
+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 {
+ 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(): StructOfStructsT {
+ 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: StructOfStructsT): void {
+ _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(
+ public a: AbilityT|null = null,
+ public b: TestT|null = null,
+ public c: AbilityT|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ 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)
+ );
+}
+}
diff --git a/tests/ts/my-game/example/test-simple-table-with-enum.js b/tests/ts/my-game/example/test-simple-table-with-enum.js
new file mode 100644
index 0000000..3690fee
--- /dev/null
+++ b/tests/ts/my-game/example/test-simple-table-with-enum.js
@@ -0,0 +1,71 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { Color } from '../../my-game/example/color.js';
+export class TestSimpleTableWithEnum {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsTestSimpleTableWithEnum(bb, obj) {
+ return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsTestSimpleTableWithEnum(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ color() {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? this.bb.readUint8(this.bb_pos + offset) : Color.Green;
+ }
+ mutate_color(value) {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint8(this.bb_pos + offset, value);
+ return true;
+ }
+ static getFullyQualifiedName() {
+ return 'MyGame_Example_TestSimpleTableWithEnum';
+ }
+ static startTestSimpleTableWithEnum(builder) {
+ builder.startObject(1);
+ }
+ static addColor(builder, color) {
+ builder.addFieldInt8(0, color, Color.Green);
+ }
+ static endTestSimpleTableWithEnum(builder) {
+ const offset = builder.endObject();
+ return offset;
+ }
+ static createTestSimpleTableWithEnum(builder, color) {
+ TestSimpleTableWithEnum.startTestSimpleTableWithEnum(builder);
+ TestSimpleTableWithEnum.addColor(builder, color);
+ return TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder);
+ }
+ serialize() {
+ return this.bb.bytes();
+ }
+ static deserialize(buffer) {
+ return TestSimpleTableWithEnum.getRootAsTestSimpleTableWithEnum(new flatbuffers.ByteBuffer(buffer));
+ }
+ unpack() {
+ return new TestSimpleTableWithEnumT(this.color());
+ }
+ unpackTo(_o) {
+ _o.color = this.color();
+ }
+}
+export class TestSimpleTableWithEnumT {
+ constructor(color = Color.Green) {
+ this.color = color;
+ }
+ pack(builder) {
+ return TestSimpleTableWithEnum.createTestSimpleTableWithEnum(builder, this.color);
+ }
+}
diff --git a/tests/ts/my-game/example/test-simple-table-with-enum.ts b/tests/ts/my-game/example/test-simple-table-with-enum.ts
new file mode 100644
index 0000000..cfca00b
--- /dev/null
+++ b/tests/ts/my-game/example/test-simple-table-with-enum.ts
@@ -0,0 +1,96 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { Color } from '../../my-game/example/color.js';
+
+
+export class TestSimpleTableWithEnum {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):TestSimpleTableWithEnum {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsTestSimpleTableWithEnum(bb:flatbuffers.ByteBuffer, obj?:TestSimpleTableWithEnum):TestSimpleTableWithEnum {
+ return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsTestSimpleTableWithEnum(bb:flatbuffers.ByteBuffer, obj?:TestSimpleTableWithEnum):TestSimpleTableWithEnum {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+color():Color {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : Color.Green;
+}
+
+mutate_color(value:Color):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint8(this.bb_pos + offset, value);
+ return true;
+}
+
+static getFullyQualifiedName():string {
+ return 'MyGame_Example_TestSimpleTableWithEnum';
+}
+
+static startTestSimpleTableWithEnum(builder:flatbuffers.Builder) {
+ builder.startObject(1);
+}
+
+static addColor(builder:flatbuffers.Builder, color:Color) {
+ builder.addFieldInt8(0, color, Color.Green);
+}
+
+static endTestSimpleTableWithEnum(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createTestSimpleTableWithEnum(builder:flatbuffers.Builder, color:Color):flatbuffers.Offset {
+ TestSimpleTableWithEnum.startTestSimpleTableWithEnum(builder);
+ TestSimpleTableWithEnum.addColor(builder, color);
+ return TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder);
+}
+
+serialize():Uint8Array {
+ return this.bb!.bytes();
+}
+
+static deserialize(buffer: Uint8Array):TestSimpleTableWithEnum {
+ return TestSimpleTableWithEnum.getRootAsTestSimpleTableWithEnum(new flatbuffers.ByteBuffer(buffer))
+}
+
+unpack(): TestSimpleTableWithEnumT {
+ return new TestSimpleTableWithEnumT(
+ this.color()
+ );
+}
+
+
+unpackTo(_o: TestSimpleTableWithEnumT): void {
+ _o.color = this.color();
+}
+}
+
+export class TestSimpleTableWithEnumT {
+constructor(
+ public color: Color = Color.Green
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ return TestSimpleTableWithEnum.createTestSimpleTableWithEnum(builder,
+ this.color
+ );
+}
+}
diff --git a/tests/ts/my-game/example/test.js b/tests/ts/my-game/example/test.js
new file mode 100644
index 0000000..9c43619
--- /dev/null
+++ b/tests/ts/my-game/example/test.js
@@ -0,0 +1,55 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+export class Test {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ a() {
+ return this.bb.readInt16(this.bb_pos);
+ }
+ mutate_a(value) {
+ this.bb.writeInt16(this.bb_pos + 0, value);
+ return true;
+ }
+ b() {
+ return this.bb.readInt8(this.bb_pos + 2);
+ }
+ mutate_b(value) {
+ this.bb.writeInt8(this.bb_pos + 2, value);
+ return true;
+ }
+ static getFullyQualifiedName() {
+ return 'MyGame_Example_Test';
+ }
+ static sizeOf() {
+ return 4;
+ }
+ static createTest(builder, a, b) {
+ builder.prep(2, 4);
+ builder.pad(1);
+ builder.writeInt8(b);
+ builder.writeInt16(a);
+ return builder.offset();
+ }
+ unpack() {
+ return new TestT(this.a(), this.b());
+ }
+ unpackTo(_o) {
+ _o.a = this.a();
+ _o.b = this.b();
+ }
+}
+export class TestT {
+ constructor(a = 0, b = 0) {
+ this.a = a;
+ this.b = b;
+ }
+ pack(builder) {
+ return Test.createTest(builder, this.a, this.b);
+ }
+}
diff --git a/tests/ts/my-game/example/test.ts b/tests/ts/my-game/example/test.ts
new file mode 100644
index 0000000..b3d84ee
--- /dev/null
+++ b/tests/ts/my-game/example/test.ts
@@ -0,0 +1,78 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+
+export class Test {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Test {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+a():number {
+ return this.bb!.readInt16(this.bb_pos);
+}
+
+mutate_a(value:number):boolean {
+ this.bb!.writeInt16(this.bb_pos + 0, value);
+ return true;
+}
+
+b():number {
+ return this.bb!.readInt8(this.bb_pos + 2);
+}
+
+mutate_b(value:number):boolean {
+ this.bb!.writeInt8(this.bb_pos + 2, value);
+ return true;
+}
+
+static getFullyQualifiedName():string {
+ return 'MyGame_Example_Test';
+}
+
+static sizeOf():number {
+ return 4;
+}
+
+static createTest(builder:flatbuffers.Builder, a: number, b: number):flatbuffers.Offset {
+ builder.prep(2, 4);
+ builder.pad(1);
+ builder.writeInt8(b);
+ builder.writeInt16(a);
+ return builder.offset();
+}
+
+
+unpack(): TestT {
+ return new TestT(
+ this.a(),
+ this.b()
+ );
+}
+
+
+unpackTo(_o: TestT): void {
+ _o.a = this.a();
+ _o.b = this.b();
+}
+}
+
+export class TestT {
+constructor(
+ public a: number = 0,
+ public b: number = 0
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ return Test.createTest(builder,
+ this.a,
+ this.b
+ );
+}
+}
diff --git a/tests/ts/my-game/example/type-aliases.js b/tests/ts/my-game/example/type-aliases.js
new file mode 100644
index 0000000..a4b5f89
--- /dev/null
+++ b/tests/ts/my-game/example/type-aliases.js
@@ -0,0 +1,290 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+export class TypeAliases {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsTypeAliases(bb, obj) {
+ return (obj || new TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsTypeAliases(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ i8() {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? this.bb.readInt8(this.bb_pos + offset) : 0;
+ }
+ mutate_i8(value) {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, value);
+ return true;
+ }
+ u8() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
+ }
+ mutate_u8(value) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint8(this.bb_pos + offset, value);
+ return true;
+ }
+ i16() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
+ }
+ mutate_i16(value) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt16(this.bb_pos + offset, value);
+ return true;
+ }
+ u16() {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
+ }
+ mutate_u16(value) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint16(this.bb_pos + offset, value);
+ return true;
+ }
+ i32() {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+ }
+ mutate_i32(value) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ u32() {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
+ }
+ mutate_u32(value) {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint32(this.bb_pos + offset, value);
+ return true;
+ }
+ i64() {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
+ }
+ mutate_i64(value) {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt64(this.bb_pos + offset, value);
+ return true;
+ }
+ u64() {
+ const offset = this.bb.__offset(this.bb_pos, 18);
+ return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
+ }
+ mutate_u64(value) {
+ const offset = this.bb.__offset(this.bb_pos, 18);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint64(this.bb_pos + offset, value);
+ return true;
+ }
+ f32() {
+ const offset = this.bb.__offset(this.bb_pos, 20);
+ return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;
+ }
+ mutate_f32(value) {
+ const offset = this.bb.__offset(this.bb_pos, 20);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeFloat32(this.bb_pos + offset, value);
+ return true;
+ }
+ f64() {
+ const offset = this.bb.__offset(this.bb_pos, 22);
+ return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
+ }
+ mutate_f64(value) {
+ const offset = this.bb.__offset(this.bb_pos, 22);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeFloat64(this.bb_pos + offset, value);
+ return true;
+ }
+ v8(index) {
+ const offset = this.bb.__offset(this.bb_pos, 24);
+ return offset ? this.bb.readInt8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
+ }
+ v8Length() {
+ const offset = this.bb.__offset(this.bb_pos, 24);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ v8Array() {
+ const offset = this.bb.__offset(this.bb_pos, 24);
+ 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)) : null;
+ }
+ vf64(index) {
+ const offset = this.bb.__offset(this.bb_pos, 26);
+ return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
+ }
+ vf64Length() {
+ const offset = this.bb.__offset(this.bb_pos, 26);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ vf64Array() {
+ const offset = this.bb.__offset(this.bb_pos, 26);
+ return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
+ }
+ static getFullyQualifiedName() {
+ return 'MyGame_Example_TypeAliases';
+ }
+ static startTypeAliases(builder) {
+ builder.startObject(12);
+ }
+ static addI8(builder, i8) {
+ builder.addFieldInt8(0, i8, 0);
+ }
+ static addU8(builder, u8) {
+ builder.addFieldInt8(1, u8, 0);
+ }
+ static addI16(builder, i16) {
+ builder.addFieldInt16(2, i16, 0);
+ }
+ static addU16(builder, u16) {
+ builder.addFieldInt16(3, u16, 0);
+ }
+ static addI32(builder, i32) {
+ builder.addFieldInt32(4, i32, 0);
+ }
+ static addU32(builder, u32) {
+ builder.addFieldInt32(5, u32, 0);
+ }
+ static addI64(builder, i64) {
+ builder.addFieldInt64(6, i64, BigInt('0'));
+ }
+ static addU64(builder, u64) {
+ builder.addFieldInt64(7, u64, BigInt('0'));
+ }
+ static addF32(builder, f32) {
+ builder.addFieldFloat32(8, f32, 0.0);
+ }
+ static addF64(builder, f64) {
+ builder.addFieldFloat64(9, f64, 0.0);
+ }
+ static addV8(builder, v8Offset) {
+ builder.addFieldOffset(10, v8Offset, 0);
+ }
+ static createV8Vector(builder, data) {
+ builder.startVector(1, data.length, 1);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt8(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startV8Vector(builder, numElems) {
+ builder.startVector(1, numElems, 1);
+ }
+ static addVf64(builder, vf64Offset) {
+ builder.addFieldOffset(11, vf64Offset, 0);
+ }
+ static createVf64Vector(builder, data) {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addFloat64(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startVf64Vector(builder, numElems) {
+ builder.startVector(8, numElems, 8);
+ }
+ static endTypeAliases(builder) {
+ const offset = builder.endObject();
+ return offset;
+ }
+ static createTypeAliases(builder, i8, u8, i16, u16, i32, u32, i64, u64, f32, f64, v8Offset, vf64Offset) {
+ TypeAliases.startTypeAliases(builder);
+ TypeAliases.addI8(builder, i8);
+ TypeAliases.addU8(builder, u8);
+ TypeAliases.addI16(builder, i16);
+ TypeAliases.addU16(builder, u16);
+ TypeAliases.addI32(builder, i32);
+ TypeAliases.addU32(builder, u32);
+ TypeAliases.addI64(builder, i64);
+ TypeAliases.addU64(builder, u64);
+ TypeAliases.addF32(builder, f32);
+ TypeAliases.addF64(builder, f64);
+ TypeAliases.addV8(builder, v8Offset);
+ TypeAliases.addVf64(builder, vf64Offset);
+ return TypeAliases.endTypeAliases(builder);
+ }
+ serialize() {
+ return this.bb.bytes();
+ }
+ static deserialize(buffer) {
+ return TypeAliases.getRootAsTypeAliases(new flatbuffers.ByteBuffer(buffer));
+ }
+ unpack() {
+ return new TypeAliasesT(this.i8(), this.u8(), this.i16(), this.u16(), this.i32(), this.u32(), this.i64(), this.u64(), this.f32(), this.f64(), this.bb.createScalarList(this.v8.bind(this), this.v8Length()), this.bb.createScalarList(this.vf64.bind(this), this.vf64Length()));
+ }
+ unpackTo(_o) {
+ _o.i8 = this.i8();
+ _o.u8 = this.u8();
+ _o.i16 = this.i16();
+ _o.u16 = this.u16();
+ _o.i32 = this.i32();
+ _o.u32 = this.u32();
+ _o.i64 = this.i64();
+ _o.u64 = this.u64();
+ _o.f32 = this.f32();
+ _o.f64 = this.f64();
+ _o.v8 = this.bb.createScalarList(this.v8.bind(this), this.v8Length());
+ _o.vf64 = this.bb.createScalarList(this.vf64.bind(this), this.vf64Length());
+ }
+}
+export class TypeAliasesT {
+ constructor(i8 = 0, u8 = 0, i16 = 0, u16 = 0, i32 = 0, u32 = 0, i64 = BigInt('0'), u64 = BigInt('0'), f32 = 0.0, f64 = 0.0, v8 = [], vf64 = []) {
+ this.i8 = i8;
+ this.u8 = u8;
+ this.i16 = i16;
+ this.u16 = u16;
+ this.i32 = i32;
+ this.u32 = u32;
+ this.i64 = i64;
+ this.u64 = u64;
+ this.f32 = f32;
+ this.f64 = f64;
+ this.v8 = v8;
+ this.vf64 = vf64;
+ }
+ pack(builder) {
+ const v8 = TypeAliases.createV8Vector(builder, this.v8);
+ const vf64 = TypeAliases.createVf64Vector(builder, this.vf64);
+ return TypeAliases.createTypeAliases(builder, this.i8, this.u8, this.i16, this.u16, this.i32, this.u32, this.i64, this.u64, this.f32, this.f64, v8, vf64);
+ }
+}
diff --git a/tests/ts/my-game/example/type-aliases.ts b/tests/ts/my-game/example/type-aliases.ts
new file mode 100644
index 0000000..805c8cf
--- /dev/null
+++ b/tests/ts/my-game/example/type-aliases.ts
@@ -0,0 +1,405 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+
+export class TypeAliases {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):TypeAliases {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsTypeAliases(bb:flatbuffers.ByteBuffer, obj?:TypeAliases):TypeAliases {
+ return (obj || new TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsTypeAliases(bb:flatbuffers.ByteBuffer, obj?:TypeAliases):TypeAliases {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+i8():number {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? this.bb!.readInt8(this.bb_pos + offset) : 0;
+}
+
+mutate_i8(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, value);
+ return true;
+}
+
+u8():number {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : 0;
+}
+
+mutate_u8(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint8(this.bb_pos + offset, value);
+ return true;
+}
+
+i16():number {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0;
+}
+
+mutate_i16(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt16(this.bb_pos + offset, value);
+ return true;
+}
+
+u16():number {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+mutate_u16(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint16(this.bb_pos + offset, value);
+ return true;
+}
+
+i32():number {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_i32(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+u32():number {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
+}
+
+mutate_u32(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint32(this.bb_pos + offset, value);
+ return true;
+}
+
+i64():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_i64(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt64(this.bb_pos + offset, value);
+ return true;
+}
+
+u64():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 18);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_u64(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 18);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint64(this.bb_pos + offset, value);
+ return true;
+}
+
+f32():number {
+ const offset = this.bb!.__offset(this.bb_pos, 20);
+ return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
+}
+
+mutate_f32(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 20);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeFloat32(this.bb_pos + offset, value);
+ return true;
+}
+
+f64():number {
+ const offset = this.bb!.__offset(this.bb_pos, 22);
+ return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
+}
+
+mutate_f64(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 22);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeFloat64(this.bb_pos + offset, value);
+ return true;
+}
+
+v8(index: number):number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 24);
+ return offset ? this.bb!.readInt8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
+}
+
+v8Length():number {
+ const offset = this.bb!.__offset(this.bb_pos, 24);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+v8Array():Int8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 24);
+ 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)) : null;
+}
+
+vf64(index: number):number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 26);
+ return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0;
+}
+
+vf64Length():number {
+ const offset = this.bb!.__offset(this.bb_pos, 26);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+vf64Array():Float64Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 26);
+ return offset ? new Float64Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
+}
+
+static getFullyQualifiedName():string {
+ return 'MyGame_Example_TypeAliases';
+}
+
+static startTypeAliases(builder:flatbuffers.Builder) {
+ builder.startObject(12);
+}
+
+static addI8(builder:flatbuffers.Builder, i8:number) {
+ builder.addFieldInt8(0, i8, 0);
+}
+
+static addU8(builder:flatbuffers.Builder, u8:number) {
+ builder.addFieldInt8(1, u8, 0);
+}
+
+static addI16(builder:flatbuffers.Builder, i16:number) {
+ builder.addFieldInt16(2, i16, 0);
+}
+
+static addU16(builder:flatbuffers.Builder, u16:number) {
+ builder.addFieldInt16(3, u16, 0);
+}
+
+static addI32(builder:flatbuffers.Builder, i32:number) {
+ builder.addFieldInt32(4, i32, 0);
+}
+
+static addU32(builder:flatbuffers.Builder, u32:number) {
+ builder.addFieldInt32(5, u32, 0);
+}
+
+static addI64(builder:flatbuffers.Builder, i64:bigint) {
+ builder.addFieldInt64(6, i64, BigInt('0'));
+}
+
+static addU64(builder:flatbuffers.Builder, u64:bigint) {
+ builder.addFieldInt64(7, u64, BigInt('0'));
+}
+
+static addF32(builder:flatbuffers.Builder, f32:number) {
+ builder.addFieldFloat32(8, f32, 0.0);
+}
+
+static addF64(builder:flatbuffers.Builder, f64:number) {
+ builder.addFieldFloat64(9, f64, 0.0);
+}
+
+static addV8(builder:flatbuffers.Builder, v8Offset:flatbuffers.Offset) {
+ builder.addFieldOffset(10, v8Offset, 0);
+}
+
+static createV8Vector(builder:flatbuffers.Builder, data:number[]|Int8Array):flatbuffers.Offset;
+/**
+ * @deprecated This Uint8Array overload will be removed in the future.
+ */
+static createV8Vector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset;
+static createV8Vector(builder:flatbuffers.Builder, data:number[]|Int8Array|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 startV8Vector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(1, numElems, 1);
+}
+
+static addVf64(builder:flatbuffers.Builder, vf64Offset:flatbuffers.Offset) {
+ builder.addFieldOffset(11, vf64Offset, 0);
+}
+
+static createVf64Vector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset;
+/**
+ * @deprecated This Uint8Array overload will be removed in the future.
+ */
+static createVf64Vector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset;
+static createVf64Vector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addFloat64(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startVf64Vector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(8, numElems, 8);
+}
+
+static endTypeAliases(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createTypeAliases(builder:flatbuffers.Builder, i8:number, u8:number, i16:number, u16:number, i32:number, u32:number, i64:bigint, u64:bigint, f32:number, f64:number, v8Offset:flatbuffers.Offset, vf64Offset:flatbuffers.Offset):flatbuffers.Offset {
+ TypeAliases.startTypeAliases(builder);
+ TypeAliases.addI8(builder, i8);
+ TypeAliases.addU8(builder, u8);
+ TypeAliases.addI16(builder, i16);
+ TypeAliases.addU16(builder, u16);
+ TypeAliases.addI32(builder, i32);
+ TypeAliases.addU32(builder, u32);
+ TypeAliases.addI64(builder, i64);
+ TypeAliases.addU64(builder, u64);
+ TypeAliases.addF32(builder, f32);
+ TypeAliases.addF64(builder, f64);
+ TypeAliases.addV8(builder, v8Offset);
+ TypeAliases.addVf64(builder, vf64Offset);
+ return TypeAliases.endTypeAliases(builder);
+}
+
+serialize():Uint8Array {
+ return this.bb!.bytes();
+}
+
+static deserialize(buffer: Uint8Array):TypeAliases {
+ return TypeAliases.getRootAsTypeAliases(new flatbuffers.ByteBuffer(buffer))
+}
+
+unpack(): TypeAliasesT {
+ return new TypeAliasesT(
+ this.i8(),
+ this.u8(),
+ this.i16(),
+ this.u16(),
+ this.i32(),
+ this.u32(),
+ this.i64(),
+ this.u64(),
+ this.f32(),
+ this.f64(),
+ this.bb!.createScalarList(this.v8.bind(this), this.v8Length()),
+ this.bb!.createScalarList(this.vf64.bind(this), this.vf64Length())
+ );
+}
+
+
+unpackTo(_o: TypeAliasesT): void {
+ _o.i8 = this.i8();
+ _o.u8 = this.u8();
+ _o.i16 = this.i16();
+ _o.u16 = this.u16();
+ _o.i32 = this.i32();
+ _o.u32 = this.u32();
+ _o.i64 = this.i64();
+ _o.u64 = this.u64();
+ _o.f32 = this.f32();
+ _o.f64 = this.f64();
+ _o.v8 = this.bb!.createScalarList(this.v8.bind(this), this.v8Length());
+ _o.vf64 = this.bb!.createScalarList(this.vf64.bind(this), this.vf64Length());
+}
+}
+
+export class TypeAliasesT {
+constructor(
+ public i8: number = 0,
+ public u8: number = 0,
+ public i16: number = 0,
+ public u16: number = 0,
+ public i32: number = 0,
+ public u32: number = 0,
+ public i64: bigint = BigInt('0'),
+ public u64: bigint = BigInt('0'),
+ public f32: number = 0.0,
+ public f64: number = 0.0,
+ public v8: (number)[] = [],
+ public vf64: (number)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const v8 = TypeAliases.createV8Vector(builder, this.v8);
+ const vf64 = TypeAliases.createVf64Vector(builder, this.vf64);
+
+ return TypeAliases.createTypeAliases(builder,
+ this.i8,
+ this.u8,
+ this.i16,
+ this.u16,
+ this.i32,
+ this.u32,
+ this.i64,
+ this.u64,
+ this.f32,
+ this.f64,
+ v8,
+ vf64
+ );
+}
+}
diff --git a/tests/ts/my-game/example/vec3.js b/tests/ts/my-game/example/vec3.js
new file mode 100644
index 0000000..cae64eb
--- /dev/null
+++ b/tests/ts/my-game/example/vec3.js
@@ -0,0 +1,98 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import { Test } from '../../my-game/example/test.js';
+export class Vec3 {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ x() {
+ return this.bb.readFloat32(this.bb_pos);
+ }
+ mutate_x(value) {
+ this.bb.writeFloat32(this.bb_pos + 0, value);
+ return true;
+ }
+ y() {
+ return this.bb.readFloat32(this.bb_pos + 4);
+ }
+ mutate_y(value) {
+ this.bb.writeFloat32(this.bb_pos + 4, value);
+ return true;
+ }
+ z() {
+ return this.bb.readFloat32(this.bb_pos + 8);
+ }
+ mutate_z(value) {
+ this.bb.writeFloat32(this.bb_pos + 8, value);
+ return true;
+ }
+ test1() {
+ return this.bb.readFloat64(this.bb_pos + 16);
+ }
+ mutate_test1(value) {
+ this.bb.writeFloat64(this.bb_pos + 16, value);
+ return true;
+ }
+ test2() {
+ return this.bb.readUint8(this.bb_pos + 24);
+ }
+ mutate_test2(value) {
+ this.bb.writeUint8(this.bb_pos + 24, value);
+ return true;
+ }
+ test3(obj) {
+ return (obj || new Test()).__init(this.bb_pos + 26, this.bb);
+ }
+ static getFullyQualifiedName() {
+ return 'MyGame_Example_Vec3';
+ }
+ static sizeOf() {
+ return 32;
+ }
+ static createVec3(builder, x, y, z, test1, test2, test3_a, test3_b) {
+ builder.prep(8, 32);
+ builder.pad(2);
+ builder.prep(2, 4);
+ builder.pad(1);
+ builder.writeInt8(test3_b);
+ builder.writeInt16(test3_a);
+ builder.pad(1);
+ builder.writeInt8(test2);
+ builder.writeFloat64(test1);
+ builder.pad(4);
+ builder.writeFloat32(z);
+ builder.writeFloat32(y);
+ builder.writeFloat32(x);
+ return builder.offset();
+ }
+ unpack() {
+ return new Vec3T(this.x(), this.y(), this.z(), this.test1(), this.test2(), (this.test3() !== null ? this.test3().unpack() : null));
+ }
+ unpackTo(_o) {
+ _o.x = this.x();
+ _o.y = this.y();
+ _o.z = this.z();
+ _o.test1 = this.test1();
+ _o.test2 = this.test2();
+ _o.test3 = (this.test3() !== null ? this.test3().unpack() : null);
+ }
+}
+export class Vec3T {
+ constructor(x = 0.0, y = 0.0, z = 0.0, test1 = 0.0, test2 = 0, test3 = null) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.test1 = test1;
+ this.test2 = test2;
+ this.test3 = test3;
+ }
+ pack(builder) {
+ var _a, _b, _c, _d;
+ return Vec3.createVec3(builder, this.x, this.y, this.z, this.test1, this.test2, ((_b = (_a = this.test3) === null || _a === void 0 ? void 0 : _a.a) !== null && _b !== void 0 ? _b : 0), ((_d = (_c = this.test3) === null || _c === void 0 ? void 0 : _c.b) !== null && _d !== void 0 ? _d : 0));
+ }
+}
diff --git a/tests/ts/my-game/example/vec3.ts b/tests/ts/my-game/example/vec3.ts
new file mode 100644
index 0000000..bc4c473
--- /dev/null
+++ b/tests/ts/my-game/example/vec3.ts
@@ -0,0 +1,137 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { Color } from '../../my-game/example/color.js';
+import { Test, TestT } from '../../my-game/example/test.js';
+
+
+export class Vec3 {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Vec3 {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+x():number {
+ return this.bb!.readFloat32(this.bb_pos);
+}
+
+mutate_x(value:number):boolean {
+ this.bb!.writeFloat32(this.bb_pos + 0, value);
+ return true;
+}
+
+y():number {
+ return this.bb!.readFloat32(this.bb_pos + 4);
+}
+
+mutate_y(value:number):boolean {
+ this.bb!.writeFloat32(this.bb_pos + 4, value);
+ return true;
+}
+
+z():number {
+ return this.bb!.readFloat32(this.bb_pos + 8);
+}
+
+mutate_z(value:number):boolean {
+ this.bb!.writeFloat32(this.bb_pos + 8, value);
+ return true;
+}
+
+test1():number {
+ return this.bb!.readFloat64(this.bb_pos + 16);
+}
+
+mutate_test1(value:number):boolean {
+ this.bb!.writeFloat64(this.bb_pos + 16, value);
+ return true;
+}
+
+test2():Color {
+ return this.bb!.readUint8(this.bb_pos + 24);
+}
+
+mutate_test2(value:Color):boolean {
+ this.bb!.writeUint8(this.bb_pos + 24, value);
+ return true;
+}
+
+test3(obj?:Test):Test|null {
+ return (obj || new Test()).__init(this.bb_pos + 26, this.bb!);
+}
+
+static getFullyQualifiedName():string {
+ return 'MyGame_Example_Vec3';
+}
+
+static sizeOf():number {
+ return 32;
+}
+
+static createVec3(builder:flatbuffers.Builder, x: number, y: number, z: number, test1: number, test2: Color, test3_a: number, test3_b: number):flatbuffers.Offset {
+ builder.prep(8, 32);
+ builder.pad(2);
+ builder.prep(2, 4);
+ builder.pad(1);
+ builder.writeInt8(test3_b);
+ builder.writeInt16(test3_a);
+ builder.pad(1);
+ builder.writeInt8(test2);
+ builder.writeFloat64(test1);
+ builder.pad(4);
+ builder.writeFloat32(z);
+ builder.writeFloat32(y);
+ builder.writeFloat32(x);
+ return builder.offset();
+}
+
+
+unpack(): Vec3T {
+ return new Vec3T(
+ this.x(),
+ this.y(),
+ this.z(),
+ this.test1(),
+ this.test2(),
+ (this.test3() !== null ? this.test3()!.unpack() : null)
+ );
+}
+
+
+unpackTo(_o: Vec3T): void {
+ _o.x = this.x();
+ _o.y = this.y();
+ _o.z = this.z();
+ _o.test1 = this.test1();
+ _o.test2 = this.test2();
+ _o.test3 = (this.test3() !== null ? this.test3()!.unpack() : null);
+}
+}
+
+export class Vec3T {
+constructor(
+ public x: number = 0.0,
+ public y: number = 0.0,
+ public z: number = 0.0,
+ public test1: number = 0.0,
+ public test2: Color = 0,
+ public test3: TestT|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ return Vec3.createVec3(builder,
+ this.x,
+ this.y,
+ this.z,
+ this.test1,
+ this.test2,
+ (this.test3?.a ?? 0),
+ (this.test3?.b ?? 0)
+ );
+}
+}
diff --git a/tests/ts/my-game/example2/monster.js b/tests/ts/my-game/example2/monster.js
new file mode 100644
index 0000000..f50a2c8
--- /dev/null
+++ b/tests/ts/my-game/example2/monster.js
@@ -0,0 +1,50 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+export class Monster {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsMonster(bb, obj) {
+ return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsMonster(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getFullyQualifiedName() {
+ return 'MyGame_Example2_Monster';
+ }
+ static startMonster(builder) {
+ builder.startObject(0);
+ }
+ static endMonster(builder) {
+ const offset = builder.endObject();
+ return offset;
+ }
+ static createMonster(builder) {
+ Monster.startMonster(builder);
+ return Monster.endMonster(builder);
+ }
+ serialize() {
+ return this.bb.bytes();
+ }
+ static deserialize(buffer) {
+ return Monster.getRootAsMonster(new flatbuffers.ByteBuffer(buffer));
+ }
+ unpack() {
+ return new MonsterT();
+ }
+ unpackTo(_o) { }
+}
+export class MonsterT {
+ constructor() { }
+ pack(builder) {
+ return Monster.createMonster(builder);
+ }
+}
diff --git a/tests/ts/my-game/example2/monster.ts b/tests/ts/my-game/example2/monster.ts
new file mode 100644
index 0000000..7240476
--- /dev/null
+++ b/tests/ts/my-game/example2/monster.ts
@@ -0,0 +1,66 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+
+export class Monster {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Monster {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:Monster):Monster {
+ return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:Monster):Monster {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getFullyQualifiedName():string {
+ return 'MyGame_Example2_Monster';
+}
+
+static startMonster(builder:flatbuffers.Builder) {
+ builder.startObject(0);
+}
+
+static endMonster(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createMonster(builder:flatbuffers.Builder):flatbuffers.Offset {
+ Monster.startMonster(builder);
+ return Monster.endMonster(builder);
+}
+
+serialize():Uint8Array {
+ return this.bb!.bytes();
+}
+
+static deserialize(buffer: Uint8Array):Monster {
+ return Monster.getRootAsMonster(new flatbuffers.ByteBuffer(buffer))
+}
+
+unpack(): MonsterT {
+ return new MonsterT();
+}
+
+
+unpackTo(_o: MonsterT): void {}
+}
+
+export class MonsterT {
+constructor(){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ return Monster.createMonster(builder);
+}
+}
diff --git a/tests/ts/my-game/in-parent-namespace.js b/tests/ts/my-game/in-parent-namespace.js
new file mode 100644
index 0000000..24b0ed7
--- /dev/null
+++ b/tests/ts/my-game/in-parent-namespace.js
@@ -0,0 +1,50 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+export class InParentNamespace {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsInParentNamespace(bb, obj) {
+ return (obj || new InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsInParentNamespace(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getFullyQualifiedName() {
+ return 'MyGame_InParentNamespace';
+ }
+ static startInParentNamespace(builder) {
+ builder.startObject(0);
+ }
+ static endInParentNamespace(builder) {
+ const offset = builder.endObject();
+ return offset;
+ }
+ static createInParentNamespace(builder) {
+ InParentNamespace.startInParentNamespace(builder);
+ return InParentNamespace.endInParentNamespace(builder);
+ }
+ serialize() {
+ return this.bb.bytes();
+ }
+ static deserialize(buffer) {
+ return InParentNamespace.getRootAsInParentNamespace(new flatbuffers.ByteBuffer(buffer));
+ }
+ unpack() {
+ return new InParentNamespaceT();
+ }
+ unpackTo(_o) { }
+}
+export class InParentNamespaceT {
+ constructor() { }
+ pack(builder) {
+ return InParentNamespace.createInParentNamespace(builder);
+ }
+}
diff --git a/tests/ts/my-game/in-parent-namespace.ts b/tests/ts/my-game/in-parent-namespace.ts
new file mode 100644
index 0000000..0de94df
--- /dev/null
+++ b/tests/ts/my-game/in-parent-namespace.ts
@@ -0,0 +1,66 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+
+export class InParentNamespace {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):InParentNamespace {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsInParentNamespace(bb:flatbuffers.ByteBuffer, obj?:InParentNamespace):InParentNamespace {
+ return (obj || new InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsInParentNamespace(bb:flatbuffers.ByteBuffer, obj?:InParentNamespace):InParentNamespace {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getFullyQualifiedName():string {
+ return 'MyGame_InParentNamespace';
+}
+
+static startInParentNamespace(builder:flatbuffers.Builder) {
+ builder.startObject(0);
+}
+
+static endInParentNamespace(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createInParentNamespace(builder:flatbuffers.Builder):flatbuffers.Offset {
+ InParentNamespace.startInParentNamespace(builder);
+ return InParentNamespace.endInParentNamespace(builder);
+}
+
+serialize():Uint8Array {
+ return this.bb!.bytes();
+}
+
+static deserialize(buffer: Uint8Array):InParentNamespace {
+ return InParentNamespace.getRootAsInParentNamespace(new flatbuffers.ByteBuffer(buffer))
+}
+
+unpack(): InParentNamespaceT {
+ return new InParentNamespaceT();
+}
+
+
+unpackTo(_o: InParentNamespaceT): void {}
+}
+
+export class InParentNamespaceT {
+constructor(){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ return InParentNamespace.createInParentNamespace(builder);
+}
+}
diff --git a/tests/ts/optional-scalars/optional-byte.ts b/tests/ts/optional-scalars/optional-byte.ts
new file mode 100644
index 0000000..f4db265
--- /dev/null
+++ b/tests/ts/optional-scalars/optional-byte.ts
@@ -0,0 +1,7 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+export enum OptionalByte {
+ None = 0,
+ One = 1,
+ Two = 2
+}
diff --git a/tests/ts/optional-scalars/scalar-stuff.ts b/tests/ts/optional-scalars/scalar-stuff.ts
new file mode 100644
index 0000000..2adf31b
--- /dev/null
+++ b/tests/ts/optional-scalars/scalar-stuff.ts
@@ -0,0 +1,427 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { OptionalByte } from '../optional-scalars/optional-byte.js';
+
+
+export class ScalarStuff {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):ScalarStuff {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsScalarStuff(bb:flatbuffers.ByteBuffer, obj?:ScalarStuff):ScalarStuff {
+ return (obj || new ScalarStuff()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsScalarStuff(bb:flatbuffers.ByteBuffer, obj?:ScalarStuff):ScalarStuff {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new ScalarStuff()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
+ return bb.__has_identifier('NULL');
+}
+
+justI8():number {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? this.bb!.readInt8(this.bb_pos + offset) : 0;
+}
+
+maybeI8():number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.readInt8(this.bb_pos + offset) : null;
+}
+
+defaultI8():number {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.readInt8(this.bb_pos + offset) : 42;
+}
+
+justU8():number {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : 0;
+}
+
+maybeU8():number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : null;
+}
+
+defaultU8():number {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : 42;
+}
+
+justI16():number {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0;
+}
+
+maybeI16():number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 18);
+ return offset ? this.bb!.readInt16(this.bb_pos + offset) : null;
+}
+
+defaultI16():number {
+ const offset = this.bb!.__offset(this.bb_pos, 20);
+ return offset ? this.bb!.readInt16(this.bb_pos + offset) : 42;
+}
+
+justU16():number {
+ const offset = this.bb!.__offset(this.bb_pos, 22);
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+maybeU16():number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 24);
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : null;
+}
+
+defaultU16():number {
+ const offset = this.bb!.__offset(this.bb_pos, 26);
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : 42;
+}
+
+justI32():number {
+ const offset = this.bb!.__offset(this.bb_pos, 28);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+maybeI32():number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 30);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : null;
+}
+
+defaultI32():number {
+ const offset = this.bb!.__offset(this.bb_pos, 32);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 42;
+}
+
+justU32():number {
+ const offset = this.bb!.__offset(this.bb_pos, 34);
+ return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
+}
+
+maybeU32():number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 36);
+ return offset ? this.bb!.readUint32(this.bb_pos + offset) : null;
+}
+
+defaultU32():number {
+ const offset = this.bb!.__offset(this.bb_pos, 38);
+ return offset ? this.bb!.readUint32(this.bb_pos + offset) : 42;
+}
+
+justI64():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 40);
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
+}
+
+maybeI64():bigint|null {
+ const offset = this.bb!.__offset(this.bb_pos, 42);
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : null;
+}
+
+defaultI64():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 44);
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('42');
+}
+
+justU64():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 46);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+maybeU64():bigint|null {
+ const offset = this.bb!.__offset(this.bb_pos, 48);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : null;
+}
+
+defaultU64():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 50);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('42');
+}
+
+justF32():number {
+ const offset = this.bb!.__offset(this.bb_pos, 52);
+ return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
+}
+
+maybeF32():number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 54);
+ return offset ? this.bb!.readFloat32(this.bb_pos + offset) : null;
+}
+
+defaultF32():number {
+ const offset = this.bb!.__offset(this.bb_pos, 56);
+ return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 42.0;
+}
+
+justF64():number {
+ const offset = this.bb!.__offset(this.bb_pos, 58);
+ return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
+}
+
+maybeF64():number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 60);
+ return offset ? this.bb!.readFloat64(this.bb_pos + offset) : null;
+}
+
+defaultF64():number {
+ const offset = this.bb!.__offset(this.bb_pos, 62);
+ return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 42.0;
+}
+
+justBool():boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 64);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+maybeBool():boolean|null {
+ const offset = this.bb!.__offset(this.bb_pos, 66);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : null;
+}
+
+defaultBool():boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 68);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : true;
+}
+
+justEnum():OptionalByte {
+ const offset = this.bb!.__offset(this.bb_pos, 70);
+ return offset ? this.bb!.readInt8(this.bb_pos + offset) : OptionalByte.None;
+}
+
+maybeEnum():OptionalByte|null {
+ const offset = this.bb!.__offset(this.bb_pos, 72);
+ return offset ? this.bb!.readInt8(this.bb_pos + offset) : null;
+}
+
+defaultEnum():OptionalByte {
+ const offset = this.bb!.__offset(this.bb_pos, 74);
+ return offset ? this.bb!.readInt8(this.bb_pos + offset) : OptionalByte.One;
+}
+
+static getFullyQualifiedName():string {
+ return 'optional_scalars_ScalarStuff';
+}
+
+static startScalarStuff(builder:flatbuffers.Builder) {
+ builder.startObject(36);
+}
+
+static addJustI8(builder:flatbuffers.Builder, justI8:number) {
+ builder.addFieldInt8(0, justI8, 0);
+}
+
+static addMaybeI8(builder:flatbuffers.Builder, maybeI8:number) {
+ builder.addFieldInt8(1, maybeI8, 0);
+}
+
+static addDefaultI8(builder:flatbuffers.Builder, defaultI8:number) {
+ builder.addFieldInt8(2, defaultI8, 42);
+}
+
+static addJustU8(builder:flatbuffers.Builder, justU8:number) {
+ builder.addFieldInt8(3, justU8, 0);
+}
+
+static addMaybeU8(builder:flatbuffers.Builder, maybeU8:number) {
+ builder.addFieldInt8(4, maybeU8, 0);
+}
+
+static addDefaultU8(builder:flatbuffers.Builder, defaultU8:number) {
+ builder.addFieldInt8(5, defaultU8, 42);
+}
+
+static addJustI16(builder:flatbuffers.Builder, justI16:number) {
+ builder.addFieldInt16(6, justI16, 0);
+}
+
+static addMaybeI16(builder:flatbuffers.Builder, maybeI16:number) {
+ builder.addFieldInt16(7, maybeI16, 0);
+}
+
+static addDefaultI16(builder:flatbuffers.Builder, defaultI16:number) {
+ builder.addFieldInt16(8, defaultI16, 42);
+}
+
+static addJustU16(builder:flatbuffers.Builder, justU16:number) {
+ builder.addFieldInt16(9, justU16, 0);
+}
+
+static addMaybeU16(builder:flatbuffers.Builder, maybeU16:number) {
+ builder.addFieldInt16(10, maybeU16, 0);
+}
+
+static addDefaultU16(builder:flatbuffers.Builder, defaultU16:number) {
+ builder.addFieldInt16(11, defaultU16, 42);
+}
+
+static addJustI32(builder:flatbuffers.Builder, justI32:number) {
+ builder.addFieldInt32(12, justI32, 0);
+}
+
+static addMaybeI32(builder:flatbuffers.Builder, maybeI32:number) {
+ builder.addFieldInt32(13, maybeI32, 0);
+}
+
+static addDefaultI32(builder:flatbuffers.Builder, defaultI32:number) {
+ builder.addFieldInt32(14, defaultI32, 42);
+}
+
+static addJustU32(builder:flatbuffers.Builder, justU32:number) {
+ builder.addFieldInt32(15, justU32, 0);
+}
+
+static addMaybeU32(builder:flatbuffers.Builder, maybeU32:number) {
+ builder.addFieldInt32(16, maybeU32, 0);
+}
+
+static addDefaultU32(builder:flatbuffers.Builder, defaultU32:number) {
+ builder.addFieldInt32(17, defaultU32, 42);
+}
+
+static addJustI64(builder:flatbuffers.Builder, justI64:bigint) {
+ builder.addFieldInt64(18, justI64, BigInt('0'));
+}
+
+static addMaybeI64(builder:flatbuffers.Builder, maybeI64:bigint) {
+ builder.addFieldInt64(19, maybeI64, BigInt(0));
+}
+
+static addDefaultI64(builder:flatbuffers.Builder, defaultI64:bigint) {
+ builder.addFieldInt64(20, defaultI64, BigInt('42'));
+}
+
+static addJustU64(builder:flatbuffers.Builder, justU64:bigint) {
+ builder.addFieldInt64(21, justU64, BigInt('0'));
+}
+
+static addMaybeU64(builder:flatbuffers.Builder, maybeU64:bigint) {
+ builder.addFieldInt64(22, maybeU64, BigInt(0));
+}
+
+static addDefaultU64(builder:flatbuffers.Builder, defaultU64:bigint) {
+ builder.addFieldInt64(23, defaultU64, BigInt('42'));
+}
+
+static addJustF32(builder:flatbuffers.Builder, justF32:number) {
+ builder.addFieldFloat32(24, justF32, 0.0);
+}
+
+static addMaybeF32(builder:flatbuffers.Builder, maybeF32:number) {
+ builder.addFieldFloat32(25, maybeF32, 0);
+}
+
+static addDefaultF32(builder:flatbuffers.Builder, defaultF32:number) {
+ builder.addFieldFloat32(26, defaultF32, 42.0);
+}
+
+static addJustF64(builder:flatbuffers.Builder, justF64:number) {
+ builder.addFieldFloat64(27, justF64, 0.0);
+}
+
+static addMaybeF64(builder:flatbuffers.Builder, maybeF64:number) {
+ builder.addFieldFloat64(28, maybeF64, 0);
+}
+
+static addDefaultF64(builder:flatbuffers.Builder, defaultF64:number) {
+ builder.addFieldFloat64(29, defaultF64, 42.0);
+}
+
+static addJustBool(builder:flatbuffers.Builder, justBool:boolean) {
+ builder.addFieldInt8(30, +justBool, +false);
+}
+
+static addMaybeBool(builder:flatbuffers.Builder, maybeBool:boolean) {
+ builder.addFieldInt8(31, +maybeBool, 0);
+}
+
+static addDefaultBool(builder:flatbuffers.Builder, defaultBool:boolean) {
+ builder.addFieldInt8(32, +defaultBool, +true);
+}
+
+static addJustEnum(builder:flatbuffers.Builder, justEnum:OptionalByte) {
+ builder.addFieldInt8(33, justEnum, OptionalByte.None);
+}
+
+static addMaybeEnum(builder:flatbuffers.Builder, maybeEnum:OptionalByte) {
+ builder.addFieldInt8(34, maybeEnum, 0);
+}
+
+static addDefaultEnum(builder:flatbuffers.Builder, defaultEnum:OptionalByte) {
+ builder.addFieldInt8(35, defaultEnum, OptionalByte.One);
+}
+
+static endScalarStuff(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static finishScalarStuffBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
+ builder.finish(offset, 'NULL');
+}
+
+static finishSizePrefixedScalarStuffBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
+ builder.finish(offset, 'NULL', true);
+}
+
+static createScalarStuff(builder:flatbuffers.Builder, justI8:number, maybeI8:number|null, defaultI8:number, justU8:number, maybeU8:number|null, defaultU8:number, justI16:number, maybeI16:number|null, defaultI16:number, justU16:number, maybeU16:number|null, defaultU16:number, justI32:number, maybeI32:number|null, defaultI32:number, justU32:number, maybeU32:number|null, defaultU32:number, justI64:bigint, maybeI64:bigint|null, defaultI64:bigint, justU64:bigint, maybeU64:bigint|null, defaultU64:bigint, justF32:number, maybeF32:number|null, defaultF32:number, justF64:number, maybeF64:number|null, defaultF64:number, justBool:boolean, maybeBool:boolean|null, defaultBool:boolean, justEnum:OptionalByte, maybeEnum:OptionalByte|null, defaultEnum:OptionalByte):flatbuffers.Offset {
+ ScalarStuff.startScalarStuff(builder);
+ ScalarStuff.addJustI8(builder, justI8);
+ if (maybeI8 !== null)
+ ScalarStuff.addMaybeI8(builder, maybeI8);
+ ScalarStuff.addDefaultI8(builder, defaultI8);
+ ScalarStuff.addJustU8(builder, justU8);
+ if (maybeU8 !== null)
+ ScalarStuff.addMaybeU8(builder, maybeU8);
+ ScalarStuff.addDefaultU8(builder, defaultU8);
+ ScalarStuff.addJustI16(builder, justI16);
+ if (maybeI16 !== null)
+ ScalarStuff.addMaybeI16(builder, maybeI16);
+ ScalarStuff.addDefaultI16(builder, defaultI16);
+ ScalarStuff.addJustU16(builder, justU16);
+ if (maybeU16 !== null)
+ ScalarStuff.addMaybeU16(builder, maybeU16);
+ ScalarStuff.addDefaultU16(builder, defaultU16);
+ ScalarStuff.addJustI32(builder, justI32);
+ if (maybeI32 !== null)
+ ScalarStuff.addMaybeI32(builder, maybeI32);
+ ScalarStuff.addDefaultI32(builder, defaultI32);
+ ScalarStuff.addJustU32(builder, justU32);
+ if (maybeU32 !== null)
+ ScalarStuff.addMaybeU32(builder, maybeU32);
+ ScalarStuff.addDefaultU32(builder, defaultU32);
+ ScalarStuff.addJustI64(builder, justI64);
+ if (maybeI64 !== null)
+ ScalarStuff.addMaybeI64(builder, maybeI64);
+ ScalarStuff.addDefaultI64(builder, defaultI64);
+ ScalarStuff.addJustU64(builder, justU64);
+ if (maybeU64 !== null)
+ ScalarStuff.addMaybeU64(builder, maybeU64);
+ ScalarStuff.addDefaultU64(builder, defaultU64);
+ ScalarStuff.addJustF32(builder, justF32);
+ if (maybeF32 !== null)
+ ScalarStuff.addMaybeF32(builder, maybeF32);
+ ScalarStuff.addDefaultF32(builder, defaultF32);
+ ScalarStuff.addJustF64(builder, justF64);
+ if (maybeF64 !== null)
+ ScalarStuff.addMaybeF64(builder, maybeF64);
+ ScalarStuff.addDefaultF64(builder, defaultF64);
+ ScalarStuff.addJustBool(builder, justBool);
+ if (maybeBool !== null)
+ ScalarStuff.addMaybeBool(builder, maybeBool);
+ ScalarStuff.addDefaultBool(builder, defaultBool);
+ ScalarStuff.addJustEnum(builder, justEnum);
+ if (maybeEnum !== null)
+ ScalarStuff.addMaybeEnum(builder, maybeEnum);
+ ScalarStuff.addDefaultEnum(builder, defaultEnum);
+ return ScalarStuff.endScalarStuff(builder);
+}
+}
diff --git a/tests/optional_scalars.ts b/tests/ts/optional_scalars.ts
similarity index 100%
rename from tests/optional_scalars.ts
rename to tests/ts/optional_scalars.ts
diff --git a/tests/ts/optional_scalars_generated.ts b/tests/ts/optional_scalars_generated.ts
new file mode 100644
index 0000000..ebd3350
--- /dev/null
+++ b/tests/ts/optional_scalars_generated.ts
@@ -0,0 +1,4 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+export { OptionalByte } from './optional-scalars/optional-byte.js';
+export { ScalarStuff } from './optional-scalars/scalar-stuff.js';
diff --git a/tests/ts/package.json b/tests/ts/package.json
new file mode 100644
index 0000000..ac2639e
--- /dev/null
+++ b/tests/ts/package.json
@@ -0,0 +1,7 @@
+{
+ "type": "module",
+ "dependencies": {
+ "@grpc/grpc-js": "^1.7.0",
+ "flatbuffers": "../../"
+ }
+}
diff --git a/tests/ts/reflection/advanced-features.ts b/tests/ts/reflection/advanced-features.ts
new file mode 100644
index 0000000..dd3b865
--- /dev/null
+++ b/tests/ts/reflection/advanced-features.ts
@@ -0,0 +1,11 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+/**
+ * New schema language features that are not supported by old code generators.
+ */
+export enum AdvancedFeatures {
+ AdvancedArrayFeatures = '1',
+ AdvancedUnionFeatures = '2',
+ OptionalScalars = '4',
+ DefaultVectorsAndStrings = '8'
+}
diff --git a/tests/ts/reflection/base-type.js b/tests/ts/reflection/base-type.js
new file mode 100644
index 0000000..dccd0ac
--- /dev/null
+++ b/tests/ts/reflection/base-type.js
@@ -0,0 +1,23 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+export var BaseType;
+(function (BaseType) {
+ BaseType[BaseType["None"] = 0] = "None";
+ BaseType[BaseType["UType"] = 1] = "UType";
+ BaseType[BaseType["Bool"] = 2] = "Bool";
+ BaseType[BaseType["Byte"] = 3] = "Byte";
+ BaseType[BaseType["UByte"] = 4] = "UByte";
+ BaseType[BaseType["Short"] = 5] = "Short";
+ BaseType[BaseType["UShort"] = 6] = "UShort";
+ BaseType[BaseType["Int"] = 7] = "Int";
+ BaseType[BaseType["UInt"] = 8] = "UInt";
+ BaseType[BaseType["Long"] = 9] = "Long";
+ BaseType[BaseType["ULong"] = 10] = "ULong";
+ BaseType[BaseType["Float"] = 11] = "Float";
+ BaseType[BaseType["Double"] = 12] = "Double";
+ BaseType[BaseType["String"] = 13] = "String";
+ BaseType[BaseType["Vector"] = 14] = "Vector";
+ BaseType[BaseType["Obj"] = 15] = "Obj";
+ BaseType[BaseType["Union"] = 16] = "Union";
+ BaseType[BaseType["Array"] = 17] = "Array";
+ BaseType[BaseType["MaxBaseType"] = 18] = "MaxBaseType";
+})(BaseType || (BaseType = {}));
diff --git a/tests/ts/reflection/base-type.ts b/tests/ts/reflection/base-type.ts
new file mode 100644
index 0000000..7ee98ed
--- /dev/null
+++ b/tests/ts/reflection/base-type.ts
@@ -0,0 +1,23 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+export enum BaseType {
+ None = 0,
+ UType = 1,
+ Bool = 2,
+ Byte = 3,
+ UByte = 4,
+ Short = 5,
+ UShort = 6,
+ Int = 7,
+ UInt = 8,
+ Long = 9,
+ ULong = 10,
+ Float = 11,
+ Double = 12,
+ String = 13,
+ Vector = 14,
+ Obj = 15,
+ Union = 16,
+ Array = 17,
+ MaxBaseType = 18
+}
diff --git a/tests/ts/reflection/enum-val.js b/tests/ts/reflection/enum-val.js
new file mode 100644
index 0000000..f2ce03d
--- /dev/null
+++ b/tests/ts/reflection/enum-val.js
@@ -0,0 +1,110 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { Type } from '../reflection/type.js';
+export class EnumVal {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsEnumVal(bb, obj) {
+ return (obj || new EnumVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsEnumVal(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new EnumVal()).__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;
+ }
+ value() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
+ }
+ mutate_value(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;
+ }
+ unionType(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? (obj || new Type()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ documentation(index, optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+ }
+ documentationLength() {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_EnumVal';
+ }
+ static startEnumVal(builder) {
+ builder.startObject(5);
+ }
+ static addName(builder, nameOffset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+ }
+ static addValue(builder, value) {
+ builder.addFieldInt64(1, value, BigInt('0'));
+ }
+ static addUnionType(builder, unionTypeOffset) {
+ builder.addFieldOffset(3, unionTypeOffset, 0);
+ }
+ static addDocumentation(builder, documentationOffset) {
+ builder.addFieldOffset(4, documentationOffset, 0);
+ }
+ static createDocumentationVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startDocumentationVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static endEnumVal(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // name
+ return offset;
+ }
+ unpack() {
+ return new EnumValT(this.name(), this.value(), (this.unionType() !== null ? this.unionType().unpack() : null), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()));
+ }
+ unpackTo(_o) {
+ _o.name = this.name();
+ _o.value = this.value();
+ _o.unionType = (this.unionType() !== null ? this.unionType().unpack() : null);
+ _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
+ }
+}
+export class EnumValT {
+ constructor(name = null, value = BigInt('0'), unionType = null, documentation = []) {
+ this.name = name;
+ this.value = value;
+ this.unionType = unionType;
+ this.documentation = documentation;
+ }
+ pack(builder) {
+ const name = (this.name !== null ? builder.createString(this.name) : 0);
+ const unionType = (this.unionType !== null ? this.unionType.pack(builder) : 0);
+ const documentation = EnumVal.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ EnumVal.startEnumVal(builder);
+ EnumVal.addName(builder, name);
+ EnumVal.addValue(builder, this.value);
+ EnumVal.addUnionType(builder, unionType);
+ EnumVal.addDocumentation(builder, documentation);
+ return EnumVal.endEnumVal(builder);
+ }
+}
diff --git a/tests/ts/reflection/enum-val.ts b/tests/ts/reflection/enum-val.ts
new file mode 100644
index 0000000..8527832
--- /dev/null
+++ b/tests/ts/reflection/enum-val.ts
@@ -0,0 +1,149 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { Type, TypeT } from '../reflection/type.js';
+
+
+export class EnumVal {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):EnumVal {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsEnumVal(bb:flatbuffers.ByteBuffer, obj?:EnumVal):EnumVal {
+ return (obj || new EnumVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsEnumVal(bb:flatbuffers.ByteBuffer, obj?:EnumVal):EnumVal {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new EnumVal()).__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;
+}
+
+value():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_value(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt64(this.bb_pos + offset, value);
+ return true;
+}
+
+unionType(obj?:Type):Type|null {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? (obj || new Type()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_EnumVal';
+}
+
+static startEnumVal(builder:flatbuffers.Builder) {
+ builder.startObject(5);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addValue(builder:flatbuffers.Builder, value:bigint) {
+ builder.addFieldInt64(1, value, BigInt('0'));
+}
+
+static addUnionType(builder:flatbuffers.Builder, unionTypeOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(3, unionTypeOffset, 0);
+}
+
+static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(4, documentationOffset, 0);
+}
+
+static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static endEnumVal(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // name
+ return offset;
+}
+
+
+unpack(): EnumValT {
+ return new EnumValT(
+ this.name(),
+ this.value(),
+ (this.unionType() !== null ? this.unionType()!.unpack() : null),
+ this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength())
+ );
+}
+
+
+unpackTo(_o: EnumValT): void {
+ _o.name = this.name();
+ _o.value = this.value();
+ _o.unionType = (this.unionType() !== null ? this.unionType()!.unpack() : null);
+ _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+}
+}
+
+export class EnumValT {
+constructor(
+ public name: string|Uint8Array|null = null,
+ public value: bigint = BigInt('0'),
+ public unionType: TypeT|null = null,
+ public documentation: (string)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const name = (this.name !== null ? builder.createString(this.name!) : 0);
+ const unionType = (this.unionType !== null ? this.unionType!.pack(builder) : 0);
+ const documentation = EnumVal.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+
+ EnumVal.startEnumVal(builder);
+ EnumVal.addName(builder, name);
+ EnumVal.addValue(builder, this.value);
+ EnumVal.addUnionType(builder, unionType);
+ EnumVal.addDocumentation(builder, documentation);
+
+ return EnumVal.endEnumVal(builder);
+}
+}
diff --git a/tests/ts/reflection/enum.js b/tests/ts/reflection/enum.js
new file mode 100644
index 0000000..4939307
--- /dev/null
+++ b/tests/ts/reflection/enum.js
@@ -0,0 +1,175 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { EnumVal } from '../reflection/enum-val.js';
+import { KeyValue } from '../reflection/key-value.js';
+import { Type } from '../reflection/type.js';
+export class Enum {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsEnum(bb, obj) {
+ return (obj || new Enum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsEnum(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Enum()).__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;
+ }
+ values(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? (obj || new EnumVal()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ valuesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ isUnion() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+ }
+ mutate_is_union(value) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, +value);
+ return true;
+ }
+ underlyingType(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? (obj || new Type()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ attributes(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ attributesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ documentation(index, optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+ }
+ documentationLength() {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ declarationFile(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_Enum';
+ }
+ static startEnum(builder) {
+ builder.startObject(7);
+ }
+ static addName(builder, nameOffset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+ }
+ static addValues(builder, valuesOffset) {
+ builder.addFieldOffset(1, valuesOffset, 0);
+ }
+ static createValuesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startValuesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addIsUnion(builder, isUnion) {
+ builder.addFieldInt8(2, +isUnion, +false);
+ }
+ static addUnderlyingType(builder, underlyingTypeOffset) {
+ builder.addFieldOffset(3, underlyingTypeOffset, 0);
+ }
+ static addAttributes(builder, attributesOffset) {
+ builder.addFieldOffset(4, attributesOffset, 0);
+ }
+ static createAttributesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startAttributesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addDocumentation(builder, documentationOffset) {
+ builder.addFieldOffset(5, documentationOffset, 0);
+ }
+ static createDocumentationVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startDocumentationVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addDeclarationFile(builder, declarationFileOffset) {
+ builder.addFieldOffset(6, declarationFileOffset, 0);
+ }
+ static endEnum(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // name
+ builder.requiredField(offset, 6); // values
+ builder.requiredField(offset, 10); // underlying_type
+ return offset;
+ }
+ unpack() {
+ return new EnumT(this.name(), this.bb.createObjList(this.values.bind(this), this.valuesLength()), this.isUnion(), (this.underlyingType() !== null ? this.underlyingType().unpack() : null), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile());
+ }
+ unpackTo(_o) {
+ _o.name = this.name();
+ _o.values = this.bb.createObjList(this.values.bind(this), this.valuesLength());
+ _o.isUnion = this.isUnion();
+ _o.underlyingType = (this.underlyingType() !== null ? this.underlyingType().unpack() : null);
+ _o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
+ _o.declarationFile = this.declarationFile();
+ }
+}
+export class EnumT {
+ constructor(name = null, values = [], isUnion = false, underlyingType = null, attributes = [], documentation = [], declarationFile = null) {
+ this.name = name;
+ this.values = values;
+ this.isUnion = isUnion;
+ this.underlyingType = underlyingType;
+ this.attributes = attributes;
+ this.documentation = documentation;
+ this.declarationFile = declarationFile;
+ }
+ pack(builder) {
+ const name = (this.name !== null ? builder.createString(this.name) : 0);
+ const values = Enum.createValuesVector(builder, builder.createObjectOffsetList(this.values));
+ const underlyingType = (this.underlyingType !== null ? this.underlyingType.pack(builder) : 0);
+ const attributes = Enum.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = Enum.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile) : 0);
+ Enum.startEnum(builder);
+ Enum.addName(builder, name);
+ Enum.addValues(builder, values);
+ Enum.addIsUnion(builder, this.isUnion);
+ Enum.addUnderlyingType(builder, underlyingType);
+ Enum.addAttributes(builder, attributes);
+ Enum.addDocumentation(builder, documentation);
+ Enum.addDeclarationFile(builder, declarationFile);
+ return Enum.endEnum(builder);
+ }
+}
diff --git a/tests/ts/reflection/enum.ts b/tests/ts/reflection/enum.ts
new file mode 100644
index 0000000..7bba354
--- /dev/null
+++ b/tests/ts/reflection/enum.ts
@@ -0,0 +1,234 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { EnumVal, EnumValT } from '../reflection/enum-val.js';
+import { KeyValue, KeyValueT } from '../reflection/key-value.js';
+import { Type, TypeT } from '../reflection/type.js';
+
+
+export class Enum {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Enum {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsEnum(bb:flatbuffers.ByteBuffer, obj?:Enum):Enum {
+ return (obj || new Enum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsEnum(bb:flatbuffers.ByteBuffer, obj?:Enum):Enum {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Enum()).__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;
+}
+
+values(index: number, obj?:EnumVal):EnumVal|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? (obj || new EnumVal()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+valuesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+isUnion():boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_is_union(value:boolean):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, +value);
+ return true;
+}
+
+underlyingType(obj?:Type):Type|null {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? (obj || new Type()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+attributes(index: number, obj?:KeyValue):KeyValue|null {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+attributesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+/**
+ * File that this Enum is declared in.
+ */
+declarationFile():string|null
+declarationFile(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+declarationFile(optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_Enum';
+}
+
+static startEnum(builder:flatbuffers.Builder) {
+ builder.startObject(7);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addValues(builder:flatbuffers.Builder, valuesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, valuesOffset, 0);
+}
+
+static createValuesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startValuesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addIsUnion(builder:flatbuffers.Builder, isUnion:boolean) {
+ builder.addFieldInt8(2, +isUnion, +false);
+}
+
+static addUnderlyingType(builder:flatbuffers.Builder, underlyingTypeOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(3, underlyingTypeOffset, 0);
+}
+
+static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(4, attributesOffset, 0);
+}
+
+static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(5, documentationOffset, 0);
+}
+
+static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addDeclarationFile(builder:flatbuffers.Builder, declarationFileOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(6, declarationFileOffset, 0);
+}
+
+static endEnum(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // name
+ builder.requiredField(offset, 6) // values
+ builder.requiredField(offset, 10) // underlying_type
+ return offset;
+}
+
+
+unpack(): EnumT {
+ return new EnumT(
+ this.name(),
+ this.bb!.createObjList(this.values.bind(this), this.valuesLength()),
+ this.isUnion(),
+ (this.underlyingType() !== null ? this.underlyingType()!.unpack() : null),
+ this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
+ this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
+ this.declarationFile()
+ );
+}
+
+
+unpackTo(_o: EnumT): void {
+ _o.name = this.name();
+ _o.values = this.bb!.createObjList(this.values.bind(this), this.valuesLength());
+ _o.isUnion = this.isUnion();
+ _o.underlyingType = (this.underlyingType() !== null ? this.underlyingType()!.unpack() : null);
+ _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+ _o.declarationFile = this.declarationFile();
+}
+}
+
+export class EnumT {
+constructor(
+ public name: string|Uint8Array|null = null,
+ public values: (EnumValT)[] = [],
+ public isUnion: boolean = false,
+ public underlyingType: TypeT|null = null,
+ public attributes: (KeyValueT)[] = [],
+ public documentation: (string)[] = [],
+ public declarationFile: string|Uint8Array|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const name = (this.name !== null ? builder.createString(this.name!) : 0);
+ const values = Enum.createValuesVector(builder, builder.createObjectOffsetList(this.values));
+ const underlyingType = (this.underlyingType !== null ? this.underlyingType!.pack(builder) : 0);
+ const attributes = Enum.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = Enum.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile!) : 0);
+
+ Enum.startEnum(builder);
+ Enum.addName(builder, name);
+ Enum.addValues(builder, values);
+ Enum.addIsUnion(builder, this.isUnion);
+ Enum.addUnderlyingType(builder, underlyingType);
+ Enum.addAttributes(builder, attributes);
+ Enum.addDocumentation(builder, documentation);
+ Enum.addDeclarationFile(builder, declarationFile);
+
+ return Enum.endEnum(builder);
+}
+}
diff --git a/tests/ts/reflection/field.js b/tests/ts/reflection/field.js
new file mode 100644
index 0000000..107b77b
--- /dev/null
+++ b/tests/ts/reflection/field.js
@@ -0,0 +1,284 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { KeyValue } from '../reflection/key-value.js';
+import { Type } from '../reflection/type.js';
+export class Field {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsField(bb, obj) {
+ return (obj || new Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsField(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Field()).__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;
+ }
+ type(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? (obj || new Type()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ id() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
+ }
+ mutate_id(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;
+ }
+ offset() {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
+ }
+ mutate_offset(value) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint16(this.bb_pos + offset, value);
+ return true;
+ }
+ defaultInteger() {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
+ }
+ mutate_default_integer(value) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt64(this.bb_pos + offset, value);
+ return true;
+ }
+ defaultReal() {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
+ }
+ mutate_default_real(value) {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeFloat64(this.bb_pos + offset, value);
+ return true;
+ }
+ deprecated() {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+ }
+ mutate_deprecated(value) {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, +value);
+ return true;
+ }
+ required() {
+ const offset = this.bb.__offset(this.bb_pos, 18);
+ return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+ }
+ mutate_required(value) {
+ const offset = this.bb.__offset(this.bb_pos, 18);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, +value);
+ return true;
+ }
+ key() {
+ const offset = this.bb.__offset(this.bb_pos, 20);
+ return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+ }
+ mutate_key(value) {
+ const offset = this.bb.__offset(this.bb_pos, 20);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, +value);
+ return true;
+ }
+ attributes(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 22);
+ return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ attributesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 22);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ documentation(index, optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 24);
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+ }
+ documentationLength() {
+ const offset = this.bb.__offset(this.bb_pos, 24);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ optional() {
+ const offset = this.bb.__offset(this.bb_pos, 26);
+ return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+ }
+ mutate_optional(value) {
+ const offset = this.bb.__offset(this.bb_pos, 26);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, +value);
+ return true;
+ }
+ /**
+ * Number of padding octets to always add after this field. Structs only.
+ */
+ padding() {
+ const offset = this.bb.__offset(this.bb_pos, 28);
+ return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
+ }
+ mutate_padding(value) {
+ const offset = this.bb.__offset(this.bb_pos, 28);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint16(this.bb_pos + offset, value);
+ return true;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_Field';
+ }
+ static startField(builder) {
+ builder.startObject(13);
+ }
+ static addName(builder, nameOffset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+ }
+ static addType(builder, typeOffset) {
+ builder.addFieldOffset(1, typeOffset, 0);
+ }
+ static addId(builder, id) {
+ builder.addFieldInt16(2, id, 0);
+ }
+ static addOffset(builder, offset) {
+ builder.addFieldInt16(3, offset, 0);
+ }
+ static addDefaultInteger(builder, defaultInteger) {
+ builder.addFieldInt64(4, defaultInteger, BigInt('0'));
+ }
+ static addDefaultReal(builder, defaultReal) {
+ builder.addFieldFloat64(5, defaultReal, 0.0);
+ }
+ static addDeprecated(builder, deprecated) {
+ builder.addFieldInt8(6, +deprecated, +false);
+ }
+ static addRequired(builder, required) {
+ builder.addFieldInt8(7, +required, +false);
+ }
+ static addKey(builder, key) {
+ builder.addFieldInt8(8, +key, +false);
+ }
+ static addAttributes(builder, attributesOffset) {
+ builder.addFieldOffset(9, attributesOffset, 0);
+ }
+ static createAttributesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startAttributesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addDocumentation(builder, documentationOffset) {
+ builder.addFieldOffset(10, documentationOffset, 0);
+ }
+ static createDocumentationVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startDocumentationVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addOptional(builder, optional) {
+ builder.addFieldInt8(11, +optional, +false);
+ }
+ static addPadding(builder, padding) {
+ builder.addFieldInt16(12, padding, 0);
+ }
+ static endField(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // name
+ builder.requiredField(offset, 6); // type
+ return offset;
+ }
+ unpack() {
+ return new FieldT(this.name(), (this.type() !== null ? this.type().unpack() : null), this.id(), this.offset(), this.defaultInteger(), this.defaultReal(), this.deprecated(), this.required(), this.key(), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.optional(), this.padding());
+ }
+ unpackTo(_o) {
+ _o.name = this.name();
+ _o.type = (this.type() !== null ? this.type().unpack() : null);
+ _o.id = this.id();
+ _o.offset = this.offset();
+ _o.defaultInteger = this.defaultInteger();
+ _o.defaultReal = this.defaultReal();
+ _o.deprecated = this.deprecated();
+ _o.required = this.required();
+ _o.key = this.key();
+ _o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
+ _o.optional = this.optional();
+ _o.padding = this.padding();
+ }
+}
+export class FieldT {
+ constructor(name = null, type = null, id = 0, offset = 0, defaultInteger = BigInt('0'), defaultReal = 0.0, deprecated = false, required = false, key = false, attributes = [], documentation = [], optional = false, padding = 0) {
+ this.name = name;
+ this.type = type;
+ this.id = id;
+ this.offset = offset;
+ this.defaultInteger = defaultInteger;
+ this.defaultReal = defaultReal;
+ this.deprecated = deprecated;
+ this.required = required;
+ this.key = key;
+ this.attributes = attributes;
+ this.documentation = documentation;
+ this.optional = optional;
+ this.padding = padding;
+ }
+ pack(builder) {
+ const name = (this.name !== null ? builder.createString(this.name) : 0);
+ const type = (this.type !== null ? this.type.pack(builder) : 0);
+ const attributes = Field.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = Field.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ Field.startField(builder);
+ Field.addName(builder, name);
+ Field.addType(builder, type);
+ Field.addId(builder, this.id);
+ Field.addOffset(builder, this.offset);
+ Field.addDefaultInteger(builder, this.defaultInteger);
+ Field.addDefaultReal(builder, this.defaultReal);
+ Field.addDeprecated(builder, this.deprecated);
+ Field.addRequired(builder, this.required);
+ Field.addKey(builder, this.key);
+ Field.addAttributes(builder, attributes);
+ Field.addDocumentation(builder, documentation);
+ Field.addOptional(builder, this.optional);
+ Field.addPadding(builder, this.padding);
+ return Field.endField(builder);
+ }
+}
diff --git a/tests/ts/reflection/field.ts b/tests/ts/reflection/field.ts
new file mode 100644
index 0000000..48c1bed
--- /dev/null
+++ b/tests/ts/reflection/field.ts
@@ -0,0 +1,377 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { KeyValue, KeyValueT } from '../reflection/key-value.js';
+import { Type, TypeT } from '../reflection/type.js';
+
+
+export class Field {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Field {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsField(bb:flatbuffers.ByteBuffer, obj?:Field):Field {
+ return (obj || new Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsField(bb:flatbuffers.ByteBuffer, obj?:Field):Field {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Field()).__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;
+}
+
+type(obj?:Type):Type|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? (obj || new Type()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+id():number {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+mutate_id(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint16(this.bb_pos + offset, value);
+ return true;
+}
+
+offset():number {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+mutate_offset(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint16(this.bb_pos + offset, value);
+ return true;
+}
+
+defaultInteger():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_default_integer(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt64(this.bb_pos + offset, value);
+ return true;
+}
+
+defaultReal():number {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
+}
+
+mutate_default_real(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeFloat64(this.bb_pos + offset, value);
+ return true;
+}
+
+deprecated():boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_deprecated(value:boolean):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, +value);
+ return true;
+}
+
+required():boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 18);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_required(value:boolean):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 18);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, +value);
+ return true;
+}
+
+key():boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 20);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_key(value:boolean):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 20);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, +value);
+ return true;
+}
+
+attributes(index: number, obj?:KeyValue):KeyValue|null {
+ const offset = this.bb!.__offset(this.bb_pos, 22);
+ return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+attributesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 22);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 24);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 24);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+optional():boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 26);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_optional(value:boolean):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 26);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, +value);
+ return true;
+}
+
+/**
+ * Number of padding octets to always add after this field. Structs only.
+ */
+padding():number {
+ const offset = this.bb!.__offset(this.bb_pos, 28);
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+mutate_padding(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 28);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint16(this.bb_pos + offset, value);
+ return true;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_Field';
+}
+
+static startField(builder:flatbuffers.Builder) {
+ builder.startObject(13);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addType(builder:flatbuffers.Builder, typeOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, typeOffset, 0);
+}
+
+static addId(builder:flatbuffers.Builder, id:number) {
+ builder.addFieldInt16(2, id, 0);
+}
+
+static addOffset(builder:flatbuffers.Builder, offset:number) {
+ builder.addFieldInt16(3, offset, 0);
+}
+
+static addDefaultInteger(builder:flatbuffers.Builder, defaultInteger:bigint) {
+ builder.addFieldInt64(4, defaultInteger, BigInt('0'));
+}
+
+static addDefaultReal(builder:flatbuffers.Builder, defaultReal:number) {
+ builder.addFieldFloat64(5, defaultReal, 0.0);
+}
+
+static addDeprecated(builder:flatbuffers.Builder, deprecated:boolean) {
+ builder.addFieldInt8(6, +deprecated, +false);
+}
+
+static addRequired(builder:flatbuffers.Builder, required:boolean) {
+ builder.addFieldInt8(7, +required, +false);
+}
+
+static addKey(builder:flatbuffers.Builder, key:boolean) {
+ builder.addFieldInt8(8, +key, +false);
+}
+
+static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(9, attributesOffset, 0);
+}
+
+static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(10, documentationOffset, 0);
+}
+
+static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addOptional(builder:flatbuffers.Builder, optional:boolean) {
+ builder.addFieldInt8(11, +optional, +false);
+}
+
+static addPadding(builder:flatbuffers.Builder, padding:number) {
+ builder.addFieldInt16(12, padding, 0);
+}
+
+static endField(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // name
+ builder.requiredField(offset, 6) // type
+ return offset;
+}
+
+
+unpack(): FieldT {
+ return new FieldT(
+ this.name(),
+ (this.type() !== null ? this.type()!.unpack() : null),
+ this.id(),
+ this.offset(),
+ this.defaultInteger(),
+ this.defaultReal(),
+ this.deprecated(),
+ this.required(),
+ this.key(),
+ this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
+ this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
+ this.optional(),
+ this.padding()
+ );
+}
+
+
+unpackTo(_o: FieldT): void {
+ _o.name = this.name();
+ _o.type = (this.type() !== null ? this.type()!.unpack() : null);
+ _o.id = this.id();
+ _o.offset = this.offset();
+ _o.defaultInteger = this.defaultInteger();
+ _o.defaultReal = this.defaultReal();
+ _o.deprecated = this.deprecated();
+ _o.required = this.required();
+ _o.key = this.key();
+ _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+ _o.optional = this.optional();
+ _o.padding = this.padding();
+}
+}
+
+export class FieldT {
+constructor(
+ public name: string|Uint8Array|null = null,
+ public type: TypeT|null = null,
+ public id: number = 0,
+ public offset: number = 0,
+ public defaultInteger: bigint = BigInt('0'),
+ public defaultReal: number = 0.0,
+ public deprecated: boolean = false,
+ public required: boolean = false,
+ public key: boolean = false,
+ public attributes: (KeyValueT)[] = [],
+ public documentation: (string)[] = [],
+ public optional: boolean = false,
+ public padding: number = 0
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const name = (this.name !== null ? builder.createString(this.name!) : 0);
+ const type = (this.type !== null ? this.type!.pack(builder) : 0);
+ const attributes = Field.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = Field.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+
+ Field.startField(builder);
+ Field.addName(builder, name);
+ Field.addType(builder, type);
+ Field.addId(builder, this.id);
+ Field.addOffset(builder, this.offset);
+ Field.addDefaultInteger(builder, this.defaultInteger);
+ Field.addDefaultReal(builder, this.defaultReal);
+ Field.addDeprecated(builder, this.deprecated);
+ Field.addRequired(builder, this.required);
+ Field.addKey(builder, this.key);
+ Field.addAttributes(builder, attributes);
+ Field.addDocumentation(builder, documentation);
+ Field.addOptional(builder, this.optional);
+ Field.addPadding(builder, this.padding);
+
+ return Field.endField(builder);
+}
+}
diff --git a/tests/ts/reflection/key-value.js b/tests/ts/reflection/key-value.js
new file mode 100644
index 0000000..622b4f2
--- /dev/null
+++ b/tests/ts/reflection/key-value.js
@@ -0,0 +1,69 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+export class KeyValue {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsKeyValue(bb, obj) {
+ return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsKeyValue(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ key(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ value(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_KeyValue';
+ }
+ static startKeyValue(builder) {
+ builder.startObject(2);
+ }
+ static addKey(builder, keyOffset) {
+ builder.addFieldOffset(0, keyOffset, 0);
+ }
+ static addValue(builder, valueOffset) {
+ builder.addFieldOffset(1, valueOffset, 0);
+ }
+ static endKeyValue(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // key
+ return offset;
+ }
+ static createKeyValue(builder, keyOffset, valueOffset) {
+ KeyValue.startKeyValue(builder);
+ KeyValue.addKey(builder, keyOffset);
+ KeyValue.addValue(builder, valueOffset);
+ return KeyValue.endKeyValue(builder);
+ }
+ unpack() {
+ return new KeyValueT(this.key(), this.value());
+ }
+ unpackTo(_o) {
+ _o.key = this.key();
+ _o.value = this.value();
+ }
+}
+export class KeyValueT {
+ constructor(key = null, value = null) {
+ this.key = key;
+ this.value = value;
+ }
+ pack(builder) {
+ const key = (this.key !== null ? builder.createString(this.key) : 0);
+ const value = (this.value !== null ? builder.createString(this.value) : 0);
+ return KeyValue.createKeyValue(builder, key, value);
+ }
+}
diff --git a/tests/ts/reflection/key-value.ts b/tests/ts/reflection/key-value.ts
new file mode 100644
index 0000000..736766b
--- /dev/null
+++ b/tests/ts/reflection/key-value.ts
@@ -0,0 +1,98 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+
+export class KeyValue {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):KeyValue {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsKeyValue(bb:flatbuffers.ByteBuffer, obj?:KeyValue):KeyValue {
+ return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsKeyValue(bb:flatbuffers.ByteBuffer, obj?:KeyValue):KeyValue {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+key():string|null
+key(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+key(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;
+}
+
+value():string|null
+value(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+value(optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_KeyValue';
+}
+
+static startKeyValue(builder:flatbuffers.Builder) {
+ builder.startObject(2);
+}
+
+static addKey(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, keyOffset, 0);
+}
+
+static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, valueOffset, 0);
+}
+
+static endKeyValue(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // key
+ return offset;
+}
+
+static createKeyValue(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset, valueOffset:flatbuffers.Offset):flatbuffers.Offset {
+ KeyValue.startKeyValue(builder);
+ KeyValue.addKey(builder, keyOffset);
+ KeyValue.addValue(builder, valueOffset);
+ return KeyValue.endKeyValue(builder);
+}
+
+unpack(): KeyValueT {
+ return new KeyValueT(
+ this.key(),
+ this.value()
+ );
+}
+
+
+unpackTo(_o: KeyValueT): void {
+ _o.key = this.key();
+ _o.value = this.value();
+}
+}
+
+export class KeyValueT {
+constructor(
+ public key: string|Uint8Array|null = null,
+ public value: string|Uint8Array|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const key = (this.key !== null ? builder.createString(this.key!) : 0);
+ const value = (this.value !== null ? builder.createString(this.value!) : 0);
+
+ return KeyValue.createKeyValue(builder,
+ key,
+ value
+ );
+}
+}
diff --git a/tests/ts/reflection/object.js b/tests/ts/reflection/object.js
new file mode 100644
index 0000000..d288545
--- /dev/null
+++ b/tests/ts/reflection/object.js
@@ -0,0 +1,201 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { Field } from '../reflection/field.js';
+import { KeyValue } from '../reflection/key-value.js';
+export class Object_ {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsObject(bb, obj) {
+ return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsObject(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Object_()).__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;
+ }
+ fields(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? (obj || new Field()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ fieldsLength() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ isStruct() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+ }
+ mutate_is_struct(value) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, +value);
+ return true;
+ }
+ minalign() {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+ }
+ mutate_minalign(value) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ bytesize() {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+ }
+ mutate_bytesize(value) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ attributes(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ attributesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ documentation(index, optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+ }
+ documentationLength() {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ declarationFile(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 18);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_Object';
+ }
+ static startObject(builder) {
+ builder.startObject(8);
+ }
+ static addName(builder, nameOffset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+ }
+ static addFields(builder, fieldsOffset) {
+ builder.addFieldOffset(1, fieldsOffset, 0);
+ }
+ static createFieldsVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startFieldsVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addIsStruct(builder, isStruct) {
+ builder.addFieldInt8(2, +isStruct, +false);
+ }
+ static addMinalign(builder, minalign) {
+ builder.addFieldInt32(3, minalign, 0);
+ }
+ static addBytesize(builder, bytesize) {
+ builder.addFieldInt32(4, bytesize, 0);
+ }
+ static addAttributes(builder, attributesOffset) {
+ builder.addFieldOffset(5, attributesOffset, 0);
+ }
+ static createAttributesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startAttributesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addDocumentation(builder, documentationOffset) {
+ builder.addFieldOffset(6, documentationOffset, 0);
+ }
+ static createDocumentationVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startDocumentationVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addDeclarationFile(builder, declarationFileOffset) {
+ builder.addFieldOffset(7, declarationFileOffset, 0);
+ }
+ static endObject(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // name
+ builder.requiredField(offset, 6); // fields
+ return offset;
+ }
+ static createObject(builder, nameOffset, fieldsOffset, isStruct, minalign, bytesize, attributesOffset, documentationOffset, declarationFileOffset) {
+ Object_.startObject(builder);
+ Object_.addName(builder, nameOffset);
+ Object_.addFields(builder, fieldsOffset);
+ Object_.addIsStruct(builder, isStruct);
+ Object_.addMinalign(builder, minalign);
+ Object_.addBytesize(builder, bytesize);
+ Object_.addAttributes(builder, attributesOffset);
+ Object_.addDocumentation(builder, documentationOffset);
+ Object_.addDeclarationFile(builder, declarationFileOffset);
+ return Object_.endObject(builder);
+ }
+ unpack() {
+ return new Object_T(this.name(), this.bb.createObjList(this.fields.bind(this), this.fieldsLength()), this.isStruct(), this.minalign(), this.bytesize(), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile());
+ }
+ unpackTo(_o) {
+ _o.name = this.name();
+ _o.fields = this.bb.createObjList(this.fields.bind(this), this.fieldsLength());
+ _o.isStruct = this.isStruct();
+ _o.minalign = this.minalign();
+ _o.bytesize = this.bytesize();
+ _o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
+ _o.declarationFile = this.declarationFile();
+ }
+}
+export class Object_T {
+ constructor(name = null, fields = [], isStruct = false, minalign = 0, bytesize = 0, attributes = [], documentation = [], declarationFile = null) {
+ this.name = name;
+ this.fields = fields;
+ this.isStruct = isStruct;
+ this.minalign = minalign;
+ this.bytesize = bytesize;
+ this.attributes = attributes;
+ this.documentation = documentation;
+ this.declarationFile = declarationFile;
+ }
+ pack(builder) {
+ const name = (this.name !== null ? builder.createString(this.name) : 0);
+ const fields = Object_.createFieldsVector(builder, builder.createObjectOffsetList(this.fields));
+ const attributes = Object_.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = Object_.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile) : 0);
+ return Object_.createObject(builder, name, fields, this.isStruct, this.minalign, this.bytesize, attributes, documentation, declarationFile);
+ }
+}
diff --git a/tests/ts/reflection/object.ts b/tests/ts/reflection/object.ts
new file mode 100644
index 0000000..1e14f03
--- /dev/null
+++ b/tests/ts/reflection/object.ts
@@ -0,0 +1,277 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { Field, FieldT } from '../reflection/field.js';
+import { KeyValue, KeyValueT } from '../reflection/key-value.js';
+
+
+export class Object_ {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Object_ {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsObject(bb:flatbuffers.ByteBuffer, obj?:Object_):Object_ {
+ return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsObject(bb:flatbuffers.ByteBuffer, obj?:Object_):Object_ {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Object_()).__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;
+}
+
+fields(index: number, obj?:Field):Field|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? (obj || new Field()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+fieldsLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+isStruct():boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_is_struct(value:boolean):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, +value);
+ return true;
+}
+
+minalign():number {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_minalign(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+bytesize():number {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_bytesize(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+attributes(index: number, obj?:KeyValue):KeyValue|null {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+attributesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+/**
+ * File that this Object is declared in.
+ */
+declarationFile():string|null
+declarationFile(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+declarationFile(optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 18);
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_Object';
+}
+
+static startObject(builder:flatbuffers.Builder) {
+ builder.startObject(8);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addFields(builder:flatbuffers.Builder, fieldsOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, fieldsOffset, 0);
+}
+
+static createFieldsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startFieldsVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addIsStruct(builder:flatbuffers.Builder, isStruct:boolean) {
+ builder.addFieldInt8(2, +isStruct, +false);
+}
+
+static addMinalign(builder:flatbuffers.Builder, minalign:number) {
+ builder.addFieldInt32(3, minalign, 0);
+}
+
+static addBytesize(builder:flatbuffers.Builder, bytesize:number) {
+ builder.addFieldInt32(4, bytesize, 0);
+}
+
+static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(5, attributesOffset, 0);
+}
+
+static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(6, documentationOffset, 0);
+}
+
+static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addDeclarationFile(builder:flatbuffers.Builder, declarationFileOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(7, declarationFileOffset, 0);
+}
+
+static endObject(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // name
+ builder.requiredField(offset, 6) // fields
+ return offset;
+}
+
+static createObject(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, fieldsOffset:flatbuffers.Offset, isStruct:boolean, minalign:number, bytesize:number, attributesOffset:flatbuffers.Offset, documentationOffset:flatbuffers.Offset, declarationFileOffset:flatbuffers.Offset):flatbuffers.Offset {
+ Object_.startObject(builder);
+ Object_.addName(builder, nameOffset);
+ Object_.addFields(builder, fieldsOffset);
+ Object_.addIsStruct(builder, isStruct);
+ Object_.addMinalign(builder, minalign);
+ Object_.addBytesize(builder, bytesize);
+ Object_.addAttributes(builder, attributesOffset);
+ Object_.addDocumentation(builder, documentationOffset);
+ Object_.addDeclarationFile(builder, declarationFileOffset);
+ return Object_.endObject(builder);
+}
+
+unpack(): Object_T {
+ return new Object_T(
+ this.name(),
+ this.bb!.createObjList(this.fields.bind(this), this.fieldsLength()),
+ this.isStruct(),
+ this.minalign(),
+ this.bytesize(),
+ this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
+ this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
+ this.declarationFile()
+ );
+}
+
+
+unpackTo(_o: Object_T): void {
+ _o.name = this.name();
+ _o.fields = this.bb!.createObjList(this.fields.bind(this), this.fieldsLength());
+ _o.isStruct = this.isStruct();
+ _o.minalign = this.minalign();
+ _o.bytesize = this.bytesize();
+ _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+ _o.declarationFile = this.declarationFile();
+}
+}
+
+export class Object_T {
+constructor(
+ public name: string|Uint8Array|null = null,
+ public fields: (FieldT)[] = [],
+ public isStruct: boolean = false,
+ public minalign: number = 0,
+ public bytesize: number = 0,
+ public attributes: (KeyValueT)[] = [],
+ public documentation: (string)[] = [],
+ public declarationFile: string|Uint8Array|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const name = (this.name !== null ? builder.createString(this.name!) : 0);
+ const fields = Object_.createFieldsVector(builder, builder.createObjectOffsetList(this.fields));
+ const attributes = Object_.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = Object_.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile!) : 0);
+
+ return Object_.createObject(builder,
+ name,
+ fields,
+ this.isStruct,
+ this.minalign,
+ this.bytesize,
+ attributes,
+ documentation,
+ declarationFile
+ );
+}
+}
diff --git a/tests/ts/reflection/rpccall.js b/tests/ts/reflection/rpccall.js
new file mode 100644
index 0000000..96e92eb
--- /dev/null
+++ b/tests/ts/reflection/rpccall.js
@@ -0,0 +1,131 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { KeyValue } from '../reflection/key-value.js';
+import { Object_ } from '../reflection/object.js';
+export class RPCCall {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsRPCCall(bb, obj) {
+ return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsRPCCall(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new RPCCall()).__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;
+ }
+ request(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ response(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ attributes(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ attributesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ documentation(index, optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+ }
+ documentationLength() {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_RPCCall';
+ }
+ static startRPCCall(builder) {
+ builder.startObject(5);
+ }
+ static addName(builder, nameOffset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+ }
+ static addRequest(builder, requestOffset) {
+ builder.addFieldOffset(1, requestOffset, 0);
+ }
+ static addResponse(builder, responseOffset) {
+ builder.addFieldOffset(2, responseOffset, 0);
+ }
+ static addAttributes(builder, attributesOffset) {
+ builder.addFieldOffset(3, attributesOffset, 0);
+ }
+ static createAttributesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startAttributesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addDocumentation(builder, documentationOffset) {
+ builder.addFieldOffset(4, documentationOffset, 0);
+ }
+ static createDocumentationVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startDocumentationVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static endRPCCall(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // name
+ builder.requiredField(offset, 6); // request
+ builder.requiredField(offset, 8); // response
+ return offset;
+ }
+ unpack() {
+ return new RPCCallT(this.name(), (this.request() !== null ? this.request().unpack() : null), (this.response() !== null ? this.response().unpack() : null), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()));
+ }
+ unpackTo(_o) {
+ _o.name = this.name();
+ _o.request = (this.request() !== null ? this.request().unpack() : null);
+ _o.response = (this.response() !== null ? this.response().unpack() : null);
+ _o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
+ }
+}
+export class RPCCallT {
+ constructor(name = null, request = null, response = null, attributes = [], documentation = []) {
+ this.name = name;
+ this.request = request;
+ this.response = response;
+ this.attributes = attributes;
+ this.documentation = documentation;
+ }
+ pack(builder) {
+ const name = (this.name !== null ? builder.createString(this.name) : 0);
+ const request = (this.request !== null ? this.request.pack(builder) : 0);
+ const response = (this.response !== null ? this.response.pack(builder) : 0);
+ const attributes = RPCCall.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = RPCCall.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ RPCCall.startRPCCall(builder);
+ RPCCall.addName(builder, name);
+ RPCCall.addRequest(builder, request);
+ RPCCall.addResponse(builder, response);
+ RPCCall.addAttributes(builder, attributes);
+ RPCCall.addDocumentation(builder, documentation);
+ return RPCCall.endRPCCall(builder);
+ }
+}
diff --git a/tests/ts/reflection/rpccall.ts b/tests/ts/reflection/rpccall.ts
new file mode 100644
index 0000000..151d7b1
--- /dev/null
+++ b/tests/ts/reflection/rpccall.ts
@@ -0,0 +1,173 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { KeyValue, KeyValueT } from '../reflection/key-value.js';
+import { Object_, Object_T } from '../reflection/object.js';
+
+
+export class RPCCall {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):RPCCall {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsRPCCall(bb:flatbuffers.ByteBuffer, obj?:RPCCall):RPCCall {
+ return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsRPCCall(bb:flatbuffers.ByteBuffer, obj?:RPCCall):RPCCall {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new RPCCall()).__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;
+}
+
+request(obj?:Object_):Object_|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+response(obj?:Object_):Object_|null {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+attributes(index: number, obj?:KeyValue):KeyValue|null {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+attributesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_RPCCall';
+}
+
+static startRPCCall(builder:flatbuffers.Builder) {
+ builder.startObject(5);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addRequest(builder:flatbuffers.Builder, requestOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, requestOffset, 0);
+}
+
+static addResponse(builder:flatbuffers.Builder, responseOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(2, responseOffset, 0);
+}
+
+static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(3, attributesOffset, 0);
+}
+
+static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(4, documentationOffset, 0);
+}
+
+static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static endRPCCall(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // name
+ builder.requiredField(offset, 6) // request
+ builder.requiredField(offset, 8) // response
+ return offset;
+}
+
+
+unpack(): RPCCallT {
+ return new RPCCallT(
+ this.name(),
+ (this.request() !== null ? this.request()!.unpack() : null),
+ (this.response() !== null ? this.response()!.unpack() : null),
+ this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
+ this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength())
+ );
+}
+
+
+unpackTo(_o: RPCCallT): void {
+ _o.name = this.name();
+ _o.request = (this.request() !== null ? this.request()!.unpack() : null);
+ _o.response = (this.response() !== null ? this.response()!.unpack() : null);
+ _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+}
+}
+
+export class RPCCallT {
+constructor(
+ public name: string|Uint8Array|null = null,
+ public request: Object_T|null = null,
+ public response: Object_T|null = null,
+ public attributes: (KeyValueT)[] = [],
+ public documentation: (string)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const name = (this.name !== null ? builder.createString(this.name!) : 0);
+ const request = (this.request !== null ? this.request!.pack(builder) : 0);
+ const response = (this.response !== null ? this.response!.pack(builder) : 0);
+ const attributes = RPCCall.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = RPCCall.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+
+ RPCCall.startRPCCall(builder);
+ RPCCall.addName(builder, name);
+ RPCCall.addRequest(builder, request);
+ RPCCall.addResponse(builder, response);
+ RPCCall.addAttributes(builder, attributes);
+ RPCCall.addDocumentation(builder, documentation);
+
+ return RPCCall.endRPCCall(builder);
+}
+}
diff --git a/tests/ts/reflection/schema-file.js b/tests/ts/reflection/schema-file.js
new file mode 100644
index 0000000..31c6145
--- /dev/null
+++ b/tests/ts/reflection/schema-file.js
@@ -0,0 +1,88 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+/**
+ * File specific information.
+ * Symbols declared within a file may be recovered by iterating over all
+ * symbols and examining the `declaration_file` field.
+ */
+export class SchemaFile {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsSchemaFile(bb, obj) {
+ return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsSchemaFile(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ filename(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ includedFilenames(index, optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+ }
+ includedFilenamesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_SchemaFile';
+ }
+ static startSchemaFile(builder) {
+ builder.startObject(2);
+ }
+ static addFilename(builder, filenameOffset) {
+ builder.addFieldOffset(0, filenameOffset, 0);
+ }
+ static addIncludedFilenames(builder, includedFilenamesOffset) {
+ builder.addFieldOffset(1, includedFilenamesOffset, 0);
+ }
+ static createIncludedFilenamesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startIncludedFilenamesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static endSchemaFile(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // filename
+ return offset;
+ }
+ static createSchemaFile(builder, filenameOffset, includedFilenamesOffset) {
+ SchemaFile.startSchemaFile(builder);
+ SchemaFile.addFilename(builder, filenameOffset);
+ SchemaFile.addIncludedFilenames(builder, includedFilenamesOffset);
+ return SchemaFile.endSchemaFile(builder);
+ }
+ unpack() {
+ return new SchemaFileT(this.filename(), this.bb.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength()));
+ }
+ unpackTo(_o) {
+ _o.filename = this.filename();
+ _o.includedFilenames = this.bb.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength());
+ }
+}
+export class SchemaFileT {
+ constructor(filename = null, includedFilenames = []) {
+ this.filename = filename;
+ this.includedFilenames = includedFilenames;
+ }
+ pack(builder) {
+ const filename = (this.filename !== null ? builder.createString(this.filename) : 0);
+ const includedFilenames = SchemaFile.createIncludedFilenamesVector(builder, builder.createObjectOffsetList(this.includedFilenames));
+ return SchemaFile.createSchemaFile(builder, filename, includedFilenames);
+ }
+}
diff --git a/tests/ts/reflection/schema-file.ts b/tests/ts/reflection/schema-file.ts
new file mode 100644
index 0000000..e1f5035
--- /dev/null
+++ b/tests/ts/reflection/schema-file.ts
@@ -0,0 +1,126 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+
+/**
+ * File specific information.
+ * Symbols declared within a file may be recovered by iterating over all
+ * symbols and examining the `declaration_file` field.
+ */
+export class SchemaFile {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):SchemaFile {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsSchemaFile(bb:flatbuffers.ByteBuffer, obj?:SchemaFile):SchemaFile {
+ return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsSchemaFile(bb:flatbuffers.ByteBuffer, obj?:SchemaFile):SchemaFile {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+/**
+ * Filename, relative to project root.
+ */
+filename():string|null
+filename(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+filename(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;
+}
+
+/**
+ * Names of included files, relative to project root.
+ */
+includedFilenames(index: number):string
+includedFilenames(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+includedFilenames(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+includedFilenamesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_SchemaFile';
+}
+
+static startSchemaFile(builder:flatbuffers.Builder) {
+ builder.startObject(2);
+}
+
+static addFilename(builder:flatbuffers.Builder, filenameOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, filenameOffset, 0);
+}
+
+static addIncludedFilenames(builder:flatbuffers.Builder, includedFilenamesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, includedFilenamesOffset, 0);
+}
+
+static createIncludedFilenamesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startIncludedFilenamesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static endSchemaFile(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // filename
+ return offset;
+}
+
+static createSchemaFile(builder:flatbuffers.Builder, filenameOffset:flatbuffers.Offset, includedFilenamesOffset:flatbuffers.Offset):flatbuffers.Offset {
+ SchemaFile.startSchemaFile(builder);
+ SchemaFile.addFilename(builder, filenameOffset);
+ SchemaFile.addIncludedFilenames(builder, includedFilenamesOffset);
+ return SchemaFile.endSchemaFile(builder);
+}
+
+unpack(): SchemaFileT {
+ return new SchemaFileT(
+ this.filename(),
+ this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength())
+ );
+}
+
+
+unpackTo(_o: SchemaFileT): void {
+ _o.filename = this.filename();
+ _o.includedFilenames = this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength());
+}
+}
+
+export class SchemaFileT {
+constructor(
+ public filename: string|Uint8Array|null = null,
+ public includedFilenames: (string)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const filename = (this.filename !== null ? builder.createString(this.filename!) : 0);
+ const includedFilenames = SchemaFile.createIncludedFilenamesVector(builder, builder.createObjectOffsetList(this.includedFilenames));
+
+ return SchemaFile.createSchemaFile(builder,
+ filename,
+ includedFilenames
+ );
+}
+}
diff --git a/tests/ts/reflection/schema.js b/tests/ts/reflection/schema.js
new file mode 100644
index 0000000..d502297
--- /dev/null
+++ b/tests/ts/reflection/schema.js
@@ -0,0 +1,213 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { Enum } from '../reflection/enum.js';
+import { Object_ } from '../reflection/object.js';
+import { SchemaFile } from '../reflection/schema-file.js';
+import { Service } from '../reflection/service.js';
+export class Schema {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsSchema(bb, obj) {
+ return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsSchema(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static bufferHasIdentifier(bb) {
+ return bb.__has_identifier('BFBS');
+ }
+ objects(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ objectsLength() {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ enums(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? (obj || new Enum()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ enumsLength() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ fileIdent(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ fileExt(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ rootTable(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ services(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? (obj || new Service()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ servicesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ advancedFeatures() {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
+ }
+ mutate_advanced_features(value) {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint64(this.bb_pos + offset, value);
+ return true;
+ }
+ /**
+ * All the files used in this compilation. Files are relative to where
+ * flatc was invoked.
+ */
+ fbsFiles(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 18);
+ return offset ? (obj || new SchemaFile()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ fbsFilesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 18);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_Schema';
+ }
+ static startSchema(builder) {
+ builder.startObject(8);
+ }
+ static addObjects(builder, objectsOffset) {
+ builder.addFieldOffset(0, objectsOffset, 0);
+ }
+ static createObjectsVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startObjectsVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addEnums(builder, enumsOffset) {
+ builder.addFieldOffset(1, enumsOffset, 0);
+ }
+ static createEnumsVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startEnumsVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addFileIdent(builder, fileIdentOffset) {
+ builder.addFieldOffset(2, fileIdentOffset, 0);
+ }
+ static addFileExt(builder, fileExtOffset) {
+ builder.addFieldOffset(3, fileExtOffset, 0);
+ }
+ static addRootTable(builder, rootTableOffset) {
+ builder.addFieldOffset(4, rootTableOffset, 0);
+ }
+ static addServices(builder, servicesOffset) {
+ builder.addFieldOffset(5, servicesOffset, 0);
+ }
+ static createServicesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startServicesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addAdvancedFeatures(builder, advancedFeatures) {
+ builder.addFieldInt64(6, advancedFeatures, BigInt('0'));
+ }
+ static addFbsFiles(builder, fbsFilesOffset) {
+ builder.addFieldOffset(7, fbsFilesOffset, 0);
+ }
+ static createFbsFilesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startFbsFilesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static endSchema(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // objects
+ builder.requiredField(offset, 6); // enums
+ return offset;
+ }
+ static finishSchemaBuffer(builder, offset) {
+ builder.finish(offset, 'BFBS');
+ }
+ static finishSizePrefixedSchemaBuffer(builder, offset) {
+ builder.finish(offset, 'BFBS', true);
+ }
+ unpack() {
+ return new SchemaT(this.bb.createObjList(this.objects.bind(this), this.objectsLength()), this.bb.createObjList(this.enums.bind(this), this.enumsLength()), this.fileIdent(), this.fileExt(), (this.rootTable() !== null ? this.rootTable().unpack() : null), this.bb.createObjList(this.services.bind(this), this.servicesLength()), this.advancedFeatures(), this.bb.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength()));
+ }
+ unpackTo(_o) {
+ _o.objects = this.bb.createObjList(this.objects.bind(this), this.objectsLength());
+ _o.enums = this.bb.createObjList(this.enums.bind(this), this.enumsLength());
+ _o.fileIdent = this.fileIdent();
+ _o.fileExt = this.fileExt();
+ _o.rootTable = (this.rootTable() !== null ? this.rootTable().unpack() : null);
+ _o.services = this.bb.createObjList(this.services.bind(this), this.servicesLength());
+ _o.advancedFeatures = this.advancedFeatures();
+ _o.fbsFiles = this.bb.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength());
+ }
+}
+export class SchemaT {
+ constructor(objects = [], enums = [], fileIdent = null, fileExt = null, rootTable = null, services = [], advancedFeatures = BigInt('0'), fbsFiles = []) {
+ this.objects = objects;
+ this.enums = enums;
+ this.fileIdent = fileIdent;
+ this.fileExt = fileExt;
+ this.rootTable = rootTable;
+ this.services = services;
+ this.advancedFeatures = advancedFeatures;
+ this.fbsFiles = fbsFiles;
+ }
+ pack(builder) {
+ const objects = Schema.createObjectsVector(builder, builder.createObjectOffsetList(this.objects));
+ const enums = Schema.createEnumsVector(builder, builder.createObjectOffsetList(this.enums));
+ const fileIdent = (this.fileIdent !== null ? builder.createString(this.fileIdent) : 0);
+ const fileExt = (this.fileExt !== null ? builder.createString(this.fileExt) : 0);
+ const rootTable = (this.rootTable !== null ? this.rootTable.pack(builder) : 0);
+ const services = Schema.createServicesVector(builder, builder.createObjectOffsetList(this.services));
+ const fbsFiles = Schema.createFbsFilesVector(builder, builder.createObjectOffsetList(this.fbsFiles));
+ Schema.startSchema(builder);
+ Schema.addObjects(builder, objects);
+ Schema.addEnums(builder, enums);
+ Schema.addFileIdent(builder, fileIdent);
+ Schema.addFileExt(builder, fileExt);
+ Schema.addRootTable(builder, rootTable);
+ Schema.addServices(builder, services);
+ Schema.addAdvancedFeatures(builder, this.advancedFeatures);
+ Schema.addFbsFiles(builder, fbsFiles);
+ return Schema.endSchema(builder);
+ }
+}
diff --git a/tests/ts/reflection/schema.ts b/tests/ts/reflection/schema.ts
new file mode 100644
index 0000000..d1839c7
--- /dev/null
+++ b/tests/ts/reflection/schema.ts
@@ -0,0 +1,276 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { Enum, EnumT } from '../reflection/enum.js';
+import { Object_, Object_T } from '../reflection/object.js';
+import { SchemaFile, SchemaFileT } from '../reflection/schema-file.js';
+import { Service, ServiceT } from '../reflection/service.js';
+
+
+export class Schema {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Schema {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsSchema(bb:flatbuffers.ByteBuffer, obj?:Schema):Schema {
+ return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsSchema(bb:flatbuffers.ByteBuffer, obj?:Schema):Schema {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
+ return bb.__has_identifier('BFBS');
+}
+
+objects(index: number, obj?:Object_):Object_|null {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+objectsLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+enums(index: number, obj?:Enum):Enum|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? (obj || new Enum()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+enumsLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+fileIdent():string|null
+fileIdent(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+fileIdent(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;
+}
+
+fileExt():string|null
+fileExt(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+fileExt(optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+rootTable(obj?:Object_):Object_|null {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+services(index: number, obj?:Service):Service|null {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? (obj || new Service()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+servicesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+advancedFeatures():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_advanced_features(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint64(this.bb_pos + offset, value);
+ return true;
+}
+
+/**
+ * All the files used in this compilation. Files are relative to where
+ * flatc was invoked.
+ */
+fbsFiles(index: number, obj?:SchemaFile):SchemaFile|null {
+ const offset = this.bb!.__offset(this.bb_pos, 18);
+ return offset ? (obj || new SchemaFile()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+fbsFilesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 18);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_Schema';
+}
+
+static startSchema(builder:flatbuffers.Builder) {
+ builder.startObject(8);
+}
+
+static addObjects(builder:flatbuffers.Builder, objectsOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, objectsOffset, 0);
+}
+
+static createObjectsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startObjectsVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addEnums(builder:flatbuffers.Builder, enumsOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, enumsOffset, 0);
+}
+
+static createEnumsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startEnumsVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addFileIdent(builder:flatbuffers.Builder, fileIdentOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(2, fileIdentOffset, 0);
+}
+
+static addFileExt(builder:flatbuffers.Builder, fileExtOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(3, fileExtOffset, 0);
+}
+
+static addRootTable(builder:flatbuffers.Builder, rootTableOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(4, rootTableOffset, 0);
+}
+
+static addServices(builder:flatbuffers.Builder, servicesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(5, servicesOffset, 0);
+}
+
+static createServicesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startServicesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addAdvancedFeatures(builder:flatbuffers.Builder, advancedFeatures:bigint) {
+ builder.addFieldInt64(6, advancedFeatures, BigInt('0'));
+}
+
+static addFbsFiles(builder:flatbuffers.Builder, fbsFilesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(7, fbsFilesOffset, 0);
+}
+
+static createFbsFilesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startFbsFilesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static endSchema(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // objects
+ builder.requiredField(offset, 6) // enums
+ return offset;
+}
+
+static finishSchemaBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
+ builder.finish(offset, 'BFBS');
+}
+
+static finishSizePrefixedSchemaBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
+ builder.finish(offset, 'BFBS', true);
+}
+
+
+unpack(): SchemaT {
+ return new SchemaT(
+ this.bb!.createObjList(this.objects.bind(this), this.objectsLength()),
+ this.bb!.createObjList(this.enums.bind(this), this.enumsLength()),
+ this.fileIdent(),
+ this.fileExt(),
+ (this.rootTable() !== null ? this.rootTable()!.unpack() : null),
+ this.bb!.createObjList(this.services.bind(this), this.servicesLength()),
+ this.advancedFeatures(),
+ this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength())
+ );
+}
+
+
+unpackTo(_o: SchemaT): void {
+ _o.objects = this.bb!.createObjList(this.objects.bind(this), this.objectsLength());
+ _o.enums = this.bb!.createObjList(this.enums.bind(this), this.enumsLength());
+ _o.fileIdent = this.fileIdent();
+ _o.fileExt = this.fileExt();
+ _o.rootTable = (this.rootTable() !== null ? this.rootTable()!.unpack() : null);
+ _o.services = this.bb!.createObjList(this.services.bind(this), this.servicesLength());
+ _o.advancedFeatures = this.advancedFeatures();
+ _o.fbsFiles = this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength());
+}
+}
+
+export class SchemaT {
+constructor(
+ public objects: (Object_T)[] = [],
+ public enums: (EnumT)[] = [],
+ public fileIdent: string|Uint8Array|null = null,
+ public fileExt: string|Uint8Array|null = null,
+ public rootTable: Object_T|null = null,
+ public services: (ServiceT)[] = [],
+ public advancedFeatures: bigint = BigInt('0'),
+ public fbsFiles: (SchemaFileT)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const objects = Schema.createObjectsVector(builder, builder.createObjectOffsetList(this.objects));
+ const enums = Schema.createEnumsVector(builder, builder.createObjectOffsetList(this.enums));
+ const fileIdent = (this.fileIdent !== null ? builder.createString(this.fileIdent!) : 0);
+ const fileExt = (this.fileExt !== null ? builder.createString(this.fileExt!) : 0);
+ const rootTable = (this.rootTable !== null ? this.rootTable!.pack(builder) : 0);
+ const services = Schema.createServicesVector(builder, builder.createObjectOffsetList(this.services));
+ const fbsFiles = Schema.createFbsFilesVector(builder, builder.createObjectOffsetList(this.fbsFiles));
+
+ Schema.startSchema(builder);
+ Schema.addObjects(builder, objects);
+ Schema.addEnums(builder, enums);
+ Schema.addFileIdent(builder, fileIdent);
+ Schema.addFileExt(builder, fileExt);
+ Schema.addRootTable(builder, rootTable);
+ Schema.addServices(builder, services);
+ Schema.addAdvancedFeatures(builder, this.advancedFeatures);
+ Schema.addFbsFiles(builder, fbsFiles);
+
+ return Schema.endSchema(builder);
+}
+}
diff --git a/tests/ts/reflection/service.js b/tests/ts/reflection/service.js
new file mode 100644
index 0000000..8c66ef7
--- /dev/null
+++ b/tests/ts/reflection/service.js
@@ -0,0 +1,146 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { KeyValue } from '../reflection/key-value.js';
+import { RPCCall } from '../reflection/rpccall.js';
+export class Service {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsService(bb, obj) {
+ return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsService(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Service()).__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;
+ }
+ calls(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? (obj || new RPCCall()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ callsLength() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ attributes(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ attributesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ documentation(index, optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+ }
+ documentationLength() {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ declarationFile(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_Service';
+ }
+ static startService(builder) {
+ builder.startObject(5);
+ }
+ static addName(builder, nameOffset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+ }
+ static addCalls(builder, callsOffset) {
+ builder.addFieldOffset(1, callsOffset, 0);
+ }
+ static createCallsVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startCallsVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addAttributes(builder, attributesOffset) {
+ builder.addFieldOffset(2, attributesOffset, 0);
+ }
+ static createAttributesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startAttributesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addDocumentation(builder, documentationOffset) {
+ builder.addFieldOffset(3, documentationOffset, 0);
+ }
+ static createDocumentationVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startDocumentationVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addDeclarationFile(builder, declarationFileOffset) {
+ builder.addFieldOffset(4, declarationFileOffset, 0);
+ }
+ static endService(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // name
+ return offset;
+ }
+ static createService(builder, nameOffset, callsOffset, attributesOffset, documentationOffset, declarationFileOffset) {
+ Service.startService(builder);
+ Service.addName(builder, nameOffset);
+ Service.addCalls(builder, callsOffset);
+ Service.addAttributes(builder, attributesOffset);
+ Service.addDocumentation(builder, documentationOffset);
+ Service.addDeclarationFile(builder, declarationFileOffset);
+ return Service.endService(builder);
+ }
+ unpack() {
+ return new ServiceT(this.name(), this.bb.createObjList(this.calls.bind(this), this.callsLength()), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile());
+ }
+ unpackTo(_o) {
+ _o.name = this.name();
+ _o.calls = this.bb.createObjList(this.calls.bind(this), this.callsLength());
+ _o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
+ _o.declarationFile = this.declarationFile();
+ }
+}
+export class ServiceT {
+ constructor(name = null, calls = [], attributes = [], documentation = [], declarationFile = null) {
+ this.name = name;
+ this.calls = calls;
+ this.attributes = attributes;
+ this.documentation = documentation;
+ this.declarationFile = declarationFile;
+ }
+ pack(builder) {
+ const name = (this.name !== null ? builder.createString(this.name) : 0);
+ const calls = Service.createCallsVector(builder, builder.createObjectOffsetList(this.calls));
+ const attributes = Service.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = Service.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile) : 0);
+ return Service.createService(builder, name, calls, attributes, documentation, declarationFile);
+ }
+}
diff --git a/tests/ts/reflection/service.ts b/tests/ts/reflection/service.ts
new file mode 100644
index 0000000..c083cae
--- /dev/null
+++ b/tests/ts/reflection/service.ts
@@ -0,0 +1,201 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { KeyValue, KeyValueT } from '../reflection/key-value.js';
+import { RPCCall, RPCCallT } from '../reflection/rpccall.js';
+
+
+export class Service {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Service {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsService(bb:flatbuffers.ByteBuffer, obj?:Service):Service {
+ return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsService(bb:flatbuffers.ByteBuffer, obj?:Service):Service {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Service()).__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;
+}
+
+calls(index: number, obj?:RPCCall):RPCCall|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? (obj || new RPCCall()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+callsLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+attributes(index: number, obj?:KeyValue):KeyValue|null {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+attributesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+/**
+ * File that this Service is declared in.
+ */
+declarationFile():string|null
+declarationFile(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+declarationFile(optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_Service';
+}
+
+static startService(builder:flatbuffers.Builder) {
+ builder.startObject(5);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addCalls(builder:flatbuffers.Builder, callsOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, callsOffset, 0);
+}
+
+static createCallsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startCallsVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(2, attributesOffset, 0);
+}
+
+static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(3, documentationOffset, 0);
+}
+
+static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addDeclarationFile(builder:flatbuffers.Builder, declarationFileOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(4, declarationFileOffset, 0);
+}
+
+static endService(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // name
+ return offset;
+}
+
+static createService(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, callsOffset:flatbuffers.Offset, attributesOffset:flatbuffers.Offset, documentationOffset:flatbuffers.Offset, declarationFileOffset:flatbuffers.Offset):flatbuffers.Offset {
+ Service.startService(builder);
+ Service.addName(builder, nameOffset);
+ Service.addCalls(builder, callsOffset);
+ Service.addAttributes(builder, attributesOffset);
+ Service.addDocumentation(builder, documentationOffset);
+ Service.addDeclarationFile(builder, declarationFileOffset);
+ return Service.endService(builder);
+}
+
+unpack(): ServiceT {
+ return new ServiceT(
+ this.name(),
+ this.bb!.createObjList(this.calls.bind(this), this.callsLength()),
+ this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
+ this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
+ this.declarationFile()
+ );
+}
+
+
+unpackTo(_o: ServiceT): void {
+ _o.name = this.name();
+ _o.calls = this.bb!.createObjList(this.calls.bind(this), this.callsLength());
+ _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+ _o.declarationFile = this.declarationFile();
+}
+}
+
+export class ServiceT {
+constructor(
+ public name: string|Uint8Array|null = null,
+ public calls: (RPCCallT)[] = [],
+ public attributes: (KeyValueT)[] = [],
+ public documentation: (string)[] = [],
+ public declarationFile: string|Uint8Array|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const name = (this.name !== null ? builder.createString(this.name!) : 0);
+ const calls = Service.createCallsVector(builder, builder.createObjectOffsetList(this.calls));
+ const attributes = Service.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = Service.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile!) : 0);
+
+ return Service.createService(builder,
+ name,
+ calls,
+ attributes,
+ documentation,
+ declarationFile
+ );
+}
+}
diff --git a/tests/ts/reflection/type.js b/tests/ts/reflection/type.js
new file mode 100644
index 0000000..f3ccbdf
--- /dev/null
+++ b/tests/ts/reflection/type.js
@@ -0,0 +1,161 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { BaseType } from '../reflection/base-type.js';
+export class Type {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsType(bb, obj) {
+ return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsType(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ baseType() {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? this.bb.readInt8(this.bb_pos + offset) : BaseType.None;
+ }
+ mutate_base_type(value) {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, value);
+ return true;
+ }
+ element() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.readInt8(this.bb_pos + offset) : BaseType.None;
+ }
+ mutate_element(value) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, value);
+ return true;
+ }
+ index() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : -1;
+ }
+ mutate_index(value) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ fixedLength() {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
+ }
+ mutate_fixed_length(value) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint16(this.bb_pos + offset, value);
+ return true;
+ }
+ /**
+ * The size (octets) of the `base_type` field.
+ */
+ baseSize() {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.readUint32(this.bb_pos + offset) : 4;
+ }
+ mutate_base_size(value) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint32(this.bb_pos + offset, value);
+ return true;
+ }
+ /**
+ * The size (octets) of the `element` field, if present.
+ */
+ elementSize() {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
+ }
+ mutate_element_size(value) {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint32(this.bb_pos + offset, value);
+ return true;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_Type';
+ }
+ static startType(builder) {
+ builder.startObject(6);
+ }
+ static addBaseType(builder, baseType) {
+ builder.addFieldInt8(0, baseType, BaseType.None);
+ }
+ static addElement(builder, element) {
+ builder.addFieldInt8(1, element, BaseType.None);
+ }
+ static addIndex(builder, index) {
+ builder.addFieldInt32(2, index, -1);
+ }
+ static addFixedLength(builder, fixedLength) {
+ builder.addFieldInt16(3, fixedLength, 0);
+ }
+ static addBaseSize(builder, baseSize) {
+ builder.addFieldInt32(4, baseSize, 4);
+ }
+ static addElementSize(builder, elementSize) {
+ builder.addFieldInt32(5, elementSize, 0);
+ }
+ static endType(builder) {
+ const offset = builder.endObject();
+ return offset;
+ }
+ static createType(builder, baseType, element, index, fixedLength, baseSize, elementSize) {
+ Type.startType(builder);
+ Type.addBaseType(builder, baseType);
+ Type.addElement(builder, element);
+ Type.addIndex(builder, index);
+ Type.addFixedLength(builder, fixedLength);
+ Type.addBaseSize(builder, baseSize);
+ Type.addElementSize(builder, elementSize);
+ return Type.endType(builder);
+ }
+ unpack() {
+ return new TypeT(this.baseType(), this.element(), this.index(), this.fixedLength(), this.baseSize(), this.elementSize());
+ }
+ unpackTo(_o) {
+ _o.baseType = this.baseType();
+ _o.element = this.element();
+ _o.index = this.index();
+ _o.fixedLength = this.fixedLength();
+ _o.baseSize = this.baseSize();
+ _o.elementSize = this.elementSize();
+ }
+}
+export class TypeT {
+ constructor(baseType = BaseType.None, element = BaseType.None, index = -1, fixedLength = 0, baseSize = 4, elementSize = 0) {
+ this.baseType = baseType;
+ this.element = element;
+ this.index = index;
+ this.fixedLength = fixedLength;
+ this.baseSize = baseSize;
+ this.elementSize = elementSize;
+ }
+ pack(builder) {
+ return Type.createType(builder, this.baseType, this.element, this.index, this.fixedLength, this.baseSize, this.elementSize);
+ }
+}
diff --git a/tests/ts/reflection/type.ts b/tests/ts/reflection/type.ts
new file mode 100644
index 0000000..e831e21
--- /dev/null
+++ b/tests/ts/reflection/type.ts
@@ -0,0 +1,219 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { BaseType } from '../reflection/base-type.js';
+
+
+export class Type {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Type {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsType(bb:flatbuffers.ByteBuffer, obj?:Type):Type {
+ return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsType(bb:flatbuffers.ByteBuffer, obj?:Type):Type {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+baseType():BaseType {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? this.bb!.readInt8(this.bb_pos + offset) : BaseType.None;
+}
+
+mutate_base_type(value:BaseType):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, value);
+ return true;
+}
+
+element():BaseType {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.readInt8(this.bb_pos + offset) : BaseType.None;
+}
+
+mutate_element(value:BaseType):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, value);
+ return true;
+}
+
+index():number {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
+}
+
+mutate_index(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+fixedLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+mutate_fixed_length(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint16(this.bb_pos + offset, value);
+ return true;
+}
+
+/**
+ * The size (octets) of the `base_type` field.
+ */
+baseSize():number {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.readUint32(this.bb_pos + offset) : 4;
+}
+
+mutate_base_size(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint32(this.bb_pos + offset, value);
+ return true;
+}
+
+/**
+ * The size (octets) of the `element` field, if present.
+ */
+elementSize():number {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
+}
+
+mutate_element_size(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint32(this.bb_pos + offset, value);
+ return true;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_Type';
+}
+
+static startType(builder:flatbuffers.Builder) {
+ builder.startObject(6);
+}
+
+static addBaseType(builder:flatbuffers.Builder, baseType:BaseType) {
+ builder.addFieldInt8(0, baseType, BaseType.None);
+}
+
+static addElement(builder:flatbuffers.Builder, element:BaseType) {
+ builder.addFieldInt8(1, element, BaseType.None);
+}
+
+static addIndex(builder:flatbuffers.Builder, index:number) {
+ builder.addFieldInt32(2, index, -1);
+}
+
+static addFixedLength(builder:flatbuffers.Builder, fixedLength:number) {
+ builder.addFieldInt16(3, fixedLength, 0);
+}
+
+static addBaseSize(builder:flatbuffers.Builder, baseSize:number) {
+ builder.addFieldInt32(4, baseSize, 4);
+}
+
+static addElementSize(builder:flatbuffers.Builder, elementSize:number) {
+ builder.addFieldInt32(5, elementSize, 0);
+}
+
+static endType(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createType(builder:flatbuffers.Builder, baseType:BaseType, element:BaseType, index:number, fixedLength:number, baseSize:number, elementSize:number):flatbuffers.Offset {
+ Type.startType(builder);
+ Type.addBaseType(builder, baseType);
+ Type.addElement(builder, element);
+ Type.addIndex(builder, index);
+ Type.addFixedLength(builder, fixedLength);
+ Type.addBaseSize(builder, baseSize);
+ Type.addElementSize(builder, elementSize);
+ return Type.endType(builder);
+}
+
+unpack(): TypeT {
+ return new TypeT(
+ this.baseType(),
+ this.element(),
+ this.index(),
+ this.fixedLength(),
+ this.baseSize(),
+ this.elementSize()
+ );
+}
+
+
+unpackTo(_o: TypeT): void {
+ _o.baseType = this.baseType();
+ _o.element = this.element();
+ _o.index = this.index();
+ _o.fixedLength = this.fixedLength();
+ _o.baseSize = this.baseSize();
+ _o.elementSize = this.elementSize();
+}
+}
+
+export class TypeT {
+constructor(
+ public baseType: BaseType = BaseType.None,
+ public element: BaseType = BaseType.None,
+ public index: number = -1,
+ public fixedLength: number = 0,
+ public baseSize: number = 4,
+ public elementSize: number = 0
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ return Type.createType(builder,
+ this.baseType,
+ this.element,
+ this.index,
+ this.fixedLength,
+ this.baseSize,
+ this.elementSize
+ );
+}
+}
diff --git a/tests/ts/reflection_generated.js b/tests/ts/reflection_generated.js
new file mode 100644
index 0000000..dd686cc
--- /dev/null
+++ b/tests/ts/reflection_generated.js
@@ -0,0 +1,1575 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+export var BaseType;
+(function (BaseType) {
+ BaseType[BaseType["None"] = 0] = "None";
+ BaseType[BaseType["UType"] = 1] = "UType";
+ BaseType[BaseType["Bool"] = 2] = "Bool";
+ BaseType[BaseType["Byte"] = 3] = "Byte";
+ BaseType[BaseType["UByte"] = 4] = "UByte";
+ BaseType[BaseType["Short"] = 5] = "Short";
+ BaseType[BaseType["UShort"] = 6] = "UShort";
+ BaseType[BaseType["Int"] = 7] = "Int";
+ BaseType[BaseType["UInt"] = 8] = "UInt";
+ BaseType[BaseType["Long"] = 9] = "Long";
+ BaseType[BaseType["ULong"] = 10] = "ULong";
+ BaseType[BaseType["Float"] = 11] = "Float";
+ BaseType[BaseType["Double"] = 12] = "Double";
+ BaseType[BaseType["String"] = 13] = "String";
+ BaseType[BaseType["Vector"] = 14] = "Vector";
+ BaseType[BaseType["Obj"] = 15] = "Obj";
+ BaseType[BaseType["Union"] = 16] = "Union";
+ BaseType[BaseType["Array"] = 17] = "Array";
+ BaseType[BaseType["MaxBaseType"] = 18] = "MaxBaseType";
+})(BaseType || (BaseType = {}));
+/**
+ * New schema language features that are not supported by old code generators.
+ */
+export var AdvancedFeatures;
+(function (AdvancedFeatures) {
+ AdvancedFeatures["AdvancedArrayFeatures"] = "1";
+ AdvancedFeatures["AdvancedUnionFeatures"] = "2";
+ AdvancedFeatures["OptionalScalars"] = "4";
+ AdvancedFeatures["DefaultVectorsAndStrings"] = "8";
+})(AdvancedFeatures || (AdvancedFeatures = {}));
+export class Type {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsType(bb, obj) {
+ return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsType(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ baseType() {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? this.bb.readInt8(this.bb_pos + offset) : BaseType.None;
+ }
+ mutate_base_type(value) {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, value);
+ return true;
+ }
+ element() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.readInt8(this.bb_pos + offset) : BaseType.None;
+ }
+ mutate_element(value) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, value);
+ return true;
+ }
+ index() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : -1;
+ }
+ mutate_index(value) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ fixedLength() {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
+ }
+ mutate_fixed_length(value) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint16(this.bb_pos + offset, value);
+ return true;
+ }
+ /**
+ * The size (octets) of the `base_type` field.
+ */
+ baseSize() {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.readUint32(this.bb_pos + offset) : 4;
+ }
+ mutate_base_size(value) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint32(this.bb_pos + offset, value);
+ return true;
+ }
+ /**
+ * The size (octets) of the `element` field, if present.
+ */
+ elementSize() {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
+ }
+ mutate_element_size(value) {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint32(this.bb_pos + offset, value);
+ return true;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_Type';
+ }
+ static startType(builder) {
+ builder.startObject(6);
+ }
+ static addBaseType(builder, baseType) {
+ builder.addFieldInt8(0, baseType, BaseType.None);
+ }
+ static addElement(builder, element) {
+ builder.addFieldInt8(1, element, BaseType.None);
+ }
+ static addIndex(builder, index) {
+ builder.addFieldInt32(2, index, -1);
+ }
+ static addFixedLength(builder, fixedLength) {
+ builder.addFieldInt16(3, fixedLength, 0);
+ }
+ static addBaseSize(builder, baseSize) {
+ builder.addFieldInt32(4, baseSize, 4);
+ }
+ static addElementSize(builder, elementSize) {
+ builder.addFieldInt32(5, elementSize, 0);
+ }
+ static endType(builder) {
+ const offset = builder.endObject();
+ return offset;
+ }
+ static createType(builder, baseType, element, index, fixedLength, baseSize, elementSize) {
+ Type.startType(builder);
+ Type.addBaseType(builder, baseType);
+ Type.addElement(builder, element);
+ Type.addIndex(builder, index);
+ Type.addFixedLength(builder, fixedLength);
+ Type.addBaseSize(builder, baseSize);
+ Type.addElementSize(builder, elementSize);
+ return Type.endType(builder);
+ }
+ unpack() {
+ return new TypeT(this.baseType(), this.element(), this.index(), this.fixedLength(), this.baseSize(), this.elementSize());
+ }
+ unpackTo(_o) {
+ _o.baseType = this.baseType();
+ _o.element = this.element();
+ _o.index = this.index();
+ _o.fixedLength = this.fixedLength();
+ _o.baseSize = this.baseSize();
+ _o.elementSize = this.elementSize();
+ }
+}
+export class TypeT {
+ constructor(baseType = BaseType.None, element = BaseType.None, index = -1, fixedLength = 0, baseSize = 4, elementSize = 0) {
+ this.baseType = baseType;
+ this.element = element;
+ this.index = index;
+ this.fixedLength = fixedLength;
+ this.baseSize = baseSize;
+ this.elementSize = elementSize;
+ }
+ pack(builder) {
+ return Type.createType(builder, this.baseType, this.element, this.index, this.fixedLength, this.baseSize, this.elementSize);
+ }
+}
+export class KeyValue {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsKeyValue(bb, obj) {
+ return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsKeyValue(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ key(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ value(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_KeyValue';
+ }
+ static startKeyValue(builder) {
+ builder.startObject(2);
+ }
+ static addKey(builder, keyOffset) {
+ builder.addFieldOffset(0, keyOffset, 0);
+ }
+ static addValue(builder, valueOffset) {
+ builder.addFieldOffset(1, valueOffset, 0);
+ }
+ static endKeyValue(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // key
+ return offset;
+ }
+ static createKeyValue(builder, keyOffset, valueOffset) {
+ KeyValue.startKeyValue(builder);
+ KeyValue.addKey(builder, keyOffset);
+ KeyValue.addValue(builder, valueOffset);
+ return KeyValue.endKeyValue(builder);
+ }
+ unpack() {
+ return new KeyValueT(this.key(), this.value());
+ }
+ unpackTo(_o) {
+ _o.key = this.key();
+ _o.value = this.value();
+ }
+}
+export class KeyValueT {
+ constructor(key = null, value = null) {
+ this.key = key;
+ this.value = value;
+ }
+ pack(builder) {
+ const key = (this.key !== null ? builder.createString(this.key) : 0);
+ const value = (this.value !== null ? builder.createString(this.value) : 0);
+ return KeyValue.createKeyValue(builder, key, value);
+ }
+}
+export class EnumVal {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsEnumVal(bb, obj) {
+ return (obj || new EnumVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsEnumVal(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new EnumVal()).__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;
+ }
+ value() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
+ }
+ mutate_value(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;
+ }
+ unionType(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? (obj || new Type()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ documentation(index, optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+ }
+ documentationLength() {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_EnumVal';
+ }
+ static startEnumVal(builder) {
+ builder.startObject(5);
+ }
+ static addName(builder, nameOffset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+ }
+ static addValue(builder, value) {
+ builder.addFieldInt64(1, value, BigInt('0'));
+ }
+ static addUnionType(builder, unionTypeOffset) {
+ builder.addFieldOffset(3, unionTypeOffset, 0);
+ }
+ static addDocumentation(builder, documentationOffset) {
+ builder.addFieldOffset(4, documentationOffset, 0);
+ }
+ static createDocumentationVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startDocumentationVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static endEnumVal(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // name
+ return offset;
+ }
+ unpack() {
+ return new EnumValT(this.name(), this.value(), (this.unionType() !== null ? this.unionType().unpack() : null), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()));
+ }
+ unpackTo(_o) {
+ _o.name = this.name();
+ _o.value = this.value();
+ _o.unionType = (this.unionType() !== null ? this.unionType().unpack() : null);
+ _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
+ }
+}
+export class EnumValT {
+ constructor(name = null, value = BigInt('0'), unionType = null, documentation = []) {
+ this.name = name;
+ this.value = value;
+ this.unionType = unionType;
+ this.documentation = documentation;
+ }
+ pack(builder) {
+ const name = (this.name !== null ? builder.createString(this.name) : 0);
+ const unionType = (this.unionType !== null ? this.unionType.pack(builder) : 0);
+ const documentation = EnumVal.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ EnumVal.startEnumVal(builder);
+ EnumVal.addName(builder, name);
+ EnumVal.addValue(builder, this.value);
+ EnumVal.addUnionType(builder, unionType);
+ EnumVal.addDocumentation(builder, documentation);
+ return EnumVal.endEnumVal(builder);
+ }
+}
+export class Enum {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsEnum(bb, obj) {
+ return (obj || new Enum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsEnum(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Enum()).__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;
+ }
+ values(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? (obj || new EnumVal()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ valuesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ isUnion() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+ }
+ mutate_is_union(value) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, +value);
+ return true;
+ }
+ underlyingType(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? (obj || new Type()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ attributes(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ attributesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ documentation(index, optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+ }
+ documentationLength() {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ declarationFile(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_Enum';
+ }
+ static startEnum(builder) {
+ builder.startObject(7);
+ }
+ static addName(builder, nameOffset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+ }
+ static addValues(builder, valuesOffset) {
+ builder.addFieldOffset(1, valuesOffset, 0);
+ }
+ static createValuesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startValuesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addIsUnion(builder, isUnion) {
+ builder.addFieldInt8(2, +isUnion, +false);
+ }
+ static addUnderlyingType(builder, underlyingTypeOffset) {
+ builder.addFieldOffset(3, underlyingTypeOffset, 0);
+ }
+ static addAttributes(builder, attributesOffset) {
+ builder.addFieldOffset(4, attributesOffset, 0);
+ }
+ static createAttributesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startAttributesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addDocumentation(builder, documentationOffset) {
+ builder.addFieldOffset(5, documentationOffset, 0);
+ }
+ static createDocumentationVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startDocumentationVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addDeclarationFile(builder, declarationFileOffset) {
+ builder.addFieldOffset(6, declarationFileOffset, 0);
+ }
+ static endEnum(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // name
+ builder.requiredField(offset, 6); // values
+ builder.requiredField(offset, 10); // underlying_type
+ return offset;
+ }
+ unpack() {
+ return new EnumT(this.name(), this.bb.createObjList(this.values.bind(this), this.valuesLength()), this.isUnion(), (this.underlyingType() !== null ? this.underlyingType().unpack() : null), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile());
+ }
+ unpackTo(_o) {
+ _o.name = this.name();
+ _o.values = this.bb.createObjList(this.values.bind(this), this.valuesLength());
+ _o.isUnion = this.isUnion();
+ _o.underlyingType = (this.underlyingType() !== null ? this.underlyingType().unpack() : null);
+ _o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
+ _o.declarationFile = this.declarationFile();
+ }
+}
+export class EnumT {
+ constructor(name = null, values = [], isUnion = false, underlyingType = null, attributes = [], documentation = [], declarationFile = null) {
+ this.name = name;
+ this.values = values;
+ this.isUnion = isUnion;
+ this.underlyingType = underlyingType;
+ this.attributes = attributes;
+ this.documentation = documentation;
+ this.declarationFile = declarationFile;
+ }
+ pack(builder) {
+ const name = (this.name !== null ? builder.createString(this.name) : 0);
+ const values = Enum.createValuesVector(builder, builder.createObjectOffsetList(this.values));
+ const underlyingType = (this.underlyingType !== null ? this.underlyingType.pack(builder) : 0);
+ const attributes = Enum.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = Enum.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile) : 0);
+ Enum.startEnum(builder);
+ Enum.addName(builder, name);
+ Enum.addValues(builder, values);
+ Enum.addIsUnion(builder, this.isUnion);
+ Enum.addUnderlyingType(builder, underlyingType);
+ Enum.addAttributes(builder, attributes);
+ Enum.addDocumentation(builder, documentation);
+ Enum.addDeclarationFile(builder, declarationFile);
+ return Enum.endEnum(builder);
+ }
+}
+export class Field {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsField(bb, obj) {
+ return (obj || new Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsField(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Field()).__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;
+ }
+ type(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? (obj || new Type()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ id() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
+ }
+ mutate_id(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;
+ }
+ offset() {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
+ }
+ mutate_offset(value) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint16(this.bb_pos + offset, value);
+ return true;
+ }
+ defaultInteger() {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');
+ }
+ mutate_default_integer(value) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt64(this.bb_pos + offset, value);
+ return true;
+ }
+ defaultReal() {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
+ }
+ mutate_default_real(value) {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeFloat64(this.bb_pos + offset, value);
+ return true;
+ }
+ deprecated() {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+ }
+ mutate_deprecated(value) {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, +value);
+ return true;
+ }
+ required() {
+ const offset = this.bb.__offset(this.bb_pos, 18);
+ return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+ }
+ mutate_required(value) {
+ const offset = this.bb.__offset(this.bb_pos, 18);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, +value);
+ return true;
+ }
+ key() {
+ const offset = this.bb.__offset(this.bb_pos, 20);
+ return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+ }
+ mutate_key(value) {
+ const offset = this.bb.__offset(this.bb_pos, 20);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, +value);
+ return true;
+ }
+ attributes(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 22);
+ return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ attributesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 22);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ documentation(index, optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 24);
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+ }
+ documentationLength() {
+ const offset = this.bb.__offset(this.bb_pos, 24);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ optional() {
+ const offset = this.bb.__offset(this.bb_pos, 26);
+ return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+ }
+ mutate_optional(value) {
+ const offset = this.bb.__offset(this.bb_pos, 26);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, +value);
+ return true;
+ }
+ /**
+ * Number of padding octets to always add after this field. Structs only.
+ */
+ padding() {
+ const offset = this.bb.__offset(this.bb_pos, 28);
+ return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
+ }
+ mutate_padding(value) {
+ const offset = this.bb.__offset(this.bb_pos, 28);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint16(this.bb_pos + offset, value);
+ return true;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_Field';
+ }
+ static startField(builder) {
+ builder.startObject(13);
+ }
+ static addName(builder, nameOffset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+ }
+ static addType(builder, typeOffset) {
+ builder.addFieldOffset(1, typeOffset, 0);
+ }
+ static addId(builder, id) {
+ builder.addFieldInt16(2, id, 0);
+ }
+ static addOffset(builder, offset) {
+ builder.addFieldInt16(3, offset, 0);
+ }
+ static addDefaultInteger(builder, defaultInteger) {
+ builder.addFieldInt64(4, defaultInteger, BigInt('0'));
+ }
+ static addDefaultReal(builder, defaultReal) {
+ builder.addFieldFloat64(5, defaultReal, 0.0);
+ }
+ static addDeprecated(builder, deprecated) {
+ builder.addFieldInt8(6, +deprecated, +false);
+ }
+ static addRequired(builder, required) {
+ builder.addFieldInt8(7, +required, +false);
+ }
+ static addKey(builder, key) {
+ builder.addFieldInt8(8, +key, +false);
+ }
+ static addAttributes(builder, attributesOffset) {
+ builder.addFieldOffset(9, attributesOffset, 0);
+ }
+ static createAttributesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startAttributesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addDocumentation(builder, documentationOffset) {
+ builder.addFieldOffset(10, documentationOffset, 0);
+ }
+ static createDocumentationVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startDocumentationVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addOptional(builder, optional) {
+ builder.addFieldInt8(11, +optional, +false);
+ }
+ static addPadding(builder, padding) {
+ builder.addFieldInt16(12, padding, 0);
+ }
+ static endField(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // name
+ builder.requiredField(offset, 6); // type
+ return offset;
+ }
+ unpack() {
+ return new FieldT(this.name(), (this.type() !== null ? this.type().unpack() : null), this.id(), this.offset(), this.defaultInteger(), this.defaultReal(), this.deprecated(), this.required(), this.key(), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.optional(), this.padding());
+ }
+ unpackTo(_o) {
+ _o.name = this.name();
+ _o.type = (this.type() !== null ? this.type().unpack() : null);
+ _o.id = this.id();
+ _o.offset = this.offset();
+ _o.defaultInteger = this.defaultInteger();
+ _o.defaultReal = this.defaultReal();
+ _o.deprecated = this.deprecated();
+ _o.required = this.required();
+ _o.key = this.key();
+ _o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
+ _o.optional = this.optional();
+ _o.padding = this.padding();
+ }
+}
+export class FieldT {
+ constructor(name = null, type = null, id = 0, offset = 0, defaultInteger = BigInt('0'), defaultReal = 0.0, deprecated = false, required = false, key = false, attributes = [], documentation = [], optional = false, padding = 0) {
+ this.name = name;
+ this.type = type;
+ this.id = id;
+ this.offset = offset;
+ this.defaultInteger = defaultInteger;
+ this.defaultReal = defaultReal;
+ this.deprecated = deprecated;
+ this.required = required;
+ this.key = key;
+ this.attributes = attributes;
+ this.documentation = documentation;
+ this.optional = optional;
+ this.padding = padding;
+ }
+ pack(builder) {
+ const name = (this.name !== null ? builder.createString(this.name) : 0);
+ const type = (this.type !== null ? this.type.pack(builder) : 0);
+ const attributes = Field.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = Field.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ Field.startField(builder);
+ Field.addName(builder, name);
+ Field.addType(builder, type);
+ Field.addId(builder, this.id);
+ Field.addOffset(builder, this.offset);
+ Field.addDefaultInteger(builder, this.defaultInteger);
+ Field.addDefaultReal(builder, this.defaultReal);
+ Field.addDeprecated(builder, this.deprecated);
+ Field.addRequired(builder, this.required);
+ Field.addKey(builder, this.key);
+ Field.addAttributes(builder, attributes);
+ Field.addDocumentation(builder, documentation);
+ Field.addOptional(builder, this.optional);
+ Field.addPadding(builder, this.padding);
+ return Field.endField(builder);
+ }
+}
+export class Object_ {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsObject(bb, obj) {
+ return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsObject(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Object_()).__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;
+ }
+ fields(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? (obj || new Field()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ fieldsLength() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ isStruct() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
+ }
+ mutate_is_struct(value) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt8(this.bb_pos + offset, +value);
+ return true;
+ }
+ minalign() {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+ }
+ mutate_minalign(value) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ bytesize() {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+ }
+ mutate_bytesize(value) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ attributes(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ attributesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ documentation(index, optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+ }
+ documentationLength() {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ declarationFile(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 18);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_Object';
+ }
+ static startObject(builder) {
+ builder.startObject(8);
+ }
+ static addName(builder, nameOffset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+ }
+ static addFields(builder, fieldsOffset) {
+ builder.addFieldOffset(1, fieldsOffset, 0);
+ }
+ static createFieldsVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startFieldsVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addIsStruct(builder, isStruct) {
+ builder.addFieldInt8(2, +isStruct, +false);
+ }
+ static addMinalign(builder, minalign) {
+ builder.addFieldInt32(3, minalign, 0);
+ }
+ static addBytesize(builder, bytesize) {
+ builder.addFieldInt32(4, bytesize, 0);
+ }
+ static addAttributes(builder, attributesOffset) {
+ builder.addFieldOffset(5, attributesOffset, 0);
+ }
+ static createAttributesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startAttributesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addDocumentation(builder, documentationOffset) {
+ builder.addFieldOffset(6, documentationOffset, 0);
+ }
+ static createDocumentationVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startDocumentationVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addDeclarationFile(builder, declarationFileOffset) {
+ builder.addFieldOffset(7, declarationFileOffset, 0);
+ }
+ static endObject(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // name
+ builder.requiredField(offset, 6); // fields
+ return offset;
+ }
+ static createObject(builder, nameOffset, fieldsOffset, isStruct, minalign, bytesize, attributesOffset, documentationOffset, declarationFileOffset) {
+ Object_.startObject(builder);
+ Object_.addName(builder, nameOffset);
+ Object_.addFields(builder, fieldsOffset);
+ Object_.addIsStruct(builder, isStruct);
+ Object_.addMinalign(builder, minalign);
+ Object_.addBytesize(builder, bytesize);
+ Object_.addAttributes(builder, attributesOffset);
+ Object_.addDocumentation(builder, documentationOffset);
+ Object_.addDeclarationFile(builder, declarationFileOffset);
+ return Object_.endObject(builder);
+ }
+ unpack() {
+ return new Object_T(this.name(), this.bb.createObjList(this.fields.bind(this), this.fieldsLength()), this.isStruct(), this.minalign(), this.bytesize(), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile());
+ }
+ unpackTo(_o) {
+ _o.name = this.name();
+ _o.fields = this.bb.createObjList(this.fields.bind(this), this.fieldsLength());
+ _o.isStruct = this.isStruct();
+ _o.minalign = this.minalign();
+ _o.bytesize = this.bytesize();
+ _o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
+ _o.declarationFile = this.declarationFile();
+ }
+}
+export class Object_T {
+ constructor(name = null, fields = [], isStruct = false, minalign = 0, bytesize = 0, attributes = [], documentation = [], declarationFile = null) {
+ this.name = name;
+ this.fields = fields;
+ this.isStruct = isStruct;
+ this.minalign = minalign;
+ this.bytesize = bytesize;
+ this.attributes = attributes;
+ this.documentation = documentation;
+ this.declarationFile = declarationFile;
+ }
+ pack(builder) {
+ const name = (this.name !== null ? builder.createString(this.name) : 0);
+ const fields = Object_.createFieldsVector(builder, builder.createObjectOffsetList(this.fields));
+ const attributes = Object_.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = Object_.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile) : 0);
+ return Object_.createObject(builder, name, fields, this.isStruct, this.minalign, this.bytesize, attributes, documentation, declarationFile);
+ }
+}
+export class RPCCall {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsRPCCall(bb, obj) {
+ return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsRPCCall(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new RPCCall()).__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;
+ }
+ request(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ response(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ attributes(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ attributesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ documentation(index, optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+ }
+ documentationLength() {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_RPCCall';
+ }
+ static startRPCCall(builder) {
+ builder.startObject(5);
+ }
+ static addName(builder, nameOffset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+ }
+ static addRequest(builder, requestOffset) {
+ builder.addFieldOffset(1, requestOffset, 0);
+ }
+ static addResponse(builder, responseOffset) {
+ builder.addFieldOffset(2, responseOffset, 0);
+ }
+ static addAttributes(builder, attributesOffset) {
+ builder.addFieldOffset(3, attributesOffset, 0);
+ }
+ static createAttributesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startAttributesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addDocumentation(builder, documentationOffset) {
+ builder.addFieldOffset(4, documentationOffset, 0);
+ }
+ static createDocumentationVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startDocumentationVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static endRPCCall(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // name
+ builder.requiredField(offset, 6); // request
+ builder.requiredField(offset, 8); // response
+ return offset;
+ }
+ unpack() {
+ return new RPCCallT(this.name(), (this.request() !== null ? this.request().unpack() : null), (this.response() !== null ? this.response().unpack() : null), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()));
+ }
+ unpackTo(_o) {
+ _o.name = this.name();
+ _o.request = (this.request() !== null ? this.request().unpack() : null);
+ _o.response = (this.response() !== null ? this.response().unpack() : null);
+ _o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
+ }
+}
+export class RPCCallT {
+ constructor(name = null, request = null, response = null, attributes = [], documentation = []) {
+ this.name = name;
+ this.request = request;
+ this.response = response;
+ this.attributes = attributes;
+ this.documentation = documentation;
+ }
+ pack(builder) {
+ const name = (this.name !== null ? builder.createString(this.name) : 0);
+ const request = (this.request !== null ? this.request.pack(builder) : 0);
+ const response = (this.response !== null ? this.response.pack(builder) : 0);
+ const attributes = RPCCall.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = RPCCall.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ RPCCall.startRPCCall(builder);
+ RPCCall.addName(builder, name);
+ RPCCall.addRequest(builder, request);
+ RPCCall.addResponse(builder, response);
+ RPCCall.addAttributes(builder, attributes);
+ RPCCall.addDocumentation(builder, documentation);
+ return RPCCall.endRPCCall(builder);
+ }
+}
+export class Service {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsService(bb, obj) {
+ return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsService(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Service()).__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;
+ }
+ calls(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? (obj || new RPCCall()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ callsLength() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ attributes(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ attributesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ documentation(index, optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+ }
+ documentationLength() {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ declarationFile(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_Service';
+ }
+ static startService(builder) {
+ builder.startObject(5);
+ }
+ static addName(builder, nameOffset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+ }
+ static addCalls(builder, callsOffset) {
+ builder.addFieldOffset(1, callsOffset, 0);
+ }
+ static createCallsVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startCallsVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addAttributes(builder, attributesOffset) {
+ builder.addFieldOffset(2, attributesOffset, 0);
+ }
+ static createAttributesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startAttributesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addDocumentation(builder, documentationOffset) {
+ builder.addFieldOffset(3, documentationOffset, 0);
+ }
+ static createDocumentationVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startDocumentationVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addDeclarationFile(builder, declarationFileOffset) {
+ builder.addFieldOffset(4, declarationFileOffset, 0);
+ }
+ static endService(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // name
+ return offset;
+ }
+ static createService(builder, nameOffset, callsOffset, attributesOffset, documentationOffset, declarationFileOffset) {
+ Service.startService(builder);
+ Service.addName(builder, nameOffset);
+ Service.addCalls(builder, callsOffset);
+ Service.addAttributes(builder, attributesOffset);
+ Service.addDocumentation(builder, documentationOffset);
+ Service.addDeclarationFile(builder, declarationFileOffset);
+ return Service.endService(builder);
+ }
+ unpack() {
+ return new ServiceT(this.name(), this.bb.createObjList(this.calls.bind(this), this.callsLength()), this.bb.createObjList(this.attributes.bind(this), this.attributesLength()), this.bb.createScalarList(this.documentation.bind(this), this.documentationLength()), this.declarationFile());
+ }
+ unpackTo(_o) {
+ _o.name = this.name();
+ _o.calls = this.bb.createObjList(this.calls.bind(this), this.callsLength());
+ _o.attributes = this.bb.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb.createScalarList(this.documentation.bind(this), this.documentationLength());
+ _o.declarationFile = this.declarationFile();
+ }
+}
+export class ServiceT {
+ constructor(name = null, calls = [], attributes = [], documentation = [], declarationFile = null) {
+ this.name = name;
+ this.calls = calls;
+ this.attributes = attributes;
+ this.documentation = documentation;
+ this.declarationFile = declarationFile;
+ }
+ pack(builder) {
+ const name = (this.name !== null ? builder.createString(this.name) : 0);
+ const calls = Service.createCallsVector(builder, builder.createObjectOffsetList(this.calls));
+ const attributes = Service.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = Service.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile) : 0);
+ return Service.createService(builder, name, calls, attributes, documentation, declarationFile);
+ }
+}
+/**
+ * File specific information.
+ * Symbols declared within a file may be recovered by iterating over all
+ * symbols and examining the `declaration_file` field.
+ */
+export class SchemaFile {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsSchemaFile(bb, obj) {
+ return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsSchemaFile(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ filename(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ includedFilenames(index, optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+ }
+ includedFilenamesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_SchemaFile';
+ }
+ static startSchemaFile(builder) {
+ builder.startObject(2);
+ }
+ static addFilename(builder, filenameOffset) {
+ builder.addFieldOffset(0, filenameOffset, 0);
+ }
+ static addIncludedFilenames(builder, includedFilenamesOffset) {
+ builder.addFieldOffset(1, includedFilenamesOffset, 0);
+ }
+ static createIncludedFilenamesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startIncludedFilenamesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static endSchemaFile(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // filename
+ return offset;
+ }
+ static createSchemaFile(builder, filenameOffset, includedFilenamesOffset) {
+ SchemaFile.startSchemaFile(builder);
+ SchemaFile.addFilename(builder, filenameOffset);
+ SchemaFile.addIncludedFilenames(builder, includedFilenamesOffset);
+ return SchemaFile.endSchemaFile(builder);
+ }
+ unpack() {
+ return new SchemaFileT(this.filename(), this.bb.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength()));
+ }
+ unpackTo(_o) {
+ _o.filename = this.filename();
+ _o.includedFilenames = this.bb.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength());
+ }
+}
+export class SchemaFileT {
+ constructor(filename = null, includedFilenames = []) {
+ this.filename = filename;
+ this.includedFilenames = includedFilenames;
+ }
+ pack(builder) {
+ const filename = (this.filename !== null ? builder.createString(this.filename) : 0);
+ const includedFilenames = SchemaFile.createIncludedFilenamesVector(builder, builder.createObjectOffsetList(this.includedFilenames));
+ return SchemaFile.createSchemaFile(builder, filename, includedFilenames);
+ }
+}
+export class Schema {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsSchema(bb, obj) {
+ return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsSchema(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static bufferHasIdentifier(bb) {
+ return bb.__has_identifier('BFBS');
+ }
+ objects(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ objectsLength() {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ enums(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? (obj || new Enum()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ enumsLength() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ fileIdent(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ fileExt(optionalEncoding) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
+ }
+ rootTable(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? (obj || new Object_()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ services(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? (obj || new Service()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ servicesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ advancedFeatures() {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
+ }
+ mutate_advanced_features(value) {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeUint64(this.bb_pos + offset, value);
+ return true;
+ }
+ /**
+ * All the files used in this compilation. Files are relative to where
+ * flatc was invoked.
+ */
+ fbsFiles(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 18);
+ return offset ? (obj || new SchemaFile()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
+ }
+ fbsFilesLength() {
+ const offset = this.bb.__offset(this.bb_pos, 18);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ static getFullyQualifiedName() {
+ return 'reflection_Schema';
+ }
+ static startSchema(builder) {
+ builder.startObject(8);
+ }
+ static addObjects(builder, objectsOffset) {
+ builder.addFieldOffset(0, objectsOffset, 0);
+ }
+ static createObjectsVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startObjectsVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addEnums(builder, enumsOffset) {
+ builder.addFieldOffset(1, enumsOffset, 0);
+ }
+ static createEnumsVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startEnumsVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addFileIdent(builder, fileIdentOffset) {
+ builder.addFieldOffset(2, fileIdentOffset, 0);
+ }
+ static addFileExt(builder, fileExtOffset) {
+ builder.addFieldOffset(3, fileExtOffset, 0);
+ }
+ static addRootTable(builder, rootTableOffset) {
+ builder.addFieldOffset(4, rootTableOffset, 0);
+ }
+ static addServices(builder, servicesOffset) {
+ builder.addFieldOffset(5, servicesOffset, 0);
+ }
+ static createServicesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startServicesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static addAdvancedFeatures(builder, advancedFeatures) {
+ builder.addFieldInt64(6, advancedFeatures, BigInt('0'));
+ }
+ static addFbsFiles(builder, fbsFilesOffset) {
+ builder.addFieldOffset(7, fbsFilesOffset, 0);
+ }
+ static createFbsFilesVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startFbsFilesVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static endSchema(builder) {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4); // objects
+ builder.requiredField(offset, 6); // enums
+ return offset;
+ }
+ static finishSchemaBuffer(builder, offset) {
+ builder.finish(offset, 'BFBS');
+ }
+ static finishSizePrefixedSchemaBuffer(builder, offset) {
+ builder.finish(offset, 'BFBS', true);
+ }
+ unpack() {
+ return new SchemaT(this.bb.createObjList(this.objects.bind(this), this.objectsLength()), this.bb.createObjList(this.enums.bind(this), this.enumsLength()), this.fileIdent(), this.fileExt(), (this.rootTable() !== null ? this.rootTable().unpack() : null), this.bb.createObjList(this.services.bind(this), this.servicesLength()), this.advancedFeatures(), this.bb.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength()));
+ }
+ unpackTo(_o) {
+ _o.objects = this.bb.createObjList(this.objects.bind(this), this.objectsLength());
+ _o.enums = this.bb.createObjList(this.enums.bind(this), this.enumsLength());
+ _o.fileIdent = this.fileIdent();
+ _o.fileExt = this.fileExt();
+ _o.rootTable = (this.rootTable() !== null ? this.rootTable().unpack() : null);
+ _o.services = this.bb.createObjList(this.services.bind(this), this.servicesLength());
+ _o.advancedFeatures = this.advancedFeatures();
+ _o.fbsFiles = this.bb.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength());
+ }
+}
+export class SchemaT {
+ constructor(objects = [], enums = [], fileIdent = null, fileExt = null, rootTable = null, services = [], advancedFeatures = BigInt('0'), fbsFiles = []) {
+ this.objects = objects;
+ this.enums = enums;
+ this.fileIdent = fileIdent;
+ this.fileExt = fileExt;
+ this.rootTable = rootTable;
+ this.services = services;
+ this.advancedFeatures = advancedFeatures;
+ this.fbsFiles = fbsFiles;
+ }
+ pack(builder) {
+ const objects = Schema.createObjectsVector(builder, builder.createObjectOffsetList(this.objects));
+ const enums = Schema.createEnumsVector(builder, builder.createObjectOffsetList(this.enums));
+ const fileIdent = (this.fileIdent !== null ? builder.createString(this.fileIdent) : 0);
+ const fileExt = (this.fileExt !== null ? builder.createString(this.fileExt) : 0);
+ const rootTable = (this.rootTable !== null ? this.rootTable.pack(builder) : 0);
+ const services = Schema.createServicesVector(builder, builder.createObjectOffsetList(this.services));
+ const fbsFiles = Schema.createFbsFilesVector(builder, builder.createObjectOffsetList(this.fbsFiles));
+ Schema.startSchema(builder);
+ Schema.addObjects(builder, objects);
+ Schema.addEnums(builder, enums);
+ Schema.addFileIdent(builder, fileIdent);
+ Schema.addFileExt(builder, fileExt);
+ Schema.addRootTable(builder, rootTable);
+ Schema.addServices(builder, services);
+ Schema.addAdvancedFeatures(builder, this.advancedFeatures);
+ Schema.addFbsFiles(builder, fbsFiles);
+ return Schema.endSchema(builder);
+ }
+}
diff --git a/tests/ts/reflection_generated.ts b/tests/ts/reflection_generated.ts
new file mode 100644
index 0000000..4bb1222
--- /dev/null
+++ b/tests/ts/reflection_generated.ts
@@ -0,0 +1,2100 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+export enum BaseType {
+ None = 0,
+ UType = 1,
+ Bool = 2,
+ Byte = 3,
+ UByte = 4,
+ Short = 5,
+ UShort = 6,
+ Int = 7,
+ UInt = 8,
+ Long = 9,
+ ULong = 10,
+ Float = 11,
+ Double = 12,
+ String = 13,
+ Vector = 14,
+ Obj = 15,
+ Union = 16,
+ Array = 17,
+ MaxBaseType = 18
+}
+
+/**
+ * New schema language features that are not supported by old code generators.
+ */
+export enum AdvancedFeatures {
+ AdvancedArrayFeatures = '1',
+ AdvancedUnionFeatures = '2',
+ OptionalScalars = '4',
+ DefaultVectorsAndStrings = '8'
+}
+
+export class Type {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Type {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsType(bb:flatbuffers.ByteBuffer, obj?:Type):Type {
+ return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsType(bb:flatbuffers.ByteBuffer, obj?:Type):Type {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Type()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+baseType():BaseType {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? this.bb!.readInt8(this.bb_pos + offset) : BaseType.None;
+}
+
+mutate_base_type(value:BaseType):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, value);
+ return true;
+}
+
+element():BaseType {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.readInt8(this.bb_pos + offset) : BaseType.None;
+}
+
+mutate_element(value:BaseType):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, value);
+ return true;
+}
+
+index():number {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : -1;
+}
+
+mutate_index(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+fixedLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+mutate_fixed_length(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint16(this.bb_pos + offset, value);
+ return true;
+}
+
+/**
+ * The size (octets) of the `base_type` field.
+ */
+baseSize():number {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.readUint32(this.bb_pos + offset) : 4;
+}
+
+mutate_base_size(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint32(this.bb_pos + offset, value);
+ return true;
+}
+
+/**
+ * The size (octets) of the `element` field, if present.
+ */
+elementSize():number {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
+}
+
+mutate_element_size(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint32(this.bb_pos + offset, value);
+ return true;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_Type';
+}
+
+static startType(builder:flatbuffers.Builder) {
+ builder.startObject(6);
+}
+
+static addBaseType(builder:flatbuffers.Builder, baseType:BaseType) {
+ builder.addFieldInt8(0, baseType, BaseType.None);
+}
+
+static addElement(builder:flatbuffers.Builder, element:BaseType) {
+ builder.addFieldInt8(1, element, BaseType.None);
+}
+
+static addIndex(builder:flatbuffers.Builder, index:number) {
+ builder.addFieldInt32(2, index, -1);
+}
+
+static addFixedLength(builder:flatbuffers.Builder, fixedLength:number) {
+ builder.addFieldInt16(3, fixedLength, 0);
+}
+
+static addBaseSize(builder:flatbuffers.Builder, baseSize:number) {
+ builder.addFieldInt32(4, baseSize, 4);
+}
+
+static addElementSize(builder:flatbuffers.Builder, elementSize:number) {
+ builder.addFieldInt32(5, elementSize, 0);
+}
+
+static endType(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createType(builder:flatbuffers.Builder, baseType:BaseType, element:BaseType, index:number, fixedLength:number, baseSize:number, elementSize:number):flatbuffers.Offset {
+ Type.startType(builder);
+ Type.addBaseType(builder, baseType);
+ Type.addElement(builder, element);
+ Type.addIndex(builder, index);
+ Type.addFixedLength(builder, fixedLength);
+ Type.addBaseSize(builder, baseSize);
+ Type.addElementSize(builder, elementSize);
+ return Type.endType(builder);
+}
+
+unpack(): TypeT {
+ return new TypeT(
+ this.baseType(),
+ this.element(),
+ this.index(),
+ this.fixedLength(),
+ this.baseSize(),
+ this.elementSize()
+ );
+}
+
+
+unpackTo(_o: TypeT): void {
+ _o.baseType = this.baseType();
+ _o.element = this.element();
+ _o.index = this.index();
+ _o.fixedLength = this.fixedLength();
+ _o.baseSize = this.baseSize();
+ _o.elementSize = this.elementSize();
+}
+}
+
+export class TypeT {
+constructor(
+ public baseType: BaseType = BaseType.None,
+ public element: BaseType = BaseType.None,
+ public index: number = -1,
+ public fixedLength: number = 0,
+ public baseSize: number = 4,
+ public elementSize: number = 0
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ return Type.createType(builder,
+ this.baseType,
+ this.element,
+ this.index,
+ this.fixedLength,
+ this.baseSize,
+ this.elementSize
+ );
+}
+}
+
+export class KeyValue {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):KeyValue {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsKeyValue(bb:flatbuffers.ByteBuffer, obj?:KeyValue):KeyValue {
+ return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsKeyValue(bb:flatbuffers.ByteBuffer, obj?:KeyValue):KeyValue {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new KeyValue()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+key():string|null
+key(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+key(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;
+}
+
+value():string|null
+value(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+value(optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_KeyValue';
+}
+
+static startKeyValue(builder:flatbuffers.Builder) {
+ builder.startObject(2);
+}
+
+static addKey(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, keyOffset, 0);
+}
+
+static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, valueOffset, 0);
+}
+
+static endKeyValue(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // key
+ return offset;
+}
+
+static createKeyValue(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset, valueOffset:flatbuffers.Offset):flatbuffers.Offset {
+ KeyValue.startKeyValue(builder);
+ KeyValue.addKey(builder, keyOffset);
+ KeyValue.addValue(builder, valueOffset);
+ return KeyValue.endKeyValue(builder);
+}
+
+unpack(): KeyValueT {
+ return new KeyValueT(
+ this.key(),
+ this.value()
+ );
+}
+
+
+unpackTo(_o: KeyValueT): void {
+ _o.key = this.key();
+ _o.value = this.value();
+}
+}
+
+export class KeyValueT {
+constructor(
+ public key: string|Uint8Array|null = null,
+ public value: string|Uint8Array|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const key = (this.key !== null ? builder.createString(this.key!) : 0);
+ const value = (this.value !== null ? builder.createString(this.value!) : 0);
+
+ return KeyValue.createKeyValue(builder,
+ key,
+ value
+ );
+}
+}
+
+export class EnumVal {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):EnumVal {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsEnumVal(bb:flatbuffers.ByteBuffer, obj?:EnumVal):EnumVal {
+ return (obj || new EnumVal()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsEnumVal(bb:flatbuffers.ByteBuffer, obj?:EnumVal):EnumVal {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new EnumVal()).__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;
+}
+
+value():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_value(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt64(this.bb_pos + offset, value);
+ return true;
+}
+
+unionType(obj?:Type):Type|null {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? (obj || new Type()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_EnumVal';
+}
+
+static startEnumVal(builder:flatbuffers.Builder) {
+ builder.startObject(5);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addValue(builder:flatbuffers.Builder, value:bigint) {
+ builder.addFieldInt64(1, value, BigInt('0'));
+}
+
+static addUnionType(builder:flatbuffers.Builder, unionTypeOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(3, unionTypeOffset, 0);
+}
+
+static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(4, documentationOffset, 0);
+}
+
+static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static endEnumVal(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // name
+ return offset;
+}
+
+
+unpack(): EnumValT {
+ return new EnumValT(
+ this.name(),
+ this.value(),
+ (this.unionType() !== null ? this.unionType()!.unpack() : null),
+ this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength())
+ );
+}
+
+
+unpackTo(_o: EnumValT): void {
+ _o.name = this.name();
+ _o.value = this.value();
+ _o.unionType = (this.unionType() !== null ? this.unionType()!.unpack() : null);
+ _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+}
+}
+
+export class EnumValT {
+constructor(
+ public name: string|Uint8Array|null = null,
+ public value: bigint = BigInt('0'),
+ public unionType: TypeT|null = null,
+ public documentation: (string)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const name = (this.name !== null ? builder.createString(this.name!) : 0);
+ const unionType = (this.unionType !== null ? this.unionType!.pack(builder) : 0);
+ const documentation = EnumVal.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+
+ EnumVal.startEnumVal(builder);
+ EnumVal.addName(builder, name);
+ EnumVal.addValue(builder, this.value);
+ EnumVal.addUnionType(builder, unionType);
+ EnumVal.addDocumentation(builder, documentation);
+
+ return EnumVal.endEnumVal(builder);
+}
+}
+
+export class Enum {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Enum {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsEnum(bb:flatbuffers.ByteBuffer, obj?:Enum):Enum {
+ return (obj || new Enum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsEnum(bb:flatbuffers.ByteBuffer, obj?:Enum):Enum {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Enum()).__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;
+}
+
+values(index: number, obj?:EnumVal):EnumVal|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? (obj || new EnumVal()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+valuesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+isUnion():boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_is_union(value:boolean):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, +value);
+ return true;
+}
+
+underlyingType(obj?:Type):Type|null {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? (obj || new Type()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+attributes(index: number, obj?:KeyValue):KeyValue|null {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+attributesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+/**
+ * File that this Enum is declared in.
+ */
+declarationFile():string|null
+declarationFile(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+declarationFile(optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_Enum';
+}
+
+static startEnum(builder:flatbuffers.Builder) {
+ builder.startObject(7);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addValues(builder:flatbuffers.Builder, valuesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, valuesOffset, 0);
+}
+
+static createValuesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startValuesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addIsUnion(builder:flatbuffers.Builder, isUnion:boolean) {
+ builder.addFieldInt8(2, +isUnion, +false);
+}
+
+static addUnderlyingType(builder:flatbuffers.Builder, underlyingTypeOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(3, underlyingTypeOffset, 0);
+}
+
+static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(4, attributesOffset, 0);
+}
+
+static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(5, documentationOffset, 0);
+}
+
+static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addDeclarationFile(builder:flatbuffers.Builder, declarationFileOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(6, declarationFileOffset, 0);
+}
+
+static endEnum(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // name
+ builder.requiredField(offset, 6) // values
+ builder.requiredField(offset, 10) // underlying_type
+ return offset;
+}
+
+
+unpack(): EnumT {
+ return new EnumT(
+ this.name(),
+ this.bb!.createObjList(this.values.bind(this), this.valuesLength()),
+ this.isUnion(),
+ (this.underlyingType() !== null ? this.underlyingType()!.unpack() : null),
+ this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
+ this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
+ this.declarationFile()
+ );
+}
+
+
+unpackTo(_o: EnumT): void {
+ _o.name = this.name();
+ _o.values = this.bb!.createObjList(this.values.bind(this), this.valuesLength());
+ _o.isUnion = this.isUnion();
+ _o.underlyingType = (this.underlyingType() !== null ? this.underlyingType()!.unpack() : null);
+ _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+ _o.declarationFile = this.declarationFile();
+}
+}
+
+export class EnumT {
+constructor(
+ public name: string|Uint8Array|null = null,
+ public values: (EnumValT)[] = [],
+ public isUnion: boolean = false,
+ public underlyingType: TypeT|null = null,
+ public attributes: (KeyValueT)[] = [],
+ public documentation: (string)[] = [],
+ public declarationFile: string|Uint8Array|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const name = (this.name !== null ? builder.createString(this.name!) : 0);
+ const values = Enum.createValuesVector(builder, builder.createObjectOffsetList(this.values));
+ const underlyingType = (this.underlyingType !== null ? this.underlyingType!.pack(builder) : 0);
+ const attributes = Enum.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = Enum.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile!) : 0);
+
+ Enum.startEnum(builder);
+ Enum.addName(builder, name);
+ Enum.addValues(builder, values);
+ Enum.addIsUnion(builder, this.isUnion);
+ Enum.addUnderlyingType(builder, underlyingType);
+ Enum.addAttributes(builder, attributes);
+ Enum.addDocumentation(builder, documentation);
+ Enum.addDeclarationFile(builder, declarationFile);
+
+ return Enum.endEnum(builder);
+}
+}
+
+export class Field {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Field {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsField(bb:flatbuffers.ByteBuffer, obj?:Field):Field {
+ return (obj || new Field()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsField(bb:flatbuffers.ByteBuffer, obj?:Field):Field {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Field()).__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;
+}
+
+type(obj?:Type):Type|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? (obj || new Type()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+id():number {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+mutate_id(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint16(this.bb_pos + offset, value);
+ return true;
+}
+
+offset():number {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+mutate_offset(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint16(this.bb_pos + offset, value);
+ return true;
+}
+
+defaultInteger():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_default_integer(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt64(this.bb_pos + offset, value);
+ return true;
+}
+
+defaultReal():number {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
+}
+
+mutate_default_real(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeFloat64(this.bb_pos + offset, value);
+ return true;
+}
+
+deprecated():boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_deprecated(value:boolean):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, +value);
+ return true;
+}
+
+required():boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 18);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_required(value:boolean):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 18);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, +value);
+ return true;
+}
+
+key():boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 20);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_key(value:boolean):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 20);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, +value);
+ return true;
+}
+
+attributes(index: number, obj?:KeyValue):KeyValue|null {
+ const offset = this.bb!.__offset(this.bb_pos, 22);
+ return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+attributesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 22);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 24);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 24);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+optional():boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 26);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_optional(value:boolean):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 26);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, +value);
+ return true;
+}
+
+/**
+ * Number of padding octets to always add after this field. Structs only.
+ */
+padding():number {
+ const offset = this.bb!.__offset(this.bb_pos, 28);
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+mutate_padding(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 28);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint16(this.bb_pos + offset, value);
+ return true;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_Field';
+}
+
+static startField(builder:flatbuffers.Builder) {
+ builder.startObject(13);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addType(builder:flatbuffers.Builder, typeOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, typeOffset, 0);
+}
+
+static addId(builder:flatbuffers.Builder, id:number) {
+ builder.addFieldInt16(2, id, 0);
+}
+
+static addOffset(builder:flatbuffers.Builder, offset:number) {
+ builder.addFieldInt16(3, offset, 0);
+}
+
+static addDefaultInteger(builder:flatbuffers.Builder, defaultInteger:bigint) {
+ builder.addFieldInt64(4, defaultInteger, BigInt('0'));
+}
+
+static addDefaultReal(builder:flatbuffers.Builder, defaultReal:number) {
+ builder.addFieldFloat64(5, defaultReal, 0.0);
+}
+
+static addDeprecated(builder:flatbuffers.Builder, deprecated:boolean) {
+ builder.addFieldInt8(6, +deprecated, +false);
+}
+
+static addRequired(builder:flatbuffers.Builder, required:boolean) {
+ builder.addFieldInt8(7, +required, +false);
+}
+
+static addKey(builder:flatbuffers.Builder, key:boolean) {
+ builder.addFieldInt8(8, +key, +false);
+}
+
+static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(9, attributesOffset, 0);
+}
+
+static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(10, documentationOffset, 0);
+}
+
+static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addOptional(builder:flatbuffers.Builder, optional:boolean) {
+ builder.addFieldInt8(11, +optional, +false);
+}
+
+static addPadding(builder:flatbuffers.Builder, padding:number) {
+ builder.addFieldInt16(12, padding, 0);
+}
+
+static endField(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // name
+ builder.requiredField(offset, 6) // type
+ return offset;
+}
+
+
+unpack(): FieldT {
+ return new FieldT(
+ this.name(),
+ (this.type() !== null ? this.type()!.unpack() : null),
+ this.id(),
+ this.offset(),
+ this.defaultInteger(),
+ this.defaultReal(),
+ this.deprecated(),
+ this.required(),
+ this.key(),
+ this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
+ this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
+ this.optional(),
+ this.padding()
+ );
+}
+
+
+unpackTo(_o: FieldT): void {
+ _o.name = this.name();
+ _o.type = (this.type() !== null ? this.type()!.unpack() : null);
+ _o.id = this.id();
+ _o.offset = this.offset();
+ _o.defaultInteger = this.defaultInteger();
+ _o.defaultReal = this.defaultReal();
+ _o.deprecated = this.deprecated();
+ _o.required = this.required();
+ _o.key = this.key();
+ _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+ _o.optional = this.optional();
+ _o.padding = this.padding();
+}
+}
+
+export class FieldT {
+constructor(
+ public name: string|Uint8Array|null = null,
+ public type: TypeT|null = null,
+ public id: number = 0,
+ public offset: number = 0,
+ public defaultInteger: bigint = BigInt('0'),
+ public defaultReal: number = 0.0,
+ public deprecated: boolean = false,
+ public required: boolean = false,
+ public key: boolean = false,
+ public attributes: (KeyValueT)[] = [],
+ public documentation: (string)[] = [],
+ public optional: boolean = false,
+ public padding: number = 0
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const name = (this.name !== null ? builder.createString(this.name!) : 0);
+ const type = (this.type !== null ? this.type!.pack(builder) : 0);
+ const attributes = Field.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = Field.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+
+ Field.startField(builder);
+ Field.addName(builder, name);
+ Field.addType(builder, type);
+ Field.addId(builder, this.id);
+ Field.addOffset(builder, this.offset);
+ Field.addDefaultInteger(builder, this.defaultInteger);
+ Field.addDefaultReal(builder, this.defaultReal);
+ Field.addDeprecated(builder, this.deprecated);
+ Field.addRequired(builder, this.required);
+ Field.addKey(builder, this.key);
+ Field.addAttributes(builder, attributes);
+ Field.addDocumentation(builder, documentation);
+ Field.addOptional(builder, this.optional);
+ Field.addPadding(builder, this.padding);
+
+ return Field.endField(builder);
+}
+}
+
+export class Object_ {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Object_ {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsObject(bb:flatbuffers.ByteBuffer, obj?:Object_):Object_ {
+ return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsObject(bb:flatbuffers.ByteBuffer, obj?:Object_):Object_ {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Object_()).__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;
+}
+
+fields(index: number, obj?:Field):Field|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? (obj || new Field()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+fieldsLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+isStruct():boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+mutate_is_struct(value:boolean):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt8(this.bb_pos + offset, +value);
+ return true;
+}
+
+minalign():number {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_minalign(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+bytesize():number {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_bytesize(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+attributes(index: number, obj?:KeyValue):KeyValue|null {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+attributesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+/**
+ * File that this Object is declared in.
+ */
+declarationFile():string|null
+declarationFile(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+declarationFile(optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 18);
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_Object';
+}
+
+static startObject(builder:flatbuffers.Builder) {
+ builder.startObject(8);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addFields(builder:flatbuffers.Builder, fieldsOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, fieldsOffset, 0);
+}
+
+static createFieldsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startFieldsVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addIsStruct(builder:flatbuffers.Builder, isStruct:boolean) {
+ builder.addFieldInt8(2, +isStruct, +false);
+}
+
+static addMinalign(builder:flatbuffers.Builder, minalign:number) {
+ builder.addFieldInt32(3, minalign, 0);
+}
+
+static addBytesize(builder:flatbuffers.Builder, bytesize:number) {
+ builder.addFieldInt32(4, bytesize, 0);
+}
+
+static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(5, attributesOffset, 0);
+}
+
+static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(6, documentationOffset, 0);
+}
+
+static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addDeclarationFile(builder:flatbuffers.Builder, declarationFileOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(7, declarationFileOffset, 0);
+}
+
+static endObject(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // name
+ builder.requiredField(offset, 6) // fields
+ return offset;
+}
+
+static createObject(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, fieldsOffset:flatbuffers.Offset, isStruct:boolean, minalign:number, bytesize:number, attributesOffset:flatbuffers.Offset, documentationOffset:flatbuffers.Offset, declarationFileOffset:flatbuffers.Offset):flatbuffers.Offset {
+ Object_.startObject(builder);
+ Object_.addName(builder, nameOffset);
+ Object_.addFields(builder, fieldsOffset);
+ Object_.addIsStruct(builder, isStruct);
+ Object_.addMinalign(builder, minalign);
+ Object_.addBytesize(builder, bytesize);
+ Object_.addAttributes(builder, attributesOffset);
+ Object_.addDocumentation(builder, documentationOffset);
+ Object_.addDeclarationFile(builder, declarationFileOffset);
+ return Object_.endObject(builder);
+}
+
+unpack(): Object_T {
+ return new Object_T(
+ this.name(),
+ this.bb!.createObjList(this.fields.bind(this), this.fieldsLength()),
+ this.isStruct(),
+ this.minalign(),
+ this.bytesize(),
+ this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
+ this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
+ this.declarationFile()
+ );
+}
+
+
+unpackTo(_o: Object_T): void {
+ _o.name = this.name();
+ _o.fields = this.bb!.createObjList(this.fields.bind(this), this.fieldsLength());
+ _o.isStruct = this.isStruct();
+ _o.minalign = this.minalign();
+ _o.bytesize = this.bytesize();
+ _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+ _o.declarationFile = this.declarationFile();
+}
+}
+
+export class Object_T {
+constructor(
+ public name: string|Uint8Array|null = null,
+ public fields: (FieldT)[] = [],
+ public isStruct: boolean = false,
+ public minalign: number = 0,
+ public bytesize: number = 0,
+ public attributes: (KeyValueT)[] = [],
+ public documentation: (string)[] = [],
+ public declarationFile: string|Uint8Array|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const name = (this.name !== null ? builder.createString(this.name!) : 0);
+ const fields = Object_.createFieldsVector(builder, builder.createObjectOffsetList(this.fields));
+ const attributes = Object_.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = Object_.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile!) : 0);
+
+ return Object_.createObject(builder,
+ name,
+ fields,
+ this.isStruct,
+ this.minalign,
+ this.bytesize,
+ attributes,
+ documentation,
+ declarationFile
+ );
+}
+}
+
+export class RPCCall {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):RPCCall {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsRPCCall(bb:flatbuffers.ByteBuffer, obj?:RPCCall):RPCCall {
+ return (obj || new RPCCall()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsRPCCall(bb:flatbuffers.ByteBuffer, obj?:RPCCall):RPCCall {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new RPCCall()).__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;
+}
+
+request(obj?:Object_):Object_|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+response(obj?:Object_):Object_|null {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+attributes(index: number, obj?:KeyValue):KeyValue|null {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+attributesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_RPCCall';
+}
+
+static startRPCCall(builder:flatbuffers.Builder) {
+ builder.startObject(5);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addRequest(builder:flatbuffers.Builder, requestOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, requestOffset, 0);
+}
+
+static addResponse(builder:flatbuffers.Builder, responseOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(2, responseOffset, 0);
+}
+
+static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(3, attributesOffset, 0);
+}
+
+static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(4, documentationOffset, 0);
+}
+
+static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static endRPCCall(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // name
+ builder.requiredField(offset, 6) // request
+ builder.requiredField(offset, 8) // response
+ return offset;
+}
+
+
+unpack(): RPCCallT {
+ return new RPCCallT(
+ this.name(),
+ (this.request() !== null ? this.request()!.unpack() : null),
+ (this.response() !== null ? this.response()!.unpack() : null),
+ this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
+ this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength())
+ );
+}
+
+
+unpackTo(_o: RPCCallT): void {
+ _o.name = this.name();
+ _o.request = (this.request() !== null ? this.request()!.unpack() : null);
+ _o.response = (this.response() !== null ? this.response()!.unpack() : null);
+ _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+}
+}
+
+export class RPCCallT {
+constructor(
+ public name: string|Uint8Array|null = null,
+ public request: Object_T|null = null,
+ public response: Object_T|null = null,
+ public attributes: (KeyValueT)[] = [],
+ public documentation: (string)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const name = (this.name !== null ? builder.createString(this.name!) : 0);
+ const request = (this.request !== null ? this.request!.pack(builder) : 0);
+ const response = (this.response !== null ? this.response!.pack(builder) : 0);
+ const attributes = RPCCall.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = RPCCall.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+
+ RPCCall.startRPCCall(builder);
+ RPCCall.addName(builder, name);
+ RPCCall.addRequest(builder, request);
+ RPCCall.addResponse(builder, response);
+ RPCCall.addAttributes(builder, attributes);
+ RPCCall.addDocumentation(builder, documentation);
+
+ return RPCCall.endRPCCall(builder);
+}
+}
+
+export class Service {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Service {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsService(bb:flatbuffers.ByteBuffer, obj?:Service):Service {
+ return (obj || new Service()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsService(bb:flatbuffers.ByteBuffer, obj?:Service):Service {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Service()).__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;
+}
+
+calls(index: number, obj?:RPCCall):RPCCall|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? (obj || new RPCCall()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+callsLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+attributes(index: number, obj?:KeyValue):KeyValue|null {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? (obj || new KeyValue()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+attributesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+documentation(index: number):string
+documentation(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+documentation(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+documentationLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+/**
+ * File that this Service is declared in.
+ */
+declarationFile():string|null
+declarationFile(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+declarationFile(optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_Service';
+}
+
+static startService(builder:flatbuffers.Builder) {
+ builder.startObject(5);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, nameOffset, 0);
+}
+
+static addCalls(builder:flatbuffers.Builder, callsOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, callsOffset, 0);
+}
+
+static createCallsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startCallsVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addAttributes(builder:flatbuffers.Builder, attributesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(2, attributesOffset, 0);
+}
+
+static createAttributesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startAttributesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addDocumentation(builder:flatbuffers.Builder, documentationOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(3, documentationOffset, 0);
+}
+
+static createDocumentationVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startDocumentationVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addDeclarationFile(builder:flatbuffers.Builder, declarationFileOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(4, declarationFileOffset, 0);
+}
+
+static endService(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // name
+ return offset;
+}
+
+static createService(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset, callsOffset:flatbuffers.Offset, attributesOffset:flatbuffers.Offset, documentationOffset:flatbuffers.Offset, declarationFileOffset:flatbuffers.Offset):flatbuffers.Offset {
+ Service.startService(builder);
+ Service.addName(builder, nameOffset);
+ Service.addCalls(builder, callsOffset);
+ Service.addAttributes(builder, attributesOffset);
+ Service.addDocumentation(builder, documentationOffset);
+ Service.addDeclarationFile(builder, declarationFileOffset);
+ return Service.endService(builder);
+}
+
+unpack(): ServiceT {
+ return new ServiceT(
+ this.name(),
+ this.bb!.createObjList(this.calls.bind(this), this.callsLength()),
+ this.bb!.createObjList(this.attributes.bind(this), this.attributesLength()),
+ this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength()),
+ this.declarationFile()
+ );
+}
+
+
+unpackTo(_o: ServiceT): void {
+ _o.name = this.name();
+ _o.calls = this.bb!.createObjList(this.calls.bind(this), this.callsLength());
+ _o.attributes = this.bb!.createObjList(this.attributes.bind(this), this.attributesLength());
+ _o.documentation = this.bb!.createScalarList(this.documentation.bind(this), this.documentationLength());
+ _o.declarationFile = this.declarationFile();
+}
+}
+
+export class ServiceT {
+constructor(
+ public name: string|Uint8Array|null = null,
+ public calls: (RPCCallT)[] = [],
+ public attributes: (KeyValueT)[] = [],
+ public documentation: (string)[] = [],
+ public declarationFile: string|Uint8Array|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const name = (this.name !== null ? builder.createString(this.name!) : 0);
+ const calls = Service.createCallsVector(builder, builder.createObjectOffsetList(this.calls));
+ const attributes = Service.createAttributesVector(builder, builder.createObjectOffsetList(this.attributes));
+ const documentation = Service.createDocumentationVector(builder, builder.createObjectOffsetList(this.documentation));
+ const declarationFile = (this.declarationFile !== null ? builder.createString(this.declarationFile!) : 0);
+
+ return Service.createService(builder,
+ name,
+ calls,
+ attributes,
+ documentation,
+ declarationFile
+ );
+}
+}
+
+/**
+ * File specific information.
+ * Symbols declared within a file may be recovered by iterating over all
+ * symbols and examining the `declaration_file` field.
+ */
+export class SchemaFile {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):SchemaFile {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsSchemaFile(bb:flatbuffers.ByteBuffer, obj?:SchemaFile):SchemaFile {
+ return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsSchemaFile(bb:flatbuffers.ByteBuffer, obj?:SchemaFile):SchemaFile {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new SchemaFile()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+/**
+ * Filename, relative to project root.
+ */
+filename():string|null
+filename(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+filename(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;
+}
+
+/**
+ * Names of included files, relative to project root.
+ */
+includedFilenames(index: number):string
+includedFilenames(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+includedFilenames(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+includedFilenamesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_SchemaFile';
+}
+
+static startSchemaFile(builder:flatbuffers.Builder) {
+ builder.startObject(2);
+}
+
+static addFilename(builder:flatbuffers.Builder, filenameOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, filenameOffset, 0);
+}
+
+static addIncludedFilenames(builder:flatbuffers.Builder, includedFilenamesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, includedFilenamesOffset, 0);
+}
+
+static createIncludedFilenamesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startIncludedFilenamesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static endSchemaFile(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // filename
+ return offset;
+}
+
+static createSchemaFile(builder:flatbuffers.Builder, filenameOffset:flatbuffers.Offset, includedFilenamesOffset:flatbuffers.Offset):flatbuffers.Offset {
+ SchemaFile.startSchemaFile(builder);
+ SchemaFile.addFilename(builder, filenameOffset);
+ SchemaFile.addIncludedFilenames(builder, includedFilenamesOffset);
+ return SchemaFile.endSchemaFile(builder);
+}
+
+unpack(): SchemaFileT {
+ return new SchemaFileT(
+ this.filename(),
+ this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength())
+ );
+}
+
+
+unpackTo(_o: SchemaFileT): void {
+ _o.filename = this.filename();
+ _o.includedFilenames = this.bb!.createScalarList(this.includedFilenames.bind(this), this.includedFilenamesLength());
+}
+}
+
+export class SchemaFileT {
+constructor(
+ public filename: string|Uint8Array|null = null,
+ public includedFilenames: (string)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const filename = (this.filename !== null ? builder.createString(this.filename!) : 0);
+ const includedFilenames = SchemaFile.createIncludedFilenamesVector(builder, builder.createObjectOffsetList(this.includedFilenames));
+
+ return SchemaFile.createSchemaFile(builder,
+ filename,
+ includedFilenames
+ );
+}
+}
+
+export class Schema {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Schema {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsSchema(bb:flatbuffers.ByteBuffer, obj?:Schema):Schema {
+ return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsSchema(bb:flatbuffers.ByteBuffer, obj?:Schema):Schema {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
+ return bb.__has_identifier('BFBS');
+}
+
+objects(index: number, obj?:Object_):Object_|null {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+objectsLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+enums(index: number, obj?:Enum):Enum|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? (obj || new Enum()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+enumsLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+fileIdent():string|null
+fileIdent(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+fileIdent(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;
+}
+
+fileExt():string|null
+fileExt(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+fileExt(optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+rootTable(obj?:Object_):Object_|null {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? (obj || new Object_()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+services(index: number, obj?:Service):Service|null {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? (obj || new Service()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+servicesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+advancedFeatures():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+mutate_advanced_features(value:bigint):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeUint64(this.bb_pos + offset, value);
+ return true;
+}
+
+/**
+ * All the files used in this compilation. Files are relative to where
+ * flatc was invoked.
+ */
+fbsFiles(index: number, obj?:SchemaFile):SchemaFile|null {
+ const offset = this.bb!.__offset(this.bb_pos, 18);
+ return offset ? (obj || new SchemaFile()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+fbsFilesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 18);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+static getFullyQualifiedName():string {
+ return 'reflection_Schema';
+}
+
+static startSchema(builder:flatbuffers.Builder) {
+ builder.startObject(8);
+}
+
+static addObjects(builder:flatbuffers.Builder, objectsOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, objectsOffset, 0);
+}
+
+static createObjectsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startObjectsVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addEnums(builder:flatbuffers.Builder, enumsOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, enumsOffset, 0);
+}
+
+static createEnumsVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startEnumsVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addFileIdent(builder:flatbuffers.Builder, fileIdentOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(2, fileIdentOffset, 0);
+}
+
+static addFileExt(builder:flatbuffers.Builder, fileExtOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(3, fileExtOffset, 0);
+}
+
+static addRootTable(builder:flatbuffers.Builder, rootTableOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(4, rootTableOffset, 0);
+}
+
+static addServices(builder:flatbuffers.Builder, servicesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(5, servicesOffset, 0);
+}
+
+static createServicesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startServicesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addAdvancedFeatures(builder:flatbuffers.Builder, advancedFeatures:bigint) {
+ builder.addFieldInt64(6, advancedFeatures, BigInt('0'));
+}
+
+static addFbsFiles(builder:flatbuffers.Builder, fbsFilesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(7, fbsFilesOffset, 0);
+}
+
+static createFbsFilesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startFbsFilesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static endSchema(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 4) // objects
+ builder.requiredField(offset, 6) // enums
+ return offset;
+}
+
+static finishSchemaBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
+ builder.finish(offset, 'BFBS');
+}
+
+static finishSizePrefixedSchemaBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
+ builder.finish(offset, 'BFBS', true);
+}
+
+
+unpack(): SchemaT {
+ return new SchemaT(
+ this.bb!.createObjList(this.objects.bind(this), this.objectsLength()),
+ this.bb!.createObjList(this.enums.bind(this), this.enumsLength()),
+ this.fileIdent(),
+ this.fileExt(),
+ (this.rootTable() !== null ? this.rootTable()!.unpack() : null),
+ this.bb!.createObjList(this.services.bind(this), this.servicesLength()),
+ this.advancedFeatures(),
+ this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength())
+ );
+}
+
+
+unpackTo(_o: SchemaT): void {
+ _o.objects = this.bb!.createObjList(this.objects.bind(this), this.objectsLength());
+ _o.enums = this.bb!.createObjList(this.enums.bind(this), this.enumsLength());
+ _o.fileIdent = this.fileIdent();
+ _o.fileExt = this.fileExt();
+ _o.rootTable = (this.rootTable() !== null ? this.rootTable()!.unpack() : null);
+ _o.services = this.bb!.createObjList(this.services.bind(this), this.servicesLength());
+ _o.advancedFeatures = this.advancedFeatures();
+ _o.fbsFiles = this.bb!.createObjList(this.fbsFiles.bind(this), this.fbsFilesLength());
+}
+}
+
+export class SchemaT {
+constructor(
+ public objects: (Object_T)[] = [],
+ public enums: (EnumT)[] = [],
+ public fileIdent: string|Uint8Array|null = null,
+ public fileExt: string|Uint8Array|null = null,
+ public rootTable: Object_T|null = null,
+ public services: (ServiceT)[] = [],
+ public advancedFeatures: bigint = BigInt('0'),
+ public fbsFiles: (SchemaFileT)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const objects = Schema.createObjectsVector(builder, builder.createObjectOffsetList(this.objects));
+ const enums = Schema.createEnumsVector(builder, builder.createObjectOffsetList(this.enums));
+ const fileIdent = (this.fileIdent !== null ? builder.createString(this.fileIdent!) : 0);
+ const fileExt = (this.fileExt !== null ? builder.createString(this.fileExt!) : 0);
+ const rootTable = (this.rootTable !== null ? this.rootTable!.pack(builder) : 0);
+ const services = Schema.createServicesVector(builder, builder.createObjectOffsetList(this.services));
+ const fbsFiles = Schema.createFbsFilesVector(builder, builder.createObjectOffsetList(this.fbsFiles));
+
+ Schema.startSchema(builder);
+ Schema.addObjects(builder, objects);
+ Schema.addEnums(builder, enums);
+ Schema.addFileIdent(builder, fileIdent);
+ Schema.addFileExt(builder, fileExt);
+ Schema.addRootTable(builder, rootTable);
+ Schema.addServices(builder, services);
+ Schema.addAdvancedFeatures(builder, this.advancedFeatures);
+ Schema.addFbsFiles(builder, fbsFiles);
+
+ return Schema.endSchema(builder);
+}
+}
+
diff --git a/tests/test_dir/BUILD.bazel b/tests/ts/test_dir/BUILD.bazel
similarity index 86%
rename from tests/test_dir/BUILD.bazel
rename to tests/ts/test_dir/BUILD.bazel
index 6140d28..8b0acca 100644
--- a/tests/test_dir/BUILD.bazel
+++ b/tests/ts/test_dir/BUILD.bazel
@@ -1,4 +1,4 @@
-load("//:build_defs.bzl", "flatbuffer_ts_library")
+load("//:typescript.bzl", "flatbuffer_ts_library")
flatbuffer_ts_library(
name = "typescript_transitive_ts_fbs",
diff --git a/tests/test_dir/typescript_include.fbs b/tests/ts/test_dir/typescript_include.fbs
similarity index 100%
rename from tests/test_dir/typescript_include.fbs
rename to tests/ts/test_dir/typescript_include.fbs
diff --git a/tests/test_dir/typescript_transitive_include.fbs b/tests/ts/test_dir/typescript_transitive_include.fbs
similarity index 100%
rename from tests/test_dir/typescript_transitive_include.fbs
rename to tests/ts/test_dir/typescript_transitive_include.fbs
diff --git a/tests/ts/ts-flat-files/monster_test_generated.ts b/tests/ts/ts-flat-files/monster_test_generated.ts
new file mode 100644
index 0000000..8a768f2
--- /dev/null
+++ b/tests/ts/ts-flat-files/monster_test_generated.ts
@@ -0,0 +1,1830 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+export enum MyGame_OtherNameSpace_FromInclude {
+ IncludeVal = '0'
+}
+
+/**
+ * Composite components of Monster color.
+ */
+export enum MyGame_Example_Color {
+ Red = 1,
+
+ /**
+ * \brief color Green
+ * Green is bit_flag with value (1u << 1)
+ */
+ Green = 2,
+
+ /**
+ * \brief color Blue (1u << 3)
+ */
+ Blue = 8
+}
+
+export enum MyGame_Example_Race {
+ None = -1,
+ Human = 0,
+ Dwarf = 1,
+ Elf = 2
+}
+
+export enum MyGame_Example_LongEnum {
+ LongOne = '2',
+ LongTwo = '4',
+ LongBig = '1099511627776'
+}
+
+export enum MyGame_Example_Any {
+ NONE = 0,
+ Monster = 1,
+ TestSimpleTableWithEnum = 2,
+ MyGame_Example2_Monster = 3
+}
+
+export function unionToAny(
+ type: MyGame_Example_Any,
+ accessor: (obj:MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum) => MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum|null
+): MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum|null {
+ switch(MyGame_Example_Any[type]) {
+ case 'NONE': return null;
+ case 'Monster': return accessor(new MyGame_Example_Monster())! as MyGame_Example_Monster;
+ case 'TestSimpleTableWithEnum': return accessor(new MyGame_Example_TestSimpleTableWithEnum())! as MyGame_Example_TestSimpleTableWithEnum;
+ case 'MyGame_Example2_Monster': return accessor(new MyGame_Example2_Monster())! as MyGame_Example2_Monster;
+ default: return null;
+ }
+}
+
+export function unionListToAny(
+ type: MyGame_Example_Any,
+ accessor: (index: number, obj:MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum) => MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum|null,
+ index: number
+): MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum|null {
+ switch(MyGame_Example_Any[type]) {
+ case 'NONE': return null;
+ case 'Monster': return accessor(index, new MyGame_Example_Monster())! as MyGame_Example_Monster;
+ case 'TestSimpleTableWithEnum': return accessor(index, new MyGame_Example_TestSimpleTableWithEnum())! as MyGame_Example_TestSimpleTableWithEnum;
+ case 'MyGame_Example2_Monster': return accessor(index, new MyGame_Example2_Monster())! as MyGame_Example2_Monster;
+ default: return null;
+ }
+}
+
+export enum MyGame_Example_AnyUniqueAliases {
+ NONE = 0,
+ M = 1,
+ TS = 2,
+ M2 = 3
+}
+
+export function unionToAnyUniqueAliases(
+ type: MyGame_Example_AnyUniqueAliases,
+ accessor: (obj:MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum) => MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum|null
+): MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum|null {
+ switch(MyGame_Example_AnyUniqueAliases[type]) {
+ case 'NONE': return null;
+ case 'M': return accessor(new MyGame_Example_Monster())! as MyGame_Example_Monster;
+ case 'TS': return accessor(new MyGame_Example_TestSimpleTableWithEnum())! as MyGame_Example_TestSimpleTableWithEnum;
+ case 'M2': return accessor(new MyGame_Example2_Monster())! as MyGame_Example2_Monster;
+ default: return null;
+ }
+}
+
+export function unionListToAnyUniqueAliases(
+ type: MyGame_Example_AnyUniqueAliases,
+ accessor: (index: number, obj:MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum) => MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum|null,
+ index: number
+): MyGame_Example2_Monster|MyGame_Example_Monster|MyGame_Example_TestSimpleTableWithEnum|null {
+ switch(MyGame_Example_AnyUniqueAliases[type]) {
+ case 'NONE': return null;
+ case 'M': return accessor(index, new MyGame_Example_Monster())! as MyGame_Example_Monster;
+ case 'TS': return accessor(index, new MyGame_Example_TestSimpleTableWithEnum())! as MyGame_Example_TestSimpleTableWithEnum;
+ case 'M2': return accessor(index, new MyGame_Example2_Monster())! as MyGame_Example2_Monster;
+ default: return null;
+ }
+}
+
+export enum MyGame_Example_AnyAmbiguousAliases {
+ NONE = 0,
+ M1 = 1,
+ M2 = 2,
+ M3 = 3
+}
+
+export function unionToAnyAmbiguousAliases(
+ type: MyGame_Example_AnyAmbiguousAliases,
+ accessor: (obj:MyGame_Example_Monster) => MyGame_Example_Monster|null
+): MyGame_Example_Monster|null {
+ switch(MyGame_Example_AnyAmbiguousAliases[type]) {
+ case 'NONE': return null;
+ case 'M1': return accessor(new MyGame_Example_Monster())! as MyGame_Example_Monster;
+ case 'M2': return accessor(new MyGame_Example_Monster())! as MyGame_Example_Monster;
+ case 'M3': return accessor(new MyGame_Example_Monster())! as MyGame_Example_Monster;
+ default: return null;
+ }
+}
+
+export function unionListToAnyAmbiguousAliases(
+ type: MyGame_Example_AnyAmbiguousAliases,
+ accessor: (index: number, obj:MyGame_Example_Monster) => MyGame_Example_Monster|null,
+ index: number
+): MyGame_Example_Monster|null {
+ switch(MyGame_Example_AnyAmbiguousAliases[type]) {
+ case 'NONE': return null;
+ case 'M1': return accessor(index, new MyGame_Example_Monster())! as MyGame_Example_Monster;
+ case 'M2': return accessor(index, new MyGame_Example_Monster())! as MyGame_Example_Monster;
+ case 'M3': return accessor(index, new MyGame_Example_Monster())! as MyGame_Example_Monster;
+ default: return null;
+ }
+}
+
+export class MyGame_OtherNameSpace_Unused {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_OtherNameSpace_Unused {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+a():number {
+ return this.bb!.readInt32(this.bb_pos);
+}
+
+static sizeOf():number {
+ return 4;
+}
+
+static createUnused(builder:flatbuffers.Builder, a: number):flatbuffers.Offset {
+ builder.prep(4, 4);
+ builder.writeInt32(a);
+ return builder.offset();
+}
+
+}
+
+export class MyGame_OtherNameSpace_TableB {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_OtherNameSpace_TableB {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsTableB(bb:flatbuffers.ByteBuffer, obj?:MyGame_OtherNameSpace_TableB):MyGame_OtherNameSpace_TableB {
+ return (obj || new MyGame_OtherNameSpace_TableB()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsTableB(bb:flatbuffers.ByteBuffer, obj?:MyGame_OtherNameSpace_TableB):MyGame_OtherNameSpace_TableB {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new MyGame_OtherNameSpace_TableB()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+a(obj?:TableA):TableA|null {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? (obj || new TableA()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+static startTableB(builder:flatbuffers.Builder) {
+ builder.startObject(1);
+}
+
+static addA(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, aOffset, 0);
+}
+
+static endTableB(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createTableB(builder:flatbuffers.Builder, aOffset:flatbuffers.Offset):flatbuffers.Offset {
+ MyGame_OtherNameSpace_TableB.startTableB(builder);
+ MyGame_OtherNameSpace_TableB.addA(builder, aOffset);
+ return MyGame_OtherNameSpace_TableB.endTableB(builder);
+}
+
+serialize():Uint8Array {
+ return this.bb!.bytes();
+}
+
+static deserialize(buffer: Uint8Array):TableB {
+ return MyGame_OtherNameSpace_TableB.getRootAsTableB(new flatbuffers.ByteBuffer(buffer))
+}
+}
+
+export class TableA {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):TableA {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsTableA(bb:flatbuffers.ByteBuffer, obj?:TableA):TableA {
+ return (obj || new TableA()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsTableA(bb:flatbuffers.ByteBuffer, obj?:TableA):TableA {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new TableA()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+b(obj?:MyGame_OtherNameSpace_TableB):MyGame_OtherNameSpace_TableB|null {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? (obj || new MyGame_OtherNameSpace_TableB()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+static startTableA(builder:flatbuffers.Builder) {
+ builder.startObject(1);
+}
+
+static addB(builder:flatbuffers.Builder, bOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, bOffset, 0);
+}
+
+static endTableA(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createTableA(builder:flatbuffers.Builder, bOffset:flatbuffers.Offset):flatbuffers.Offset {
+ TableA.startTableA(builder);
+ TableA.addB(builder, bOffset);
+ return TableA.endTableA(builder);
+}
+
+serialize():Uint8Array {
+ return this.bb!.bytes();
+}
+
+static deserialize(buffer: Uint8Array):TableA {
+ return TableA.getRootAsTableA(new flatbuffers.ByteBuffer(buffer))
+}
+}
+
+export class MyGame_InParentNamespace {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_InParentNamespace {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsInParentNamespace(bb:flatbuffers.ByteBuffer, obj?:MyGame_InParentNamespace):MyGame_InParentNamespace {
+ return (obj || new MyGame_InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsInParentNamespace(bb:flatbuffers.ByteBuffer, obj?:MyGame_InParentNamespace):MyGame_InParentNamespace {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new MyGame_InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static startInParentNamespace(builder:flatbuffers.Builder) {
+ builder.startObject(0);
+}
+
+static endInParentNamespace(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createInParentNamespace(builder:flatbuffers.Builder):flatbuffers.Offset {
+ MyGame_InParentNamespace.startInParentNamespace(builder);
+ return MyGame_InParentNamespace.endInParentNamespace(builder);
+}
+
+serialize():Uint8Array {
+ return this.bb!.bytes();
+}
+
+static deserialize(buffer: Uint8Array):InParentNamespace {
+ return MyGame_InParentNamespace.getRootAsInParentNamespace(new flatbuffers.ByteBuffer(buffer))
+}
+}
+
+export class MyGame_Example2_Monster {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example2_Monster {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example2_Monster):MyGame_Example2_Monster {
+ return (obj || new MyGame_Example2_Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example2_Monster):MyGame_Example2_Monster {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new MyGame_Example2_Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static startMonster(builder:flatbuffers.Builder) {
+ builder.startObject(0);
+}
+
+static endMonster(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createMonster(builder:flatbuffers.Builder):flatbuffers.Offset {
+ MyGame_Example2_Monster.startMonster(builder);
+ return MyGame_Example2_Monster.endMonster(builder);
+}
+
+serialize():Uint8Array {
+ return this.bb!.bytes();
+}
+
+static deserialize(buffer: Uint8Array):Monster {
+ return MyGame_Example2_Monster.getRootAsMonster(new flatbuffers.ByteBuffer(buffer))
+}
+}
+
+export class MyGame_Example_Test {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_Test {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+a():number {
+ return this.bb!.readInt16(this.bb_pos);
+}
+
+b():number {
+ return this.bb!.readInt8(this.bb_pos + 2);
+}
+
+static sizeOf():number {
+ return 4;
+}
+
+static createTest(builder:flatbuffers.Builder, a: number, b: number):flatbuffers.Offset {
+ builder.prep(2, 4);
+ builder.pad(1);
+ builder.writeInt8(b);
+ builder.writeInt16(a);
+ return builder.offset();
+}
+
+}
+
+export class MyGame_Example_TestSimpleTableWithEnum {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_TestSimpleTableWithEnum {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsTestSimpleTableWithEnum(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_TestSimpleTableWithEnum):MyGame_Example_TestSimpleTableWithEnum {
+ return (obj || new MyGame_Example_TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsTestSimpleTableWithEnum(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_TestSimpleTableWithEnum):MyGame_Example_TestSimpleTableWithEnum {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new MyGame_Example_TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+color():MyGame_Example_Color {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : MyGame_Example_Color.Green;
+}
+
+static startTestSimpleTableWithEnum(builder:flatbuffers.Builder) {
+ builder.startObject(1);
+}
+
+static addColor(builder:flatbuffers.Builder, color:MyGame_Example_Color) {
+ builder.addFieldInt8(0, color, MyGame_Example_Color.Green);
+}
+
+static endTestSimpleTableWithEnum(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createTestSimpleTableWithEnum(builder:flatbuffers.Builder, color:MyGame_Example_Color):flatbuffers.Offset {
+ MyGame_Example_TestSimpleTableWithEnum.startTestSimpleTableWithEnum(builder);
+ MyGame_Example_TestSimpleTableWithEnum.addColor(builder, color);
+ return MyGame_Example_TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder);
+}
+
+serialize():Uint8Array {
+ return this.bb!.bytes();
+}
+
+static deserialize(buffer: Uint8Array):TestSimpleTableWithEnum {
+ return MyGame_Example_TestSimpleTableWithEnum.getRootAsTestSimpleTableWithEnum(new flatbuffers.ByteBuffer(buffer))
+}
+}
+
+export class MyGame_Example_Vec3 {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_Vec3 {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+x():number {
+ return this.bb!.readFloat32(this.bb_pos);
+}
+
+y():number {
+ return this.bb!.readFloat32(this.bb_pos + 4);
+}
+
+z():number {
+ return this.bb!.readFloat32(this.bb_pos + 8);
+}
+
+test1():number {
+ return this.bb!.readFloat64(this.bb_pos + 16);
+}
+
+test2():MyGame_Example_Color {
+ return this.bb!.readUint8(this.bb_pos + 24);
+}
+
+test3(obj?:MyGame_Example_Test):MyGame_Example_Test|null {
+ return (obj || new MyGame_Example_Test()).__init(this.bb_pos + 26, this.bb!);
+}
+
+static sizeOf():number {
+ return 32;
+}
+
+static createVec3(builder:flatbuffers.Builder, x: number, y: number, z: number, test1: number, test2: MyGame_Example_Color, test3_a: number, test3_b: number):flatbuffers.Offset {
+ builder.prep(8, 32);
+ builder.pad(2);
+ builder.prep(2, 4);
+ builder.pad(1);
+ builder.writeInt8(test3_b);
+ builder.writeInt16(test3_a);
+ builder.pad(1);
+ builder.writeInt8(test2);
+ builder.writeFloat64(test1);
+ builder.pad(4);
+ builder.writeFloat32(z);
+ builder.writeFloat32(y);
+ builder.writeFloat32(x);
+ return builder.offset();
+}
+
+}
+
+export class MyGame_Example_Ability {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_Ability {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+id():number {
+ return this.bb!.readUint32(this.bb_pos);
+}
+
+distance():number {
+ return this.bb!.readUint32(this.bb_pos + 4);
+}
+
+static sizeOf():number {
+ return 8;
+}
+
+static createAbility(builder:flatbuffers.Builder, id: number, distance: number):flatbuffers.Offset {
+ builder.prep(4, 8);
+ builder.writeInt32(distance);
+ builder.writeInt32(id);
+ return builder.offset();
+}
+
+}
+
+export class MyGame_Example_StructOfStructs {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_StructOfStructs {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+a(obj?:MyGame_Example_Ability):MyGame_Example_Ability|null {
+ return (obj || new MyGame_Example_Ability()).__init(this.bb_pos, this.bb!);
+}
+
+b(obj?:MyGame_Example_Test):MyGame_Example_Test|null {
+ return (obj || new MyGame_Example_Test()).__init(this.bb_pos + 8, this.bb!);
+}
+
+c(obj?:MyGame_Example_Ability):MyGame_Example_Ability|null {
+ return (obj || new MyGame_Example_Ability()).__init(this.bb_pos + 12, this.bb!);
+}
+
+static sizeOf():number {
+ return 20;
+}
+
+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 {
+ 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();
+}
+
+}
+
+export class MyGame_Example_StructOfStructsOfStructs {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_StructOfStructsOfStructs {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+a(obj?:MyGame_Example_StructOfStructs):MyGame_Example_StructOfStructs|null {
+ return (obj || new MyGame_Example_StructOfStructs()).__init(this.bb_pos, this.bb!);
+}
+
+static sizeOf():number {
+ return 20;
+}
+
+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 {
+ 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();
+}
+
+}
+
+export class MyGame_Example_Stat {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_Stat {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsStat(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_Stat):MyGame_Example_Stat {
+ return (obj || new MyGame_Example_Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsStat(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_Stat):MyGame_Example_Stat {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new MyGame_Example_Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+id():string|null
+id(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+id(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;
+}
+
+val():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
+}
+
+count():number {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+static startStat(builder:flatbuffers.Builder) {
+ builder.startObject(3);
+}
+
+static addId(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(0, idOffset, 0);
+}
+
+static addVal(builder:flatbuffers.Builder, val:bigint) {
+ builder.addFieldInt64(1, val, BigInt('0'));
+}
+
+static addCount(builder:flatbuffers.Builder, count:number) {
+ builder.addFieldInt16(2, count, 0);
+}
+
+static endStat(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createStat(builder:flatbuffers.Builder, idOffset:flatbuffers.Offset, val:bigint, count:number):flatbuffers.Offset {
+ MyGame_Example_Stat.startStat(builder);
+ MyGame_Example_Stat.addId(builder, idOffset);
+ MyGame_Example_Stat.addVal(builder, val);
+ MyGame_Example_Stat.addCount(builder, count);
+ return MyGame_Example_Stat.endStat(builder);
+}
+
+serialize():Uint8Array {
+ return this.bb!.bytes();
+}
+
+static deserialize(buffer: Uint8Array):Stat {
+ return MyGame_Example_Stat.getRootAsStat(new flatbuffers.ByteBuffer(buffer))
+}
+}
+
+export class MyGame_Example_Referrable {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_Referrable {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsReferrable(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_Referrable):MyGame_Example_Referrable {
+ return (obj || new MyGame_Example_Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsReferrable(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_Referrable):MyGame_Example_Referrable {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new MyGame_Example_Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+id():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+static startReferrable(builder:flatbuffers.Builder) {
+ builder.startObject(1);
+}
+
+static addId(builder:flatbuffers.Builder, id:bigint) {
+ builder.addFieldInt64(0, id, BigInt('0'));
+}
+
+static endReferrable(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createReferrable(builder:flatbuffers.Builder, id:bigint):flatbuffers.Offset {
+ MyGame_Example_Referrable.startReferrable(builder);
+ MyGame_Example_Referrable.addId(builder, id);
+ return MyGame_Example_Referrable.endReferrable(builder);
+}
+
+serialize():Uint8Array {
+ return this.bb!.bytes();
+}
+
+static deserialize(buffer: Uint8Array):Referrable {
+ return MyGame_Example_Referrable.getRootAsReferrable(new flatbuffers.ByteBuffer(buffer))
+}
+}
+
+/**
+ * an example documentation comment: "monster object"
+ */
+export class MyGame_Example_Monster {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_Monster {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_Monster):MyGame_Example_Monster {
+ return (obj || new MyGame_Example_Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsMonster(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_Monster):MyGame_Example_Monster {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new MyGame_Example_Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
+ return bb.__has_identifier('MONS');
+}
+
+pos(obj?:MyGame_Example_Vec3):MyGame_Example_Vec3|null {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? (obj || new MyGame_Example_Vec3()).__init(this.bb_pos + offset, this.bb!) : null;
+}
+
+mana():number {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.readInt16(this.bb_pos + offset) : 150;
+}
+
+hp():number {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.readInt16(this.bb_pos + offset) : 100;
+}
+
+name():string|null
+name(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
+name(optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
+}
+
+inventory(index: number):number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
+}
+
+inventoryLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+inventoryArray():Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ 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;
+}
+
+color():MyGame_Example_Color {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : MyGame_Example_Color.Blue;
+}
+
+testType():MyGame_Example_Any {
+ const offset = this.bb!.__offset(this.bb_pos, 18);
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : MyGame_Example_Any.NONE;
+}
+
+test<T extends flatbuffers.Table>(obj:any):any|null {
+ const offset = this.bb!.__offset(this.bb_pos, 20);
+ return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;
+}
+
+test4(index: number, obj?:MyGame_Example_Test):MyGame_Example_Test|null {
+ const offset = this.bb!.__offset(this.bb_pos, 22);
+ return offset ? (obj || new MyGame_Example_Test()).__init(this.bb!.__vector(this.bb_pos + offset) + index * 4, this.bb!) : null;
+}
+
+test4Length():number {
+ const offset = this.bb!.__offset(this.bb_pos, 22);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+testarrayofstring(index: number):string
+testarrayofstring(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+testarrayofstring(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 24);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+testarrayofstringLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 24);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+/**
+ * an example documentation comment: this will end up in the generated code
+ * multiline too
+ */
+testarrayoftables(index: number, obj?:MyGame_Example_Monster):MyGame_Example_Monster|null {
+ const offset = this.bb!.__offset(this.bb_pos, 26);
+ return offset ? (obj || new MyGame_Example_Monster()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+testarrayoftablesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 26);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+enemy(obj?:MyGame_Example_Monster):MyGame_Example_Monster|null {
+ const offset = this.bb!.__offset(this.bb_pos, 28);
+ return offset ? (obj || new MyGame_Example_Monster()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+testnestedflatbuffer(index: number):number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 30);
+ return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
+}
+
+testnestedflatbufferLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 30);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+testnestedflatbufferArray():Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 30);
+ 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;
+}
+
+testempty(obj?:MyGame_Example_Stat):MyGame_Example_Stat|null {
+ const offset = this.bb!.__offset(this.bb_pos, 32);
+ return offset ? (obj || new MyGame_Example_Stat()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+testbool():boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 34);
+ return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
+}
+
+testhashs32Fnv1():number {
+ const offset = this.bb!.__offset(this.bb_pos, 36);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+testhashu32Fnv1():number {
+ const offset = this.bb!.__offset(this.bb_pos, 38);
+ return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
+}
+
+testhashs64Fnv1():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 40);
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
+}
+
+testhashu64Fnv1():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 42);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+testhashs32Fnv1a():number {
+ const offset = this.bb!.__offset(this.bb_pos, 44);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+testhashu32Fnv1a():number {
+ const offset = this.bb!.__offset(this.bb_pos, 46);
+ return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
+}
+
+testhashs64Fnv1a():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 48);
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
+}
+
+testhashu64Fnv1a():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 50);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+testarrayofbools(index: number):boolean|null {
+ const offset = this.bb!.__offset(this.bb_pos, 52);
+ return offset ? !!this.bb!.readInt8(this.bb!.__vector(this.bb_pos + offset) + index) : false;
+}
+
+testarrayofboolsLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 52);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+testarrayofboolsArray():Int8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 52);
+ 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)) : null;
+}
+
+testf():number {
+ const offset = this.bb!.__offset(this.bb_pos, 54);
+ return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 3.14159;
+}
+
+testf2():number {
+ const offset = this.bb!.__offset(this.bb_pos, 56);
+ return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 3.0;
+}
+
+testf3():number {
+ const offset = this.bb!.__offset(this.bb_pos, 58);
+ return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
+}
+
+testarrayofstring2(index: number):string
+testarrayofstring2(index: number,optionalEncoding:flatbuffers.Encoding):string|Uint8Array
+testarrayofstring2(index: number,optionalEncoding?:any):string|Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 60);
+ return offset ? this.bb!.__string(this.bb!.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
+}
+
+testarrayofstring2Length():number {
+ const offset = this.bb!.__offset(this.bb_pos, 60);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+testarrayofsortedstruct(index: number, obj?:MyGame_Example_Ability):MyGame_Example_Ability|null {
+ const offset = this.bb!.__offset(this.bb_pos, 62);
+ return offset ? (obj || new MyGame_Example_Ability()).__init(this.bb!.__vector(this.bb_pos + offset) + index * 8, this.bb!) : null;
+}
+
+testarrayofsortedstructLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 62);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+flex(index: number):number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 64);
+ return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
+}
+
+flexLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 64);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+flexArray():Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 64);
+ 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;
+}
+
+test5(index: number, obj?:MyGame_Example_Test):MyGame_Example_Test|null {
+ const offset = this.bb!.__offset(this.bb_pos, 66);
+ return offset ? (obj || new MyGame_Example_Test()).__init(this.bb!.__vector(this.bb_pos + offset) + index * 4, this.bb!) : null;
+}
+
+test5Length():number {
+ const offset = this.bb!.__offset(this.bb_pos, 66);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+vectorOfLongs(index: number):bigint|null {
+ const offset = this.bb!.__offset(this.bb_pos, 68);
+ return offset ? this.bb!.readInt64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
+}
+
+vectorOfLongsLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 68);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+vectorOfDoubles(index: number):number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 70);
+ return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0;
+}
+
+vectorOfDoublesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 70);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+vectorOfDoublesArray():Float64Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 70);
+ return offset ? new Float64Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
+}
+
+parentNamespaceTest(obj?:MyGame_InParentNamespace):MyGame_InParentNamespace|null {
+ const offset = this.bb!.__offset(this.bb_pos, 72);
+ return offset ? (obj || new MyGame_InParentNamespace()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+vectorOfReferrables(index: number, obj?:MyGame_Example_Referrable):MyGame_Example_Referrable|null {
+ const offset = this.bb!.__offset(this.bb_pos, 74);
+ return offset ? (obj || new MyGame_Example_Referrable()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+vectorOfReferrablesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 74);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+singleWeakReference():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 76);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+vectorOfWeakReferences(index: number):bigint|null {
+ const offset = this.bb!.__offset(this.bb_pos, 78);
+ return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
+}
+
+vectorOfWeakReferencesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 78);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+vectorOfStrongReferrables(index: number, obj?:MyGame_Example_Referrable):MyGame_Example_Referrable|null {
+ const offset = this.bb!.__offset(this.bb_pos, 80);
+ return offset ? (obj || new MyGame_Example_Referrable()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+vectorOfStrongReferrablesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 80);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+coOwningReference():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 82);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+vectorOfCoOwningReferences(index: number):bigint|null {
+ const offset = this.bb!.__offset(this.bb_pos, 84);
+ return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
+}
+
+vectorOfCoOwningReferencesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 84);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+nonOwningReference():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 86);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+vectorOfNonOwningReferences(index: number):bigint|null {
+ const offset = this.bb!.__offset(this.bb_pos, 88);
+ return offset ? this.bb!.readUint64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
+}
+
+vectorOfNonOwningReferencesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 88);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+anyUniqueType():MyGame_Example_AnyUniqueAliases {
+ const offset = this.bb!.__offset(this.bb_pos, 90);
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : MyGame_Example_AnyUniqueAliases.NONE;
+}
+
+anyUnique<T extends flatbuffers.Table>(obj:any):any|null {
+ const offset = this.bb!.__offset(this.bb_pos, 92);
+ return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;
+}
+
+anyAmbiguousType():MyGame_Example_AnyAmbiguousAliases {
+ const offset = this.bb!.__offset(this.bb_pos, 94);
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : MyGame_Example_AnyAmbiguousAliases.NONE;
+}
+
+anyAmbiguous<T extends flatbuffers.Table>(obj:any):any|null {
+ const offset = this.bb!.__offset(this.bb_pos, 96);
+ return offset ? this.bb!.__union(obj, this.bb_pos + offset) : null;
+}
+
+vectorOfEnums(index: number):MyGame_Example_Color|null {
+ const offset = this.bb!.__offset(this.bb_pos, 98);
+ return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
+}
+
+vectorOfEnumsLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 98);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+vectorOfEnumsArray():Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 98);
+ 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;
+}
+
+signedEnum():MyGame_Example_Race {
+ const offset = this.bb!.__offset(this.bb_pos, 100);
+ return offset ? this.bb!.readInt8(this.bb_pos + offset) : MyGame_Example_Race.None;
+}
+
+testrequirednestedflatbuffer(index: number):number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 102);
+ return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
+}
+
+testrequirednestedflatbufferLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 102);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+testrequirednestedflatbufferArray():Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 102);
+ 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;
+}
+
+scalarKeySortedTables(index: number, obj?:MyGame_Example_Stat):MyGame_Example_Stat|null {
+ const offset = this.bb!.__offset(this.bb_pos, 104);
+ return offset ? (obj || new MyGame_Example_Stat()).__init(this.bb!.__indirect(this.bb!.__vector(this.bb_pos + offset) + index * 4), this.bb!) : null;
+}
+
+scalarKeySortedTablesLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 104);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+nativeInline(obj?:MyGame_Example_Test):MyGame_Example_Test|null {
+ const offset = this.bb!.__offset(this.bb_pos, 106);
+ return offset ? (obj || new MyGame_Example_Test()).__init(this.bb_pos + offset, this.bb!) : null;
+}
+
+longEnumNonEnumDefault():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 108);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+longEnumNormalDefault():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 110);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('2');
+}
+
+static startMonster(builder:flatbuffers.Builder) {
+ builder.startObject(54);
+}
+
+static addPos(builder:flatbuffers.Builder, posOffset:flatbuffers.Offset) {
+ builder.addFieldStruct(0, posOffset, 0);
+}
+
+static addMana(builder:flatbuffers.Builder, mana:number) {
+ builder.addFieldInt16(1, mana, 150);
+}
+
+static addHp(builder:flatbuffers.Builder, hp:number) {
+ builder.addFieldInt16(2, hp, 100);
+}
+
+static addName(builder:flatbuffers.Builder, nameOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(3, nameOffset, 0);
+}
+
+static addInventory(builder:flatbuffers.Builder, inventoryOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(5, inventoryOffset, 0);
+}
+
+static createInventoryVector(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 startInventoryVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(1, numElems, 1);
+}
+
+static addColor(builder:flatbuffers.Builder, color:MyGame_Example_Color) {
+ builder.addFieldInt8(6, color, MyGame_Example_Color.Blue);
+}
+
+static addTestType(builder:flatbuffers.Builder, testType:MyGame_Example_Any) {
+ builder.addFieldInt8(7, testType, MyGame_Example_Any.NONE);
+}
+
+static addTest(builder:flatbuffers.Builder, testOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(8, testOffset, 0);
+}
+
+static addTest4(builder:flatbuffers.Builder, test4Offset:flatbuffers.Offset) {
+ builder.addFieldOffset(9, test4Offset, 0);
+}
+
+static startTest4Vector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 2);
+}
+
+static addTestarrayofstring(builder:flatbuffers.Builder, testarrayofstringOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(10, testarrayofstringOffset, 0);
+}
+
+static createTestarrayofstringVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startTestarrayofstringVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addTestarrayoftables(builder:flatbuffers.Builder, testarrayoftablesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(11, testarrayoftablesOffset, 0);
+}
+
+static createTestarrayoftablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startTestarrayoftablesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addEnemy(builder:flatbuffers.Builder, enemyOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(12, enemyOffset, 0);
+}
+
+static addTestnestedflatbuffer(builder:flatbuffers.Builder, testnestedflatbufferOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(13, testnestedflatbufferOffset, 0);
+}
+
+static createTestnestedflatbufferVector(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 startTestnestedflatbufferVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(1, numElems, 1);
+}
+
+static addTestempty(builder:flatbuffers.Builder, testemptyOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(14, testemptyOffset, 0);
+}
+
+static addTestbool(builder:flatbuffers.Builder, testbool:boolean) {
+ builder.addFieldInt8(15, +testbool, +false);
+}
+
+static addTesthashs32Fnv1(builder:flatbuffers.Builder, testhashs32Fnv1:number) {
+ builder.addFieldInt32(16, testhashs32Fnv1, 0);
+}
+
+static addTesthashu32Fnv1(builder:flatbuffers.Builder, testhashu32Fnv1:number) {
+ builder.addFieldInt32(17, testhashu32Fnv1, 0);
+}
+
+static addTesthashs64Fnv1(builder:flatbuffers.Builder, testhashs64Fnv1:bigint) {
+ builder.addFieldInt64(18, testhashs64Fnv1, BigInt('0'));
+}
+
+static addTesthashu64Fnv1(builder:flatbuffers.Builder, testhashu64Fnv1:bigint) {
+ builder.addFieldInt64(19, testhashu64Fnv1, BigInt('0'));
+}
+
+static addTesthashs32Fnv1a(builder:flatbuffers.Builder, testhashs32Fnv1a:number) {
+ builder.addFieldInt32(20, testhashs32Fnv1a, 0);
+}
+
+static addTesthashu32Fnv1a(builder:flatbuffers.Builder, testhashu32Fnv1a:number) {
+ builder.addFieldInt32(21, testhashu32Fnv1a, 0);
+}
+
+static addTesthashs64Fnv1a(builder:flatbuffers.Builder, testhashs64Fnv1a:bigint) {
+ builder.addFieldInt64(22, testhashs64Fnv1a, BigInt('0'));
+}
+
+static addTesthashu64Fnv1a(builder:flatbuffers.Builder, testhashu64Fnv1a:bigint) {
+ builder.addFieldInt64(23, testhashu64Fnv1a, BigInt('0'));
+}
+
+static addTestarrayofbools(builder:flatbuffers.Builder, testarrayofboolsOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(24, testarrayofboolsOffset, 0);
+}
+
+static createTestarrayofboolsVector(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 startTestarrayofboolsVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(1, numElems, 1);
+}
+
+static addTestf(builder:flatbuffers.Builder, testf:number) {
+ builder.addFieldFloat32(25, testf, 3.14159);
+}
+
+static addTestf2(builder:flatbuffers.Builder, testf2:number) {
+ builder.addFieldFloat32(26, testf2, 3.0);
+}
+
+static addTestf3(builder:flatbuffers.Builder, testf3:number) {
+ builder.addFieldFloat32(27, testf3, 0.0);
+}
+
+static addTestarrayofstring2(builder:flatbuffers.Builder, testarrayofstring2Offset:flatbuffers.Offset) {
+ builder.addFieldOffset(28, testarrayofstring2Offset, 0);
+}
+
+static createTestarrayofstring2Vector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startTestarrayofstring2Vector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addTestarrayofsortedstruct(builder:flatbuffers.Builder, testarrayofsortedstructOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(29, testarrayofsortedstructOffset, 0);
+}
+
+static startTestarrayofsortedstructVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(8, numElems, 4);
+}
+
+static addFlex(builder:flatbuffers.Builder, flexOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(30, flexOffset, 0);
+}
+
+static createFlexVector(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 startFlexVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(1, numElems, 1);
+}
+
+static addTest5(builder:flatbuffers.Builder, test5Offset:flatbuffers.Offset) {
+ builder.addFieldOffset(31, test5Offset, 0);
+}
+
+static startTest5Vector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 2);
+}
+
+static addVectorOfLongs(builder:flatbuffers.Builder, vectorOfLongsOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(32, vectorOfLongsOffset, 0);
+}
+
+static createVectorOfLongsVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt64(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startVectorOfLongsVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(8, numElems, 8);
+}
+
+static addVectorOfDoubles(builder:flatbuffers.Builder, vectorOfDoublesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(33, vectorOfDoublesOffset, 0);
+}
+
+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 createVectorOfDoublesVector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addFloat64(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startVectorOfDoublesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(8, numElems, 8);
+}
+
+static addParentNamespaceTest(builder:flatbuffers.Builder, parentNamespaceTestOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(34, parentNamespaceTestOffset, 0);
+}
+
+static addVectorOfReferrables(builder:flatbuffers.Builder, vectorOfReferrablesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(35, vectorOfReferrablesOffset, 0);
+}
+
+static createVectorOfReferrablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startVectorOfReferrablesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addSingleWeakReference(builder:flatbuffers.Builder, singleWeakReference:bigint) {
+ builder.addFieldInt64(36, singleWeakReference, BigInt('0'));
+}
+
+static addVectorOfWeakReferences(builder:flatbuffers.Builder, vectorOfWeakReferencesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(37, vectorOfWeakReferencesOffset, 0);
+}
+
+static createVectorOfWeakReferencesVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt64(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startVectorOfWeakReferencesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(8, numElems, 8);
+}
+
+static addVectorOfStrongReferrables(builder:flatbuffers.Builder, vectorOfStrongReferrablesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(38, vectorOfStrongReferrablesOffset, 0);
+}
+
+static createVectorOfStrongReferrablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startVectorOfStrongReferrablesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addCoOwningReference(builder:flatbuffers.Builder, coOwningReference:bigint) {
+ builder.addFieldInt64(39, coOwningReference, BigInt('0'));
+}
+
+static addVectorOfCoOwningReferences(builder:flatbuffers.Builder, vectorOfCoOwningReferencesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(40, vectorOfCoOwningReferencesOffset, 0);
+}
+
+static createVectorOfCoOwningReferencesVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt64(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startVectorOfCoOwningReferencesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(8, numElems, 8);
+}
+
+static addNonOwningReference(builder:flatbuffers.Builder, nonOwningReference:bigint) {
+ builder.addFieldInt64(41, nonOwningReference, BigInt('0'));
+}
+
+static addVectorOfNonOwningReferences(builder:flatbuffers.Builder, vectorOfNonOwningReferencesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(42, vectorOfNonOwningReferencesOffset, 0);
+}
+
+static createVectorOfNonOwningReferencesVector(builder:flatbuffers.Builder, data:bigint[]):flatbuffers.Offset {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt64(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startVectorOfNonOwningReferencesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(8, numElems, 8);
+}
+
+static addAnyUniqueType(builder:flatbuffers.Builder, anyUniqueType:MyGame_Example_AnyUniqueAliases) {
+ builder.addFieldInt8(43, anyUniqueType, MyGame_Example_AnyUniqueAliases.NONE);
+}
+
+static addAnyUnique(builder:flatbuffers.Builder, anyUniqueOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(44, anyUniqueOffset, 0);
+}
+
+static addAnyAmbiguousType(builder:flatbuffers.Builder, anyAmbiguousType:MyGame_Example_AnyAmbiguousAliases) {
+ builder.addFieldInt8(45, anyAmbiguousType, MyGame_Example_AnyAmbiguousAliases.NONE);
+}
+
+static addAnyAmbiguous(builder:flatbuffers.Builder, anyAmbiguousOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(46, anyAmbiguousOffset, 0);
+}
+
+static addVectorOfEnums(builder:flatbuffers.Builder, vectorOfEnumsOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(47, vectorOfEnumsOffset, 0);
+}
+
+static createVectorOfEnumsVector(builder:flatbuffers.Builder, data:MyGame_Example_Color[]):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 startVectorOfEnumsVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(1, numElems, 1);
+}
+
+static addSignedEnum(builder:flatbuffers.Builder, signedEnum:MyGame_Example_Race) {
+ builder.addFieldInt8(48, signedEnum, MyGame_Example_Race.None);
+}
+
+static addTestrequirednestedflatbuffer(builder:flatbuffers.Builder, testrequirednestedflatbufferOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(49, testrequirednestedflatbufferOffset, 0);
+}
+
+static createTestrequirednestedflatbufferVector(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 startTestrequirednestedflatbufferVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(1, numElems, 1);
+}
+
+static addScalarKeySortedTables(builder:flatbuffers.Builder, scalarKeySortedTablesOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(50, scalarKeySortedTablesOffset, 0);
+}
+
+static createScalarKeySortedTablesVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startScalarKeySortedTablesVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static addNativeInline(builder:flatbuffers.Builder, nativeInlineOffset:flatbuffers.Offset) {
+ builder.addFieldStruct(51, nativeInlineOffset, 0);
+}
+
+static addLongEnumNonEnumDefault(builder:flatbuffers.Builder, longEnumNonEnumDefault:bigint) {
+ builder.addFieldInt64(52, longEnumNonEnumDefault, BigInt('0'));
+}
+
+static addLongEnumNormalDefault(builder:flatbuffers.Builder, longEnumNormalDefault:bigint) {
+ builder.addFieldInt64(53, longEnumNormalDefault, BigInt('2'));
+}
+
+static endMonster(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ builder.requiredField(offset, 10) // name
+ return offset;
+}
+
+static finishMonsterBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
+ builder.finish(offset, 'MONS');
+}
+
+static finishSizePrefixedMonsterBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
+ builder.finish(offset, 'MONS', true);
+}
+
+
+serialize():Uint8Array {
+ return this.bb!.bytes();
+}
+
+static deserialize(buffer: Uint8Array):Monster {
+ return MyGame_Example_Monster.getRootAsMonster(new flatbuffers.ByteBuffer(buffer))
+}
+}
+
+export class MyGame_Example_TypeAliases {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):MyGame_Example_TypeAliases {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsTypeAliases(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_TypeAliases):MyGame_Example_TypeAliases {
+ return (obj || new MyGame_Example_TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsTypeAliases(bb:flatbuffers.ByteBuffer, obj?:MyGame_Example_TypeAliases):MyGame_Example_TypeAliases {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new MyGame_Example_TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+i8():number {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? this.bb!.readInt8(this.bb_pos + offset) : 0;
+}
+
+u8():number {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : 0;
+}
+
+i16():number {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.readInt16(this.bb_pos + offset) : 0;
+}
+
+u16():number {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.readUint16(this.bb_pos + offset) : 0;
+}
+
+i32():number {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+u32():number {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
+}
+
+i64():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
+}
+
+u64():bigint {
+ const offset = this.bb!.__offset(this.bb_pos, 18);
+ return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
+}
+
+f32():number {
+ const offset = this.bb!.__offset(this.bb_pos, 20);
+ return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
+}
+
+f64():number {
+ const offset = this.bb!.__offset(this.bb_pos, 22);
+ return offset ? this.bb!.readFloat64(this.bb_pos + offset) : 0.0;
+}
+
+v8(index: number):number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 24);
+ return offset ? this.bb!.readInt8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
+}
+
+v8Length():number {
+ const offset = this.bb!.__offset(this.bb_pos, 24);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+v8Array():Int8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 24);
+ 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)) : null;
+}
+
+vf64(index: number):number|null {
+ const offset = this.bb!.__offset(this.bb_pos, 26);
+ return offset ? this.bb!.readFloat64(this.bb!.__vector(this.bb_pos + offset) + index * 8) : 0;
+}
+
+vf64Length():number {
+ const offset = this.bb!.__offset(this.bb_pos, 26);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+vf64Array():Float64Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 26);
+ return offset ? new Float64Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null;
+}
+
+static startTypeAliases(builder:flatbuffers.Builder) {
+ builder.startObject(12);
+}
+
+static addI8(builder:flatbuffers.Builder, i8:number) {
+ builder.addFieldInt8(0, i8, 0);
+}
+
+static addU8(builder:flatbuffers.Builder, u8:number) {
+ builder.addFieldInt8(1, u8, 0);
+}
+
+static addI16(builder:flatbuffers.Builder, i16:number) {
+ builder.addFieldInt16(2, i16, 0);
+}
+
+static addU16(builder:flatbuffers.Builder, u16:number) {
+ builder.addFieldInt16(3, u16, 0);
+}
+
+static addI32(builder:flatbuffers.Builder, i32:number) {
+ builder.addFieldInt32(4, i32, 0);
+}
+
+static addU32(builder:flatbuffers.Builder, u32:number) {
+ builder.addFieldInt32(5, u32, 0);
+}
+
+static addI64(builder:flatbuffers.Builder, i64:bigint) {
+ builder.addFieldInt64(6, i64, BigInt('0'));
+}
+
+static addU64(builder:flatbuffers.Builder, u64:bigint) {
+ builder.addFieldInt64(7, u64, BigInt('0'));
+}
+
+static addF32(builder:flatbuffers.Builder, f32:number) {
+ builder.addFieldFloat32(8, f32, 0.0);
+}
+
+static addF64(builder:flatbuffers.Builder, f64:number) {
+ builder.addFieldFloat64(9, f64, 0.0);
+}
+
+static addV8(builder:flatbuffers.Builder, v8Offset:flatbuffers.Offset) {
+ builder.addFieldOffset(10, v8Offset, 0);
+}
+
+static createV8Vector(builder:flatbuffers.Builder, data:number[]|Int8Array):flatbuffers.Offset;
+/**
+ * @deprecated This Uint8Array overload will be removed in the future.
+ */
+static createV8Vector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset;
+static createV8Vector(builder:flatbuffers.Builder, data:number[]|Int8Array|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 startV8Vector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(1, numElems, 1);
+}
+
+static addVf64(builder:flatbuffers.Builder, vf64Offset:flatbuffers.Offset) {
+ builder.addFieldOffset(11, vf64Offset, 0);
+}
+
+static createVf64Vector(builder:flatbuffers.Builder, data:number[]|Float64Array):flatbuffers.Offset;
+/**
+ * @deprecated This Uint8Array overload will be removed in the future.
+ */
+static createVf64Vector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset;
+static createVf64Vector(builder:flatbuffers.Builder, data:number[]|Float64Array|Uint8Array):flatbuffers.Offset {
+ builder.startVector(8, data.length, 8);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addFloat64(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startVf64Vector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(8, numElems, 8);
+}
+
+static endTypeAliases(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createTypeAliases(builder:flatbuffers.Builder, i8:number, u8:number, i16:number, u16:number, i32:number, u32:number, i64:bigint, u64:bigint, f32:number, f64:number, v8Offset:flatbuffers.Offset, vf64Offset:flatbuffers.Offset):flatbuffers.Offset {
+ MyGame_Example_TypeAliases.startTypeAliases(builder);
+ MyGame_Example_TypeAliases.addI8(builder, i8);
+ MyGame_Example_TypeAliases.addU8(builder, u8);
+ MyGame_Example_TypeAliases.addI16(builder, i16);
+ MyGame_Example_TypeAliases.addU16(builder, u16);
+ MyGame_Example_TypeAliases.addI32(builder, i32);
+ MyGame_Example_TypeAliases.addU32(builder, u32);
+ MyGame_Example_TypeAliases.addI64(builder, i64);
+ MyGame_Example_TypeAliases.addU64(builder, u64);
+ MyGame_Example_TypeAliases.addF32(builder, f32);
+ MyGame_Example_TypeAliases.addF64(builder, f64);
+ MyGame_Example_TypeAliases.addV8(builder, v8Offset);
+ MyGame_Example_TypeAliases.addVf64(builder, vf64Offset);
+ return MyGame_Example_TypeAliases.endTypeAliases(builder);
+}
+
+serialize():Uint8Array {
+ return this.bb!.bytes();
+}
+
+static deserialize(buffer: Uint8Array):TypeAliases {
+ return MyGame_Example_TypeAliases.getRootAsTypeAliases(new flatbuffers.ByteBuffer(buffer))
+}
+}
+
diff --git a/tests/tsconfig.json b/tests/ts/tsconfig.json
similarity index 100%
rename from tests/tsconfig.json
rename to tests/ts/tsconfig.json
diff --git a/tests/ts/typescript/class.js b/tests/ts/typescript/class.js
new file mode 100644
index 0000000..9b0f2c0
--- /dev/null
+++ b/tests/ts/typescript/class.js
@@ -0,0 +1,6 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+export var class_;
+(function (class_) {
+ class_[class_["new_"] = 0] = "new_";
+ class_[class_["instanceof_"] = 1] = "instanceof_";
+})(class_ || (class_ = {}));
diff --git a/tests/ts/typescript/class.ts b/tests/ts/typescript/class.ts
new file mode 100644
index 0000000..fd8f145
--- /dev/null
+++ b/tests/ts/typescript/class.ts
@@ -0,0 +1,6 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+export enum class_ {
+ new_ = 0,
+ instanceof_ = 1
+}
diff --git a/tests/ts/typescript/object.js b/tests/ts/typescript/object.js
new file mode 100644
index 0000000..05ffb1a
--- /dev/null
+++ b/tests/ts/typescript/object.js
@@ -0,0 +1,166 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { Abc } from '../foobar/abc.js';
+import { class_ as foobar_class_ } from '../foobar/class.js';
+import { Schema } from '../reflection/schema.js';
+import { class_ } from '../typescript/class.js';
+export class Object_ {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsObject(bb, obj) {
+ return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsObject(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ return_() {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+ }
+ mutate_return(value) {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ if_() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+ }
+ mutate_if(value) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ switch_() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+ }
+ mutate_switch(value) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ enum_() {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : class_.new_;
+ }
+ mutate_enum(value) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ enum2() {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : foobar_class_.arguments_;
+ }
+ mutate_enum2(value) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ enum3() {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : Abc.a;
+ }
+ mutate_enum3(value) {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ reflect(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ return offset ? (obj || new Schema()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ static getFullyQualifiedName() {
+ return 'typescript_Object';
+ }
+ static startObject(builder) {
+ builder.startObject(7);
+ }
+ static addReturn(builder, return_) {
+ builder.addFieldInt32(0, return_, 0);
+ }
+ static addIf(builder, if_) {
+ builder.addFieldInt32(1, if_, 0);
+ }
+ static addSwitch(builder, switch_) {
+ builder.addFieldInt32(2, switch_, 0);
+ }
+ static addEnum(builder, enum_) {
+ builder.addFieldInt32(3, enum_, class_.new_);
+ }
+ static addEnum2(builder, enum2) {
+ builder.addFieldInt32(4, enum2, foobar_class_.arguments_);
+ }
+ static addEnum3(builder, enum3) {
+ builder.addFieldInt32(5, enum3, Abc.a);
+ }
+ static addReflect(builder, reflectOffset) {
+ builder.addFieldOffset(6, reflectOffset, 0);
+ }
+ static endObject(builder) {
+ const offset = builder.endObject();
+ return offset;
+ }
+ unpack() {
+ return new Object_T(this.return_(), this.if_(), this.switch_(), this.enum_(), this.enum2(), this.enum3(), (this.reflect() !== null ? this.reflect().unpack() : null));
+ }
+ unpackTo(_o) {
+ _o.return_ = this.return_();
+ _o.if_ = this.if_();
+ _o.switch_ = this.switch_();
+ _o.enum_ = this.enum_();
+ _o.enum2 = this.enum2();
+ _o.enum3 = this.enum3();
+ _o.reflect = (this.reflect() !== null ? this.reflect().unpack() : null);
+ }
+}
+export class Object_T {
+ constructor(return_ = 0, if_ = 0, switch_ = 0, enum_ = class_.new_, enum2 = foobar_class_.arguments_, enum3 = Abc.a, reflect = null) {
+ this.return_ = return_;
+ this.if_ = if_;
+ this.switch_ = switch_;
+ this.enum_ = enum_;
+ this.enum2 = enum2;
+ this.enum3 = enum3;
+ this.reflect = reflect;
+ }
+ pack(builder) {
+ const reflect = (this.reflect !== null ? this.reflect.pack(builder) : 0);
+ Object_.startObject(builder);
+ Object_.addReturn(builder, this.return_);
+ Object_.addIf(builder, this.if_);
+ Object_.addSwitch(builder, this.switch_);
+ Object_.addEnum(builder, this.enum_);
+ Object_.addEnum2(builder, this.enum2);
+ Object_.addEnum3(builder, this.enum3);
+ Object_.addReflect(builder, reflect);
+ return Object_.endObject(builder);
+ }
+}
diff --git a/tests/ts/typescript/object.ts b/tests/ts/typescript/object.ts
new file mode 100644
index 0000000..041b660
--- /dev/null
+++ b/tests/ts/typescript/object.ts
@@ -0,0 +1,222 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { Abc } from '../foobar/abc.js';
+import { class_ as foobar_class_ } from '../foobar/class.js';
+import { Schema, SchemaT } from '../reflection/schema.js';
+import { class_ } from '../typescript/class.js';
+
+
+export class Object_ {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Object_ {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsObject(bb:flatbuffers.ByteBuffer, obj?:Object_):Object_ {
+ return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsObject(bb:flatbuffers.ByteBuffer, obj?:Object_):Object_ {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+return_():number {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_return(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+if_():number {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_if(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+switch_():number {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_switch(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+enum_():class_ {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : class_.new_;
+}
+
+mutate_enum(value:class_):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+enum2():foobar_class_ {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : foobar_class_.arguments_;
+}
+
+mutate_enum2(value:foobar_class_):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+enum3():Abc {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : Abc.a;
+}
+
+mutate_enum3(value:Abc):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+reflect(obj?:Schema):Schema|null {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? (obj || new Schema()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+static getFullyQualifiedName():string {
+ return 'typescript_Object';
+}
+
+static startObject(builder:flatbuffers.Builder) {
+ builder.startObject(7);
+}
+
+static addReturn(builder:flatbuffers.Builder, return_:number) {
+ builder.addFieldInt32(0, return_, 0);
+}
+
+static addIf(builder:flatbuffers.Builder, if_:number) {
+ builder.addFieldInt32(1, if_, 0);
+}
+
+static addSwitch(builder:flatbuffers.Builder, switch_:number) {
+ builder.addFieldInt32(2, switch_, 0);
+}
+
+static addEnum(builder:flatbuffers.Builder, enum_:class_) {
+ builder.addFieldInt32(3, enum_, class_.new_);
+}
+
+static addEnum2(builder:flatbuffers.Builder, enum2:foobar_class_) {
+ builder.addFieldInt32(4, enum2, foobar_class_.arguments_);
+}
+
+static addEnum3(builder:flatbuffers.Builder, enum3:Abc) {
+ builder.addFieldInt32(5, enum3, Abc.a);
+}
+
+static addReflect(builder:flatbuffers.Builder, reflectOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(6, reflectOffset, 0);
+}
+
+static endObject(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+
+unpack(): Object_T {
+ return new Object_T(
+ this.return_(),
+ this.if_(),
+ this.switch_(),
+ this.enum_(),
+ this.enum2(),
+ this.enum3(),
+ (this.reflect() !== null ? this.reflect()!.unpack() : null)
+ );
+}
+
+
+unpackTo(_o: Object_T): void {
+ _o.return_ = this.return_();
+ _o.if_ = this.if_();
+ _o.switch_ = this.switch_();
+ _o.enum_ = this.enum_();
+ _o.enum2 = this.enum2();
+ _o.enum3 = this.enum3();
+ _o.reflect = (this.reflect() !== null ? this.reflect()!.unpack() : null);
+}
+}
+
+export class Object_T {
+constructor(
+ public return_: number = 0,
+ public if_: number = 0,
+ public switch_: number = 0,
+ public enum_: class_ = class_.new_,
+ public enum2: foobar_class_ = foobar_class_.arguments_,
+ public enum3: Abc = Abc.a,
+ public reflect: SchemaT|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const reflect = (this.reflect !== null ? this.reflect!.pack(builder) : 0);
+
+ Object_.startObject(builder);
+ Object_.addReturn(builder, this.return_);
+ Object_.addIf(builder, this.if_);
+ Object_.addSwitch(builder, this.switch_);
+ Object_.addEnum(builder, this.enum_);
+ Object_.addEnum2(builder, this.enum2);
+ Object_.addEnum3(builder, this.enum3);
+ Object_.addReflect(builder, reflect);
+
+ return Object_.endObject(builder);
+}
+}
diff --git a/tests/ts/typescript_include_generated.js b/tests/ts/typescript_include_generated.js
new file mode 100644
index 0000000..e0e1df1
--- /dev/null
+++ b/tests/ts/typescript_include_generated.js
@@ -0,0 +1,5 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+export var class_;
+(function (class_) {
+ class_[class_["arguments_"] = 0] = "arguments_";
+})(class_ || (class_ = {}));
diff --git a/tests/ts/typescript_include_generated.ts b/tests/ts/typescript_include_generated.ts
new file mode 100644
index 0000000..d419431
--- /dev/null
+++ b/tests/ts/typescript_include_generated.ts
@@ -0,0 +1,7 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+
+export enum class_ {
+ arguments_ = 0
+}
+
diff --git a/tests/typescript_keywords.fbs b/tests/ts/typescript_keywords.fbs
similarity index 100%
rename from tests/typescript_keywords.fbs
rename to tests/ts/typescript_keywords.fbs
diff --git a/tests/ts/typescript_keywords_generated.js b/tests/ts/typescript_keywords_generated.js
new file mode 100644
index 0000000..4525da7
--- /dev/null
+++ b/tests/ts/typescript_keywords_generated.js
@@ -0,0 +1,170 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { Schema as Schema } from './reflection_generated.js';
+import { class_ as foobar_class_ } from './typescript_include_generated.js';
+import { Abc as Abc } from './typescript_transitive_include_generated.js';
+export var class_;
+(function (class_) {
+ class_[class_["new_"] = 0] = "new_";
+ class_[class_["instanceof_"] = 1] = "instanceof_";
+})(class_ || (class_ = {}));
+export class Object_ {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsObject(bb, obj) {
+ return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsObject(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ return_() {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+ }
+ mutate_return(value) {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ if_() {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+ }
+ mutate_if(value) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ switch_() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+ }
+ mutate_switch(value) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ enum_() {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : class_.new_;
+ }
+ mutate_enum(value) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ enum2() {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : foobar_class_.arguments_;
+ }
+ mutate_enum2(value) {
+ const offset = this.bb.__offset(this.bb_pos, 12);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ enum3() {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : Abc.a;
+ }
+ mutate_enum3(value) {
+ const offset = this.bb.__offset(this.bb_pos, 14);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ reflect(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 16);
+ return offset ? (obj || new Schema()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
+ }
+ static getFullyQualifiedName() {
+ return 'typescript_Object';
+ }
+ static startObject(builder) {
+ builder.startObject(7);
+ }
+ static addReturn(builder, return_) {
+ builder.addFieldInt32(0, return_, 0);
+ }
+ static addIf(builder, if_) {
+ builder.addFieldInt32(1, if_, 0);
+ }
+ static addSwitch(builder, switch_) {
+ builder.addFieldInt32(2, switch_, 0);
+ }
+ static addEnum(builder, enum_) {
+ builder.addFieldInt32(3, enum_, class_.new_);
+ }
+ static addEnum2(builder, enum2) {
+ builder.addFieldInt32(4, enum2, foobar_class_.arguments_);
+ }
+ static addEnum3(builder, enum3) {
+ builder.addFieldInt32(5, enum3, Abc.a);
+ }
+ static addReflect(builder, reflectOffset) {
+ builder.addFieldOffset(6, reflectOffset, 0);
+ }
+ static endObject(builder) {
+ const offset = builder.endObject();
+ return offset;
+ }
+ unpack() {
+ return new Object_T(this.return_(), this.if_(), this.switch_(), this.enum_(), this.enum2(), this.enum3(), (this.reflect() !== null ? this.reflect().unpack() : null));
+ }
+ unpackTo(_o) {
+ _o.return_ = this.return_();
+ _o.if_ = this.if_();
+ _o.switch_ = this.switch_();
+ _o.enum_ = this.enum_();
+ _o.enum2 = this.enum2();
+ _o.enum3 = this.enum3();
+ _o.reflect = (this.reflect() !== null ? this.reflect().unpack() : null);
+ }
+}
+export class Object_T {
+ constructor(return_ = 0, if_ = 0, switch_ = 0, enum_ = class_.new_, enum2 = foobar_class_.arguments_, enum3 = Abc.a, reflect = null) {
+ this.return_ = return_;
+ this.if_ = if_;
+ this.switch_ = switch_;
+ this.enum_ = enum_;
+ this.enum2 = enum2;
+ this.enum3 = enum3;
+ this.reflect = reflect;
+ }
+ pack(builder) {
+ const reflect = (this.reflect !== null ? this.reflect.pack(builder) : 0);
+ Object_.startObject(builder);
+ Object_.addReturn(builder, this.return_);
+ Object_.addIf(builder, this.if_);
+ Object_.addSwitch(builder, this.switch_);
+ Object_.addEnum(builder, this.enum_);
+ Object_.addEnum2(builder, this.enum2);
+ Object_.addEnum3(builder, this.enum3);
+ Object_.addReflect(builder, reflect);
+ return Object_.endObject(builder);
+ }
+}
diff --git a/tests/ts/typescript_keywords_generated.ts b/tests/ts/typescript_keywords_generated.ts
new file mode 100644
index 0000000..4272425
--- /dev/null
+++ b/tests/ts/typescript_keywords_generated.ts
@@ -0,0 +1,226 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import {Schema as Schema, SchemaT as SchemaT} from './reflection_generated.js';
+import {class_ as foobar_class_} from './typescript_include_generated.js';
+import {Abc as Abc} from './typescript_transitive_include_generated.js';
+
+export enum class_ {
+ new_ = 0,
+ instanceof_ = 1
+}
+
+export class Object_ {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Object_ {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsObject(bb:flatbuffers.ByteBuffer, obj?:Object_):Object_ {
+ return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsObject(bb:flatbuffers.ByteBuffer, obj?:Object_):Object_ {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Object_()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+return_():number {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_return(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+if_():number {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_if(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+switch_():number {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_switch(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+enum_():class_ {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : class_.new_;
+}
+
+mutate_enum(value:class_):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+enum2():foobar_class_ {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : foobar_class_.arguments_;
+}
+
+mutate_enum2(value:foobar_class_):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 12);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+enum3():Abc {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : Abc.a;
+}
+
+mutate_enum3(value:Abc):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 14);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+reflect(obj?:Schema):Schema|null {
+ const offset = this.bb!.__offset(this.bb_pos, 16);
+ return offset ? (obj || new Schema()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
+}
+
+static getFullyQualifiedName():string {
+ return 'typescript_Object';
+}
+
+static startObject(builder:flatbuffers.Builder) {
+ builder.startObject(7);
+}
+
+static addReturn(builder:flatbuffers.Builder, return_:number) {
+ builder.addFieldInt32(0, return_, 0);
+}
+
+static addIf(builder:flatbuffers.Builder, if_:number) {
+ builder.addFieldInt32(1, if_, 0);
+}
+
+static addSwitch(builder:flatbuffers.Builder, switch_:number) {
+ builder.addFieldInt32(2, switch_, 0);
+}
+
+static addEnum(builder:flatbuffers.Builder, enum_:class_) {
+ builder.addFieldInt32(3, enum_, class_.new_);
+}
+
+static addEnum2(builder:flatbuffers.Builder, enum2:foobar_class_) {
+ builder.addFieldInt32(4, enum2, foobar_class_.arguments_);
+}
+
+static addEnum3(builder:flatbuffers.Builder, enum3:Abc) {
+ builder.addFieldInt32(5, enum3, Abc.a);
+}
+
+static addReflect(builder:flatbuffers.Builder, reflectOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(6, reflectOffset, 0);
+}
+
+static endObject(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+
+unpack(): Object_T {
+ return new Object_T(
+ this.return_(),
+ this.if_(),
+ this.switch_(),
+ this.enum_(),
+ this.enum2(),
+ this.enum3(),
+ (this.reflect() !== null ? this.reflect()!.unpack() : null)
+ );
+}
+
+
+unpackTo(_o: Object_T): void {
+ _o.return_ = this.return_();
+ _o.if_ = this.if_();
+ _o.switch_ = this.switch_();
+ _o.enum_ = this.enum_();
+ _o.enum2 = this.enum2();
+ _o.enum3 = this.enum3();
+ _o.reflect = (this.reflect() !== null ? this.reflect()!.unpack() : null);
+}
+}
+
+export class Object_T {
+constructor(
+ public return_: number = 0,
+ public if_: number = 0,
+ public switch_: number = 0,
+ public enum_: class_ = class_.new_,
+ public enum2: foobar_class_ = foobar_class_.arguments_,
+ public enum3: Abc = Abc.a,
+ public reflect: SchemaT|null = null
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const reflect = (this.reflect !== null ? this.reflect!.pack(builder) : 0);
+
+ Object_.startObject(builder);
+ Object_.addReturn(builder, this.return_);
+ Object_.addIf(builder, this.if_);
+ Object_.addSwitch(builder, this.switch_);
+ Object_.addEnum(builder, this.enum_);
+ Object_.addEnum2(builder, this.enum2);
+ Object_.addEnum3(builder, this.enum3);
+ Object_.addReflect(builder, reflect);
+
+ return Object_.endObject(builder);
+}
+}
+
diff --git a/tests/ts/typescript_transitive_include_generated.js b/tests/ts/typescript_transitive_include_generated.js
new file mode 100644
index 0000000..cdef988
--- /dev/null
+++ b/tests/ts/typescript_transitive_include_generated.js
@@ -0,0 +1,5 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+export var Abc;
+(function (Abc) {
+ Abc[Abc["a"] = 0] = "a";
+})(Abc || (Abc = {}));
diff --git a/tests/ts/typescript_transitive_include_generated.ts b/tests/ts/typescript_transitive_include_generated.ts
new file mode 100644
index 0000000..6bb1601
--- /dev/null
+++ b/tests/ts/typescript_transitive_include_generated.ts
@@ -0,0 +1,7 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+
+export enum Abc {
+ a = 0
+}
+
diff --git a/tests/ts/unicode_test.mon b/tests/ts/unicode_test.mon
new file mode 100644
index 0000000..14f5fb4
--- /dev/null
+++ b/tests/ts/unicode_test.mon
Binary files differ
diff --git a/tests/ts/union_vector/attacker.js b/tests/ts/union_vector/attacker.js
new file mode 100644
index 0000000..32be94e
--- /dev/null
+++ b/tests/ts/union_vector/attacker.js
@@ -0,0 +1,64 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+export class Attacker {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsAttacker(bb, obj) {
+ return (obj || new Attacker()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsAttacker(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Attacker()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ swordAttackDamage() {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+ }
+ mutate_sword_attack_damage(value) {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ static getFullyQualifiedName() {
+ return 'Attacker';
+ }
+ static startAttacker(builder) {
+ builder.startObject(1);
+ }
+ static addSwordAttackDamage(builder, swordAttackDamage) {
+ builder.addFieldInt32(0, swordAttackDamage, 0);
+ }
+ static endAttacker(builder) {
+ const offset = builder.endObject();
+ return offset;
+ }
+ static createAttacker(builder, swordAttackDamage) {
+ Attacker.startAttacker(builder);
+ Attacker.addSwordAttackDamage(builder, swordAttackDamage);
+ return Attacker.endAttacker(builder);
+ }
+ unpack() {
+ return new AttackerT(this.swordAttackDamage());
+ }
+ unpackTo(_o) {
+ _o.swordAttackDamage = this.swordAttackDamage();
+ }
+}
+export class AttackerT {
+ constructor(swordAttackDamage = 0) {
+ this.swordAttackDamage = swordAttackDamage;
+ }
+ pack(builder) {
+ return Attacker.createAttacker(builder, this.swordAttackDamage);
+ }
+}
diff --git a/tests/ts/union_vector/attacker.ts b/tests/ts/union_vector/attacker.ts
new file mode 100644
index 0000000..6b3fc0f
--- /dev/null
+++ b/tests/ts/union_vector/attacker.ts
@@ -0,0 +1,87 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+
+export class Attacker {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Attacker {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsAttacker(bb:flatbuffers.ByteBuffer, obj?:Attacker):Attacker {
+ return (obj || new Attacker()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsAttacker(bb:flatbuffers.ByteBuffer, obj?:Attacker):Attacker {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Attacker()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+swordAttackDamage():number {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_sword_attack_damage(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+static getFullyQualifiedName():string {
+ return 'Attacker';
+}
+
+static startAttacker(builder:flatbuffers.Builder) {
+ builder.startObject(1);
+}
+
+static addSwordAttackDamage(builder:flatbuffers.Builder, swordAttackDamage:number) {
+ builder.addFieldInt32(0, swordAttackDamage, 0);
+}
+
+static endAttacker(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createAttacker(builder:flatbuffers.Builder, swordAttackDamage:number):flatbuffers.Offset {
+ Attacker.startAttacker(builder);
+ Attacker.addSwordAttackDamage(builder, swordAttackDamage);
+ return Attacker.endAttacker(builder);
+}
+
+unpack(): AttackerT {
+ return new AttackerT(
+ this.swordAttackDamage()
+ );
+}
+
+
+unpackTo(_o: AttackerT): void {
+ _o.swordAttackDamage = this.swordAttackDamage();
+}
+}
+
+export class AttackerT {
+constructor(
+ public swordAttackDamage: number = 0
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ return Attacker.createAttacker(builder,
+ this.swordAttackDamage
+ );
+}
+}
diff --git a/tests/ts/union_vector/book-reader.js b/tests/ts/union_vector/book-reader.js
new file mode 100644
index 0000000..0d9e1a5
--- /dev/null
+++ b/tests/ts/union_vector/book-reader.js
@@ -0,0 +1,44 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+export class BookReader {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ booksRead() {
+ return this.bb.readInt32(this.bb_pos);
+ }
+ mutate_books_read(value) {
+ this.bb.writeInt32(this.bb_pos + 0, value);
+ return true;
+ }
+ static getFullyQualifiedName() {
+ return 'BookReader';
+ }
+ static sizeOf() {
+ return 4;
+ }
+ static createBookReader(builder, books_read) {
+ builder.prep(4, 4);
+ builder.writeInt32(books_read);
+ return builder.offset();
+ }
+ unpack() {
+ return new BookReaderT(this.booksRead());
+ }
+ unpackTo(_o) {
+ _o.booksRead = this.booksRead();
+ }
+}
+export class BookReaderT {
+ constructor(booksRead = 0) {
+ this.booksRead = booksRead;
+ }
+ pack(builder) {
+ return BookReader.createBookReader(builder, this.booksRead);
+ }
+}
diff --git a/tests/ts/union_vector/book-reader.ts b/tests/ts/union_vector/book-reader.ts
new file mode 100644
index 0000000..7a31278
--- /dev/null
+++ b/tests/ts/union_vector/book-reader.ts
@@ -0,0 +1,63 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+
+export class BookReader {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):BookReader {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+booksRead():number {
+ return this.bb!.readInt32(this.bb_pos);
+}
+
+mutate_books_read(value:number):boolean {
+ this.bb!.writeInt32(this.bb_pos + 0, value);
+ return true;
+}
+
+static getFullyQualifiedName():string {
+ return 'BookReader';
+}
+
+static sizeOf():number {
+ return 4;
+}
+
+static createBookReader(builder:flatbuffers.Builder, books_read: number):flatbuffers.Offset {
+ builder.prep(4, 4);
+ builder.writeInt32(books_read);
+ return builder.offset();
+}
+
+
+unpack(): BookReaderT {
+ return new BookReaderT(
+ this.booksRead()
+ );
+}
+
+
+unpackTo(_o: BookReaderT): void {
+ _o.booksRead = this.booksRead();
+}
+}
+
+export class BookReaderT {
+constructor(
+ public booksRead: number = 0
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ return BookReader.createBookReader(builder,
+ this.booksRead
+ );
+}
+}
diff --git a/tests/ts/union_vector/character.js b/tests/ts/union_vector/character.js
new file mode 100644
index 0000000..04e3294
--- /dev/null
+++ b/tests/ts/union_vector/character.js
@@ -0,0 +1,38 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import { Attacker } from './attacker.js';
+import { BookReader } from './book-reader.js';
+import { Rapunzel } from './rapunzel.js';
+export var Character;
+(function (Character) {
+ Character[Character["NONE"] = 0] = "NONE";
+ Character[Character["MuLan"] = 1] = "MuLan";
+ Character[Character["Rapunzel"] = 2] = "Rapunzel";
+ Character[Character["Belle"] = 3] = "Belle";
+ Character[Character["BookFan"] = 4] = "BookFan";
+ Character[Character["Other"] = 5] = "Other";
+ Character[Character["Unused"] = 6] = "Unused";
+})(Character || (Character = {}));
+export function unionToCharacter(type, accessor) {
+ switch (Character[type]) {
+ case 'NONE': return null;
+ case 'MuLan': return accessor(new Attacker());
+ case 'Rapunzel': return accessor(new Rapunzel());
+ case 'Belle': return accessor(new BookReader());
+ case 'BookFan': return accessor(new BookReader());
+ case 'Other': return accessor('');
+ case 'Unused': return accessor('');
+ default: return null;
+ }
+}
+export function unionListToCharacter(type, accessor, index) {
+ switch (Character[type]) {
+ case 'NONE': return null;
+ case 'MuLan': return accessor(index, new Attacker());
+ case 'Rapunzel': return accessor(index, new Rapunzel());
+ case 'Belle': return accessor(index, new BookReader());
+ case 'BookFan': return accessor(index, new BookReader());
+ case 'Other': return accessor(index, '');
+ case 'Unused': return accessor(index, '');
+ default: return null;
+ }
+}
diff --git a/tests/ts/union_vector/character.ts b/tests/ts/union_vector/character.ts
new file mode 100644
index 0000000..ddad875
--- /dev/null
+++ b/tests/ts/union_vector/character.ts
@@ -0,0 +1,49 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import { Attacker, AttackerT } from './attacker.js';
+import { BookReader, BookReaderT } from './book-reader.js';
+import { Rapunzel, RapunzelT } from './rapunzel.js';
+
+
+export enum Character {
+ NONE = 0,
+ MuLan = 1,
+ Rapunzel = 2,
+ Belle = 3,
+ BookFan = 4,
+ Other = 5,
+ Unused = 6
+}
+
+export function unionToCharacter(
+ type: Character,
+ accessor: (obj:Attacker|BookReader|Rapunzel|string) => Attacker|BookReader|Rapunzel|string|null
+): Attacker|BookReader|Rapunzel|string|null {
+ switch(Character[type]) {
+ case 'NONE': return null;
+ case 'MuLan': return accessor(new Attacker())! as Attacker;
+ case 'Rapunzel': return accessor(new Rapunzel())! as Rapunzel;
+ case 'Belle': return accessor(new BookReader())! as BookReader;
+ case 'BookFan': return accessor(new BookReader())! as BookReader;
+ case 'Other': return accessor('') as string;
+ case 'Unused': return accessor('') as string;
+ default: return null;
+ }
+}
+
+export function unionListToCharacter(
+ type: Character,
+ accessor: (index: number, obj:Attacker|BookReader|Rapunzel|string) => Attacker|BookReader|Rapunzel|string|null,
+ index: number
+): Attacker|BookReader|Rapunzel|string|null {
+ switch(Character[type]) {
+ case 'NONE': return null;
+ case 'MuLan': return accessor(index, new Attacker())! as Attacker;
+ case 'Rapunzel': return accessor(index, new Rapunzel())! as Rapunzel;
+ case 'Belle': return accessor(index, new BookReader())! as BookReader;
+ case 'BookFan': return accessor(index, new BookReader())! as BookReader;
+ case 'Other': return accessor(index, '') as string;
+ case 'Unused': return accessor(index, '') as string;
+ default: return null;
+ }
+}
diff --git a/tests/ts/union_vector/falling-tub.js b/tests/ts/union_vector/falling-tub.js
new file mode 100644
index 0000000..d3c4dfe
--- /dev/null
+++ b/tests/ts/union_vector/falling-tub.js
@@ -0,0 +1,44 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+export class FallingTub {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ weight() {
+ return this.bb.readInt32(this.bb_pos);
+ }
+ mutate_weight(value) {
+ this.bb.writeInt32(this.bb_pos + 0, value);
+ return true;
+ }
+ static getFullyQualifiedName() {
+ return 'FallingTub';
+ }
+ static sizeOf() {
+ return 4;
+ }
+ static createFallingTub(builder, weight) {
+ builder.prep(4, 4);
+ builder.writeInt32(weight);
+ return builder.offset();
+ }
+ unpack() {
+ return new FallingTubT(this.weight());
+ }
+ unpackTo(_o) {
+ _o.weight = this.weight();
+ }
+}
+export class FallingTubT {
+ constructor(weight = 0) {
+ this.weight = weight;
+ }
+ pack(builder) {
+ return FallingTub.createFallingTub(builder, this.weight);
+ }
+}
diff --git a/tests/ts/union_vector/falling-tub.ts b/tests/ts/union_vector/falling-tub.ts
new file mode 100644
index 0000000..b32f99d
--- /dev/null
+++ b/tests/ts/union_vector/falling-tub.ts
@@ -0,0 +1,63 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+
+export class FallingTub {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):FallingTub {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+weight():number {
+ return this.bb!.readInt32(this.bb_pos);
+}
+
+mutate_weight(value:number):boolean {
+ this.bb!.writeInt32(this.bb_pos + 0, value);
+ return true;
+}
+
+static getFullyQualifiedName():string {
+ return 'FallingTub';
+}
+
+static sizeOf():number {
+ return 4;
+}
+
+static createFallingTub(builder:flatbuffers.Builder, weight: number):flatbuffers.Offset {
+ builder.prep(4, 4);
+ builder.writeInt32(weight);
+ return builder.offset();
+}
+
+
+unpack(): FallingTubT {
+ return new FallingTubT(
+ this.weight()
+ );
+}
+
+
+unpackTo(_o: FallingTubT): void {
+ _o.weight = this.weight();
+}
+}
+
+export class FallingTubT {
+constructor(
+ public weight: number = 0
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ return FallingTub.createFallingTub(builder,
+ this.weight
+ );
+}
+}
diff --git a/tests/ts/union_vector/gadget.js b/tests/ts/union_vector/gadget.js
new file mode 100644
index 0000000..202a214
--- /dev/null
+++ b/tests/ts/union_vector/gadget.js
@@ -0,0 +1,25 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import { FallingTub } from './falling-tub.js';
+import { HandFan } from './hand-fan.js';
+export var Gadget;
+(function (Gadget) {
+ Gadget[Gadget["NONE"] = 0] = "NONE";
+ Gadget[Gadget["FallingTub"] = 1] = "FallingTub";
+ Gadget[Gadget["HandFan"] = 2] = "HandFan";
+})(Gadget || (Gadget = {}));
+export function unionToGadget(type, accessor) {
+ switch (Gadget[type]) {
+ case 'NONE': return null;
+ case 'FallingTub': return accessor(new FallingTub());
+ case 'HandFan': return accessor(new HandFan());
+ default: return null;
+ }
+}
+export function unionListToGadget(type, accessor, index) {
+ switch (Gadget[type]) {
+ case 'NONE': return null;
+ case 'FallingTub': return accessor(index, new FallingTub());
+ case 'HandFan': return accessor(index, new HandFan());
+ default: return null;
+ }
+}
diff --git a/tests/ts/union_vector/gadget.ts b/tests/ts/union_vector/gadget.ts
new file mode 100644
index 0000000..b6e117b
--- /dev/null
+++ b/tests/ts/union_vector/gadget.ts
@@ -0,0 +1,36 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import { FallingTub, FallingTubT } from './falling-tub.js';
+import { HandFan, HandFanT } from './hand-fan.js';
+
+
+export enum Gadget {
+ NONE = 0,
+ FallingTub = 1,
+ HandFan = 2
+}
+
+export function unionToGadget(
+ type: Gadget,
+ accessor: (obj:FallingTub|HandFan) => FallingTub|HandFan|null
+): FallingTub|HandFan|null {
+ switch(Gadget[type]) {
+ case 'NONE': return null;
+ case 'FallingTub': return accessor(new FallingTub())! as FallingTub;
+ case 'HandFan': return accessor(new HandFan())! as HandFan;
+ default: return null;
+ }
+}
+
+export function unionListToGadget(
+ type: Gadget,
+ accessor: (index: number, obj:FallingTub|HandFan) => FallingTub|HandFan|null,
+ index: number
+): FallingTub|HandFan|null {
+ switch(Gadget[type]) {
+ case 'NONE': return null;
+ case 'FallingTub': return accessor(index, new FallingTub())! as FallingTub;
+ case 'HandFan': return accessor(index, new HandFan())! as HandFan;
+ default: return null;
+ }
+}
diff --git a/tests/ts/union_vector/hand-fan.js b/tests/ts/union_vector/hand-fan.js
new file mode 100644
index 0000000..21decca
--- /dev/null
+++ b/tests/ts/union_vector/hand-fan.js
@@ -0,0 +1,64 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+export class HandFan {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsHandFan(bb, obj) {
+ return (obj || new HandFan()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsHandFan(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new HandFan()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ length() {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
+ }
+ mutate_length(value) {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ if (offset === 0) {
+ return false;
+ }
+ this.bb.writeInt32(this.bb_pos + offset, value);
+ return true;
+ }
+ static getFullyQualifiedName() {
+ return 'HandFan';
+ }
+ static startHandFan(builder) {
+ builder.startObject(1);
+ }
+ static addLength(builder, length) {
+ builder.addFieldInt32(0, length, 0);
+ }
+ static endHandFan(builder) {
+ const offset = builder.endObject();
+ return offset;
+ }
+ static createHandFan(builder, length) {
+ HandFan.startHandFan(builder);
+ HandFan.addLength(builder, length);
+ return HandFan.endHandFan(builder);
+ }
+ unpack() {
+ return new HandFanT(this.length());
+ }
+ unpackTo(_o) {
+ _o.length = this.length();
+ }
+}
+export class HandFanT {
+ constructor(length = 0) {
+ this.length = length;
+ }
+ pack(builder) {
+ return HandFan.createHandFan(builder, this.length);
+ }
+}
diff --git a/tests/ts/union_vector/hand-fan.ts b/tests/ts/union_vector/hand-fan.ts
new file mode 100644
index 0000000..f90b4dd
--- /dev/null
+++ b/tests/ts/union_vector/hand-fan.ts
@@ -0,0 +1,87 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+
+export class HandFan {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):HandFan {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsHandFan(bb:flatbuffers.ByteBuffer, obj?:HandFan):HandFan {
+ return (obj || new HandFan()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsHandFan(bb:flatbuffers.ByteBuffer, obj?:HandFan):HandFan {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new HandFan()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+length():number {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0;
+}
+
+mutate_length(value:number):boolean {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+
+ if (offset === 0) {
+ return false;
+ }
+
+ this.bb!.writeInt32(this.bb_pos + offset, value);
+ return true;
+}
+
+static getFullyQualifiedName():string {
+ return 'HandFan';
+}
+
+static startHandFan(builder:flatbuffers.Builder) {
+ builder.startObject(1);
+}
+
+static addLength(builder:flatbuffers.Builder, length:number) {
+ builder.addFieldInt32(0, length, 0);
+}
+
+static endHandFan(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static createHandFan(builder:flatbuffers.Builder, length:number):flatbuffers.Offset {
+ HandFan.startHandFan(builder);
+ HandFan.addLength(builder, length);
+ return HandFan.endHandFan(builder);
+}
+
+unpack(): HandFanT {
+ return new HandFanT(
+ this.length()
+ );
+}
+
+
+unpackTo(_o: HandFanT): void {
+ _o.length = this.length();
+}
+}
+
+export class HandFanT {
+constructor(
+ public length: number = 0
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ return HandFan.createHandFan(builder,
+ this.length
+ );
+}
+}
diff --git a/tests/ts/union_vector/movie.js b/tests/ts/union_vector/movie.js
new file mode 100644
index 0000000..0245a43
--- /dev/null
+++ b/tests/ts/union_vector/movie.js
@@ -0,0 +1,185 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+import * as flatbuffers from 'flatbuffers';
+import { Character, unionToCharacter, unionListToCharacter } from './character.js';
+export class Movie {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ static getRootAsMovie(bb, obj) {
+ return (obj || new Movie()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static getSizePrefixedRootAsMovie(bb, obj) {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Movie()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+ }
+ static bufferHasIdentifier(bb) {
+ return bb.__has_identifier('MOVI');
+ }
+ mainCharacterType() {
+ const offset = this.bb.__offset(this.bb_pos, 4);
+ return offset ? this.bb.readUint8(this.bb_pos + offset) : Character.NONE;
+ }
+ mainCharacter(obj) {
+ const offset = this.bb.__offset(this.bb_pos, 6);
+ return offset ? this.bb.__union_with_string(obj, this.bb_pos + offset) : null;
+ }
+ charactersType(index) {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
+ }
+ charactersTypeLength() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ charactersTypeArray() {
+ const offset = this.bb.__offset(this.bb_pos, 8);
+ 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;
+ }
+ characters(index, obj) {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.__union_with_string(obj, this.bb.__vector(this.bb_pos + offset) + index * 4) : null;
+ }
+ charactersLength() {
+ const offset = this.bb.__offset(this.bb_pos, 10);
+ return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
+ }
+ static getFullyQualifiedName() {
+ return 'Movie';
+ }
+ static startMovie(builder) {
+ builder.startObject(4);
+ }
+ static addMainCharacterType(builder, mainCharacterType) {
+ builder.addFieldInt8(0, mainCharacterType, Character.NONE);
+ }
+ static addMainCharacter(builder, mainCharacterOffset) {
+ builder.addFieldOffset(1, mainCharacterOffset, 0);
+ }
+ static addCharactersType(builder, charactersTypeOffset) {
+ builder.addFieldOffset(2, charactersTypeOffset, 0);
+ }
+ static createCharactersTypeVector(builder, data) {
+ builder.startVector(1, data.length, 1);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addInt8(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startCharactersTypeVector(builder, numElems) {
+ builder.startVector(1, numElems, 1);
+ }
+ static addCharacters(builder, charactersOffset) {
+ builder.addFieldOffset(3, charactersOffset, 0);
+ }
+ static createCharactersVector(builder, data) {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]);
+ }
+ return builder.endVector();
+ }
+ static startCharactersVector(builder, numElems) {
+ builder.startVector(4, numElems, 4);
+ }
+ static endMovie(builder) {
+ const offset = builder.endObject();
+ return offset;
+ }
+ static finishMovieBuffer(builder, offset) {
+ builder.finish(offset, 'MOVI');
+ }
+ static finishSizePrefixedMovieBuffer(builder, offset) {
+ builder.finish(offset, 'MOVI', true);
+ }
+ static createMovie(builder, mainCharacterType, mainCharacterOffset, charactersTypeOffset, charactersOffset) {
+ Movie.startMovie(builder);
+ Movie.addMainCharacterType(builder, mainCharacterType);
+ Movie.addMainCharacter(builder, mainCharacterOffset);
+ Movie.addCharactersType(builder, charactersTypeOffset);
+ Movie.addCharacters(builder, charactersOffset);
+ return Movie.endMovie(builder);
+ }
+ unpack() {
+ return new MovieT(this.mainCharacterType(), (() => {
+ let temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this));
+ if (temp === null) {
+ return null;
+ }
+ if (typeof temp === 'string') {
+ return temp;
+ }
+ return temp.unpack();
+ })(), this.bb.createScalarList(this.charactersType.bind(this), this.charactersTypeLength()), (() => {
+ let ret = [];
+ for (let targetEnumIndex = 0; targetEnumIndex < this.charactersTypeLength(); ++targetEnumIndex) {
+ let targetEnum = this.charactersType(targetEnumIndex);
+ if (targetEnum === null || Character[targetEnum] === 'NONE') {
+ continue;
+ }
+ let temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex);
+ if (temp === null) {
+ continue;
+ }
+ if (typeof temp === 'string') {
+ ret.push(temp);
+ continue;
+ }
+ ret.push(temp.unpack());
+ }
+ return ret;
+ })());
+ }
+ unpackTo(_o) {
+ _o.mainCharacterType = this.mainCharacterType();
+ _o.mainCharacter = (() => {
+ let temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this));
+ if (temp === null) {
+ return null;
+ }
+ if (typeof temp === 'string') {
+ return temp;
+ }
+ return temp.unpack();
+ })();
+ _o.charactersType = this.bb.createScalarList(this.charactersType.bind(this), this.charactersTypeLength());
+ _o.characters = (() => {
+ let ret = [];
+ for (let targetEnumIndex = 0; targetEnumIndex < this.charactersTypeLength(); ++targetEnumIndex) {
+ let targetEnum = this.charactersType(targetEnumIndex);
+ if (targetEnum === null || Character[targetEnum] === 'NONE') {
+ continue;
+ }
+ let temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex);
+ if (temp === null) {
+ continue;
+ }
+ if (typeof temp === 'string') {
+ ret.push(temp);
+ continue;
+ }
+ ret.push(temp.unpack());
+ }
+ return ret;
+ })();
+ }
+}
+export class MovieT {
+ constructor(mainCharacterType = Character.NONE, mainCharacter = null, charactersType = [], characters = []) {
+ this.mainCharacterType = mainCharacterType;
+ this.mainCharacter = mainCharacter;
+ this.charactersType = charactersType;
+ this.characters = characters;
+ }
+ pack(builder) {
+ const mainCharacter = builder.createObjectOffset(this.mainCharacter);
+ const charactersType = Movie.createCharactersTypeVector(builder, this.charactersType);
+ const characters = Movie.createCharactersVector(builder, builder.createObjectOffsetList(this.characters));
+ return Movie.createMovie(builder, this.mainCharacterType, mainCharacter, charactersType, characters);
+ }
+}
diff --git a/tests/ts/union_vector/movie.ts b/tests/ts/union_vector/movie.ts
new file mode 100644
index 0000000..6edeb53
--- /dev/null
+++ b/tests/ts/union_vector/movie.ts
@@ -0,0 +1,211 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+import { Attacker, AttackerT } from './attacker.js';
+import { BookReader, BookReaderT } from './book-reader.js';
+import { Character, unionToCharacter, unionListToCharacter } from './character.js';
+import { Rapunzel, RapunzelT } from './rapunzel.js';
+
+
+export class Movie {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Movie {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+static getRootAsMovie(bb:flatbuffers.ByteBuffer, obj?:Movie):Movie {
+ return (obj || new Movie()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static getSizePrefixedRootAsMovie(bb:flatbuffers.ByteBuffer, obj?:Movie):Movie {
+ bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
+ return (obj || new Movie()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
+}
+
+static bufferHasIdentifier(bb:flatbuffers.ByteBuffer):boolean {
+ return bb.__has_identifier('MOVI');
+}
+
+mainCharacterType():Character {
+ const offset = this.bb!.__offset(this.bb_pos, 4);
+ return offset ? this.bb!.readUint8(this.bb_pos + offset) : Character.NONE;
+}
+
+mainCharacter<T extends flatbuffers.Table>(obj:any|string):any|string|null {
+ const offset = this.bb!.__offset(this.bb_pos, 6);
+ return offset ? this.bb!.__union_with_string(obj, this.bb_pos + offset) : null;
+}
+
+charactersType(index: number):Character|null {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0;
+}
+
+charactersTypeLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+charactersTypeArray():Uint8Array|null {
+ const offset = this.bb!.__offset(this.bb_pos, 8);
+ 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;
+}
+
+characters(index: number, obj:any|string):any|string|null {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.__union_with_string(obj, this.bb!.__vector(this.bb_pos + offset) + index * 4) : null;
+}
+
+charactersLength():number {
+ const offset = this.bb!.__offset(this.bb_pos, 10);
+ return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
+}
+
+static getFullyQualifiedName():string {
+ return 'Movie';
+}
+
+static startMovie(builder:flatbuffers.Builder) {
+ builder.startObject(4);
+}
+
+static addMainCharacterType(builder:flatbuffers.Builder, mainCharacterType:Character) {
+ builder.addFieldInt8(0, mainCharacterType, Character.NONE);
+}
+
+static addMainCharacter(builder:flatbuffers.Builder, mainCharacterOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(1, mainCharacterOffset, 0);
+}
+
+static addCharactersType(builder:flatbuffers.Builder, charactersTypeOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(2, charactersTypeOffset, 0);
+}
+
+static createCharactersTypeVector(builder:flatbuffers.Builder, data:Character[]):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 startCharactersTypeVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(1, numElems, 1);
+}
+
+static addCharacters(builder:flatbuffers.Builder, charactersOffset:flatbuffers.Offset) {
+ builder.addFieldOffset(3, charactersOffset, 0);
+}
+
+static createCharactersVector(builder:flatbuffers.Builder, data:flatbuffers.Offset[]):flatbuffers.Offset {
+ builder.startVector(4, data.length, 4);
+ for (let i = data.length - 1; i >= 0; i--) {
+ builder.addOffset(data[i]!);
+ }
+ return builder.endVector();
+}
+
+static startCharactersVector(builder:flatbuffers.Builder, numElems:number) {
+ builder.startVector(4, numElems, 4);
+}
+
+static endMovie(builder:flatbuffers.Builder):flatbuffers.Offset {
+ const offset = builder.endObject();
+ return offset;
+}
+
+static finishMovieBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
+ builder.finish(offset, 'MOVI');
+}
+
+static finishSizePrefixedMovieBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offset) {
+ builder.finish(offset, 'MOVI', true);
+}
+
+static createMovie(builder:flatbuffers.Builder, mainCharacterType:Character, mainCharacterOffset:flatbuffers.Offset, charactersTypeOffset:flatbuffers.Offset, charactersOffset:flatbuffers.Offset):flatbuffers.Offset {
+ Movie.startMovie(builder);
+ Movie.addMainCharacterType(builder, mainCharacterType);
+ Movie.addMainCharacter(builder, mainCharacterOffset);
+ Movie.addCharactersType(builder, charactersTypeOffset);
+ Movie.addCharacters(builder, charactersOffset);
+ return Movie.endMovie(builder);
+}
+
+unpack(): MovieT {
+ return new MovieT(
+ this.mainCharacterType(),
+ (() => {
+ let temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this));
+ if(temp === null) { return null; }
+ if(typeof temp === 'string') { return temp; }
+ return temp.unpack()
+ })(),
+ this.bb!.createScalarList(this.charactersType.bind(this), this.charactersTypeLength()),
+ (() => {
+ let ret = [];
+ for(let targetEnumIndex = 0; targetEnumIndex < this.charactersTypeLength(); ++targetEnumIndex) {
+ let targetEnum = this.charactersType(targetEnumIndex);
+ if(targetEnum === null || Character[targetEnum!] === 'NONE') { continue; }
+
+ let temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex);
+ if(temp === null) { continue; }
+ if(typeof temp === 'string') { ret.push(temp); continue; }
+ ret.push(temp.unpack());
+ }
+ return ret;
+ })()
+ );
+}
+
+
+unpackTo(_o: MovieT): void {
+ _o.mainCharacterType = this.mainCharacterType();
+ _o.mainCharacter = (() => {
+ let temp = unionToCharacter(this.mainCharacterType(), this.mainCharacter.bind(this));
+ if(temp === null) { return null; }
+ if(typeof temp === 'string') { return temp; }
+ return temp.unpack()
+ })();
+ _o.charactersType = this.bb!.createScalarList(this.charactersType.bind(this), this.charactersTypeLength());
+ _o.characters = (() => {
+ let ret = [];
+ for(let targetEnumIndex = 0; targetEnumIndex < this.charactersTypeLength(); ++targetEnumIndex) {
+ let targetEnum = this.charactersType(targetEnumIndex);
+ if(targetEnum === null || Character[targetEnum!] === 'NONE') { continue; }
+
+ let temp = unionListToCharacter(targetEnum, this.characters.bind(this), targetEnumIndex);
+ if(temp === null) { continue; }
+ if(typeof temp === 'string') { ret.push(temp); continue; }
+ ret.push(temp.unpack());
+ }
+ return ret;
+ })();
+}
+}
+
+export class MovieT {
+constructor(
+ public mainCharacterType: Character = Character.NONE,
+ public mainCharacter: AttackerT|BookReaderT|RapunzelT|string|null = null,
+ public charactersType: (Character)[] = [],
+ public characters: (AttackerT|BookReaderT|RapunzelT|string)[] = []
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ const mainCharacter = builder.createObjectOffset(this.mainCharacter);
+ const charactersType = Movie.createCharactersTypeVector(builder, this.charactersType);
+ const characters = Movie.createCharactersVector(builder, builder.createObjectOffsetList(this.characters));
+
+ return Movie.createMovie(builder,
+ this.mainCharacterType,
+ mainCharacter,
+ charactersType,
+ characters
+ );
+}
+}
diff --git a/tests/ts/union_vector/rapunzel.js b/tests/ts/union_vector/rapunzel.js
new file mode 100644
index 0000000..67a5e44
--- /dev/null
+++ b/tests/ts/union_vector/rapunzel.js
@@ -0,0 +1,44 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+export class Rapunzel {
+ constructor() {
+ this.bb = null;
+ this.bb_pos = 0;
+ }
+ __init(i, bb) {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+ }
+ hairLength() {
+ return this.bb.readInt32(this.bb_pos);
+ }
+ mutate_hair_length(value) {
+ this.bb.writeInt32(this.bb_pos + 0, value);
+ return true;
+ }
+ static getFullyQualifiedName() {
+ return 'Rapunzel';
+ }
+ static sizeOf() {
+ return 4;
+ }
+ static createRapunzel(builder, hair_length) {
+ builder.prep(4, 4);
+ builder.writeInt32(hair_length);
+ return builder.offset();
+ }
+ unpack() {
+ return new RapunzelT(this.hairLength());
+ }
+ unpackTo(_o) {
+ _o.hairLength = this.hairLength();
+ }
+}
+export class RapunzelT {
+ constructor(hairLength = 0) {
+ this.hairLength = hairLength;
+ }
+ pack(builder) {
+ return Rapunzel.createRapunzel(builder, this.hairLength);
+ }
+}
diff --git a/tests/ts/union_vector/rapunzel.ts b/tests/ts/union_vector/rapunzel.ts
new file mode 100644
index 0000000..e1dc63d
--- /dev/null
+++ b/tests/ts/union_vector/rapunzel.ts
@@ -0,0 +1,63 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+import * as flatbuffers from 'flatbuffers';
+
+
+
+export class Rapunzel {
+ bb: flatbuffers.ByteBuffer|null = null;
+ bb_pos = 0;
+ __init(i:number, bb:flatbuffers.ByteBuffer):Rapunzel {
+ this.bb_pos = i;
+ this.bb = bb;
+ return this;
+}
+
+hairLength():number {
+ return this.bb!.readInt32(this.bb_pos);
+}
+
+mutate_hair_length(value:number):boolean {
+ this.bb!.writeInt32(this.bb_pos + 0, value);
+ return true;
+}
+
+static getFullyQualifiedName():string {
+ return 'Rapunzel';
+}
+
+static sizeOf():number {
+ return 4;
+}
+
+static createRapunzel(builder:flatbuffers.Builder, hair_length: number):flatbuffers.Offset {
+ builder.prep(4, 4);
+ builder.writeInt32(hair_length);
+ return builder.offset();
+}
+
+
+unpack(): RapunzelT {
+ return new RapunzelT(
+ this.hairLength()
+ );
+}
+
+
+unpackTo(_o: RapunzelT): void {
+ _o.hairLength = this.hairLength();
+}
+}
+
+export class RapunzelT {
+constructor(
+ public hairLength: number = 0
+){}
+
+
+pack(builder:flatbuffers.Builder): flatbuffers.Offset {
+ return Rapunzel.createRapunzel(builder,
+ this.hairLength
+ );
+}
+}
diff --git a/tests/ts/union_vector/union_vector_generated.js b/tests/ts/union_vector/union_vector_generated.js
new file mode 100644
index 0000000..69ea199
--- /dev/null
+++ b/tests/ts/union_vector/union_vector_generated.js
@@ -0,0 +1,9 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+export { Attacker, AttackerT } from './attacker.js';
+export { BookReader, BookReaderT } from './book-reader.js';
+export { Character, unionToCharacter, unionListToCharacter } from './character.js';
+export { FallingTub, FallingTubT } from './falling-tub.js';
+export { Gadget, unionToGadget, unionListToGadget } from './gadget.js';
+export { HandFan, HandFanT } from './hand-fan.js';
+export { Movie, MovieT } from './movie.js';
+export { Rapunzel, RapunzelT } from './rapunzel.js';
diff --git a/tests/ts/union_vector/union_vector_generated.ts b/tests/ts/union_vector/union_vector_generated.ts
new file mode 100644
index 0000000..5527abe
--- /dev/null
+++ b/tests/ts/union_vector/union_vector_generated.ts
@@ -0,0 +1,10 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+export { Attacker, AttackerT } from './attacker.js';
+export { BookReader, BookReaderT } from './book-reader.js';
+export { Character, unionToCharacter, unionListToCharacter } from './character.js';
+export { FallingTub, FallingTubT } from './falling-tub.js';
+export { Gadget, unionToGadget, unionListToGadget } from './gadget.js';
+export { HandFan, HandFanT } from './hand-fan.js';
+export { Movie, MovieT } from './movie.js';
+export { Rapunzel, RapunzelT } from './rapunzel.js';
diff --git a/tests/type_field_collsion.fbs b/tests/type_field_collsion.fbs
new file mode 100644
index 0000000..ec73544
--- /dev/null
+++ b/tests/type_field_collsion.fbs
@@ -0,0 +1,8 @@
+namespace type_field_collsion;
+
+// This table tests collsions of identifiers.
+table Collision {
+ collision : int;
+}
+
+root_type Collision;
diff --git a/tests/type_field_collsion/Collision.cs b/tests/type_field_collsion/Collision.cs
new file mode 100644
index 0000000..2fc24f3
--- /dev/null
+++ b/tests/type_field_collsion/Collision.cs
@@ -0,0 +1,73 @@
+// <auto-generated>
+// automatically generated by the FlatBuffers compiler, do not modify
+// </auto-generated>
+
+namespace type_field_collsion
+{
+
+using global::System;
+using global::System.Collections.Generic;
+using global::Google.FlatBuffers;
+
+public struct Collision : IFlatbufferObject
+{
+ private Table __p;
+ public ByteBuffer ByteBuffer { get { return __p.bb; } }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
+ public static Collision GetRootAsCollision(ByteBuffer _bb) { return GetRootAsCollision(_bb, new Collision()); }
+ public static Collision GetRootAsCollision(ByteBuffer _bb, Collision obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
+ public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
+ public Collision __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
+
+ public int Collision_ { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
+
+ public static Offset<type_field_collsion.Collision> CreateCollision(FlatBufferBuilder builder,
+ int collision = 0) {
+ builder.StartTable(1);
+ Collision.AddCollision(builder, collision);
+ return Collision.EndCollision(builder);
+ }
+
+ public static void StartCollision(FlatBufferBuilder builder) { builder.StartTable(1); }
+ public static void AddCollision(FlatBufferBuilder builder, int collision) { builder.AddInt(0, collision, 0); }
+ public static Offset<type_field_collsion.Collision> EndCollision(FlatBufferBuilder builder) {
+ int o = builder.EndTable();
+ return new Offset<type_field_collsion.Collision>(o);
+ }
+ public static void FinishCollisionBuffer(FlatBufferBuilder builder, Offset<type_field_collsion.Collision> offset) { builder.Finish(offset.Value); }
+ public static void FinishSizePrefixedCollisionBuffer(FlatBufferBuilder builder, Offset<type_field_collsion.Collision> offset) { builder.FinishSizePrefixed(offset.Value); }
+ public CollisionT UnPack() {
+ var _o = new CollisionT();
+ this.UnPackTo(_o);
+ return _o;
+ }
+ public void UnPackTo(CollisionT _o) {
+ _o.Collision_ = this.Collision_;
+ }
+ public static Offset<type_field_collsion.Collision> Pack(FlatBufferBuilder builder, CollisionT _o) {
+ if (_o == null) return default(Offset<type_field_collsion.Collision>);
+ return CreateCollision(
+ builder,
+ _o.Collision_);
+ }
+}
+
+public class CollisionT
+{
+ public int Collision_ { get; set; }
+
+ public CollisionT() {
+ this.Collision_ = 0;
+ }
+ public static CollisionT DeserializeFromBinary(byte[] fbBuffer) {
+ return Collision.GetRootAsCollision(new ByteBuffer(fbBuffer)).UnPack();
+ }
+ public byte[] SerializeToBinary() {
+ var fbb = new FlatBufferBuilder(0x10000);
+ Collision.FinishCollisionBuffer(fbb, Collision.Pack(fbb, this));
+ return fbb.DataBuffer.ToSizedArray();
+ }
+}
+
+
+}
diff --git a/tests/union_vector/Attacker.cs b/tests/union_vector/Attacker.cs
index cf6d1a7..57c32fa 100644
--- a/tests/union_vector/Attacker.cs
+++ b/tests/union_vector/Attacker.cs
@@ -4,13 +4,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct Attacker : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static Attacker GetRootAsAttacker(ByteBuffer _bb) { return GetRootAsAttacker(_bb, new Attacker()); }
public static Attacker GetRootAsAttacker(ByteBuffer _bb, Attacker obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
diff --git a/tests/union_vector/Attacker.java b/tests/union_vector/Attacker.java
index 482a3ae..e156444 100644
--- a/tests/union_vector/Attacker.java
+++ b/tests/union_vector/Attacker.java
@@ -7,7 +7,7 @@
@SuppressWarnings("unused")
public final class Attacker extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static Attacker getRootAsAttacker(ByteBuffer _bb) { return getRootAsAttacker(_bb, new Attacker()); }
public static Attacker getRootAsAttacker(ByteBuffer _bb, Attacker obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
diff --git a/tests/union_vector/Attacker.kt b/tests/union_vector/Attacker.kt
index 9f22e98..6942bad 100644
--- a/tests/union_vector/Attacker.kt
+++ b/tests/union_vector/Attacker.kt
@@ -29,7 +29,7 @@
}
}
companion object {
- fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
fun getRootAsAttacker(_bb: ByteBuffer): Attacker = getRootAsAttacker(_bb, Attacker())
fun getRootAsAttacker(_bb: ByteBuffer, obj: Attacker): Attacker {
_bb.order(ByteOrder.LITTLE_ENDIAN)
diff --git a/tests/union_vector/BookReader.cs b/tests/union_vector/BookReader.cs
index 6cd88b3..74dd32f 100644
--- a/tests/union_vector/BookReader.cs
+++ b/tests/union_vector/BookReader.cs
@@ -4,7 +4,7 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct BookReader : IFlatbufferObject
{
diff --git a/tests/union_vector/Character.cs b/tests/union_vector/Character.cs
index 4978bdc..181f914 100644
--- a/tests/union_vector/Character.cs
+++ b/tests/union_vector/Character.cs
@@ -37,7 +37,7 @@
public string AsUnused() { return this.As<string>(); }
public static CharacterUnion FromUnused(string _unused) { return new CharacterUnion{ Type = Character.Unused, Value = _unused }; }
- public static int Pack(FlatBuffers.FlatBufferBuilder builder, CharacterUnion _o) {
+ public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, CharacterUnion _o) {
switch (_o.Type) {
default: return 0;
case Character.MuLan: return Attacker.Pack(builder, _o.AsMuLan()).Value;
diff --git a/tests/union_vector/FallingTub.cs b/tests/union_vector/FallingTub.cs
index 36c574c..792dbed 100644
--- a/tests/union_vector/FallingTub.cs
+++ b/tests/union_vector/FallingTub.cs
@@ -4,7 +4,7 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct FallingTub : IFlatbufferObject
{
diff --git a/tests/union_vector/Gadget.cs b/tests/union_vector/Gadget.cs
index e4770dd..8e5ca7b 100644
--- a/tests/union_vector/Gadget.cs
+++ b/tests/union_vector/Gadget.cs
@@ -25,7 +25,7 @@
public HandFanT AsHandFan() { return this.As<HandFanT>(); }
public static GadgetUnion FromHandFan(HandFanT _handfan) { return new GadgetUnion{ Type = Gadget.HandFan, Value = _handfan }; }
- public static int Pack(FlatBuffers.FlatBufferBuilder builder, GadgetUnion _o) {
+ public static int Pack(Google.FlatBuffers.FlatBufferBuilder builder, GadgetUnion _o) {
switch (_o.Type) {
default: return 0;
case Gadget.FallingTub: return FallingTub.Pack(builder, _o.AsFallingTub()).Value;
diff --git a/tests/union_vector/HandFan.cs b/tests/union_vector/HandFan.cs
index a888abf..52e3e74 100644
--- a/tests/union_vector/HandFan.cs
+++ b/tests/union_vector/HandFan.cs
@@ -4,13 +4,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct HandFan : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static HandFan GetRootAsHandFan(ByteBuffer _bb) { return GetRootAsHandFan(_bb, new HandFan()); }
public static HandFan GetRootAsHandFan(ByteBuffer _bb, HandFan obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
diff --git a/tests/union_vector/HandFan.java b/tests/union_vector/HandFan.java
index 14b2520..641da84 100644
--- a/tests/union_vector/HandFan.java
+++ b/tests/union_vector/HandFan.java
@@ -7,7 +7,7 @@
@SuppressWarnings("unused")
public final class HandFan extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static HandFan getRootAsHandFan(ByteBuffer _bb) { return getRootAsHandFan(_bb, new HandFan()); }
public static HandFan getRootAsHandFan(ByteBuffer _bb, HandFan obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }
diff --git a/tests/union_vector/HandFan.kt b/tests/union_vector/HandFan.kt
index 0a8a055..8304d1f 100644
--- a/tests/union_vector/HandFan.kt
+++ b/tests/union_vector/HandFan.kt
@@ -29,7 +29,7 @@
}
}
companion object {
- fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
fun getRootAsHandFan(_bb: ByteBuffer): HandFan = getRootAsHandFan(_bb, HandFan())
fun getRootAsHandFan(_bb: ByteBuffer, obj: HandFan): HandFan {
_bb.order(ByteOrder.LITTLE_ENDIAN)
diff --git a/tests/union_vector/Movie.cs b/tests/union_vector/Movie.cs
index f85daa6..9bc2d9a 100644
--- a/tests/union_vector/Movie.cs
+++ b/tests/union_vector/Movie.cs
@@ -4,13 +4,13 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct Movie : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
- public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_2_0_8(); }
public static Movie GetRootAsMovie(ByteBuffer _bb) { return GetRootAsMovie(_bb, new Movie()); }
public static Movie GetRootAsMovie(ByteBuffer _bb, Movie obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public static bool MovieBufferHasIdentifier(ByteBuffer _bb) { return Table.__has_identifier(_bb, "MOVI"); }
@@ -57,10 +57,14 @@
public static void AddCharactersType(FlatBufferBuilder builder, VectorOffset charactersTypeOffset) { builder.AddOffset(2, charactersTypeOffset.Value, 0); }
public static VectorOffset CreateCharactersTypeVector(FlatBufferBuilder builder, Character[] data) { builder.StartVector(1, data.Length, 1); for (int i = data.Length - 1; i >= 0; i--) builder.AddByte((byte)data[i]); return builder.EndVector(); }
public static VectorOffset CreateCharactersTypeVectorBlock(FlatBufferBuilder builder, Character[] data) { builder.StartVector(1, data.Length, 1); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateCharactersTypeVectorBlock(FlatBufferBuilder builder, ArraySegment<Character> data) { builder.StartVector(1, data.Count, 1); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateCharactersTypeVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<Character>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartCharactersTypeVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(1, numElems, 1); }
public static void AddCharacters(FlatBufferBuilder builder, VectorOffset charactersOffset) { builder.AddOffset(3, charactersOffset.Value, 0); }
public static VectorOffset CreateCharactersVector(FlatBufferBuilder builder, int[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i]); return builder.EndVector(); }
public static VectorOffset CreateCharactersVectorBlock(FlatBufferBuilder builder, int[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateCharactersVectorBlock(FlatBufferBuilder builder, ArraySegment<int> data) { builder.StartVector(4, data.Count, 4); builder.Add(data); return builder.EndVector(); }
+ public static VectorOffset CreateCharactersVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<int>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartCharactersVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); }
public static Offset<Movie> EndMovie(FlatBufferBuilder builder) {
int o = builder.EndTable();
diff --git a/tests/union_vector/Movie.java b/tests/union_vector/Movie.java
index dc40d80..2cf1622 100644
--- a/tests/union_vector/Movie.java
+++ b/tests/union_vector/Movie.java
@@ -7,7 +7,7 @@
@SuppressWarnings("unused")
public final class Movie extends Table {
- public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_0(); }
+ public static void ValidateVersion() { Constants.FLATBUFFERS_2_0_8(); }
public static Movie getRootAsMovie(ByteBuffer _bb) { return getRootAsMovie(_bb, new Movie()); }
public static Movie getRootAsMovie(ByteBuffer _bb, Movie obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
public static boolean MovieBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "MOVI"); }
diff --git a/tests/union_vector/Movie.kt b/tests/union_vector/Movie.kt
index a9ad906..ee26a59 100644
--- a/tests/union_vector/Movie.kt
+++ b/tests/union_vector/Movie.kt
@@ -67,7 +67,7 @@
val o = __offset(10); return if (o != 0) __vector_len(o) else 0
}
companion object {
- fun validateVersion() = Constants.FLATBUFFERS_2_0_0()
+ fun validateVersion() = Constants.FLATBUFFERS_2_0_8()
fun getRootAsMovie(_bb: ByteBuffer): Movie = getRootAsMovie(_bb, Movie())
fun getRootAsMovie(_bb: ByteBuffer, obj: Movie): Movie {
_bb.order(ByteOrder.LITTLE_ENDIAN)
diff --git a/tests/union_vector/Rapunzel.cs b/tests/union_vector/Rapunzel.cs
index 31d2cdf..b9559d3 100644
--- a/tests/union_vector/Rapunzel.cs
+++ b/tests/union_vector/Rapunzel.cs
@@ -4,7 +4,7 @@
using global::System;
using global::System.Collections.Generic;
-using global::FlatBuffers;
+using global::Google.FlatBuffers;
public struct Rapunzel : IFlatbufferObject
{
diff --git a/tests/union_vector/attacker.ts b/tests/union_vector/attacker.ts
index af37020..6b3fc0f 100644
--- a/tests/union_vector/attacker.ts
+++ b/tests/union_vector/attacker.ts
@@ -7,7 +7,7 @@
export class Attacker {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):Attacker {
+ __init(i:number, bb:flatbuffers.ByteBuffer):Attacker {
this.bb_pos = i;
this.bb = bb;
return this;
diff --git a/tests/union_vector/book-reader.ts b/tests/union_vector/book-reader.ts
index 2310600..7a31278 100644
--- a/tests/union_vector/book-reader.ts
+++ b/tests/union_vector/book-reader.ts
@@ -7,7 +7,7 @@
export class BookReader {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):BookReader {
+ __init(i:number, bb:flatbuffers.ByteBuffer):BookReader {
this.bb_pos = i;
this.bb = bb;
return this;
diff --git a/tests/union_vector/character.ts b/tests/union_vector/character.ts
index dbf8d51..d8ffbc2 100644
--- a/tests/union_vector/character.ts
+++ b/tests/union_vector/character.ts
@@ -5,7 +5,7 @@
import { Rapunzel, RapunzelT } from './rapunzel';
-export enum Character{
+export enum Character {
NONE = 0,
MuLan = 1,
Rapunzel = 2,
@@ -47,4 +47,3 @@
default: return null;
}
}
-
diff --git a/tests/union_vector/falling-tub.ts b/tests/union_vector/falling-tub.ts
index 3a836b3..b32f99d 100644
--- a/tests/union_vector/falling-tub.ts
+++ b/tests/union_vector/falling-tub.ts
@@ -7,7 +7,7 @@
export class FallingTub {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):FallingTub {
+ __init(i:number, bb:flatbuffers.ByteBuffer):FallingTub {
this.bb_pos = i;
this.bb = bb;
return this;
diff --git a/tests/union_vector/gadget.ts b/tests/union_vector/gadget.ts
index 4d84b0a..328071e 100644
--- a/tests/union_vector/gadget.ts
+++ b/tests/union_vector/gadget.ts
@@ -4,7 +4,7 @@
import { HandFan, HandFanT } from './hand-fan';
-export enum Gadget{
+export enum Gadget {
NONE = 0,
FallingTub = 1,
HandFan = 2
@@ -34,4 +34,3 @@
default: return null;
}
}
-
diff --git a/tests/union_vector/hand-fan.ts b/tests/union_vector/hand-fan.ts
index 4a770ba..f90b4dd 100644
--- a/tests/union_vector/hand-fan.ts
+++ b/tests/union_vector/hand-fan.ts
@@ -7,7 +7,7 @@
export class HandFan {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):HandFan {
+ __init(i:number, bb:flatbuffers.ByteBuffer):HandFan {
this.bb_pos = i;
this.bb = bb;
return this;
diff --git a/tests/union_vector/movie.ts b/tests/union_vector/movie.ts
index b3e8381..fceadaa 100644
--- a/tests/union_vector/movie.ts
+++ b/tests/union_vector/movie.ts
@@ -11,7 +11,7 @@
export class Movie {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):Movie {
+ __init(i:number, bb:flatbuffers.ByteBuffer):Movie {
this.bb_pos = i;
this.bb = bb;
return this;
diff --git a/tests/union_vector/rapunzel.ts b/tests/union_vector/rapunzel.ts
index 28f6e99..e1dc63d 100644
--- a/tests/union_vector/rapunzel.ts
+++ b/tests/union_vector/rapunzel.ts
@@ -7,7 +7,7 @@
export class Rapunzel {
bb: flatbuffers.ByteBuffer|null = null;
bb_pos = 0;
-__init(i:number, bb:flatbuffers.ByteBuffer):Rapunzel {
+ __init(i:number, bb:flatbuffers.ByteBuffer):Rapunzel {
this.bb_pos = i;
this.bb = bb;
return this;
diff --git a/tests/union_vector/union_vector_generated.h b/tests/union_vector/union_vector_generated.h
index e08df6a..8f60272 100644
--- a/tests/union_vector/union_vector_generated.h
+++ b/tests/union_vector/union_vector_generated.h
@@ -6,6 +6,13 @@
#include "flatbuffers/flatbuffers.h"
+// Ensure the included flatbuffers.h is the same version as when this file was
+// generated, otherwise it may not be compatible.
+static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
+ FLATBUFFERS_VERSION_MINOR == 0 &&
+ FLATBUFFERS_VERSION_REVISION == 8,
+ "Non-compatible flatbuffers version included");
+
struct Attacker;
struct AttackerBuilder;
struct AttackerT;
@@ -349,9 +356,6 @@
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
return RapunzelTypeTable();
}
- static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
- return "Rapunzel";
- }
Rapunzel()
: hair_length_(0) {
}
@@ -385,9 +389,6 @@
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
return BookReaderTypeTable();
}
- static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
- return "BookReader";
- }
BookReader()
: books_read_(0) {
}
@@ -421,9 +422,6 @@
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
return FallingTubTypeTable();
}
- static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
- return "FallingTub";
- }
FallingTub()
: weight_(0) {
}
@@ -451,9 +449,6 @@
struct AttackerT : public flatbuffers::NativeTable {
typedef Attacker TableType;
- static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
- return "AttackerT";
- }
int32_t sword_attack_damage = 0;
};
@@ -463,9 +458,6 @@
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
return AttackerTypeTable();
}
- static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
- return "Attacker";
- }
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_SWORD_ATTACK_DAMAGE = 4
};
@@ -515,9 +507,6 @@
struct HandFanT : public flatbuffers::NativeTable {
typedef HandFan TableType;
- static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
- return "HandFanT";
- }
int32_t length = 0;
};
@@ -527,9 +516,6 @@
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
return HandFanTypeTable();
}
- static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
- return "HandFan";
- }
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_LENGTH = 4
};
@@ -579,9 +565,6 @@
struct MovieT : public flatbuffers::NativeTable {
typedef Movie TableType;
- static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
- return "MovieT";
- }
CharacterUnion main_character{};
std::vector<CharacterUnion> characters{};
};
@@ -592,9 +575,6 @@
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
return MovieTypeTable();
}
- static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
- return "Movie";
- }
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_MAIN_CHARACTER_TYPE = 4,
VT_MAIN_CHARACTER = 6,
@@ -813,8 +793,8 @@
(void)_resolver;
{ auto _e = main_character_type(); _o->main_character.type = _e; }
{ auto _e = main_character(); if (_e) _o->main_character.value = CharacterUnion::UnPack(_e, main_character_type(), _resolver); }
- { auto _e = characters_type(); if (_e) { _o->characters.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->characters[_i].type = static_cast<Character>(_e->Get(_i)); } } }
- { auto _e = characters(); if (_e) { _o->characters.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->characters[_i].value = CharacterUnion::UnPack(_e->Get(_i), characters_type()->GetEnum<Character>(_i), _resolver); } } }
+ { auto _e = characters_type(); if (_e) { _o->characters.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->characters[_i].type = static_cast<Character>(_e->Get(_i)); } } else { _o->characters.resize(0); } }
+ { auto _e = characters(); if (_e) { _o->characters.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->characters[_i].value = CharacterUnion::UnPack(_e->Get(_i), characters_type()->GetEnum<Character>(_i), _resolver); } } else { _o->characters.resize(0); } }
}
inline flatbuffers::Offset<Movie> Movie::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MovieT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
diff --git a/tests/union_vector/union_vector_generated.ts b/tests/union_vector/union_vector_generated.ts
new file mode 100644
index 0000000..d3b41c4
--- /dev/null
+++ b/tests/union_vector/union_vector_generated.ts
@@ -0,0 +1,10 @@
+// automatically generated by the FlatBuffers compiler, do not modify
+
+export { Attacker, AttackerT } from './attacker';
+export { BookReader, BookReaderT } from './book-reader';
+export { Character, unionToCharacter, unionListToCharacter } from './character';
+export { FallingTub, FallingTubT } from './falling-tub';
+export { Gadget, unionToGadget, unionListToGadget } from './gadget';
+export { HandFan, HandFanT } from './hand-fan';
+export { Movie, MovieT } from './movie';
+export { Rapunzel, RapunzelT } from './rapunzel';
diff --git a/tests/util_test.cpp b/tests/util_test.cpp
new file mode 100644
index 0000000..d6db916
--- /dev/null
+++ b/tests/util_test.cpp
@@ -0,0 +1,167 @@
+#include "util_test.h"
+
+#include "flatbuffers/util.h"
+#include "test_assert.h"
+
+namespace flatbuffers {
+namespace tests {
+namespace {
+
+template<typename T>
+void NumericUtilsTestInteger(const char *lower, const char *upper) {
+ T x;
+ TEST_EQ(flatbuffers::StringToNumber("1q", &x), false);
+ TEST_EQ(x, 0);
+ TEST_EQ(flatbuffers::StringToNumber(upper, &x), false);
+ TEST_EQ(x, flatbuffers::numeric_limits<T>::max());
+ TEST_EQ(flatbuffers::StringToNumber(lower, &x), false);
+ auto expval = flatbuffers::is_unsigned<T>::value
+ ? flatbuffers::numeric_limits<T>::max()
+ : flatbuffers::numeric_limits<T>::lowest();
+ TEST_EQ(x, expval);
+}
+
+template<typename T>
+void NumericUtilsTestFloat(const char *lower, const char *upper) {
+ T f;
+ TEST_EQ(flatbuffers::StringToNumber("", &f), false);
+ TEST_EQ(flatbuffers::StringToNumber("1q", &f), false);
+ TEST_EQ(f, 0);
+ TEST_EQ(flatbuffers::StringToNumber(upper, &f), true);
+ TEST_EQ(f, +flatbuffers::numeric_limits<T>::infinity());
+ TEST_EQ(flatbuffers::StringToNumber(lower, &f), true);
+ TEST_EQ(f, -flatbuffers::numeric_limits<T>::infinity());
+}
+} // namespace
+
+void NumericUtilsTest() {
+ NumericUtilsTestInteger<uint64_t>("-1", "18446744073709551616");
+ NumericUtilsTestInteger<uint8_t>("-1", "256");
+ NumericUtilsTestInteger<int64_t>("-9223372036854775809",
+ "9223372036854775808");
+ NumericUtilsTestInteger<int8_t>("-129", "128");
+ NumericUtilsTestFloat<float>("-3.4029e+38", "+3.4029e+38");
+ NumericUtilsTestFloat<float>("-1.7977e+308", "+1.7977e+308");
+}
+
+void IsAsciiUtilsTest() {
+ char c = -128;
+ for (int cnt = 0; cnt < 256; cnt++) {
+ auto alpha = (('a' <= c) && (c <= 'z')) || (('A' <= c) && (c <= 'Z'));
+ auto dec = (('0' <= c) && (c <= '9'));
+ auto hex = (('a' <= c) && (c <= 'f')) || (('A' <= c) && (c <= 'F'));
+ TEST_EQ(flatbuffers::is_alpha(c), alpha);
+ TEST_EQ(flatbuffers::is_alnum(c), alpha || dec);
+ TEST_EQ(flatbuffers::is_digit(c), dec);
+ TEST_EQ(flatbuffers::is_xdigit(c), dec || hex);
+ c += 1;
+ }
+}
+
+void UtilConvertCase() {
+ {
+ struct TestCase {
+ std::string input;
+ flatbuffers::Case output_case;
+ std::string expected_output;
+ };
+
+ std::vector<TestCase> cases;
+
+ // Tests for the common cases
+ cases.push_back({ "the_quick_brown_fox", flatbuffers::Case::kUpperCamel,
+ "TheQuickBrownFox" });
+ cases.push_back({ "the_quick_brown_fox", flatbuffers::Case::kLowerCamel,
+ "theQuickBrownFox" });
+ cases.push_back({ "the_quick_brown_fox", flatbuffers::Case::kSnake,
+ "the_quick_brown_fox" });
+ cases.push_back({ "the_quick_brown_fox", flatbuffers::Case::kScreamingSnake,
+ "THE_QUICK_BROWN_FOX" });
+ cases.push_back({ "the_quick_brown_fox", flatbuffers::Case::kAllLower,
+ "the_quick_brown_fox" });
+ cases.push_back({ "the_quick_brown_fox", flatbuffers::Case::kAllUpper,
+ "THE_QUICK_BROWN_FOX" });
+ cases.push_back({ "the_quick_brown_fox", flatbuffers::Case::kUnknown,
+ "the_quick_brown_fox" });
+ cases.push_back({ "the_quick_brown_fox", flatbuffers::Case::kKeep,
+ "the_quick_brown_fox" });
+ cases.push_back({ "the_quick_brown_fox", flatbuffers::Case::kSnake2,
+ "the_quick_brown_fox" });
+
+ // Tests for some snake_cases where the _ is oddly placed or
+ // missing.
+ cases.push_back({ "single", flatbuffers::Case::kUpperCamel, "Single" });
+ cases.push_back({ "Single", flatbuffers::Case::kUpperCamel, "Single" });
+ cases.push_back({ "_leading", flatbuffers::Case::kUpperCamel, "_leading" });
+ cases.push_back(
+ { "trailing_", flatbuffers::Case::kUpperCamel, "Trailing_" });
+ cases.push_back({ "double__underscore", flatbuffers::Case::kUpperCamel,
+ "Double_underscore" });
+ cases.push_back({ "single", flatbuffers::Case::kLowerCamel, "single" });
+ cases.push_back({ "Single", flatbuffers::Case::kLowerCamel, "Single" });
+ cases.push_back({ "_leading", flatbuffers::Case::kLowerCamel, "Leading" });
+ cases.push_back(
+ { "trailing_", flatbuffers::Case::kLowerCamel, "trailing_" });
+ cases.push_back({ "double__underscore", flatbuffers::Case::kLowerCamel,
+ "double_underscore" });
+
+ // Tests for some output snake_cases
+ cases.push_back({ "single", flatbuffers::Case::kSnake, "single" });
+ cases.push_back({ "single", flatbuffers::Case::kScreamingSnake, "SINGLE" });
+ cases.push_back(
+ { "_leading", flatbuffers::Case::kScreamingSnake, "_LEADING" });
+ cases.push_back(
+ { "trailing_", flatbuffers::Case::kScreamingSnake, "TRAILING_" });
+ cases.push_back({ "double__underscore", flatbuffers::Case::kScreamingSnake,
+ "DOUBLE__UNDERSCORE" });
+
+ for (auto &test_case : cases) {
+ TEST_EQ(test_case.expected_output,
+ flatbuffers::ConvertCase(test_case.input, test_case.output_case));
+ }
+ }
+
+ // Tests for the non snake_case inputs.
+ {
+ struct TestCase {
+ flatbuffers::Case input_case;
+ std::string input;
+ flatbuffers::Case output_case;
+ std::string expected_output;
+ };
+
+ std::vector<TestCase> cases;
+
+ cases.push_back({ flatbuffers::Case::kUpperCamel, "TheQuickBrownFox",
+ flatbuffers::Case::kSnake, "the_quick_brown_fox" });
+ cases.push_back({ flatbuffers::Case::kLowerCamel, "theQuickBrownFox",
+ flatbuffers::Case::kSnake, "the_quick_brown_fox" });
+ cases.push_back({ flatbuffers::Case::kSnake, "the_quick_brown_fox",
+ flatbuffers::Case::kSnake, "the_quick_brown_fox" });
+ cases.push_back({ flatbuffers::Case::kScreamingSnake, "THE_QUICK_BROWN_FOX",
+ flatbuffers::Case::kSnake, "THE_QUICK_BROWN_FOX" });
+ cases.push_back({ flatbuffers::Case::kAllUpper, "SINGLE",
+ flatbuffers::Case::kSnake, "SINGLE" });
+ cases.push_back({ flatbuffers::Case::kAllLower, "single",
+ flatbuffers::Case::kSnake, "single" });
+ cases.push_back({ flatbuffers::Case::kUpperCamel, "ABCtest",
+ flatbuffers::Case::kSnake, "abctest" });
+ cases.push_back({ flatbuffers::Case::kUpperCamel, "tHe_qUiCk_BrOwN_fOx",
+ flatbuffers::Case::kKeep, "tHe_qUiCk_BrOwN_fOx" });
+ cases.push_back({ flatbuffers::Case::kLowerCamel, "theQuick12345Fox",
+ flatbuffers::Case::kSnake, "the_quick_12345fox" });
+ cases.push_back({ flatbuffers::Case::kLowerCamel, "a12b34c45",
+ flatbuffers::Case::kSnake, "a_12b_34c_45" });
+ cases.push_back({ flatbuffers::Case::kLowerCamel, "a12b34c45",
+ flatbuffers::Case::kSnake2, "a12_b34_c45" });
+
+ for (auto &test_case : cases) {
+ TEST_EQ(test_case.expected_output,
+ flatbuffers::ConvertCase(test_case.input, test_case.output_case,
+ test_case.input_case));
+ }
+ }
+}
+
+} // namespace tests
+} // namespace flatbuffers
diff --git a/tests/util_test.h b/tests/util_test.h
new file mode 100644
index 0000000..9f2a257
--- /dev/null
+++ b/tests/util_test.h
@@ -0,0 +1,15 @@
+#ifndef TESTS_UTIL_TEST_H
+#define TESTS_UTIL_TEST_H
+
+namespace flatbuffers {
+namespace tests {
+
+void NumericUtilsTest();
+void IsAsciiUtilsTest();
+void UtilConvertCase();
+
+
+} // namespace tests
+} // namespace flatbuffers
+
+#endif
diff --git a/tests/vector_has_test.fbs b/tests/vector_has_test.fbs
new file mode 100644
index 0000000..dbc7271
--- /dev/null
+++ b/tests/vector_has_test.fbs
@@ -0,0 +1,10 @@
+namespace Swift.Tests;
+
+table Vectors
+{
+ none:[ulong];
+ empty:[ulong];
+ array:[ulong];
+}
+
+root_type Vectors;