Compare commits

..

19 Commits

Author SHA1 Message Date
Derek Bailey
af9ceabeef FlatBuffers Version 23.1.4 (#7758) 2023-01-04 15:22:46 -08:00
Michael Le
3b2eb77595 Fix go.mod name (#7756) 2023-01-04 09:27:44 -08:00
Michael Le
6420fa5c88 [Go]Add go.mod (#7720)
Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-01-03 20:56:11 -08:00
Robin Giese
01589630ba Fix "'flatbuffers::FieldDef* field' shadows a parameter" (#7740) 2023-01-03 20:00:54 -08:00
RishabhDeep Singh
e0d68bdda2 Add link to building guide (#7733) 2022-12-22 14:06:57 -08:00
James Kuszmaul
e43a80c322 [TS] Fix getFullyQualifiedName codegen for typescript (#7730)
#7451 caused getFullyQualifiedName to return a name with underscores,
not periods. Because the fully qualified name is a property of
FlatBuffers, not the language being codegen'd for, it should use
periods. Fixes #7564.

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-12-22 20:59:40 +00:00
RishabhDeep Singh
449d5649d6 Fixed test cases (#7732)
* Fix Cannot find symbol and test case

* Add generated tests

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-12-22 20:51:39 +00:00
Michael Le
96d438df47 Perform nil check on string fields when packing (#7719)
Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-12-22 20:28:00 +00:00
engedy
4e396d47bc Add CI step to build with -DFLATBUFFERS_NO_FILE_TESTS. (#7729)
* Add CI step to build with -DFLATBUFFERS_NO_FILE_TESTS

* Fix cmake syntax

* Further fix cmake argumetns

* Add workaround for unused-parameter.

* Remove build matrix

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-12-22 08:48:48 -08:00
engedy
b47ba1d5ff Add include guards around DoNotRequireEofTest (#7728)
Guard DoNotRequireEofTest against -Wunused-function on platforms without file tests.
2022-12-21 14:59:34 -08:00
Casper
a078130c87 Fix Rust codegen escaping field in tables. (#7659)
* Fix Rust codegen escaping  field in tables.

* other gencode

* gencode

* removed a debug print

* regen code

Co-authored-by: Casper Neo <cneo@google.com>
Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-12-15 06:04:57 +00:00
Saman
9ed76559df Add clang-tidy, fix some bugpron problems. (#7708)
* Add clang-tidy, fix some bugpron problems.

* Fix more issues

* Fix some more issues :))

* Minimal pr to just add clang-tidy

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-12-14 21:58:55 -08:00
mogemimi
9927747d4e [C++] Fix clang -Wnewline-eof warning (#7711)
* Fix clang -Wnewline-eof warning

* Enable -Wnewline-eof warning

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-12-14 21:35:54 -08:00
Wen Sun
52d1b77941 Add CI job to build linux and run unit test on s390x (#7707)
* create job to build linux and run unit test on s390x

* update

* update

* update

* update

* update

* print out machine type

* create regression test to build a big endian arch and run unit tests daily

* rename and schedule run on pr merged and on request

* udpate

Co-authored-by: Wen Sun <sunwen@google.com>
Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-12-14 14:56:31 -08:00
Jared Junyoung Lim
40aa964057 Add Ref.AsStringBytes to flatbuffers.flexbuffers Python API (#7713)
* Add Ref.AsStringBytes to flatbuffers.flexbuffers Python API

* Append Bytes to AsStringBytes return value

Co-authored-by: Jared Junyoung Lim <jaredlim@google.com>
2022-12-14 14:42:56 -08:00
Michael Le
e1a2f688e0 [Go] Fix bug where bytes wasn't being imported when using --gen-onefile flag (#7706)
* Fix bug one file import bug

* Create reset import function and add braces
2022-12-12 23:06:48 -08:00
Saman
c0797b22ae fix clang format plus implicit cast error. (#7704) 2022-12-12 21:22:24 -08:00
Maxim Zaks
97ee210826 Fix a bug where a floating point number was cast to int and the value was stored incorrectly because of low byte width. (#7703)
Reported in https://github.com/google/flatbuffers/issues/7690
2022-12-12 21:20:26 -08:00
Max Burke
3be296ec8a [Rust] Restore public visibility of previously-public fields (#7700)
* Restore public visibility of previously-public fields

* code review feedback
2022-12-08 18:20:14 -05:00
289 changed files with 1434 additions and 393 deletions

347
.clang-tidy Normal file
View File

@@ -0,0 +1,347 @@
---
FormatStyle: "file"
WarningsAsErrors: "*"
HeaderFilterRegex: ".*"
Checks: "google-build-explicit-make-pair,
google-build-namespaces,
google-build-using-namespace,
google-default-arguments,
google-explicit-constructor,
google-global-names-in-headers,
google-objc-avoid-nsobject-new,
google-objc-avoid-throwing-exception,
google-objc-function-naming,
google-objc-global-variable-declaration,
google-readability-avoid-underscore-in-googletest-name,
google-readability-braces-around-statements,
google-readability-casting,
google-readability-function-size,
google-readability-namespace-comments,
google-runtime-int,
google-runtime-operator,
google-upgrade-googletest-case,
clang-analyzer-apiModeling.StdCLibraryFunctions,
clang-analyzer-apiModeling.TrustNonnull,
clang-analyzer-apiModeling.google.GTest,
clang-analyzer-apiModeling.llvm.CastValue,
clang-analyzer-apiModeling.llvm.ReturnValue,
clang-analyzer-core.CallAndMessage,
clang-analyzer-core.CallAndMessageModeling,
clang-analyzer-core.DivideZero,
clang-analyzer-core.DynamicTypePropagation,
clang-analyzer-core.NonNullParamChecker,
clang-analyzer-core.NonnilStringConstants,
clang-analyzer-core.NullDereference,
clang-analyzer-core.StackAddrEscapeBase,
clang-analyzer-core.StackAddressEscape,
clang-analyzer-core.UndefinedBinaryOperatorResult,
clang-analyzer-core.VLASize,
clang-analyzer-core.builtin.BuiltinFunctions,
clang-analyzer-core.builtin.NoReturnFunctions,
clang-analyzer-core.uninitialized.ArraySubscript,
clang-analyzer-core.uninitialized.Assign,
clang-analyzer-core.uninitialized.Branch,
clang-analyzer-core.uninitialized.CapturedBlockVariable,
clang-analyzer-core.uninitialized.UndefReturn,
clang-analyzer-cplusplus.InnerPointer,
clang-analyzer-cplusplus.Move,
clang-analyzer-cplusplus.NewDelete,
clang-analyzer-cplusplus.NewDeleteLeaks,
clang-analyzer-cplusplus.PlacementNew,
clang-analyzer-cplusplus.PureVirtualCall,
clang-analyzer-cplusplus.SelfAssignment,
clang-analyzer-cplusplus.SmartPtrModeling,
clang-analyzer-cplusplus.StringChecker,
clang-analyzer-cplusplus.VirtualCallModeling,
clang-analyzer-deadcode.DeadStores,
clang-analyzer-fuchsia.HandleChecker,
clang-analyzer-nullability.NullPassedToNonnull,
clang-analyzer-nullability.NullReturnedFromNonnull,
clang-analyzer-nullability.NullabilityBase,
clang-analyzer-nullability.NullableDereferenced,
clang-analyzer-nullability.NullablePassedToNonnull,
clang-analyzer-nullability.NullableReturnedFromNonnull,
clang-analyzer-optin.cplusplus.UninitializedObject,
clang-analyzer-optin.cplusplus.VirtualCall,
clang-analyzer-optin.mpi.MPI-Checker,
clang-analyzer-optin.osx.OSObjectCStyleCast,
clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker,
clang-analyzer-optin.osx.cocoa.localizability.NonLocalizedStringChecker,
clang-analyzer-optin.performance.GCDAntipattern,
clang-analyzer-optin.performance.Padding,
clang-analyzer-optin.portability.UnixAPI,
clang-analyzer-osx.API,
clang-analyzer-osx.MIG,
clang-analyzer-osx.NSOrCFErrorDerefChecker,
clang-analyzer-osx.NumberObjectConversion,
clang-analyzer-osx.OSObjectRetainCount,
clang-analyzer-osx.ObjCProperty,
clang-analyzer-osx.SecKeychainAPI,
clang-analyzer-osx.cocoa.AtSync,
clang-analyzer-osx.cocoa.AutoreleaseWrite,
clang-analyzer-osx.cocoa.ClassRelease,
clang-analyzer-osx.cocoa.Dealloc,
clang-analyzer-osx.cocoa.IncompatibleMethodTypes,
clang-analyzer-osx.cocoa.Loops,
clang-analyzer-osx.cocoa.MissingSuperCall,
clang-analyzer-osx.cocoa.NSAutoreleasePool,
clang-analyzer-osx.cocoa.NSError,
clang-analyzer-osx.cocoa.NilArg,
clang-analyzer-osx.cocoa.NonNilReturnValue,
clang-analyzer-osx.cocoa.ObjCGenerics,
clang-analyzer-osx.cocoa.RetainCount,
clang-analyzer-osx.cocoa.RetainCountBase,
clang-analyzer-osx.cocoa.RunLoopAutoreleaseLeak,
clang-analyzer-osx.cocoa.SelfInit,
clang-analyzer-osx.cocoa.SuperDealloc,
clang-analyzer-osx.cocoa.UnusedIvars,
clang-analyzer-osx.cocoa.VariadicMethodTypes,
clang-analyzer-osx.coreFoundation.CFError,
clang-analyzer-osx.coreFoundation.CFNumber,
clang-analyzer-osx.coreFoundation.CFRetainRelease,
clang-analyzer-osx.coreFoundation.containers.OutOfBounds,
clang-analyzer-osx.coreFoundation.containers.PointerSizedValues,
clang-analyzer-security.FloatLoopCounter,
clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
clang-analyzer-security.insecureAPI.SecuritySyntaxChecker,
clang-analyzer-security.insecureAPI.UncheckedReturn,
clang-analyzer-security.insecureAPI.bcmp,
clang-analyzer-security.insecureAPI.bcopy,
clang-analyzer-security.insecureAPI.bzero,
clang-analyzer-security.insecureAPI.decodeValueOfObjCType,
clang-analyzer-security.insecureAPI.getpw,
clang-analyzer-security.insecureAPI.gets,
clang-analyzer-security.insecureAPI.mkstemp,
clang-analyzer-security.insecureAPI.mktemp,
clang-analyzer-security.insecureAPI.rand,
clang-analyzer-security.insecureAPI.strcpy,
clang-analyzer-security.insecureAPI.vfork,
clang-analyzer-unix.API,
clang-analyzer-unix.DynamicMemoryModeling,
clang-analyzer-unix.Malloc,
clang-analyzer-unix.MallocSizeof,
clang-analyzer-unix.MismatchedDeallocator,
clang-analyzer-unix.Vfork,
clang-analyzer-unix.cstring.BadSizeArg,
clang-analyzer-unix.cstring.CStringModeling,
clang-analyzer-unix.cstring.NullArg,
clang-analyzer-valist.CopyToSelf,
clang-analyzer-valist.Uninitialized,
clang-analyzer-valist.Unterminated,
clang-analyzer-valist.ValistBase,
clang-analyzer-webkit.NoUncountedMemberChecker,
clang-analyzer-webkit.RefCntblBaseVirtualDtor,
clang-analyzer-webkit.UncountedLambdaCapturesChecker,
################################################ Optional checks ################################################
#google-readability-todo,
#bugprone-argument-comment,
#bugprone-assert-side-effect,
#bugprone-bad-signal-to-kill-thread,
#bugprone-bool-pointer-implicit-conversion,
#bugprone-branch-clone,
#bugprone-copy-constructor-init,
#bugprone-dangling-handle,
#bugprone-dynamic-static-initializers,
#bugprone-easily-swappable-parameters,
#bugprone-exception-escape,
#bugprone-fold-init-type,
#bugprone-forward-declaration-namespace,
#bugprone-forwarding-reference-overload,
#bugprone-implicit-widening-of-multiplication-result,
#bugprone-inaccurate-erase,
#bugprone-incorrect-roundings,
#bugprone-infinite-loop,
#bugprone-integer-division,
#bugprone-lambda-function-name,
#bugprone-macro-parentheses,
#bugprone-macro-repeated-side-effects,
#bugprone-misplaced-operator-in-strlen-in-alloc,
#bugprone-misplaced-pointer-arithmetic-in-alloc,
#bugprone-misplaced-widening-cast,
#bugprone-move-forwarding-reference,
#bugprone-multiple-statement-macro,
#bugprone-narrowing-conversions,
#bugprone-no-escape,
#bugprone-not-null-terminated-result,
#bugprone-parent-virtual-call,
#bugprone-posix-return,
#bugprone-redundant-branch-condition,
#bugprone-reserved-identifier,
#bugprone-signal-handler,
#bugprone-signed-char-misuse,
#bugprone-sizeof-container,
#bugprone-sizeof-expression,
#bugprone-spuriously-wake-up-functions,
#bugprone-string-constructor,
#bugprone-string-integer-assignment,
#bugprone-string-literal-with-embedded-nul,
#bugprone-stringview-nullptr,
#bugprone-suspicious-enum-usage,
#bugprone-suspicious-include,
#bugprone-suspicious-memory-comparison,
#bugprone-suspicious-memset-usage,
#bugprone-suspicious-missing-comma,
#bugprone-suspicious-semicolon,
#bugprone-suspicious-string-compare,
#bugprone-swapped-arguments,
#bugprone-terminating-continue,
#bugprone-throw-keyword-missing,
#bugprone-too-small-loop-variable,
#bugprone-undefined-memory-manipulation,
#bugprone-undelegated-constructor,
#bugprone-unhandled-exception-at-new,
#bugprone-unhandled-self-assignment,
#bugprone-unused-raii,
#bugprone-unused-return-value,
#bugprone-use-after-move,
#bugprone-virtual-near-miss,
#cppcoreguidelines-avoid-c-arrays,
#cppcoreguidelines-avoid-goto,
#cppcoreguidelines-avoid-magic-numbers,
#cppcoreguidelines-avoid-non-const-global-variables,
#cppcoreguidelines-c-copy-assignment-signature,
#cppcoreguidelines-explicit-virtual-functions,
#cppcoreguidelines-init-variables,
#cppcoreguidelines-interfaces-global-init,
#cppcoreguidelines-macro-usage,
#cppcoreguidelines-narrowing-conversions,
#cppcoreguidelines-no-malloc,
#cppcoreguidelines-non-private-member-variables-in-classes,
#cppcoreguidelines-owning-memory,
#cppcoreguidelines-prefer-member-initializer,
#cppcoreguidelines-pro-bounds-array-to-pointer-decay,
#cppcoreguidelines-pro-bounds-constant-array-index,
#cppcoreguidelines-pro-bounds-pointer-arithmetic,
#cppcoreguidelines-pro-type-const-cast,
#cppcoreguidelines-pro-type-cstyle-cast,
#cppcoreguidelines-pro-type-member-init,
#cppcoreguidelines-pro-type-reinterpret-cast,
#cppcoreguidelines-pro-type-static-cast-downcast,
#cppcoreguidelines-pro-type-union-access,
#cppcoreguidelines-pro-type-vararg,
#cppcoreguidelines-slicing,
#cppcoreguidelines-special-member-functions,
#cppcoreguidelines-virtual-class-destructor,
#hicpp-avoid-c-arrays,
#hicpp-avoid-goto,
#hicpp-braces-around-statements,
#hicpp-deprecated-headers,
#hicpp-exception-baseclass,
#hicpp-explicit-conversions,
#hicpp-function-size,
#hicpp-invalid-access-moved,
#hicpp-member-init,
#hicpp-move-const-arg,
#hicpp-multiway-paths-covered,
#hicpp-named-parameter,
#hicpp-new-delete-operators,
#hicpp-no-array-decay,
#hicpp-no-assembler,
#hicpp-no-malloc,
#hicpp-noexcept-move,
#hicpp-signed-bitwise,
#hicpp-special-member-functions,
#hicpp-static-assert,
#hicpp-undelegated-constructor,
#hicpp-uppercase-literal-suffix,
#hicpp-use-auto,
#hicpp-use-emplace,
#hicpp-use-equals-default,
#hicpp-use-equals-delete,
#hicpp-use-noexcept,
#hicpp-use-nullptr,
#hicpp-use-override,
#hicpp-vararg,
#modernize-avoid-bind,
#modernize-avoid-c-arrays,
#modernize-concat-nested-namespaces,
#modernize-deprecated-headers,
#modernize-deprecated-ios-base-aliases,
#modernize-loop-convert,
#modernize-make-shared,
#modernize-make-unique,
#modernize-pass-by-value,
#modernize-raw-string-literal,
#modernize-redundant-void-arg,
#modernize-replace-auto-ptr,
#modernize-replace-disallow-copy-and-assign-macro,
#modernize-replace-random-shuffle,
#modernize-return-braced-init-list,
#modernize-shrink-to-fit,
#modernize-unary-static-assert,
#modernize-use-auto,
#modernize-use-bool-literals,
#modernize-use-default-member-init,
#modernize-use-emplace,
#modernize-use-equals-default,
#modernize-use-equals-delete,
#modernize-use-nodiscard,
#modernize-use-noexcept,
#modernize-use-nullptr,
#modernize-use-override,
#modernize-use-trailing-return-type,
#modernize-use-transparent-functors,
#modernize-use-uncaught-exceptions,
#modernize-use-using,
#performance-faster-string-find,
#performance-for-range-copy,
#performance-implicit-conversion-in-loop,
#performance-inefficient-algorithm,
#performance-inefficient-string-concatenation,
#performance-inefficient-vector-operation,
#performance-move-const-arg,
#performance-move-constructor-init,
#performance-no-automatic-move,
#performance-no-int-to-ptr,
#performance-noexcept-move-constructor,
#performance-trivially-destructible,
#performance-type-promotion-in-math-fn,
#performance-unnecessary-copy-initialization,
#performance-unnecessary-value-param,
#portability-restrict-system-includes,
#portability-simd-intrinsics,
#readability-avoid-const-params-in-decls,
#readability-braces-around-statements,
#readability-const-return-type,
#readability-container-contains,
#readability-container-data-pointer,
#readability-container-size-empty,
#readability-convert-member-functions-to-static,
#readability-delete-null-pointer,
#readability-duplicate-include,
#readability-else-after-return,
#readability-function-cognitive-complexity,
#readability-function-size,
#readability-identifier-length,
#readability-identifier-naming,
#readability-implicit-bool-conversion,
#readability-inconsistent-declaration-parameter-name,
#readability-isolate-declaration,
#readability-magic-numbers,
#readability-make-member-function-const,
#readability-misleading-indentation,
#readability-misplaced-array-index,
#readability-named-parameter,
#readability-non-const-parameter,
#readability-qualified-auto,
#readability-redundant-access-specifiers,
#readability-redundant-control-flow,
#readability-redundant-declaration,
#readability-redundant-function-ptr-dereference,
#readability-redundant-member-init,
#readability-redundant-preprocessor,
#readability-redundant-smartptr-get,
#readability-redundant-string-cstr,
#readability-redundant-string-init,
#readability-simplify-boolean-expr,
#readability-simplify-subscript-expr,
#readability-static-accessed-through-instance,
#readability-static-definition-in-anonymous-namespace,
#readability-string-compare,
#readability-suspicious-call-argument,
#readability-uniqueptr-delete-release,
#readability-uppercase-literal-suffix,
#readability-use-anyofallof
"

View File

@@ -3,7 +3,7 @@ Thank you for submitting a PR!
Please delete this standard text once you've created your own description. Please delete this standard text once you've created your own description.
If you make changes to any of the code generators (`src/idl_gen*`) be sure to If you make changes to any of the code generators (`src/idl_gen*`) be sure to
build your project, as it will generate code based on the changes. If necessary [build](https://google.github.io/flatbuffers/flatbuffers_guide_building.html) your project, as it will generate code based on the changes. If necessary
the code generation script can be directly run (`scripts/generate_code.py`), the code generation script can be directly run (`scripts/generate_code.py`),
requires Python3. This allows us to better see the effect of the PR. requires Python3. This allows us to better see the effect of the PR.

View File

@@ -62,6 +62,16 @@ jobs:
if: matrix.cxx == 'g++-10' && startsWith(github.ref, 'refs/tags/') if: matrix.cxx == 'g++-10' && startsWith(github.ref, 'refs/tags/')
id: hash-gcc id: hash-gcc
run: echo "::set-output name=hashes::$(sha256sum Linux.flatc.binary.${{ matrix.cxx }}.zip | base64 -w0)" run: echo "::set-output name=hashes::$(sha256sum Linux.flatc.binary.${{ matrix.cxx }}.zip | base64 -w0)"
build-linux-no-file-tests:
name: Build Linux with -DFLATBUFFERS_NO_FILE_TESTS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: cmake
run: CXX=clang++-12 cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_STRICT_MODE=ON -DFLATBUFFERS_CXX_FLAGS="-DFLATBUFFERS_NO_FILE_TESTS" .
- name: build
run: make -j
build-linux-cpp-std: build-linux-cpp-std:
name: Build Linux C++ name: Build Linux C++

35
.github/workflows/extrabuild.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Build and unit tests that are more time consuming
permissions: read-all
on:
# For manual tests.
workflow_dispatch:
pull_request:
types:
- closed
schedule:
- cron: "30 20 * * *"
jobs:
build-linux-s390x:
name: Build Linux on s390x arch and run unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: uraimo/run-on-arch-action@v2
name: Run commands
id: runcmd
with:
arch: s390x
distro: ubuntu_latest
install: |
apt-get update -q -y
apt-get -y install cmake
apt-get -y install make
apt-get -y install g++
run: |
lscpu | grep Endian
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
make -j
./flattests

View File

@@ -4,19 +4,37 @@ All major or breaking changes will be documented in this file, as well as any
new features that should be highlighted. Minor fixes or improvements are not new features that should be highlighted. Minor fixes or improvements are not
necessarily listed. necessarily listed.
## 22.12.06 (Dec 06 2022) ## [23.1.4 (Jan 4 2023)](https://github.com/google/flatbuffers/releases/tag/v23.1.4)
* Major release! Just kidding, we are continuing the
[versioning scheme](https://github.com/google/flatbuffers/wiki/Versioning) of
using a date to signify releases. This results in the first release of the new
year to bump the tradition major version field.
* Go minimum version is now 1.19 (#7720) with the addition of Go modules.
* Added CI support for Big Endian regression testing (#7707).
* Fixed `getFullyQualifiedName` in typescript to return name delimited by '.'
instead of '_' (#7730).
* Fixed the versioning scheme to not include leading zeros which are not
consistently handled by every package manager. Only the last release
(12.12.06) should have suffered from this.
## [22.12.06 (Dec 06 2022)](https://github.com/google/flatbuffers/releases/tag/v22.12.06)
* Bug fixing release, no major changes. * Bug fixing release, no major changes.
## 22.10.25 (Oct 25 2022) ## [22.10.25 (Oct 25 2022)](https://github.com/google/flatbuffers/releases/tag/v22.10.25)
* Added Nim language support with generator and runtime libraries (#7534). * Added Nim language support with generator and runtime libraries (#7534).
## 22.9.29 (Sept 29 2022) ## [22.9.29 (Sept 29 2022)](https://github.com/google/flatbuffers/releases/tag/v22.9.29)
* Rust soundness fixes to avoid the crate from bing labelled unsafe (#7518). * Rust soundness fixes to avoid the crate from bing labelled unsafe (#7518).
## 22.9.24 (Sept 24 2022) ## [22.9.24 (Sept 24 2022)](https://github.com/google/flatbuffers/releases/tag/v22.9.24)
* 20 Major releases in a row? Nope, we switched to a new * 20 Major releases in a row? Nope, we switched to a new
[versioning scheme](https://github.com/google/flatbuffers/wiki/Versioning) [versioning scheme](https://github.com/google/flatbuffers/wiki/Versioning)
@@ -67,4 +85,4 @@ necessarily listed.
* First binary schema generator (Lua) to generate Lua code via a .bfbs file. * First binary schema generator (Lua) to generate Lua code via a .bfbs file.
This is mostly an implementation detail of flatc internals, but will be slowly This is mostly an implementation detail of flatc internals, but will be slowly
applied to the other language generators. applied to the other language generators.

View File

@@ -1,6 +1,6 @@
set(VERSION_MAJOR 22) set(VERSION_MAJOR 23)
set(VERSION_MINOR 12) set(VERSION_MINOR 1)
set(VERSION_PATCH 06) set(VERSION_PATCH 4)
set(VERSION_COMMIT 0) set(VERSION_COMMIT 0)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")

View File

@@ -426,6 +426,7 @@ else()
# This isn't working for some reason: $<$<CXX_COMPILER_ID:CLANG>: # This isn't working for some reason: $<$<CXX_COMPILER_ID:CLANG>:
$<$<BOOL:${IS_CLANG}>: $<$<BOOL:${IS_CLANG}>:
-Wnewline-eof
-Wno-unknown-warning-option -Wno-unknown-warning-option
-Wmissing-declarations -Wmissing-declarations
-Wzero-as-null-pointer-constant -Wzero-as-null-pointer-constant

View File

@@ -1,6 +1,6 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'FlatBuffers' s.name = 'FlatBuffers'
s.version = '22.12.06' s.version = '23.1.4'
s.summary = 'FlatBuffers: Memory Efficient Serialization Library' s.summary = 'FlatBuffers: Memory Efficient Serialization Library'
s.description = "FlatBuffers is a cross platform serialization library architected for s.description = "FlatBuffers is a cross platform serialization library architected for

View File

@@ -36,7 +36,7 @@ class Animal : Table() {
return if(o != 0) bb.getShort(o + bb_pos).toUShort() else 0u return if(o != 0) bb.getShort(o + bb_pos).toUShort() else 0u
} }
companion object { companion object {
fun validateVersion() = Constants.FLATBUFFERS_22_12_06() fun validateVersion() = Constants.FLATBUFFERS_23_1_4()
fun getRootAsAnimal(_bb: ByteBuffer): Animal = getRootAsAnimal(_bb, Animal()) fun getRootAsAnimal(_bb: ByteBuffer): Animal = getRootAsAnimal(_bb, Animal())
fun getRootAsAnimal(_bb: ByteBuffer, obj: Animal): Animal { fun getRootAsAnimal(_bb: ByteBuffer, obj: Animal): Animal {
_bb.order(ByteOrder.LITTLE_ENDIAN) _bb.order(ByteOrder.LITTLE_ENDIAN)

View File

@@ -9,7 +9,7 @@ class BitWidthUtil {
} }
static BitWidth width(num value) { static BitWidth width(num value) {
if (value.toInt() == value) { if (value is int) {
var v = value.toInt().abs(); var v = value.toInt().abs();
if (v >> 7 == 0) return BitWidth.width8; if (v >> 7 == 0) return BitWidth.width8;
if (v >> 15 == 0) return BitWidth.width16; if (v >> 15 == 0) return BitWidth.width16;

View File

@@ -1,5 +1,5 @@
name: flat_buffers name: flat_buffers
version: 22.12.06 version: 23.1.4
description: FlatBuffers reading and writing library for Dart. Based on original work by Konstantin Scheglov and Paul Berry of the Dart SDK team. description: FlatBuffers reading and writing library for Dart. Based on original work by Konstantin Scheglov and Paul Berry of the Dart SDK team.
homepage: https://github.com/google/flatbuffers homepage: https://github.com/google/flatbuffers
documentation: https://google.github.io/flatbuffers/index.html documentation: https://google.github.io/flatbuffers/index.html

View File

@@ -40,6 +40,10 @@ void main() {
flx.addInt(-1025); flx.addInt(-1025);
expect(flx.finish(), [255, 251, 5, 2]); expect(flx.finish(), [255, 251, 5, 2]);
} }
{
var builder = Builder()..addDouble(1.0);
expect(builder.finish(), [0, 0, 128, 63, 14, 4]);
}
{ {
var flx = Builder(); var flx = Builder();
flx.addDouble(0.1); flx.addDouble(0.1);

View File

@@ -37,6 +37,7 @@ void main() {
// expect(FlxValue.fromBuffer(b([255, 255, 255, 255, 255, 255, 255, 255, 11, 8])).intValue, 18446744073709551615); // expect(FlxValue.fromBuffer(b([255, 255, 255, 255, 255, 255, 255, 255, 11, 8])).intValue, 18446744073709551615);
}); });
test('double value', () { test('double value', () {
expect(Reference.fromBuffer(b([0, 0, 128, 63, 14, 4])).doubleValue, 1.0);
expect(Reference.fromBuffer(b([0, 0, 144, 64, 14, 4])).doubleValue, 4.5); expect(Reference.fromBuffer(b([0, 0, 144, 64, 14, 4])).doubleValue, 4.5);
expect(Reference.fromBuffer(b([205, 204, 204, 61, 14, 4])).doubleValue, expect(Reference.fromBuffer(b([205, 204, 204, 61, 14, 4])).doubleValue,
closeTo(.1, .001)); closeTo(.1, .001));

View File

@@ -278,3 +278,122 @@ class KeywordsInTableObjectBuilder extends fb.ObjectBuilder {
return fbBuilder.buffer; return fbBuilder.buffer;
} }
} }
class Table2 {
Table2._(this._bc, this._bcOffset);
factory Table2(List<int> bytes) {
final rootRef = fb.BufferContext.fromBytes(bytes);
return reader.read(rootRef, 0);
}
static const fb.Reader<Table2> reader = _Table2Reader();
final fb.BufferContext _bc;
final int _bcOffset;
KeywordsInUnionTypeId? get typeType => KeywordsInUnionTypeId._createOrNull(const fb.Uint8Reader().vTableGetNullable(_bc, _bcOffset, 4));
dynamic get type {
switch (typeType?.value) {
case 1: return KeywordsInTable.reader.vTableGetNullable(_bc, _bcOffset, 6);
case 2: return KeywordsInTable.reader.vTableGetNullable(_bc, _bcOffset, 6);
default: return null;
}
}
@override
String toString() {
return 'Table2{typeType: ${typeType}, type: ${type}}';
}
Table2T unpack() => Table2T(
typeType: typeType,
type: type);
static int pack(fb.Builder fbBuilder, Table2T? object) {
if (object == null) return 0;
return object.pack(fbBuilder);
}
}
class Table2T implements fb.Packable {
KeywordsInUnionTypeId? typeType;
dynamic type;
Table2T({
this.typeType,
this.type});
@override
int pack(fb.Builder fbBuilder) {
final int? typeOffset = type?.pack(fbBuilder);
fbBuilder.startTable(2);
fbBuilder.addUint8(0, typeType?.value);
fbBuilder.addOffset(1, typeOffset);
return fbBuilder.endTable();
}
@override
String toString() {
return 'Table2T{typeType: ${typeType}, type: ${type}}';
}
}
class _Table2Reader extends fb.TableReader<Table2> {
const _Table2Reader();
@override
Table2 createObject(fb.BufferContext bc, int offset) =>
Table2._(bc, offset);
}
class Table2Builder {
Table2Builder(this.fbBuilder);
final fb.Builder fbBuilder;
void begin() {
fbBuilder.startTable(2);
}
int addTypeType(KeywordsInUnionTypeId? typeType) {
fbBuilder.addUint8(0, typeType?.value);
return fbBuilder.offset;
}
int addTypeOffset(int? offset) {
fbBuilder.addOffset(1, offset);
return fbBuilder.offset;
}
int finish() {
return fbBuilder.endTable();
}
}
class Table2ObjectBuilder extends fb.ObjectBuilder {
final KeywordsInUnionTypeId? _typeType;
final dynamic _type;
Table2ObjectBuilder({
KeywordsInUnionTypeId? typeType,
dynamic type,
})
: _typeType = typeType,
_type = type;
/// Finish building, and store into the [fbBuilder].
@override
int finish(fb.Builder fbBuilder) {
final int? typeOffset = _type?.getOrCreateOffset(fbBuilder);
fbBuilder.startTable(2);
fbBuilder.addUint8(0, _typeType?.value);
fbBuilder.addOffset(1, typeOffset);
return fbBuilder.endTable();
}
/// 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;
}
}

3
go/go.mod Normal file
View File

@@ -0,0 +1,3 @@
module github.com/google/flatbuffers/go
go 1.19

View File

@@ -6,7 +6,7 @@ import FlatBuffers
public struct models_HelloReply: FlatBufferObject, Verifiable { public struct models_HelloReply: FlatBufferObject, Verifiable {
static func validateVersion() { FlatBuffersVersion_22_12_06() } static func validateVersion() { FlatBuffersVersion_23_1_4() }
public var __buffer: ByteBuffer! { return _accessor.bb } public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table private var _accessor: Table
@@ -55,7 +55,7 @@ extension models_HelloReply: Encodable {
public struct models_HelloRequest: FlatBufferObject, Verifiable { public struct models_HelloRequest: FlatBufferObject, Verifiable {
static func validateVersion() { FlatBuffersVersion_22_12_06() } static func validateVersion() { FlatBuffersVersion_23_1_4() }
public var __buffer: ByteBuffer! { return _accessor.bb } public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table private var _accessor: Table

View File

@@ -65,4 +65,4 @@ class Allocator {
} // namespace flatbuffers } // namespace flatbuffers
#endif // FLATBUFFERS_ALLOCATOR_H_ #endif // FLATBUFFERS_ALLOCATOR_H_

View File

@@ -138,9 +138,9 @@
#endif #endif
#endif // !defined(FLATBUFFERS_LITTLEENDIAN) #endif // !defined(FLATBUFFERS_LITTLEENDIAN)
#define FLATBUFFERS_VERSION_MAJOR 22 #define FLATBUFFERS_VERSION_MAJOR 23
#define FLATBUFFERS_VERSION_MINOR 12 #define FLATBUFFERS_VERSION_MINOR 1
#define FLATBUFFERS_VERSION_REVISION 06 #define FLATBUFFERS_VERSION_REVISION 4
#define FLATBUFFERS_STRING_EXPAND(X) #X #define FLATBUFFERS_STRING_EXPAND(X) #X
#define FLATBUFFERS_STRING(X) FLATBUFFERS_STRING_EXPAND(X) #define FLATBUFFERS_STRING(X) FLATBUFFERS_STRING_EXPAND(X)
namespace flatbuffers { namespace flatbuffers {

View File

@@ -50,4 +50,4 @@ template<typename T> struct BufferRef : BufferRefBase {
} // namespace flatbuffers } // namespace flatbuffers
#endif // FLATBUFFERS_BUFFER_REF_H_ #endif // FLATBUFFERS_BUFFER_REF_H_

View File

@@ -61,4 +61,4 @@ inline uint8_t *ReallocateDownward(Allocator *allocator, uint8_t *old_p,
} // namespace flatbuffers } // namespace flatbuffers
#endif // FLATBUFFERS_DEFAULT_ALLOCATOR_H_ #endif // FLATBUFFERS_DEFAULT_ALLOCATOR_H_

View File

@@ -385,9 +385,8 @@ class Reference {
Reference(const uint8_t *data, uint8_t parent_width, uint8_t packed_type) Reference(const uint8_t *data, uint8_t parent_width, uint8_t packed_type)
: data_(data), : data_(data),
parent_width_(parent_width), parent_width_(parent_width),
byte_width_(1 << (packed_type & 3)), byte_width_(static_cast<uint8_t>(1 << (packed_type & 3))),
type_(static_cast<Type>(packed_type >> 2)) { type_(static_cast<Type>(packed_type >> 2)) {}
}
Type GetType() const { return type_; } Type GetType() const { return type_; }

View File

@@ -8,9 +8,9 @@
// Ensure the included flatbuffers.h is the same version as when this file was // Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible. // generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 22 && static_assert(FLATBUFFERS_VERSION_MAJOR == 23 &&
FLATBUFFERS_VERSION_MINOR == 12 && FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 6, FLATBUFFERS_VERSION_REVISION == 4,
"Non-compatible flatbuffers version included"); "Non-compatible flatbuffers version included");
namespace reflection { namespace reflection {

View File

@@ -61,4 +61,4 @@ static inline flatbuffers::string_view GetStringView(const String *str) {
} // namespace flatbuffers } // namespace flatbuffers
#endif // FLATBUFFERS_STRING_H_ #endif // FLATBUFFERS_STRING_H_

View File

@@ -50,4 +50,4 @@ class Struct FLATBUFFERS_FINAL_CLASS {
} // namespace flatbuffers } // namespace flatbuffers
#endif // FLATBUFFERS_STRUCT_H_ #endif // FLATBUFFERS_STRUCT_H_

View File

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.google.flatbuffers</groupId> <groupId>com.google.flatbuffers</groupId>
<artifactId>flatbuffers-java</artifactId> <artifactId>flatbuffers-java</artifactId>
<version>22.12.06</version> <version>23.1.4</version>
<packaging>bundle</packaging> <packaging>bundle</packaging>
<name>FlatBuffers Java API</name> <name>FlatBuffers Java API</name>
<description> <description>

View File

@@ -46,7 +46,7 @@ public class Constants {
Changes to the Java implementation need to be sure to change Changes to the Java implementation need to be sure to change
the version here and in the code generator on every possible the version here and in the code generator on every possible
incompatible change */ incompatible change */
public static void FLATBUFFERS_22_12_06() {} public static void FLATBUFFERS_23_1_4() {}
} }
/// @endcond /// @endcond

View File

@@ -32,6 +32,6 @@ namespace Google.FlatBuffers
Changes to the C# implementation need to be sure to change Changes to the C# implementation need to be sure to change
the version here and in the code generator on every possible the version here and in the code generator on every possible
incompatible change */ incompatible change */
public static void FLATBUFFERS_22_12_06() {} public static void FLATBUFFERS_23_1_4() {}
} }
} }

View File

@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.1;netstandard2.0;net46</TargetFrameworks> <TargetFrameworks>netstandard2.1;netstandard2.0;net46</TargetFrameworks>
<Description>A cross-platform memory efficient serialization library</Description> <Description>A cross-platform memory efficient serialization library</Description>
<PackageVersion>22.12.06</PackageVersion> <PackageVersion>23.1.4</PackageVersion>
<Authors>Google LLC</Authors> <Authors>Google LLC</Authors>
<PackageProjectUrl>https://github.com/google/flatbuffers</PackageProjectUrl> <PackageProjectUrl>https://github.com/google/flatbuffers</PackageProjectUrl>
<RepositoryUrl>https://github.com/google/flatbuffers</RepositoryUrl> <RepositoryUrl>https://github.com/google/flatbuffers</RepositoryUrl>

View File

@@ -1,6 +1,6 @@
{ {
"name": "flatbuffers", "name": "flatbuffers",
"version": "22.12.06", "version": "23.1.4",
"description": "Memory Efficient Serialization Library", "description": "Memory Efficient Serialization Library",
"files": [ "files": [
"js/**/*.js", "js/**/*.js",

View File

@@ -14,4 +14,4 @@
# Placeholder, to be updated during the release process # Placeholder, to be updated during the release process
# by the setup.py # by the setup.py
__version__ = u"22.12.06" __version__ = u"23.1.4"

View File

@@ -727,6 +727,15 @@ class Ref:
def IsString(self): def IsString(self):
return self._type is Type.STRING return self._type is Type.STRING
@property
def AsStringBytes(self):
if self.IsString:
return String(self._Indirect(), self._byte_width).Bytes
elif self.IsKey:
return self.AsKeyBytes
else:
raise self._ConvertError(Type.STRING)
@property @property
def AsString(self): def AsString(self):
if self.IsString: if self.IsString:

View File

@@ -16,7 +16,7 @@ from setuptools import setup
setup( setup(
name='flatbuffers', name='flatbuffers',
version='22.12.06', version='23.1.4',
license='Apache 2.0', license='Apache 2.0',
license_files='../LICENSE.txt', license_files='../LICENSE.txt',
author='Derek Bailey', author='Derek Bailey',

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "flatbuffers" name = "flatbuffers"
version = "22.12.6" version = "23.1.4"
edition = "2018" edition = "2018"
authors = ["Robert Winslow <hello@rwinslow.com>", "FlatBuffers Maintainers"] authors = ["Robert Winslow <hello@rwinslow.com>", "FlatBuffers Maintainers"]
license = "Apache-2.0" license = "Apache-2.0"

View File

@@ -25,6 +25,16 @@ pub struct Table<'a> {
} }
impl<'a> Table<'a> { impl<'a> Table<'a> {
#[inline]
pub fn buf(&self) -> &'a [u8] {
self.buf
}
#[inline]
pub fn loc(&self) -> usize {
self.loc
}
/// # Safety /// # Safety
/// ///
/// `buf` must contain a `soffset_t` at `loc`, which points to a valid vtable /// `buf` must contain a `soffset_t` at `loc`, which points to a valid vtable

View File

@@ -8,9 +8,9 @@
// Ensure the included flatbuffers.h is the same version as when this file was // Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible. // generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 22 && static_assert(FLATBUFFERS_VERSION_MAJOR == 23 &&
FLATBUFFERS_VERSION_MINOR == 12 && FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 6, FLATBUFFERS_VERSION_REVISION == 4,
"Non-compatible flatbuffers version included"); "Non-compatible flatbuffers version included");
namespace MyGame { namespace MyGame {

View File

@@ -31,7 +31,7 @@ public enum MyGame_Sample_Equipment: UInt8, Enum {
public struct MyGame_Sample_Vec3: NativeStruct { public struct MyGame_Sample_Vec3: NativeStruct {
static func validateVersion() { FlatBuffersVersion_22_12_06() } static func validateVersion() { FlatBuffersVersion_23_1_4() }
private var _x: Float32 private var _x: Float32
private var _y: Float32 private var _y: Float32
@@ -56,7 +56,7 @@ public struct MyGame_Sample_Vec3: NativeStruct {
public struct MyGame_Sample_Vec3_Mutable: FlatBufferObject { public struct MyGame_Sample_Vec3_Mutable: FlatBufferObject {
static func validateVersion() { FlatBuffersVersion_22_12_06() } static func validateVersion() { FlatBuffersVersion_23_1_4() }
public var __buffer: ByteBuffer! { return _accessor.bb } public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Struct private var _accessor: Struct
@@ -72,7 +72,7 @@ public struct MyGame_Sample_Vec3_Mutable: FlatBufferObject {
public struct MyGame_Sample_Monster: FlatBufferObject { public struct MyGame_Sample_Monster: FlatBufferObject {
static func validateVersion() { FlatBuffersVersion_22_12_06() } static func validateVersion() { FlatBuffersVersion_23_1_4() }
public var __buffer: ByteBuffer! { return _accessor.bb } public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table private var _accessor: Table
@@ -162,7 +162,7 @@ public struct MyGame_Sample_Monster: FlatBufferObject {
public struct MyGame_Sample_Weapon: FlatBufferObject { public struct MyGame_Sample_Weapon: FlatBufferObject {
static func validateVersion() { FlatBuffersVersion_22_12_06() } static func validateVersion() { FlatBuffersVersion_23_1_4() }
public var __buffer: ByteBuffer! { return _accessor.bb } public var __buffer: ByteBuffer! { return _accessor.bb }
private var _accessor: Table private var _accessor: Table

1
scripts/clang-tidy-git.sh Executable file
View File

@@ -0,0 +1 @@
run-clang-tidy -fix -extra-arg=-std=c++11 -extra-arg=-Wno-unknown-warning-option `git diff --name-only origin/HEAD`

View File

@@ -1,7 +1,7 @@
printf -v year '%(%y)T' -1 printf -v year '%(%y)T' -1
printf -v month '%(%m)T' -1 printf -v month '%(%-m)T' -1
printf -v day '%(%d)T' -1 printf -v day '%(%-d)T' -1
version="$year.$month.$day" version="$year.$month.$day"
version_underscore="$year\_$month\_$day" version_underscore="$year\_$month\_$day"

View File

@@ -630,4 +630,4 @@ std::unique_ptr<BfbsGenerator> NewLuaBfbsGenerator(
return std::unique_ptr<LuaBfbsGenerator>(new LuaBfbsGenerator(flatc_version)); return std::unique_ptr<LuaBfbsGenerator>(new LuaBfbsGenerator(flatc_version));
} }
} // namespace flatbuffers } // namespace flatbuffers

View File

@@ -30,4 +30,4 @@ std::unique_ptr<BfbsGenerator> NewLuaBfbsGenerator(
} // namespace flatbuffers } // namespace flatbuffers
#endif // FLATBUFFERS_BFBS_GEN_LUA_H_ #endif // FLATBUFFERS_BFBS_GEN_LUA_H_

View File

@@ -48,4 +48,4 @@ class BfbsNamer : public Namer {
} // namespace flatbuffers } // namespace flatbuffers
#endif // FLATBUFFERS_BFBS_NAMER #endif // FLATBUFFERS_BFBS_NAMER

View File

@@ -389,4 +389,4 @@ class BinaryAnnotator {
} // namespace flatbuffers } // namespace flatbuffers
#endif // FLATBUFFERS_BINARY_ANNOTATOR_H_ #endif // FLATBUFFERS_BINARY_ANNOTATOR_H_

View File

@@ -655,7 +655,7 @@ class CSharpGenerator : public BaseGenerator {
// Force compile time error if not using the same version runtime. // Force compile time error if not using the same version runtime.
code += " public static void ValidateVersion() {"; code += " public static void ValidateVersion() {";
code += " FlatBufferConstants."; code += " FlatBufferConstants.";
code += "FLATBUFFERS_22_12_06(); "; code += "FLATBUFFERS_23_1_4(); ";
code += "}\n"; code += "}\n";
// Generate a special accessor for the table that when used as the root // Generate a special accessor for the table that when used as the root

View File

@@ -103,10 +103,10 @@ class GoGenerator : public BaseGenerator {
bool needs_imports = false; bool needs_imports = false;
for (auto it = parser_.enums_.vec.begin(); it != parser_.enums_.vec.end(); for (auto it = parser_.enums_.vec.begin(); it != parser_.enums_.vec.end();
++it) { ++it) {
tracked_imported_namespaces_.clear(); if (!parser_.opts.one_file) {
needs_math_import_ = false; needs_imports = false;
needs_bytes_import_ = false; ResetImports();
needs_imports = false; }
std::string enumcode; std::string enumcode;
GenEnum(**it, &enumcode); GenEnum(**it, &enumcode);
if ((*it)->is_union && parser_.opts.generate_object_based_api) { if ((*it)->is_union && parser_.opts.generate_object_based_api) {
@@ -124,9 +124,7 @@ class GoGenerator : public BaseGenerator {
for (auto it = parser_.structs_.vec.begin(); for (auto it = parser_.structs_.vec.begin();
it != parser_.structs_.vec.end(); ++it) { it != parser_.structs_.vec.end(); ++it) {
tracked_imported_namespaces_.clear(); if (!parser_.opts.one_file) { ResetImports(); }
needs_math_import_ = false;
needs_bytes_import_ = false;
std::string declcode; std::string declcode;
GenStruct(**it, &declcode); GenStruct(**it, &declcode);
if (parser_.opts.one_file) { if (parser_.opts.one_file) {
@@ -503,7 +501,9 @@ class GoGenerator : public BaseGenerator {
auto &vector_struct_fields = vectortype.struct_def->fields.vec; auto &vector_struct_fields = vectortype.struct_def->fields.vec;
auto kit = auto kit =
std::find_if(vector_struct_fields.begin(), vector_struct_fields.end(), std::find_if(vector_struct_fields.begin(), vector_struct_fields.end(),
[&](FieldDef *field) { return field->key; }); [&](FieldDef *vector_struct_field) {
return vector_struct_field->key;
});
auto &key_field = **kit; auto &key_field = **kit;
FLATBUFFERS_ASSERT(key_field.key); FLATBUFFERS_ASSERT(key_field.key);
@@ -915,6 +915,7 @@ class GoGenerator : public BaseGenerator {
code += "buf []byte) bool {\n"; code += "buf []byte) bool {\n";
code += "\tspan := flatbuffers.GetUOffsetT(buf[vectorLocation - 4:])\n"; code += "\tspan := flatbuffers.GetUOffsetT(buf[vectorLocation - 4:])\n";
code += "\tstart := flatbuffers.UOffsetT(0)\n"; code += "\tstart := flatbuffers.UOffsetT(0)\n";
if (IsString(field.value.type)) { code += "\tbKey := []byte(key)\n"; }
code += "\tfor span != 0 {\n"; code += "\tfor span != 0 {\n";
code += "\t\tmiddle := span / 2\n"; code += "\t\tmiddle := span / 2\n";
code += "\t\ttableOffset := flatbuffers.GetIndirectOffset(buf, "; code += "\t\ttableOffset := flatbuffers.GetIndirectOffset(buf, ";
@@ -924,7 +925,6 @@ class GoGenerator : public BaseGenerator {
code += "\t\tobj.Init(buf, tableOffset)\n"; code += "\t\tobj.Init(buf, tableOffset)\n";
if (IsString(field.value.type)) { if (IsString(field.value.type)) {
code += "\t\tbKey := []byte(key)\n";
needs_bytes_import_ = true; needs_bytes_import_ = true;
code += code +=
"\t\tcomp := bytes.Compare(obj." + namer_.Function(field.name) + "()"; "\t\tcomp := bytes.Compare(obj." + namer_.Function(field.name) + "()";
@@ -1056,8 +1056,11 @@ class GoGenerator : public BaseGenerator {
const std::string offset = field_var + "Offset"; const std::string offset = field_var + "Offset";
if (IsString(field.value.type)) { if (IsString(field.value.type)) {
code += code += "\t" + offset + " := flatbuffers.UOffsetT(0)\n";
"\t" + offset + " := builder.CreateString(t." + field_field + ")\n"; code += "\tif t." + field_field + " != \"\" {\n";
code += "\t\t" + offset + " = builder.CreateString(t." + field_field +
")\n";
code += "\t}\n";
} else if (IsVector(field.value.type) && } else if (IsVector(field.value.type) &&
field.value.type.element == BASE_TYPE_UCHAR && field.value.type.element == BASE_TYPE_UCHAR &&
field.value.type.enum_def == nullptr) { field.value.type.enum_def == nullptr) {
@@ -1462,6 +1465,7 @@ class GoGenerator : public BaseGenerator {
StructBuilderBody(struct_def, "", code_ptr); StructBuilderBody(struct_def, "", code_ptr);
EndBuilderBody(code_ptr); EndBuilderBody(code_ptr);
} }
// Begin by declaring namespace and imports. // Begin by declaring namespace and imports.
void BeginFile(const std::string &name_space_name, const bool needs_imports, void BeginFile(const std::string &name_space_name, const bool needs_imports,
const bool is_enum, std::string *code_ptr) { const bool is_enum, std::string *code_ptr) {
@@ -1503,6 +1507,13 @@ class GoGenerator : public BaseGenerator {
} }
} }
// Resets the needed imports before generating a new file.
void ResetImports() {
tracked_imported_namespaces_.clear();
needs_bytes_import_ = false;
needs_math_import_ = false;
}
// Save out the generated code for a Go Table type. // Save out the generated code for a Go Table type.
bool SaveType(const Definition &def, const std::string &classcode, bool SaveType(const Definition &def, const std::string &classcode,
const bool needs_imports, const bool is_enum) { const bool needs_imports, const bool is_enum) {

View File

@@ -185,7 +185,9 @@ class JavaGenerator : public BaseGenerator {
"import com.google.flatbuffers.DoubleVector;\n" "import com.google.flatbuffers.DoubleVector;\n"
"import com.google.flatbuffers.FlatBufferBuilder;\n" "import com.google.flatbuffers.FlatBufferBuilder;\n"
"import com.google.flatbuffers.FloatVector;\n" "import com.google.flatbuffers.FloatVector;\n"
"import com.google.flatbuffers.IntVector;\n"
"import com.google.flatbuffers.LongVector;\n" "import com.google.flatbuffers.LongVector;\n"
"import com.google.flatbuffers.ShortVector;\n"
"import com.google.flatbuffers.StringVector;\n" "import com.google.flatbuffers.StringVector;\n"
"import com.google.flatbuffers.Struct;\n" "import com.google.flatbuffers.Struct;\n"
"import com.google.flatbuffers.Table;\n" "import com.google.flatbuffers.Table;\n"
@@ -681,7 +683,7 @@ class JavaGenerator : public BaseGenerator {
// Force compile time error if not using the same version runtime. // Force compile time error if not using the same version runtime.
code += " public static void ValidateVersion() {"; code += " public static void ValidateVersion() {";
code += " Constants."; code += " Constants.";
code += "FLATBUFFERS_22_12_06(); "; code += "FLATBUFFERS_23_1_4(); ";
code += "}\n"; code += "}\n";
// Generate a special accessor for the table that when used as the root // Generate a special accessor for the table that when used as the root

View File

@@ -505,7 +505,7 @@ class KotlinGenerator : public BaseGenerator {
// runtime. // runtime.
GenerateFunOneLine( GenerateFunOneLine(
writer, "validateVersion", "", "", writer, "validateVersion", "", "",
[&]() { writer += "Constants.FLATBUFFERS_22_12_06()"; }, [&]() { writer += "Constants.FLATBUFFERS_23_1_4()"; },
options.gen_jvmstatic); options.gen_jvmstatic);
GenerateGetRootAsAccessors(namer_.Type(struct_def), writer, options); GenerateGetRootAsAccessors(namer_.Type(struct_def), writer, options);

View File

@@ -1629,7 +1629,7 @@ class RustGenerator : public BaseGenerator {
code_.SetValue("OFFSET_VALUE", NumToString(field.value.offset)); code_.SetValue("OFFSET_VALUE", NumToString(field.value.offset));
code_.SetValue("FIELD", namer_.Field(field)); code_.SetValue("FIELD", namer_.Field(field));
code_.SetValue("BLDR_DEF_VAL", GetDefaultValue(field, kBuilder)); code_.SetValue("BLDR_DEF_VAL", GetDefaultValue(field, kBuilder));
code_.SetValue("DISCRIMINANT", namer_.Field(field) + "_type"); code_.SetValue("DISCRIMINANT", namer_.LegacyRustUnionTypeMethod(field));
code_.IncrementIdentLevel(); code_.IncrementIdentLevel();
cb(field); cb(field);
code_.DecrementIdentLevel(); code_.DecrementIdentLevel();
@@ -1747,7 +1747,10 @@ class RustGenerator : public BaseGenerator {
const auto &enum_def = *type.enum_def; const auto &enum_def = *type.enum_def;
code_.SetValue("ENUM_TY", WrapInNameSpace(enum_def)); code_.SetValue("ENUM_TY", WrapInNameSpace(enum_def));
code_.SetValue("NATIVE_ENUM_NAME", NamespacedNativeName(enum_def)); code_.SetValue("NATIVE_ENUM_NAME", NamespacedNativeName(enum_def));
code_ += " let {{FIELD}} = match self.{{FIELD}}_type() {"; code_.SetValue("UNION_TYPE_METHOD",
namer_.LegacyRustUnionTypeMethod(field));
code_ += " let {{FIELD}} = match self.{{UNION_TYPE_METHOD}}() {";
code_ += " {{ENUM_TY}}::NONE => {{NATIVE_ENUM_NAME}}::NONE,"; code_ += " {{ENUM_TY}}::NONE => {{NATIVE_ENUM_NAME}}::NONE,";
ForAllUnionObjectVariantsBesidesNone(enum_def, [&] { ForAllUnionObjectVariantsBesidesNone(enum_def, [&] {
code_ += code_ +=
@@ -1973,10 +1976,12 @@ class RustGenerator : public BaseGenerator {
const EnumDef &union_def = *field.value.type.enum_def; const EnumDef &union_def = *field.value.type.enum_def;
code_.SetValue("UNION_TYPE", WrapInNameSpace(union_def)); code_.SetValue("UNION_TYPE", WrapInNameSpace(union_def));
code_.SetValue("UNION_TYPE_OFFSET_NAME", code_.SetValue("UNION_TYPE_OFFSET_NAME",
namer_.LegacyRustFieldOffsetName(field) + "_TYPE"); namer_.LegacyRustUnionTypeOffsetName(field));
code_.SetValue("UNION_TYPE_METHOD",
namer_.LegacyRustUnionTypeMethod(field));
code_ += code_ +=
"\n .visit_union::<{{UNION_TYPE}}, _>(" "\n .visit_union::<{{UNION_TYPE}}, _>("
"\"{{FIELD}}_type\", Self::{{UNION_TYPE_OFFSET_NAME}}, " "\"{{UNION_TYPE_METHOD}}\", Self::{{UNION_TYPE_OFFSET_NAME}}, "
"\"{{FIELD}}\", Self::{{OFFSET_NAME}}, {{IS_REQ}}, " "\"{{FIELD}}\", Self::{{OFFSET_NAME}}, {{IS_REQ}}, "
"|key, v, pos| {"; "|key, v, pos| {";
code_ += " match key {"; code_ += " match key {";
@@ -2045,8 +2050,10 @@ class RustGenerator : public BaseGenerator {
const auto &enum_def = *type.enum_def; const auto &enum_def = *type.enum_def;
code_.SetValue("ENUM_TY", WrapInNameSpace(enum_def)); code_.SetValue("ENUM_TY", WrapInNameSpace(enum_def));
code_.SetValue("FIELD", namer_.Field(field)); code_.SetValue("FIELD", namer_.Field(field));
code_.SetValue("UNION_TYPE_METHOD",
namer_.LegacyRustUnionTypeMethod(field));
code_ += " match self.{{FIELD}}_type() {"; code_ += " match self.{{UNION_TYPE_METHOD}}() {";
code_ += " {{ENUM_TY}}::NONE => (),"; code_ += " {{ENUM_TY}}::NONE => (),";
ForAllUnionObjectVariantsBesidesNone(enum_def, [&] { ForAllUnionObjectVariantsBesidesNone(enum_def, [&] {
code_.SetValue("FIELD", namer_.Field(field)); code_.SetValue("FIELD", namer_.Field(field));
@@ -2255,8 +2262,9 @@ class RustGenerator : public BaseGenerator {
case ftUnionValue: { case ftUnionValue: {
code_.SetValue("ENUM_METHOD", code_.SetValue("ENUM_METHOD",
namer_.Method(*field.value.type.enum_def)); namer_.Method(*field.value.type.enum_def));
code_.SetValue("DISCRIMINANT", namer_.LegacyRustUnionTypeMethod(field));
code_ += code_ +=
" let {{FIELD}}_type = " " let {{DISCRIMINANT}} = "
"self.{{FIELD}}.{{ENUM_METHOD}}_type();"; "self.{{FIELD}}.{{ENUM_METHOD}}_type();";
code_ += " let {{FIELD}} = self.{{FIELD}}.pack(_fbb);"; code_ += " let {{FIELD}} = self.{{FIELD}}.pack(_fbb);";
return; return;

View File

@@ -1846,7 +1846,7 @@ class SwiftGenerator : public BaseGenerator {
} }
std::string ValidateFunc() { std::string ValidateFunc() {
return "static func validateVersion() { FlatBuffersVersion_22_12_06() }"; return "static func validateVersion() { FlatBuffersVersion_23_1_4() }";
} }
std::string GenType(const Type &type, std::string GenType(const Type &type,

View File

@@ -1898,7 +1898,10 @@ class TsGenerator : public BaseGenerator {
if (parser_.opts.generate_name_strings) { if (parser_.opts.generate_name_strings) {
GenDocComment(code_ptr); GenDocComment(code_ptr);
code += "static getFullyQualifiedName():string {\n"; code += "static getFullyQualifiedName():string {\n";
code += " return '" + WrapInNameSpace(struct_def) + "';\n"; code +=
" return '" +
struct_def.defined_namespace->GetFullyQualifiedName(struct_def.name) +
"';\n";
code += "}\n\n"; code += "}\n\n";
} }

View File

@@ -102,6 +102,10 @@ class IdlNamer : public Namer {
std::string LegacyRustFieldOffsetName(const FieldDef &field) const { std::string LegacyRustFieldOffsetName(const FieldDef &field) const {
return "VT_" + ConvertCase(EscapeKeyword(field.name), Case::kAllUpper); return "VT_" + ConvertCase(EscapeKeyword(field.name), Case::kAllUpper);
} }
std::string LegacyRustUnionTypeOffsetName(const FieldDef &field) const {
return "VT_" + ConvertCase(EscapeKeyword(field.name + "_type"), Case::kAllUpper);
}
std::string LegacySwiftVariant(const EnumVal &ev) const { std::string LegacySwiftVariant(const EnumVal &ev) const {
auto name = ev.name; auto name = ev.name;
@@ -140,6 +144,11 @@ class IdlNamer : public Namer {
return "mutate_" + d.name; return "mutate_" + d.name;
} }
std::string LegacyRustUnionTypeMethod(const FieldDef &d) {
// assert d is a union
return Method(d.name + "_type");
}
private: private:
std::string NamespacedString(const struct Namespace *ns, std::string NamespacedString(const struct Namespace *ns,
const std::string &str) const { const std::string &str) const {

View File

@@ -119,4 +119,4 @@ extension UInt64: Scalar, Verifiable {
public typealias NumericValue = UInt64 public typealias NumericValue = UInt64
} }
public func FlatBuffersVersion_22_12_06() {} public func FlatBuffersVersion_23_1_4() {}

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : Declared by :
]# ]#

View File

@@ -9,7 +9,9 @@ import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector; import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder; import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector; import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector; import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector; import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct; import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table; import com.google.flatbuffers.Table;
@@ -19,7 +21,7 @@ import java.nio.ByteOrder;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class LongFloatEntry extends Table { public final class LongFloatEntry extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_22_12_06(); } public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_4(); }
public static LongFloatEntry getRootAsLongFloatEntry(ByteBuffer _bb) { return getRootAsLongFloatEntry(_bb, new LongFloatEntry()); } 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 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 void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }

View File

@@ -32,7 +32,7 @@ class LongFloatEntry : Table() {
return (val_1 - val_2).sign return (val_1 - val_2).sign
} }
companion object { companion object {
fun validateVersion() = Constants.FLATBUFFERS_22_12_06() fun validateVersion() = Constants.FLATBUFFERS_23_1_4()
fun getRootAsLongFloatEntry(_bb: ByteBuffer): LongFloatEntry = getRootAsLongFloatEntry(_bb, LongFloatEntry()) fun getRootAsLongFloatEntry(_bb: ByteBuffer): LongFloatEntry = getRootAsLongFloatEntry(_bb, LongFloatEntry())
fun getRootAsLongFloatEntry(_bb: ByteBuffer, obj: LongFloatEntry): LongFloatEntry { fun getRootAsLongFloatEntry(_bb: ByteBuffer, obj: LongFloatEntry): LongFloatEntry {
_bb.order(ByteOrder.LITTLE_ENDIAN) _bb.order(ByteOrder.LITTLE_ENDIAN)

View File

@@ -9,7 +9,9 @@ import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector; import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder; import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector; import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector; import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector; import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct; import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table; import com.google.flatbuffers.Table;
@@ -19,7 +21,7 @@ import java.nio.ByteOrder;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class LongFloatMap extends Table { public final class LongFloatMap extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_22_12_06(); } public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_4(); }
public static LongFloatMap getRootAsLongFloatMap(ByteBuffer _bb) { return getRootAsLongFloatMap(_bb, new LongFloatMap()); } 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 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 void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }

View File

@@ -46,7 +46,7 @@ class LongFloatMap : Table() {
} }
} }
companion object { companion object {
fun validateVersion() = Constants.FLATBUFFERS_22_12_06() fun validateVersion() = Constants.FLATBUFFERS_23_1_4()
fun getRootAsLongFloatMap(_bb: ByteBuffer): LongFloatMap = getRootAsLongFloatMap(_bb, LongFloatMap()) fun getRootAsLongFloatMap(_bb: ByteBuffer): LongFloatMap = getRootAsLongFloatMap(_bb, LongFloatMap())
fun getRootAsLongFloatMap(_bb: ByteBuffer, obj: LongFloatMap): LongFloatMap { fun getRootAsLongFloatMap(_bb: ByteBuffer, obj: LongFloatMap): LongFloatMap {
_bb.order(ByteOrder.LITTLE_ENDIAN) _bb.order(ByteOrder.LITTLE_ENDIAN)

View File

@@ -13,7 +13,7 @@ public struct KeywordsInTable : IFlatbufferObject
{ {
private Table __p; private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } } public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_22_12_06(); } public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_4(); }
public static KeywordsInTable GetRootAsKeywordsInTable(ByteBuffer _bb) { return GetRootAsKeywordsInTable(_bb, new KeywordsInTable()); } 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 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); } public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }

View File

@@ -0,0 +1,94 @@
// <auto-generated>
// automatically generated by the FlatBuffers compiler, do not modify
// </auto-generated>
namespace KeywordTest
{
using global::System;
using global::System.Collections.Generic;
using global::Google.FlatBuffers;
public struct Table2 : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_4(); }
public static Table2 GetRootAsTable2(ByteBuffer _bb) { return GetRootAsTable2(_bb, new Table2()); }
public static Table2 GetRootAsTable2(ByteBuffer _bb, Table2 obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
public Table2 __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public KeywordTest.KeywordsInUnion TypeType { get { int o = __p.__offset(4); return o != 0 ? (KeywordTest.KeywordsInUnion)__p.bb.Get(o + __p.bb_pos) : KeywordTest.KeywordsInUnion.NONE; } }
public TTable? Type<TTable>() where TTable : struct, IFlatbufferObject { int o = __p.__offset(6); return o != 0 ? (TTable?)__p.__union<TTable>(o + __p.bb_pos) : null; }
public KeywordTest.KeywordsInTable TypeAsstatic() { return Type<KeywordTest.KeywordsInTable>().Value; }
public KeywordTest.KeywordsInTable TypeAsinternal() { return Type<KeywordTest.KeywordsInTable>().Value; }
public static Offset<KeywordTest.Table2> CreateTable2(FlatBufferBuilder builder,
KeywordTest.KeywordsInUnion type_type = KeywordTest.KeywordsInUnion.NONE,
int typeOffset = 0) {
builder.StartTable(2);
Table2.AddType(builder, typeOffset);
Table2.AddTypeType(builder, type_type);
return Table2.EndTable2(builder);
}
public static void StartTable2(FlatBufferBuilder builder) { builder.StartTable(2); }
public static void AddTypeType(FlatBufferBuilder builder, KeywordTest.KeywordsInUnion typeType) { builder.AddByte(0, (byte)typeType, 0); }
public static void AddType(FlatBufferBuilder builder, int typeOffset) { builder.AddOffset(1, typeOffset, 0); }
public static Offset<KeywordTest.Table2> EndTable2(FlatBufferBuilder builder) {
int o = builder.EndTable();
return new Offset<KeywordTest.Table2>(o);
}
public Table2T UnPack() {
var _o = new Table2T();
this.UnPackTo(_o);
return _o;
}
public void UnPackTo(Table2T _o) {
_o.Type = new KeywordTest.KeywordsInUnionUnion();
_o.Type.Type = this.TypeType;
switch (this.TypeType) {
default: break;
case KeywordTest.KeywordsInUnion.static:
_o.Type.Value = this.Type<KeywordTest.KeywordsInTable>().HasValue ? this.Type<KeywordTest.KeywordsInTable>().Value.UnPack() : null;
break;
case KeywordTest.KeywordsInUnion.internal:
_o.Type.Value = this.Type<KeywordTest.KeywordsInTable>().HasValue ? this.Type<KeywordTest.KeywordsInTable>().Value.UnPack() : null;
break;
}
}
public static Offset<KeywordTest.Table2> Pack(FlatBufferBuilder builder, Table2T _o) {
if (_o == null) return default(Offset<KeywordTest.Table2>);
var _type_type = _o.Type == null ? KeywordTest.KeywordsInUnion.NONE : _o.Type.Type;
var _type = _o.Type == null ? 0 : KeywordTest.KeywordsInUnionUnion.Pack(builder, _o.Type);
return CreateTable2(
builder,
_type_type,
_type);
}
}
public class Table2T
{
[Newtonsoft.Json.JsonProperty("type_type")]
private KeywordTest.KeywordsInUnion TypeType {
get {
return this.Type != null ? this.Type.Type : KeywordTest.KeywordsInUnion.NONE;
}
set {
this.Type = new KeywordTest.KeywordsInUnionUnion();
this.Type.Type = value;
}
}
[Newtonsoft.Json.JsonProperty("type")]
[Newtonsoft.Json.JsonConverter(typeof(KeywordTest.KeywordsInUnionUnion_JsonConverter))]
public KeywordTest.KeywordsInUnionUnion Type { get; set; }
public Table2T() {
this.Type = null;
}
}
}

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : Declared by :
]# ]#

View File

@@ -9,7 +9,9 @@ import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector; import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder; import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector; import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector; import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector; import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct; import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table; import com.google.flatbuffers.Table;

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : //monster_test.fbs Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs) Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : Declared by :
Rooting type : MyGame.Example.Monster () Rooting type : MyGame.Example.Monster ()

View File

@@ -9,7 +9,9 @@ import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector; import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder; import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector; import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector; import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector; import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct; import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table; import com.google.flatbuffers.Table;

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : //monster_test.fbs Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs) Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : Declared by :
Rooting type : MyGame.Example.Monster () Rooting type : MyGame.Example.Monster ()

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : //monster_test.fbs Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs) Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : Declared by :
Rooting type : MyGame.Example.Monster () Rooting type : MyGame.Example.Monster ()

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : //monster_test.fbs Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs) Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : Declared by :
Rooting type : MyGame.Example.Monster () Rooting type : MyGame.Example.Monster ()

View File

@@ -9,7 +9,9 @@ import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector; import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder; import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector; import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector; import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector; import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct; import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table; import com.google.flatbuffers.Table;

View File

@@ -9,7 +9,9 @@ import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector; import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder; import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector; import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector; import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector; import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct; import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table; import com.google.flatbuffers.Table;

View File

@@ -13,7 +13,7 @@ public struct ArrayTable : IFlatbufferObject
{ {
private Table __p; private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } } public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_22_12_06(); } public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_4(); }
public static ArrayTable GetRootAsArrayTable(ByteBuffer _bb) { return GetRootAsArrayTable(_bb, new ArrayTable()); } 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 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"); } public static bool ArrayTableBufferHasIdentifier(ByteBuffer _bb) { return Table.__has_identifier(_bb, "ARRT"); }

View File

@@ -9,7 +9,9 @@ import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector; import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder; import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector; import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector; import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector; import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct; import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table; import com.google.flatbuffers.Table;
@@ -19,7 +21,7 @@ import java.nio.ByteOrder;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class ArrayTable extends Table { public final class ArrayTable extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_22_12_06(); } public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_4(); }
public static ArrayTable getRootAsArrayTable(ByteBuffer _bb) { return getRootAsArrayTable(_bb, new ArrayTable()); } 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 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"); } public static boolean ArrayTableBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "ARRT"); }

View File

@@ -9,7 +9,9 @@ import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector; import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder; import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector; import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector; import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector; import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct; import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table; import com.google.flatbuffers.Table;

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : //monster_test.fbs Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs) Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : Declared by :
Rooting type : MyGame.Example.Monster () Rooting type : MyGame.Example.Monster ()

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : //monster_test.fbs Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs) Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : Declared by :
Rooting type : MyGame.Example.Monster () Rooting type : MyGame.Example.Monster ()

View File

@@ -14,7 +14,7 @@ public struct Monster : IFlatbufferObject
{ {
private Table __p; private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } } public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_22_12_06(); } public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_4(); }
public static Monster GetRootAsMonster(ByteBuffer _bb) { return GetRootAsMonster(_bb, new Monster()); } 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 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"); } public static bool MonsterBufferHasIdentifier(ByteBuffer _bb) { return Table.__has_identifier(_bb, "MONS"); }

View File

@@ -74,7 +74,10 @@ type MonsterT struct {
func (t *MonsterT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT { func (t *MonsterT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
if t == nil { return 0 } if t == nil { return 0 }
nameOffset := builder.CreateString(t.Name) nameOffset := flatbuffers.UOffsetT(0)
if t.Name != "" {
nameOffset = builder.CreateString(t.Name)
}
inventoryOffset := flatbuffers.UOffsetT(0) inventoryOffset := flatbuffers.UOffsetT(0)
if t.Inventory != nil { if t.Inventory != nil {
inventoryOffset = builder.CreateByteString(t.Inventory) inventoryOffset = builder.CreateByteString(t.Inventory)
@@ -579,12 +582,12 @@ func MonsterKeyCompare(o1, o2 flatbuffers.UOffsetT, buf []byte) bool {
func (rcv *Monster) LookupByKey(key string, vectorLocation flatbuffers.UOffsetT, buf []byte) bool { func (rcv *Monster) LookupByKey(key string, vectorLocation flatbuffers.UOffsetT, buf []byte) bool {
span := flatbuffers.GetUOffsetT(buf[vectorLocation - 4:]) span := flatbuffers.GetUOffsetT(buf[vectorLocation - 4:])
start := flatbuffers.UOffsetT(0) start := flatbuffers.UOffsetT(0)
bKey := []byte(key)
for span != 0 { for span != 0 {
middle := span / 2 middle := span / 2
tableOffset := flatbuffers.GetIndirectOffset(buf, vectorLocation+ 4 * (start + middle)) tableOffset := flatbuffers.GetIndirectOffset(buf, vectorLocation+ 4 * (start + middle))
obj := &Monster{} obj := &Monster{}
obj.Init(buf, tableOffset) obj.Init(buf, tableOffset)
bKey := []byte(key)
comp := bytes.Compare(obj.Name(), bKey) comp := bytes.Compare(obj.Name(), bKey)
if comp > 0 { if comp > 0 {
span = middle span = middle

View File

@@ -9,7 +9,9 @@ import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector; import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder; import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector; import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector; import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector; import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct; import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table; import com.google.flatbuffers.Table;
@@ -22,7 +24,7 @@ import java.nio.ByteOrder;
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class Monster extends Table { public final class Monster extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_22_12_06(); } public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_4(); }
public static Monster getRootAsMonster(ByteBuffer _bb) { return getRootAsMonster(_bb, new Monster()); } 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 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"); } public static boolean MonsterBufferHasIdentifier(ByteBuffer _bb) { return __has_identifier(_bb, "MONS"); }

View File

@@ -986,7 +986,7 @@ class Monster : Table() {
return compareStrings(__offset(10, o1, _bb), __offset(10, o2, _bb), _bb) return compareStrings(__offset(10, o1, _bb), __offset(10, o2, _bb), _bb)
} }
companion object { companion object {
fun validateVersion() = Constants.FLATBUFFERS_22_12_06() fun validateVersion() = Constants.FLATBUFFERS_23_1_4()
fun getRootAsMonster(_bb: ByteBuffer): Monster = getRootAsMonster(_bb, Monster()) fun getRootAsMonster(_bb: ByteBuffer): Monster = getRootAsMonster(_bb, Monster())
fun getRootAsMonster(_bb: ByteBuffer, obj: Monster): Monster { fun getRootAsMonster(_bb: ByteBuffer, obj: Monster): Monster {
_bb.order(ByteOrder.LITTLE_ENDIAN) _bb.order(ByteOrder.LITTLE_ENDIAN)

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : //monster_test.fbs Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs) Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : Declared by :
Rooting type : MyGame.Example.Monster () Rooting type : MyGame.Example.Monster ()

View File

@@ -9,7 +9,9 @@ import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector; import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder; import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector; import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector; import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector; import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct; import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table; import com.google.flatbuffers.Table;

View File

@@ -9,7 +9,9 @@ import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector; import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder; import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector; import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector; import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector; import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct; import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table; import com.google.flatbuffers.Table;

View File

@@ -9,7 +9,9 @@ import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector; import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder; import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector; import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector; import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector; import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct; import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table; import com.google.flatbuffers.Table;

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : //monster_test.fbs Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs) Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : Declared by :
Rooting type : MyGame.Example.Monster () Rooting type : MyGame.Example.Monster ()

View File

@@ -13,7 +13,7 @@ public struct Referrable : IFlatbufferObject
{ {
private Table __p; private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } } public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_22_12_06(); } public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_4(); }
public static Referrable GetRootAsReferrable(ByteBuffer _bb) { return GetRootAsReferrable(_bb, new Referrable()); } 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 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); } public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }

View File

@@ -9,7 +9,9 @@ import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector; import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder; import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector; import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector; import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector; import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct; import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table; import com.google.flatbuffers.Table;
@@ -19,7 +21,7 @@ import java.nio.ByteOrder;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class Referrable extends Table { public final class Referrable extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_22_12_06(); } public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_4(); }
public static Referrable getRootAsReferrable(ByteBuffer _bb) { return getRootAsReferrable(_bb, new Referrable()); } 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 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); } public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }

View File

@@ -36,7 +36,7 @@ class Referrable : Table() {
return (val_1 - val_2).sign return (val_1 - val_2).sign
} }
companion object { companion object {
fun validateVersion() = Constants.FLATBUFFERS_22_12_06() fun validateVersion() = Constants.FLATBUFFERS_23_1_4()
fun getRootAsReferrable(_bb: ByteBuffer): Referrable = getRootAsReferrable(_bb, Referrable()) fun getRootAsReferrable(_bb: ByteBuffer): Referrable = getRootAsReferrable(_bb, Referrable())
fun getRootAsReferrable(_bb: ByteBuffer, obj: Referrable): Referrable { fun getRootAsReferrable(_bb: ByteBuffer, obj: Referrable): Referrable {
_bb.order(ByteOrder.LITTLE_ENDIAN) _bb.order(ByteOrder.LITTLE_ENDIAN)

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : //monster_test.fbs Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs) Rooting type : MyGame.Example.Monster (//monster_test.fbs)

View File

@@ -2,7 +2,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : Declared by :
Rooting type : MyGame.Example.Monster () Rooting type : MyGame.Example.Monster ()

View File

@@ -9,7 +9,9 @@ import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector; import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder; import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector; import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector; import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector; import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct; import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table; import com.google.flatbuffers.Table;

View File

@@ -13,7 +13,7 @@ public struct Stat : IFlatbufferObject
{ {
private Table __p; private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } } public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_22_12_06(); } public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_23_1_4(); }
public static Stat GetRootAsStat(ByteBuffer _bb) { return GetRootAsStat(_bb, new Stat()); } 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 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); } public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }

View File

@@ -14,7 +14,10 @@ type StatT struct {
func (t *StatT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT { func (t *StatT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
if t == nil { return 0 } if t == nil { return 0 }
idOffset := builder.CreateString(t.Id) idOffset := flatbuffers.UOffsetT(0)
if t.Id != "" {
idOffset = builder.CreateString(t.Id)
}
StatStart(builder) StatStart(builder)
StatAddId(builder, idOffset) StatAddId(builder, idOffset)
StatAddVal(builder, t.Val) StatAddVal(builder, t.Val)

View File

@@ -9,7 +9,9 @@ import com.google.flatbuffers.Constants;
import com.google.flatbuffers.DoubleVector; import com.google.flatbuffers.DoubleVector;
import com.google.flatbuffers.FlatBufferBuilder; import com.google.flatbuffers.FlatBufferBuilder;
import com.google.flatbuffers.FloatVector; import com.google.flatbuffers.FloatVector;
import com.google.flatbuffers.IntVector;
import com.google.flatbuffers.LongVector; import com.google.flatbuffers.LongVector;
import com.google.flatbuffers.ShortVector;
import com.google.flatbuffers.StringVector; import com.google.flatbuffers.StringVector;
import com.google.flatbuffers.Struct; import com.google.flatbuffers.Struct;
import com.google.flatbuffers.Table; import com.google.flatbuffers.Table;
@@ -19,7 +21,7 @@ import java.nio.ByteOrder;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class Stat extends Table { public final class Stat extends Table {
public static void ValidateVersion() { Constants.FLATBUFFERS_22_12_06(); } public static void ValidateVersion() { Constants.FLATBUFFERS_23_1_4(); }
public static Stat getRootAsStat(ByteBuffer _bb) { return getRootAsStat(_bb, new Stat()); } 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 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); } public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); }

View File

@@ -57,7 +57,7 @@ class Stat : Table() {
return (val_1 - val_2).sign return (val_1 - val_2).sign
} }
companion object { companion object {
fun validateVersion() = Constants.FLATBUFFERS_22_12_06() fun validateVersion() = Constants.FLATBUFFERS_23_1_4()
fun getRootAsStat(_bb: ByteBuffer): Stat = getRootAsStat(_bb, Stat()) fun getRootAsStat(_bb: ByteBuffer): Stat = getRootAsStat(_bb, Stat())
fun getRootAsStat(_bb: ByteBuffer, obj: Stat): Stat { fun getRootAsStat(_bb: ByteBuffer, obj: Stat): Stat {
_bb.order(ByteOrder.LITTLE_ENDIAN) _bb.order(ByteOrder.LITTLE_ENDIAN)

View File

@@ -3,7 +3,7 @@
Automatically generated by the FlatBuffers compiler, do not modify. Automatically generated by the FlatBuffers compiler, do not modify.
Or modify. I'm a message, not a cop. Or modify. I'm a message, not a cop.
flatc version: 22.12.06 flatc version: 23.1.4
Declared by : //monster_test.fbs Declared by : //monster_test.fbs
Rooting type : MyGame.Example.Monster (//monster_test.fbs) Rooting type : MyGame.Example.Monster (//monster_test.fbs)

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