mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-10 07:06:26 +00:00
Compare commits
50 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
203241ed32 | ||
|
|
ac485609c4 | ||
|
|
de5b85aa66 | ||
|
|
de3df2d88b | ||
|
|
043a24f2e4 | ||
|
|
5a48b0d7d6 | ||
|
|
ce307556fb | ||
|
|
cb616e27cb | ||
|
|
a54ca1e759 | ||
|
|
5b3fadcc16 | ||
|
|
872a497464 | ||
|
|
e301702964 | ||
|
|
f7b734438d | ||
|
|
5792623df4 | ||
|
|
0edb275285 | ||
|
|
acc6a20d39 | ||
|
|
04cd037ba2 | ||
|
|
e1c5db988a | ||
|
|
b80142b901 | ||
|
|
54418f371b | ||
|
|
c92e78a9f8 | ||
|
|
d243b904cc | ||
|
|
374f8fb5fb | ||
|
|
dadbff5714 | ||
|
|
76ddae006f | ||
|
|
cfe157ec56 | ||
|
|
413115858c | ||
|
|
88046190ee | ||
|
|
72aa85a759 | ||
|
|
bfceebb7fb | ||
|
|
bc44fad352 | ||
|
|
4fca4dc60c | ||
|
|
036032373b | ||
|
|
89dfb43f3b | ||
|
|
c49aff4b6f | ||
|
|
56e60223c3 | ||
|
|
89b1f5aa1b | ||
|
|
b901598233 | ||
|
|
8cdc6a2885 | ||
|
|
a67e35aff9 | ||
|
|
f124e41ae6 | ||
|
|
4c954181cd | ||
|
|
7f7547737e | ||
|
|
a79d61ea85 | ||
|
|
d465b39c3e | ||
|
|
c5a609dc20 | ||
|
|
5634dc3d0d | ||
|
|
37e37b8cad | ||
|
|
8fd4534fbe | ||
|
|
d5427da52f |
16
.github/labeler.yml
vendored
16
.github/labeler.yml
vendored
@@ -15,11 +15,15 @@ c#:
|
|||||||
swift:
|
swift:
|
||||||
- '**/*.swift'
|
- '**/*.swift'
|
||||||
- swift/**/*
|
- swift/**/*
|
||||||
- tests/FlatBuffers.GRPC.Swift/**/*
|
- tests/swift/**
|
||||||
- tests/FlatBuffers.Benchmarks.swift/**/*
|
|
||||||
- tests/FlatBuffers.Test.Swift/**/*
|
|
||||||
- src/idl_gen_swift.cpp
|
- src/idl_gen_swift.cpp
|
||||||
|
|
||||||
|
nim:
|
||||||
|
- '**/*.nim'
|
||||||
|
- nim/**/*
|
||||||
|
- src/idl_gen_nim.cpp
|
||||||
|
- src/bfbs_gen_nim.cpp
|
||||||
|
|
||||||
javascript:
|
javascript:
|
||||||
- '**/*.js'
|
- '**/*.js'
|
||||||
- src/idl_gen_ts.cpp
|
- src/idl_gen_ts.cpp
|
||||||
@@ -63,7 +67,7 @@ rust:
|
|||||||
- '**/*.rs'
|
- '**/*.rs'
|
||||||
- rust/**/*
|
- rust/**/*
|
||||||
- src/idl_gen_rust.cpp
|
- src/idl_gen_rust.cpp
|
||||||
|
|
||||||
dart:
|
dart:
|
||||||
- '**/*.dart'
|
- '**/*.dart'
|
||||||
- src/idl_gen_dart.cpp
|
- src/idl_gen_dart.cpp
|
||||||
@@ -86,10 +90,8 @@ documentation:
|
|||||||
|
|
||||||
CI:
|
CI:
|
||||||
- '.github/**/*'
|
- '.github/**/*'
|
||||||
- '.travis/**/*'
|
|
||||||
- '.bazelci/**/*'
|
- '.bazelci/**/*'
|
||||||
- .travis.yml
|
|
||||||
|
|
||||||
grpc:
|
grpc:
|
||||||
- grpc/**/*
|
- grpc/**/*
|
||||||
- src/idl_gen_grpc.cpp
|
- src/idl_gen_grpc.cpp
|
||||||
|
|||||||
34
.github/workflows/build.yml
vendored
34
.github/workflows/build.yml
vendored
@@ -82,10 +82,14 @@ jobs:
|
|||||||
CXX=${{ matrix.cxx }} cmake -G "Unix Makefiles"
|
CXX=${{ matrix.cxx }} cmake -G "Unix Makefiles"
|
||||||
-DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_STRICT_MODE=ON
|
-DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_STRICT_MODE=ON
|
||||||
-DFLATBUFFERS_CPP_STD=${{ matrix.std }}
|
-DFLATBUFFERS_CPP_STD=${{ matrix.std }}
|
||||||
|
-DFLATBUFFERS_BUILD_CPP17=${{ matrix.std >= 17 && 'On' || 'Off'}}
|
||||||
- name: build
|
- name: build
|
||||||
run: make -j
|
run: make -j
|
||||||
- name: test
|
- name: test
|
||||||
run: ./flattests
|
run: ./flattests
|
||||||
|
- name: test C++17
|
||||||
|
if: matrix.std >= 17
|
||||||
|
run: ./flattests_cpp17
|
||||||
|
|
||||||
build-windows-cpp-std:
|
build-windows-cpp-std:
|
||||||
name: Build Windows C++
|
name: Build Windows C++
|
||||||
@@ -103,10 +107,14 @@ jobs:
|
|||||||
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release
|
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release
|
||||||
-DFLATBUFFERS_STRICT_MODE=ON
|
-DFLATBUFFERS_STRICT_MODE=ON
|
||||||
-DFLATBUFFERS_CPP_STD=${{ matrix.std }}
|
-DFLATBUFFERS_CPP_STD=${{ matrix.std }}
|
||||||
|
-DFLATBUFFERS_BUILD_CPP17=${{ matrix.std >= 17 && 'On' || 'Off'}}
|
||||||
- name: build
|
- name: build
|
||||||
run: msbuild.exe FlatBuffers.sln /p:Configuration=Release /p:Platform=x64
|
run: msbuild.exe FlatBuffers.sln /p:Configuration=Release /p:Platform=x64
|
||||||
- name: test
|
- name: test
|
||||||
run: Release\flattests.exe
|
run: Release\flattests.exe
|
||||||
|
- name: test C++17
|
||||||
|
if: matrix.std >= 17
|
||||||
|
run: Release\flattests_cpp17.exe
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
permissions:
|
permissions:
|
||||||
@@ -350,8 +358,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: test
|
- name: test
|
||||||
working-directory: tests
|
working-directory: java
|
||||||
run: bash JavaTest.sh
|
run: mvn test
|
||||||
|
|
||||||
build-kotlin-macos:
|
build-kotlin-macos:
|
||||||
name: Build Kotlin MacOS
|
name: Build Kotlin MacOS
|
||||||
@@ -422,7 +430,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: test
|
- name: test
|
||||||
working-directory: tests/FlatBuffers.Test.Swift
|
working-directory: tests/swift/tests
|
||||||
run: sh SwiftTest.sh
|
run: sh SwiftTest.sh
|
||||||
|
|
||||||
build-swift-wasm:
|
build-swift-wasm:
|
||||||
@@ -435,7 +443,7 @@ jobs:
|
|||||||
- name: Setup Wasmer
|
- name: Setup Wasmer
|
||||||
uses: wasmerio/setup-wasmer@v1
|
uses: wasmerio/setup-wasmer@v1
|
||||||
- name: Test
|
- name: Test
|
||||||
working-directory: tests/FlatBuffers.Test.Swift.Wasm
|
working-directory: tests/swift/Wasm.tests
|
||||||
run: carton test
|
run: carton test
|
||||||
|
|
||||||
build-ts:
|
build-ts:
|
||||||
@@ -451,7 +459,7 @@ jobs:
|
|||||||
- name: compile
|
- name: compile
|
||||||
run: yarn compile
|
run: yarn compile
|
||||||
- name: test
|
- name: test
|
||||||
working-directory: tests
|
working-directory: tests/ts
|
||||||
run: python3 TypeScriptTest.py
|
run: python3 TypeScriptTest.py
|
||||||
|
|
||||||
build-dart:
|
build-dart:
|
||||||
@@ -469,6 +477,22 @@ jobs:
|
|||||||
working-directory: tests
|
working-directory: tests
|
||||||
run: bash DartTest.sh
|
run: bash DartTest.sh
|
||||||
|
|
||||||
|
build-nim:
|
||||||
|
name: Build Nim
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: flatc
|
||||||
|
# FIXME: make test script not rely on flatc
|
||||||
|
run: cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_BUILD_TESTS=OFF -DFLATBUFFERS_INSTALL=OFF -DFLATBUFFERS_BUILD_FLATLIB=OFF -DFLATBUFFERS_BUILD_FLATHASH=OFF . && make -j
|
||||||
|
- uses: jiro4989/setup-nim-action@v1
|
||||||
|
- name: install library
|
||||||
|
working-directory: nim
|
||||||
|
run: nimble -y develop
|
||||||
|
- name: test
|
||||||
|
working-directory: tests/nim
|
||||||
|
run: python3 testnim.py
|
||||||
|
|
||||||
release-digests:
|
release-digests:
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
needs: [build-linux, build-windows, build-mac-intel, build-mac-universal]
|
needs: [build-linux, build-windows, build-mac-intel, build-mac-universal]
|
||||||
|
|||||||
54
.github/workflows/release.yml
vendored
Normal file
54
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
name: Release
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
on:
|
||||||
|
# For manual tests.
|
||||||
|
workflow_dispatch:
|
||||||
|
release:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-npm:
|
||||||
|
name: Publish NPM
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: '16.x'
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
- run: npm publish
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
|
publish-pypi:
|
||||||
|
name: Publish PyPi
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ./python
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.10'
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: |
|
||||||
|
python3 -m pip install --upgrade pip
|
||||||
|
python3 -m pip install setuptools wheel twine
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
python3 setup.py sdist bdist_wheel
|
||||||
|
|
||||||
|
- name: Upload to PyPi
|
||||||
|
run: |
|
||||||
|
python3 -m twine upload dist/*
|
||||||
|
env:
|
||||||
|
TWINE_USERNAME: __token__
|
||||||
|
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -78,7 +78,7 @@ tests/php/
|
|||||||
CMakeLists.txt.user
|
CMakeLists.txt.user
|
||||||
CMakeScripts/**
|
CMakeScripts/**
|
||||||
CTestTestfile.cmake
|
CTestTestfile.cmake
|
||||||
FlatBuffersConfigVersion.cmake
|
flatbuffers-config-version.cmake
|
||||||
FlatBuffers.cbp
|
FlatBuffers.cbp
|
||||||
build/Xcode/FlatBuffers.xcodeproj/project.xcworkspace/**
|
build/Xcode/FlatBuffers.xcodeproj/project.xcworkspace/**
|
||||||
build/Xcode/FlatBuffers.xcodeproj/xcuserdata/**
|
build/Xcode/FlatBuffers.xcodeproj/xcuserdata/**
|
||||||
@@ -88,6 +88,7 @@ java/*.iml
|
|||||||
.idea
|
.idea
|
||||||
*.iml
|
*.iml
|
||||||
target
|
target
|
||||||
|
java/target
|
||||||
**/*.pyc
|
**/*.pyc
|
||||||
build/VS2010/FlatBuffers.sdf
|
build/VS2010/FlatBuffers.sdf
|
||||||
build/VS2010/FlatBuffers.opensdf
|
build/VS2010/FlatBuffers.opensdf
|
||||||
@@ -148,4 +149,4 @@ flatbuffers.pc
|
|||||||
**/html/**
|
**/html/**
|
||||||
**/latex/**
|
**/latex/**
|
||||||
# https://cmake.org/cmake/help/latest/module/FetchContent.html#variable:FETCHCONTENT_BASE_DIR
|
# https://cmake.org/cmake/help/latest/module/FetchContent.html#variable:FETCHCONTENT_BASE_DIR
|
||||||
_deps/
|
_deps/
|
||||||
|
|||||||
215
.travis.yml
215
.travis.yml
@@ -1,215 +0,0 @@
|
|||||||
env:
|
|
||||||
global:
|
|
||||||
# Set at the root level as this is ignored when set under matrix.env.
|
|
||||||
- GCC_VERSION="4.9"
|
|
||||||
# Fail on first error if UBSAN or ASAN enabled for a target
|
|
||||||
- UBSAN_OPTIONS=halt_on_error=1
|
|
||||||
- ASAN_OPTIONS=halt_on_error=1
|
|
||||||
# Travis machines have 2 cores
|
|
||||||
- JOBS=2
|
|
||||||
- MAKEFLAGS="-j 2"
|
|
||||||
|
|
||||||
conan-linux: &conan-linux
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
language: python
|
|
||||||
python: "3.7"
|
|
||||||
services:
|
|
||||||
- docker
|
|
||||||
install:
|
|
||||||
- ./conan/travis/install.sh
|
|
||||||
script:
|
|
||||||
- ./conan/travis/build.sh
|
|
||||||
if: tag IS present
|
|
||||||
|
|
||||||
conan-linux-master: &conan-linux-master
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
language: python
|
|
||||||
python: "3.7"
|
|
||||||
services:
|
|
||||||
- docker
|
|
||||||
install:
|
|
||||||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./conan/travis/install.sh; fi'
|
|
||||||
script:
|
|
||||||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./conan/travis/build.sh; fi'
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
|
|
||||||
conan-osx: &conan-osx
|
|
||||||
os: osx
|
|
||||||
language: generic
|
|
||||||
install:
|
|
||||||
- ./conan/travis/install.sh
|
|
||||||
script:
|
|
||||||
- ./conan/travis/build.sh
|
|
||||||
if: tag IS present
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
#- language: python
|
|
||||||
# python: "2.7"
|
|
||||||
# install:
|
|
||||||
# - "pip install wheel twine"
|
|
||||||
# script:
|
|
||||||
# - "cd python/"
|
|
||||||
# - 'VERSION="$TRAVIS_TAG" python setup.py sdist bdist_wheel'
|
|
||||||
# - "cd ../"
|
|
||||||
# deploy:
|
|
||||||
# # Checkpointed release builds.
|
|
||||||
# - provider: script
|
|
||||||
# script: .travis/deploy-python.sh
|
|
||||||
# skip_cleanup: true
|
|
||||||
# on:
|
|
||||||
# tags: true
|
|
||||||
# # all_branches must be set with tags: true. See below post:
|
|
||||||
# # https://stackoverflow.com/a/27775257/1076585
|
|
||||||
# all_branches: true
|
|
||||||
# # Produce a new build for the cutting edge when master changes.
|
|
||||||
# - provider: script
|
|
||||||
# script: .travis/deploy-python.sh
|
|
||||||
# skip_cleanup: true
|
|
||||||
# on:
|
|
||||||
# branch: master
|
|
||||||
- language: cpp
|
|
||||||
os:
|
|
||||||
- linux
|
|
||||||
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- docker-ce
|
|
||||||
script:
|
|
||||||
- bash .travis/build-and-run-docker-test-containers.sh
|
|
||||||
|
|
||||||
- language: cpp
|
|
||||||
os:
|
|
||||||
- linux
|
|
||||||
|
|
||||||
compiler:
|
|
||||||
- gcc
|
|
||||||
|
|
||||||
env:
|
|
||||||
matrix:
|
|
||||||
- BUILD_TYPE=Debug
|
|
||||||
- BUILD_TYPE=Release
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq g++-$GCC_VERSION; fi
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq gcc-$GCC_VERSION; fi
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s -v -f $(which g++-$GCC_VERSION) /usr/bin/g++; fi
|
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s -v -f $(which gcc-$GCC_VERSION) /usr/bin/gcc; fi
|
|
||||||
|
|
||||||
script:
|
|
||||||
- pip install cmake
|
|
||||||
- bash .travis/check-sources.sh
|
|
||||||
- bash grpc/build_grpc.sh
|
|
||||||
- cmake .
|
|
||||||
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
|
||||||
-DFLATBUFFERS_BUILD_GRPCTEST=ON
|
|
||||||
-DGRPC_INSTALL_PATH=$TRAVIS_BUILD_DIR/google/grpc/install
|
|
||||||
-DPROTOBUF_DOWNLOAD_PATH=$TRAVIS_BUILD_DIR/google/grpc/third_party/protobuf
|
|
||||||
-DFLATBUFFERS_CODE_SANITIZE=ON
|
|
||||||
- cmake --build . --target all --clean-first -- -j${JOBS}
|
|
||||||
- LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/google/grpc/install/lib ctest --extra-verbose --output-on-failure
|
|
||||||
|
|
||||||
- language: cpp
|
|
||||||
os: osx
|
|
||||||
osx_image: xcode9.3
|
|
||||||
env:
|
|
||||||
matrix:
|
|
||||||
- BUILD_TYPE=Debug
|
|
||||||
- BUILD_TYPE=Release
|
|
||||||
|
|
||||||
script:
|
|
||||||
- pip install --user cmake
|
|
||||||
- mkdir ~/cmake_path
|
|
||||||
- ln -s $(find ~/Library/Python -name cmake -type f | head -n 1) ~/cmake_path/cmake
|
|
||||||
- ln -s $(find ~/Library/Python -name ctest -type f | head -n 1) ~/cmake_path/ctest
|
|
||||||
- export PATH=~/cmake_path:${PATH}
|
|
||||||
- bash grpc/build_grpc.sh
|
|
||||||
- cmake .
|
|
||||||
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
|
||||||
-DFLATBUFFERS_BUILD_GRPCTEST=ON
|
|
||||||
-DGRPC_INSTALL_PATH=$TRAVIS_BUILD_DIR/google/grpc/install
|
|
||||||
-DPROTOBUF_DOWNLOAD_PATH=$TRAVIS_BUILD_DIR/google/grpc/third_party/protobuf
|
|
||||||
-DFLATBUFFERS_CODE_SANITIZE=ON
|
|
||||||
- cmake --build . -- -j${JOBS}
|
|
||||||
- DYLD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/google/grpc/install/lib ctest --extra-verbose --output-on-failure
|
|
||||||
|
|
||||||
- <<: *conan-linux-master
|
|
||||||
env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/gcc8
|
|
||||||
- <<: *conan-linux
|
|
||||||
env: CONAN_GCC_VERSIONS=4.9 CONAN_DOCKER_IMAGE=conanio/gcc49
|
|
||||||
- <<: *conan-linux
|
|
||||||
env: CONAN_GCC_VERSIONS=5 CONAN_DOCKER_IMAGE=conanio/gcc5
|
|
||||||
- <<: *conan-linux
|
|
||||||
env: CONAN_GCC_VERSIONS=6 CONAN_DOCKER_IMAGE=conanio/gcc6
|
|
||||||
- <<: *conan-linux
|
|
||||||
env: CONAN_GCC_VERSIONS=7 CONAN_DOCKER_IMAGE=conanio/gcc7
|
|
||||||
- <<: *conan-linux
|
|
||||||
env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/gcc8
|
|
||||||
- <<: *conan-linux
|
|
||||||
env: CONAN_GCC_VERSIONS=9 CONAN_DOCKER_IMAGE=conanio/gcc9
|
|
||||||
- <<: *conan-linux
|
|
||||||
env: CONAN_CLANG_VERSIONS=3.9 CONAN_DOCKER_IMAGE=conanio/clang39
|
|
||||||
- <<: *conan-linux
|
|
||||||
env: CONAN_CLANG_VERSIONS=4.0 CONAN_DOCKER_IMAGE=conanio/clang40
|
|
||||||
- <<: *conan-linux
|
|
||||||
env: CONAN_CLANG_VERSIONS=5.0 CONAN_DOCKER_IMAGE=conanio/clang50
|
|
||||||
- <<: *conan-linux
|
|
||||||
env: CONAN_CLANG_VERSIONS=6.0 CONAN_DOCKER_IMAGE=conanio/clang60
|
|
||||||
- <<: *conan-linux
|
|
||||||
env: CONAN_CLANG_VERSIONS=7.0 CONAN_DOCKER_IMAGE=conanio/clang7
|
|
||||||
- <<: *conan-linux
|
|
||||||
env: CONAN_CLANG_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/clang8
|
|
||||||
- <<: *conan-osx
|
|
||||||
osx_image: xcode7.3
|
|
||||||
env: CONAN_APPLE_CLANG_VERSIONS=7.3
|
|
||||||
- <<: *conan-osx
|
|
||||||
osx_image: xcode8.3
|
|
||||||
env: CONAN_APPLE_CLANG_VERSIONS=8.1
|
|
||||||
- <<: *conan-osx
|
|
||||||
osx_image: xcode9
|
|
||||||
env: CONAN_APPLE_CLANG_VERSIONS=9.0
|
|
||||||
- <<: *conan-osx
|
|
||||||
osx_image: xcode9.4
|
|
||||||
env: CONAN_APPLE_CLANG_VERSIONS=9.1
|
|
||||||
- <<: *conan-osx
|
|
||||||
osx_image: xcode10.2
|
|
||||||
env: CONAN_APPLE_CLANG_VERSIONS=10.0
|
|
||||||
|
|
||||||
- language: android
|
|
||||||
sudo: true
|
|
||||||
dist: trusty
|
|
||||||
android:
|
|
||||||
components:
|
|
||||||
- tools
|
|
||||||
- platform-tools
|
|
||||||
- extra-android-m2repository
|
|
||||||
licenses:
|
|
||||||
- 'android-sdk-preview-license-52d11cd2'
|
|
||||||
- 'android-sdk-license-.+'
|
|
||||||
- 'google-gdk-license-.+'
|
|
||||||
compiler:
|
|
||||||
- gcc
|
|
||||||
before_install:
|
|
||||||
- echo y | sdkmanager "platforms;android-30"
|
|
||||||
- echo y | sdkmanager "build-tools;30.0.2"
|
|
||||||
- echo y | sdkmanager "ndk-bundle"
|
|
||||||
- echo y | sdkmanager "cmake;3.6.4111459"
|
|
||||||
script:
|
|
||||||
- cmake -DFLATBUFFERS_BUILD_TESTS=OFF -DFLATBUFFERS_BUILD_FLATLIB=OFF -DFLATBUFFERS_BUILD_FLATHASH=OFF .; make; export PATH="$PATH:${PWD}"
|
|
||||||
- cd android; ./gradlew clean build
|
|
||||||
|
|
||||||
- language: generic
|
|
||||||
if: type IN (pull_request)
|
|
||||||
os: linux
|
|
||||||
install:
|
|
||||||
- bash .travis/format_install.sh
|
|
||||||
|
|
||||||
script:
|
|
||||||
- bash .travis/format_check.sh
|
|
||||||
58
CHANGELOG.md
58
CHANGELOG.md
@@ -4,33 +4,63 @@ 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.10.25 (Oct 25 2002)
|
||||||
|
|
||||||
|
* Added Nim language support with generator and runtime libraries (#7534).
|
||||||
|
|
||||||
|
## 22.9.29 (Sept 29 2022)
|
||||||
|
|
||||||
|
* Rust soundness fixes to avoid the crate from bing labelled unsafe (#7518).
|
||||||
|
|
||||||
|
## 22.9.24 (Sept 24 2022)
|
||||||
|
|
||||||
|
* 20 Major releases in a row? Nope, we switched to a new
|
||||||
|
[versioning scheme](https://github.com/google/flatbuffers/wiki/Versioning)
|
||||||
|
that is based on date.
|
||||||
|
|
||||||
|
* Python supports fixed size arrays now (#7529).
|
||||||
|
|
||||||
|
* Behavior change in how C++ object API uses `UnPackTo`. The original intent of
|
||||||
|
this was to reduce allocations by reusing an existing object to pack data
|
||||||
|
into. At some point, this logic started to merge the states of the two objects
|
||||||
|
instead of clearing the state of the packee. This change goes back to the
|
||||||
|
original intention, the packed object is cleared when getting data packed into
|
||||||
|
it (#7527).
|
||||||
|
|
||||||
|
* Fixed a bug in C++ alignment that was using `sizeof()` instead of the intended
|
||||||
|
`AlignOf()` for structs (#7520).
|
||||||
|
|
||||||
|
* C# has an
|
||||||
|
[official Nuget package](https://www.nuget.org/packages/Google.FlatBuffers)
|
||||||
|
now (#7496).
|
||||||
|
|
||||||
## 2.0.8 (Aug 29 2022)
|
## 2.0.8 (Aug 29 2022)
|
||||||
|
|
||||||
* Fix for `--keep-prefix` the was generating the wrong include statements for
|
* Fix for `--keep-prefix` the was generating the wrong include statements for
|
||||||
C++ (#7469). The bug was introduced in 2.0.7.
|
C++ (#7469). The bug was introduced in 2.0.7.
|
||||||
|
|
||||||
* Added the `Verifier::Options` option struct to allow specifying runtime
|
* Added the `Verifier::Options` option struct to allow specifying runtime
|
||||||
configuration settings for the verifier (#7489). This allows to skip verifying
|
configuration settings for the verifier (#7489). This allows to skip verifying
|
||||||
nested flatbuffers, a on-by-default change that was introduced in 2.0.7. This
|
nested flatbuffers, a on-by-default change that was introduced in 2.0.7. This
|
||||||
deprecates the existing `Verifier` constructor, which may be removed in a future
|
deprecates the existing `Verifier` constructor, which may be removed in a
|
||||||
version.
|
future version.
|
||||||
|
|
||||||
* Refactor of `tests/test.cpp` that lead to ~10% speedup in compilation of the
|
* Refactor of `tests/test.cpp` that lead to ~10% speedup in compilation of the
|
||||||
entire project (#7487).
|
entire project (#7487).
|
||||||
|
|
||||||
## 2.0.7 (Aug 22 2022)
|
## 2.0.7 (Aug 22 2022)
|
||||||
|
|
||||||
* This is the first version with an explicit change log, so all the previous
|
* This is the first version with an explicit change log, so all the previous
|
||||||
features will not be listed.
|
features will not be listed.
|
||||||
|
|
||||||
* Verifier now checks that buffers are at least the minimum size required to be
|
* Verifier now checks that buffers are at least the minimum size required to be
|
||||||
a flatbuffers (12 bytes). This includes nested flatbuffers, which previously
|
a flatbuffers (12 bytes). This includes nested flatbuffers, which previously
|
||||||
could be declared valid at size 0.
|
could be declared valid at size 0.
|
||||||
|
|
||||||
* Annotated binaries. Given a flatbuffer binary and a schema (or binary schema)
|
* Annotated binaries. Given a flatbuffer binary and a schema (or binary schema)
|
||||||
one can generate an annotated flatbuffer (.afb) to describe each byte in the
|
one can generate an annotated flatbuffer (.afb) to describe each byte in the
|
||||||
binary with schema metadata and value.
|
binary with schema metadata and value.
|
||||||
|
|
||||||
* 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.
|
||||||
@@ -654,9 +654,9 @@ if(FLATBUFFERS_INSTALL)
|
|||||||
|
|
||||||
set(FB_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/flatbuffers")
|
set(FB_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/flatbuffers")
|
||||||
|
|
||||||
configure_file(CMake/FlatBuffersConfigVersion.cmake.in FlatBuffersConfigVersion.cmake @ONLY)
|
configure_file(CMake/flatbuffers-config-version.cmake.in flatbuffers-config-version.cmake @ONLY)
|
||||||
install(
|
install(
|
||||||
FILES "CMake/FlatBuffersConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/FlatBuffersConfigVersion.cmake"
|
FILES "CMake/flatbuffers-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-config-version.cmake"
|
||||||
DESTINATION ${FB_CMAKE_DIR}
|
DESTINATION ${FB_CMAKE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
set(VERSION_MAJOR 2)
|
set(VERSION_MAJOR 22)
|
||||||
set(VERSION_MINOR 0)
|
set(VERSION_MINOR 10)
|
||||||
set(VERSION_PATCH 8)
|
set(VERSION_PATCH 26)
|
||||||
set(VERSION_COMMIT 0)
|
set(VERSION_COMMIT 0)
|
||||||
|
|
||||||
find_program(GIT git)
|
find_program(GIT git)
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ set(FlatBuffers_Compiler_SRCS
|
|||||||
src/flatc_main.cpp
|
src/flatc_main.cpp
|
||||||
src/bfbs_gen.h
|
src/bfbs_gen.h
|
||||||
src/bfbs_gen_lua.h
|
src/bfbs_gen_lua.h
|
||||||
|
src/bfbs_gen_nim.h
|
||||||
src/bfbs_namer.h
|
src/bfbs_namer.h
|
||||||
include/flatbuffers/code_generators.h
|
include/flatbuffers/code_generators.h
|
||||||
src/binary_annotator.h
|
src/binary_annotator.h
|
||||||
@@ -189,6 +190,7 @@ set(FlatBuffers_Compiler_SRCS
|
|||||||
src/annotated_binary_text_gen.h
|
src/annotated_binary_text_gen.h
|
||||||
src/annotated_binary_text_gen.cpp
|
src/annotated_binary_text_gen.cpp
|
||||||
src/bfbs_gen_lua.cpp
|
src/bfbs_gen_lua.cpp
|
||||||
|
src/bfbs_gen_nim.cpp
|
||||||
src/code_generators.cpp
|
src/code_generators.cpp
|
||||||
grpc/src/compiler/schema_interface.h
|
grpc/src/compiler/schema_interface.h
|
||||||
grpc/src/compiler/cpp_generator.h
|
grpc/src/compiler/cpp_generator.h
|
||||||
@@ -230,6 +232,8 @@ set(FlatBuffers_Tests_SRCS
|
|||||||
tests/util_test.cpp
|
tests/util_test.cpp
|
||||||
tests/native_type_test_impl.h
|
tests/native_type_test_impl.h
|
||||||
tests/native_type_test_impl.cpp
|
tests/native_type_test_impl.cpp
|
||||||
|
tests/alignment_test.h
|
||||||
|
tests/alignment_test.cpp
|
||||||
include/flatbuffers/code_generators.h
|
include/flatbuffers/code_generators.h
|
||||||
src/code_generators.cpp
|
src/code_generators.cpp
|
||||||
# file generate by running compiler on tests/monster_test.fbs
|
# file generate by running compiler on tests/monster_test.fbs
|
||||||
@@ -251,6 +255,8 @@ set(FlatBuffers_Tests_SRCS
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}/tests/optional_scalars_generated.h
|
${CMAKE_CURRENT_BINARY_DIR}/tests/optional_scalars_generated.h
|
||||||
# file generate by running compiler on tests/native_inline_table_test.fbs
|
# file generate by running compiler on tests/native_inline_table_test.fbs
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/tests/native_inline_table_test_generated.h
|
${CMAKE_CURRENT_BINARY_DIR}/tests/native_inline_table_test_generated.h
|
||||||
|
# file generate by running compiler on tests/alignment_test.fbs
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/tests/alignment_test_generated.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(FlatBuffers_Tests_CPP17_SRCS
|
set(FlatBuffers_Tests_CPP17_SRCS
|
||||||
@@ -623,6 +629,7 @@ if(FLATBUFFERS_BUILD_TESTS)
|
|||||||
compile_flatbuffers_schema_to_binary(tests/arrays_test.fbs)
|
compile_flatbuffers_schema_to_binary(tests/arrays_test.fbs)
|
||||||
compile_flatbuffers_schema_to_embedded_binary(tests/monster_test.fbs "--no-includes;--gen-compare")
|
compile_flatbuffers_schema_to_embedded_binary(tests/monster_test.fbs "--no-includes;--gen-compare")
|
||||||
compile_flatbuffers_schema_to_cpp(tests/native_inline_table_test.fbs "--gen-compare")
|
compile_flatbuffers_schema_to_cpp(tests/native_inline_table_test.fbs "--gen-compare")
|
||||||
|
compile_flatbuffers_schema_to_cpp(tests/alignment_test.fbs "--gen-compare")
|
||||||
if(NOT (MSVC AND (MSVC_VERSION LESS 1900)))
|
if(NOT (MSVC AND (MSVC_VERSION LESS 1900)))
|
||||||
compile_flatbuffers_schema_to_cpp(tests/monster_extra.fbs) # Test floating-point NAN/INF.
|
compile_flatbuffers_schema_to_cpp(tests/monster_extra.fbs) # Test floating-point NAN/INF.
|
||||||
endif()
|
endif()
|
||||||
@@ -699,9 +706,12 @@ if(FLATBUFFERS_INSTALL)
|
|||||||
|
|
||||||
set(FB_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/flatbuffers")
|
set(FB_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/flatbuffers")
|
||||||
|
|
||||||
configure_file(CMake/FlatBuffersConfigVersion.cmake.in FlatBuffersConfigVersion.cmake @ONLY)
|
configure_file(CMake/flatbuffers-config-version.cmake.in flatbuffers-config-version.cmake @ONLY)
|
||||||
install(
|
install(
|
||||||
FILES "CMake/FlatBuffersConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/FlatBuffersConfigVersion.cmake"
|
FILES
|
||||||
|
"CMake/flatbuffers-config.cmake"
|
||||||
|
"CMake/BuildFlatBuffers.cmake"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/flatbuffers-config-version.cmake"
|
||||||
DESTINATION ${FB_CMAKE_DIR}
|
DESTINATION ${FB_CMAKE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = 'FlatBuffers'
|
s.name = 'FlatBuffers'
|
||||||
s.version = '2.0.0'
|
s.version = '22.10.26'
|
||||||
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
|
||||||
@@ -11,11 +11,11 @@ Pod::Spec.new do |s|
|
|||||||
s.homepage = 'https://github.com/google/flatbuffers'
|
s.homepage = 'https://github.com/google/flatbuffers'
|
||||||
s.license = { :type => 'Apache2.0', :file => 'LICENSE' }
|
s.license = { :type => 'Apache2.0', :file => 'LICENSE' }
|
||||||
s.author = { 'mustii' => 'mustii@mmk.one' }
|
s.author = { 'mustii' => 'mustii@mmk.one' }
|
||||||
s.source = { :git => 'https://github.com/mustiikhalil/flatbuffers.git', :tag => s.version.to_s, :submodules => true }
|
s.source = { :git => 'https://github.com/google/flatbuffers.git', :tag => s.version.to_s, :submodules => true }
|
||||||
|
|
||||||
s.ios.deployment_target = '11.0'
|
s.ios.deployment_target = '11.0'
|
||||||
s.osx.deployment_target = '10.14'
|
s.osx.deployment_target = '10.14'
|
||||||
|
|
||||||
s.swift_version = '5.0'
|
s.swift_version = '5.0'
|
||||||
s.source_files = 'Sources/**/*'
|
s.source_files = 'swift/Sources/Flatbuffers/*.swift'
|
||||||
end
|
end
|
||||||
@@ -32,5 +32,6 @@ let package = Package(
|
|||||||
.target(
|
.target(
|
||||||
name: "FlatBuffers",
|
name: "FlatBuffers",
|
||||||
dependencies: [],
|
dependencies: [],
|
||||||
|
path: "swift/Sources",
|
||||||
exclude: ["Documentation.docc/Resources/code/swift"]),
|
exclude: ["Documentation.docc/Resources/code/swift"]),
|
||||||
])
|
])
|
||||||
@@ -31,6 +31,7 @@ let package = Package(
|
|||||||
targets: [
|
targets: [
|
||||||
.target(
|
.target(
|
||||||
name: "FlatBuffers",
|
name: "FlatBuffers",
|
||||||
dependencies: []),
|
dependencies: [],
|
||||||
|
path: "swift/Sources")
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -56,10 +56,13 @@ http_archive(
|
|||||||
)
|
)
|
||||||
|
|
||||||
##### GRPC
|
##### GRPC
|
||||||
_GRPC_VERSION = "1.48.0" # https://github.com/grpc/grpc/releases/tag/v1.48.0
|
_GRPC_VERSION = "1.49.0" # https://github.com/grpc/grpc/releases/tag/v1.48.0
|
||||||
|
|
||||||
http_archive(
|
http_archive(
|
||||||
name = "com_github_grpc_grpc",
|
name = "com_github_grpc_grpc",
|
||||||
|
patch_args = ["-p1"],
|
||||||
|
patches = ["//grpc:build_grpc_with_cxx14.patch"],
|
||||||
|
sha256 = "15715e1847cc9e42014f02c727dbcb48e39dbdb90f79ad3d66fe4361709ff935",
|
||||||
strip_prefix = "grpc-" + _GRPC_VERSION,
|
strip_prefix = "grpc-" + _GRPC_VERSION,
|
||||||
urls = ["https://github.com/grpc/grpc/archive/refs/tags/v" + _GRPC_VERSION + ".tar.gz"],
|
urls = ["https://github.com/grpc/grpc/archive/refs/tags/v" + _GRPC_VERSION + ".tar.gz"],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
<uses-feature android:glEsVersion="0x00020000"></uses-feature>
|
<uses-feature android:glEsVersion="0x00020000"></uses-feature>
|
||||||
|
|
||||||
<!-- This .apk has no Java code itself, so set hasCode to false. -->
|
<!-- This .apk has no Java code itself, so set hasCode to false. -->
|
||||||
<application android:label="@string/app_name"
|
<application android:name="android.support.multidex.MultiDexApplication"
|
||||||
|
android:label="@string/app_name"
|
||||||
android:hasCode="false"
|
android:hasCode="false"
|
||||||
android:allowBackup="false">
|
android:allowBackup="false">
|
||||||
<!-- Our activity is the built-in NativeActivity framework class.
|
<!-- Our activity is the built-in NativeActivity framework class.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.flatbuffers.app"
|
applicationId "com.flatbuffers.app"
|
||||||
minSdkVersion 16
|
minSdkVersion 26
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
@@ -18,6 +18,14 @@ android {
|
|||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java {
|
||||||
|
srcDir '../../java/src/main/java/'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters 'arm64-v8a', 'armeabi-v7a'
|
abiFilters 'arm64-v8a', 'armeabi-v7a'
|
||||||
}
|
}
|
||||||
@@ -105,30 +113,6 @@ android {
|
|||||||
dependsOn(generateFbsCpp)
|
dependsOn(generateFbsCpp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// flavorDimensions "stl-variant"
|
|
||||||
// productFlavors {
|
|
||||||
// gnustl {
|
|
||||||
// dimension "stl-variant"
|
|
||||||
// applicationIdSuffix ".gnustl"
|
|
||||||
// versionNameSuffix "-gnustl"
|
|
||||||
// externalNativeBuild {
|
|
||||||
// ndkBuild {
|
|
||||||
// arguments "APP_STL=gnustl_static"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// libcpp {
|
|
||||||
// dimension "stl-variant"
|
|
||||||
// applicationIdSuffix ".libcpp"
|
|
||||||
// versionNameSuffix "-libcpp"
|
|
||||||
// externalNativeBuild {
|
|
||||||
// ndkBuild {
|
|
||||||
// arguments "APP_STL=c++_static"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -136,6 +120,8 @@ dependencies {
|
|||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
implementation 'androidx.core:core-ktx:1.3.2'
|
implementation 'androidx.core:core-ktx:1.3.2'
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
implementation 'com.google.flatbuffers:flatbuffers-java:2.0.0'
|
|
||||||
|
// If you using java runtime you can add its dependency as the example below
|
||||||
|
// implementation 'com.google.flatbuffers:flatbuffers-java:$latest_version'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,13 @@
|
|||||||
|
|
||||||
#include "flatbuffers/flatbuffers.h"
|
#include "flatbuffers/flatbuffers.h"
|
||||||
|
|
||||||
|
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||||
|
// generated, otherwise it may not be compatible.
|
||||||
|
static_assert(FLATBUFFERS_VERSION_MAJOR == 2 &&
|
||||||
|
FLATBUFFERS_VERSION_MINOR == 0 &&
|
||||||
|
FLATBUFFERS_VERSION_REVISION == 8,
|
||||||
|
"Non-compatible flatbuffers version included");
|
||||||
|
|
||||||
namespace com {
|
namespace com {
|
||||||
namespace fbs {
|
namespace fbs {
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|||||||
@@ -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_2_0_0()
|
fun validateVersion() = Constants.FLATBUFFERS_22_10_26()
|
||||||
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)
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import os
|
|
||||||
|
|
||||||
if os.getenv("APPVEYOR_REPO_TAG") != "true":
|
|
||||||
print("Skip build step. It's not TAG")
|
|
||||||
else:
|
|
||||||
os.system("python conan/build.py")
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import os
|
|
||||||
|
|
||||||
if os.getenv("APPVEYOR_REPO_TAG") != "true":
|
|
||||||
print("Skip step. It's not TAG")
|
|
||||||
else:
|
|
||||||
os.system("pip install conan conan-package-tools")
|
|
||||||
@@ -21,14 +21,6 @@ def get_branch():
|
|||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
version = get_branch()
|
version = get_branch()
|
||||||
if os.getenv("TRAVIS", False):
|
|
||||||
version = os.getenv("TRAVIS_BRANCH")
|
|
||||||
|
|
||||||
if os.getenv("APPVEYOR", False):
|
|
||||||
version = os.getenv("APPVEYOR_REPO_BRANCH")
|
|
||||||
if os.getenv("APPVEYOR_REPO_TAG") == "true":
|
|
||||||
version = os.getenv("APPVEYOR_REPO_TAG_NAME")
|
|
||||||
|
|
||||||
match = re.search(r"v(\d+\.\d+\.\d+.*)", version)
|
match = re.search(r"v(\d+\.\d+\.\d+.*)", version)
|
||||||
if match:
|
if match:
|
||||||
return match.group(1)
|
return match.group(1)
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
set -x
|
|
||||||
|
|
||||||
if [[ "$(uname -s)" == 'Darwin' ]]; then
|
|
||||||
if which pyenv > /dev/null; then
|
|
||||||
eval "$(pyenv init -)"
|
|
||||||
fi
|
|
||||||
pyenv activate conan
|
|
||||||
fi
|
|
||||||
|
|
||||||
conan user
|
|
||||||
python conan/build.py
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
set -x
|
|
||||||
|
|
||||||
if [[ "$(uname -s)" == 'Darwin' ]]; then
|
|
||||||
brew update || brew update
|
|
||||||
brew outdated pyenv || brew upgrade pyenv
|
|
||||||
brew install pyenv-virtualenv
|
|
||||||
brew install cmake || true
|
|
||||||
|
|
||||||
if which pyenv > /dev/null; then
|
|
||||||
eval "$(pyenv init -)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
pyenv install 2.7.10
|
|
||||||
pyenv virtualenv 2.7.10 conan
|
|
||||||
pyenv rehash
|
|
||||||
pyenv activate conan
|
|
||||||
fi
|
|
||||||
|
|
||||||
pip install -U conan_package_tools conan
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
name: flat_buffers
|
name: flat_buffers
|
||||||
version: 2.0.8
|
version: 22.10.26
|
||||||
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
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ include = `include` string\_constant `;`
|
|||||||
|
|
||||||
namespace\_decl = `namespace` ident ( `.` ident )* `;`
|
namespace\_decl = `namespace` ident ( `.` ident )* `;`
|
||||||
|
|
||||||
attribute\_decl = `attribute` ident | `"`ident`"` `;`
|
attribute\_decl = `attribute` ident | `"` ident `"` `;`
|
||||||
|
|
||||||
type\_decl = ( `table` | `struct` ) ident metadata `{` field\_decl+ `}`
|
type\_decl = ( `table` | `struct` ) ident metadata `{` field\_decl+ `}`
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ type = `bool` | `byte` | `ubyte` | `short` | `ushort` | `int` | `uint` |
|
|||||||
`float32` | `float64` |
|
`float32` | `float64` |
|
||||||
`string` | `[` type `]` | ident
|
`string` | `[` type `]` | ident
|
||||||
|
|
||||||
enumval\_decl = ident [ `=` integer\_constant ]
|
enumval\_decl = ident [ `=` integer\_constant ] metadata
|
||||||
|
|
||||||
metadata = [ `(` commasep( ident [ `:` single\_value ] ) `)` ]
|
metadata = [ `(` commasep( ident [ `:` single\_value ] ) `)` ]
|
||||||
|
|
||||||
|
|||||||
@@ -309,11 +309,11 @@ in the corresponding C++ code. Multiple such lines per item are allowed.
|
|||||||
|
|
||||||
### Attributes
|
### Attributes
|
||||||
|
|
||||||
Attributes may be attached to a declaration, behind a field, or after
|
Attributes may be attached to a declaration, behind a field/enum value,
|
||||||
the name of a table/struct/enum/union. These may either have a value or
|
or after the name of a table/struct/enum/union. These may either have
|
||||||
not. Some attributes like `deprecated` are understood by the compiler;
|
a value or not. Some attributes like `deprecated` are understood by
|
||||||
user defined ones need to be declared with the attribute declaration
|
the compiler; user defined ones need to be declared with the attribute
|
||||||
(like `priority` in the example above), and are
|
declaration (like `priority` in the example above), and are
|
||||||
available to query if you parse the schema at runtime.
|
available to query if you parse the schema at runtime.
|
||||||
This is useful if you write your own code generators/editors etc., and
|
This is useful if you write your own code generators/editors etc., and
|
||||||
you wish to add additional information specific to your tool (such as a
|
you wish to add additional information specific to your tool (such as a
|
||||||
@@ -552,7 +552,7 @@ the world. If this is not practical for you, use explicit field ids, which
|
|||||||
should always generate a merge conflict if two people try to allocate the same
|
should always generate a merge conflict if two people try to allocate the same
|
||||||
id.
|
id.
|
||||||
|
|
||||||
### Schema evolution examples
|
### Schema evolution examples (tables)
|
||||||
|
|
||||||
Some examples to clarify what happens as you change a schema:
|
Some examples to clarify what happens as you change a schema:
|
||||||
|
|
||||||
@@ -614,6 +614,41 @@ Occasionally ok. You've renamed fields, which will break all code (and JSON
|
|||||||
files!) that use this schema, but as long as the change is obvious, this is not
|
files!) that use this schema, but as long as the change is obvious, this is not
|
||||||
incompatible with the actual binary buffers, since those only ever address
|
incompatible with the actual binary buffers, since those only ever address
|
||||||
fields by id/offset.
|
fields by id/offset.
|
||||||
|
|
||||||
|
#### Schema evolution examples (unions)
|
||||||
|
|
||||||
|
Suppose we have the following schema:
|
||||||
|
```
|
||||||
|
union Foo { A, B }
|
||||||
|
```
|
||||||
|
We can add another variant at the end.
|
||||||
|
```
|
||||||
|
union Foo { A, B, another_a: A }
|
||||||
|
```
|
||||||
|
and this will be okay. Old code will not recognize `another_a`.
|
||||||
|
However if we add `another_a` anywhere but the end, e.g.
|
||||||
|
```
|
||||||
|
union Foo { A, another_a: A, B }
|
||||||
|
```
|
||||||
|
this is not okay. When new code writes `another_a`, old code will
|
||||||
|
misinterpret it as `B` (and vice versa). However you can explicitly
|
||||||
|
set the union's "discriminant" value like so:
|
||||||
|
```
|
||||||
|
union Foo { A = 1, another_a: A = 3, B = 2 }
|
||||||
|
```
|
||||||
|
This is okay.
|
||||||
|
|
||||||
|
```
|
||||||
|
union Foo { original_a: A = 1, another_a: A = 3, B = 2 }
|
||||||
|
```
|
||||||
|
Renaming fields will break code and any saved human readable representations,
|
||||||
|
such as json files, but the binary buffers will be the same.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
### Testing whether a field is present in a table
|
### Testing whether a field is present in a table
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ GitHub page](https://github.com/google/flatbuffers/tree/master/swift).
|
|||||||
|
|
||||||
## Testing the FlatBuffers Swift library
|
## Testing the FlatBuffers Swift library
|
||||||
|
|
||||||
The code to test the Swift library can be found at `flatbuffers/Flatbuffers.Test.Swift`.
|
The code to test the Swift library can be found at `flatbuffers/tests/swift/tests`.
|
||||||
The test code itself is located in [Flatbuffers.Test.Swift](https://github.com/google/flatbuffers/blob/master/tests/FlatBuffers.Test.Swift).
|
The test code itself is located in [flatbuffers/tests/swift/tests](https://github.com/google/flatbuffers/blob/master/tests/swift/tests).
|
||||||
|
|
||||||
To run the tests, use the [SwiftTest.sh](https://github.com/google/flatbuffers/blob/master/tests/FlatBuffers.Test.Swift/SwiftTest.sh) shell script.
|
To run the tests, use the [SwiftTest.sh](https://github.com/google/flatbuffers/blob/master/tests/swift/tests/SwiftTest.sh) shell script.
|
||||||
|
|
||||||
*Note: The shell script requires [Swift](https://swift.org) to
|
*Note: The shell script requires [Swift](https://swift.org) to
|
||||||
be installed.*
|
be installed.*
|
||||||
|
|||||||
10
grpc/build_grpc_with_cxx14.patch
Normal file
10
grpc/build_grpc_with_cxx14.patch
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
diff --git a/bazel/copts.bzl b/bazel/copts.bzl
|
||||||
|
index 10be944f25..879518b92f 100644
|
||||||
|
--- a/bazel/copts.bzl
|
||||||
|
+++ b/bazel/copts.bzl
|
||||||
|
@@ -59,4 +59,4 @@ GRPC_LLVM_WARNING_FLAGS = [
|
||||||
|
GRPC_DEFAULT_COPTS = select({
|
||||||
|
"//:use_strict_warning": GRPC_LLVM_WARNING_FLAGS + ["-DUSE_STRICT_WARNING=1"],
|
||||||
|
"//conditions:default": [],
|
||||||
|
-})
|
||||||
|
+}) + ["-std=c++14"]
|
||||||
@@ -6,7 +6,7 @@ import FlatBuffers
|
|||||||
|
|
||||||
public struct models_HelloReply: FlatBufferObject, Verifiable {
|
public struct models_HelloReply: FlatBufferObject, Verifiable {
|
||||||
|
|
||||||
static func validateVersion() { FlatBuffersVersion_2_0_8() }
|
static func validateVersion() { FlatBuffersVersion_22_10_26() }
|
||||||
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_2_0_8() }
|
static func validateVersion() { FlatBuffersVersion_22_10_26() }
|
||||||
public var __buffer: ByteBuffer! { return _accessor.bb }
|
public var __buffer: ByteBuffer! { return _accessor.bb }
|
||||||
private var _accessor: Table
|
private var _accessor: Table
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// automatically generated by the FlatBuffers compiler, do not modify
|
// automatically generated by the FlatBuffers compiler, do not modify
|
||||||
|
|
||||||
export { HelloReply } from './models/hello-reply';
|
export { HelloReply } from './models/hello-reply.js';
|
||||||
export { HelloRequest } from './models/hello-request';
|
export { HelloRequest } from './models/hello-request.js';
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ template<typename T, uint16_t length> class Array {
|
|||||||
public:
|
public:
|
||||||
typedef uint16_t size_type;
|
typedef uint16_t size_type;
|
||||||
typedef typename IndirectHelper<IndirectHelperType>::return_type return_type;
|
typedef typename IndirectHelper<IndirectHelperType>::return_type return_type;
|
||||||
typedef VectorIterator<T, return_type> const_iterator;
|
typedef VectorConstIterator<T, return_type> const_iterator;
|
||||||
typedef VectorReverseIterator<const_iterator> const_reverse_iterator;
|
typedef VectorReverseIterator<const_iterator> const_reverse_iterator;
|
||||||
|
|
||||||
// If T is a LE-scalar or a struct (!scalar_tag::value).
|
// If T is a LE-scalar or a struct (!scalar_tag::value).
|
||||||
|
|||||||
@@ -138,9 +138,9 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif // !defined(FLATBUFFERS_LITTLEENDIAN)
|
#endif // !defined(FLATBUFFERS_LITTLEENDIAN)
|
||||||
|
|
||||||
#define FLATBUFFERS_VERSION_MAJOR 2
|
#define FLATBUFFERS_VERSION_MAJOR 22
|
||||||
#define FLATBUFFERS_VERSION_MINOR 0
|
#define FLATBUFFERS_VERSION_MINOR 10
|
||||||
#define FLATBUFFERS_VERSION_REVISION 8
|
#define FLATBUFFERS_VERSION_REVISION 26
|
||||||
#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 {
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ template<typename T> struct IndirectHelper {
|
|||||||
static return_type Read(const uint8_t *p, uoffset_t i) {
|
static return_type Read(const uint8_t *p, uoffset_t i) {
|
||||||
return EndianScalar((reinterpret_cast<const T *>(p))[i]);
|
return EndianScalar((reinterpret_cast<const T *>(p))[i]);
|
||||||
}
|
}
|
||||||
|
static return_type Read(uint8_t *p, uoffset_t i) {
|
||||||
|
return Read(const_cast<const uint8_t *>(p), i);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
template<typename T> struct IndirectHelper<Offset<T>> {
|
template<typename T> struct IndirectHelper<Offset<T>> {
|
||||||
typedef const T *return_type;
|
typedef const T *return_type;
|
||||||
@@ -85,13 +88,20 @@ template<typename T> struct IndirectHelper<Offset<T>> {
|
|||||||
p += i * sizeof(uoffset_t);
|
p += i * sizeof(uoffset_t);
|
||||||
return reinterpret_cast<return_type>(p + ReadScalar<uoffset_t>(p));
|
return reinterpret_cast<return_type>(p + ReadScalar<uoffset_t>(p));
|
||||||
}
|
}
|
||||||
|
static mutable_return_type Read(uint8_t *p, uoffset_t i) {
|
||||||
|
p += i * sizeof(uoffset_t);
|
||||||
|
return reinterpret_cast<mutable_return_type>(p + ReadScalar<uoffset_t>(p));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
template<typename T> struct IndirectHelper<const T *> {
|
template<typename T> struct IndirectHelper<const T *> {
|
||||||
typedef const T *return_type;
|
typedef const T *return_type;
|
||||||
typedef T *mutable_return_type;
|
typedef T *mutable_return_type;
|
||||||
static const size_t element_stride = sizeof(T);
|
static const size_t element_stride = sizeof(T);
|
||||||
static return_type Read(const uint8_t *p, uoffset_t i) {
|
static return_type Read(const uint8_t *p, uoffset_t i) {
|
||||||
return reinterpret_cast<const T *>(p + i * sizeof(T));
|
return reinterpret_cast<return_type>(p + i * sizeof(T));
|
||||||
|
}
|
||||||
|
static mutable_return_type Read(uint8_t *p, uoffset_t i) {
|
||||||
|
return reinterpret_cast<mutable_return_type>(p + i * sizeof(T));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -449,7 +449,7 @@ class FlatBufferBuilder {
|
|||||||
}
|
}
|
||||||
template<typename T> void PreAlign(size_t len) {
|
template<typename T> void PreAlign(size_t len) {
|
||||||
AssertScalarT<T>();
|
AssertScalarT<T>();
|
||||||
PreAlign(len, sizeof(T));
|
PreAlign(len, AlignOf<T>());
|
||||||
}
|
}
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
||||||
@@ -589,11 +589,15 @@ class FlatBufferBuilder {
|
|||||||
return PushElement(static_cast<uoffset_t>(len));
|
return PushElement(static_cast<uoffset_t>(len));
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartVector(size_t len, size_t elemsize) {
|
void StartVector(size_t len, size_t elemsize, size_t alignment) {
|
||||||
NotNested();
|
NotNested();
|
||||||
nested = true;
|
nested = true;
|
||||||
PreAlign<uoffset_t>(len * elemsize);
|
PreAlign<uoffset_t>(len * elemsize);
|
||||||
PreAlign(len * elemsize, elemsize); // Just in case elemsize > uoffset_t.
|
PreAlign(len * elemsize, alignment); // Just in case elemsize > uoffset_t.
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T> void StartVector(size_t len) {
|
||||||
|
return StartVector(len, sizeof(T), AlignOf<T>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call this right before StartVector/CreateVector if you want to force the
|
// Call this right before StartVector/CreateVector if you want to force the
|
||||||
@@ -627,7 +631,7 @@ class FlatBufferBuilder {
|
|||||||
// If this assert hits, you're specifying a template argument that is
|
// If this assert hits, you're specifying a template argument that is
|
||||||
// causing the wrong overload to be selected, remove it.
|
// causing the wrong overload to be selected, remove it.
|
||||||
AssertScalarT<T>();
|
AssertScalarT<T>();
|
||||||
StartVector(len, sizeof(T));
|
StartVector<T>(len);
|
||||||
if (len == 0) { return Offset<Vector<T>>(EndVector(len)); }
|
if (len == 0) { return Offset<Vector<T>>(EndVector(len)); }
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#if FLATBUFFERS_LITTLEENDIAN
|
#if FLATBUFFERS_LITTLEENDIAN
|
||||||
@@ -668,7 +672,7 @@ class FlatBufferBuilder {
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Offset<Vector<Offset<T>>> CreateVector(const Offset<T> *v, size_t len) {
|
Offset<Vector<Offset<T>>> CreateVector(const Offset<T> *v, size_t len) {
|
||||||
StartVector(len, sizeof(Offset<T>));
|
StartVector<Offset<T>>(len);
|
||||||
for (auto i = len; i > 0;) { PushElement(v[--i]); }
|
for (auto i = len; i > 0;) { PushElement(v[--i]); }
|
||||||
return Offset<Vector<Offset<T>>>(EndVector(len));
|
return Offset<Vector<Offset<T>>>(EndVector(len));
|
||||||
}
|
}
|
||||||
@@ -688,7 +692,7 @@ class FlatBufferBuilder {
|
|||||||
// an array. Instead, read elements manually.
|
// an array. Instead, read elements manually.
|
||||||
// Background: https://isocpp.org/blog/2012/11/on-vectorbool
|
// Background: https://isocpp.org/blog/2012/11/on-vectorbool
|
||||||
Offset<Vector<uint8_t>> CreateVector(const std::vector<bool> &v) {
|
Offset<Vector<uint8_t>> CreateVector(const std::vector<bool> &v) {
|
||||||
StartVector(v.size(), sizeof(uint8_t));
|
StartVector<uint8_t>(v.size());
|
||||||
for (auto i = v.size(); i > 0;) {
|
for (auto i = v.size(); i > 0;) {
|
||||||
PushElement(static_cast<uint8_t>(v[--i]));
|
PushElement(static_cast<uint8_t>(v[--i]));
|
||||||
}
|
}
|
||||||
@@ -762,7 +766,7 @@ class FlatBufferBuilder {
|
|||||||
for (auto it = begin; it != end; ++it) {
|
for (auto it = begin; it != end; ++it) {
|
||||||
buf_.scratch_push_small(CreateString(*it));
|
buf_.scratch_push_small(CreateString(*it));
|
||||||
}
|
}
|
||||||
StartVector(size, sizeof(Offset<String>));
|
StartVector<Offset<String>>(size);
|
||||||
for (auto i = 1; i <= size; i++) {
|
for (auto i = 1; i <= size; i++) {
|
||||||
// Note we re-evaluate the buf location each iteration to account for any
|
// Note we re-evaluate the buf location each iteration to account for any
|
||||||
// underlying buffer resizing that may occur.
|
// underlying buffer resizing that may occur.
|
||||||
@@ -782,7 +786,7 @@ class FlatBufferBuilder {
|
|||||||
/// where the vector is stored.
|
/// where the vector is stored.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Offset<Vector<const T *>> CreateVectorOfStructs(const T *v, size_t len) {
|
Offset<Vector<const T *>> CreateVectorOfStructs(const T *v, size_t len) {
|
||||||
StartVector(len * sizeof(T) / AlignOf<T>(), AlignOf<T>());
|
StartVector(len * sizeof(T) / AlignOf<T>(), sizeof(T), AlignOf<T>());
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
PushBytes(reinterpret_cast<const uint8_t *>(v), sizeof(T) * len);
|
PushBytes(reinterpret_cast<const uint8_t *>(v), sizeof(T) * len);
|
||||||
}
|
}
|
||||||
@@ -1025,9 +1029,9 @@ class FlatBufferBuilder {
|
|||||||
/// written to at a later time to serialize the data into a `vector`
|
/// written to at a later time to serialize the data into a `vector`
|
||||||
/// in the buffer.
|
/// in the buffer.
|
||||||
uoffset_t CreateUninitializedVector(size_t len, size_t elemsize,
|
uoffset_t CreateUninitializedVector(size_t len, size_t elemsize,
|
||||||
uint8_t **buf) {
|
size_t alignment, uint8_t **buf) {
|
||||||
NotNested();
|
NotNested();
|
||||||
StartVector(len, elemsize);
|
StartVector(len, elemsize, alignment);
|
||||||
buf_.make_space(len * elemsize);
|
buf_.make_space(len * elemsize);
|
||||||
auto vec_start = GetSize();
|
auto vec_start = GetSize();
|
||||||
auto vec_end = EndVector(len);
|
auto vec_end = EndVector(len);
|
||||||
@@ -1035,6 +1039,12 @@ class FlatBufferBuilder {
|
|||||||
return vec_end;
|
return vec_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FLATBUFFERS_ATTRIBUTE([[deprecated("call the version above instead")]])
|
||||||
|
uoffset_t CreateUninitializedVector(size_t len, size_t elemsize,
|
||||||
|
uint8_t **buf) {
|
||||||
|
return CreateUninitializedVector(len, elemsize, elemsize, buf);
|
||||||
|
}
|
||||||
|
|
||||||
/// @brief Specialized version of `CreateVector` for non-copying use cases.
|
/// @brief Specialized version of `CreateVector` for non-copying use cases.
|
||||||
/// Write the data any time later to the returned buffer pointer `buf`.
|
/// Write the data any time later to the returned buffer pointer `buf`.
|
||||||
/// @tparam T The data type of the data that will be stored in the buffer
|
/// @tparam T The data type of the data that will be stored in the buffer
|
||||||
@@ -1046,14 +1056,14 @@ class FlatBufferBuilder {
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
Offset<Vector<T>> CreateUninitializedVector(size_t len, T **buf) {
|
Offset<Vector<T>> CreateUninitializedVector(size_t len, T **buf) {
|
||||||
AssertScalarT<T>();
|
AssertScalarT<T>();
|
||||||
return CreateUninitializedVector(len, sizeof(T),
|
return CreateUninitializedVector(len, sizeof(T), AlignOf<T>(),
|
||||||
reinterpret_cast<uint8_t **>(buf));
|
reinterpret_cast<uint8_t **>(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Offset<Vector<const T *>> CreateUninitializedVectorOfStructs(size_t len,
|
Offset<Vector<const T *>> CreateUninitializedVectorOfStructs(size_t len,
|
||||||
T **buf) {
|
T **buf) {
|
||||||
return CreateUninitializedVector(len, sizeof(T),
|
return CreateUninitializedVector(len, sizeof(T), AlignOf<T>(),
|
||||||
reinterpret_cast<uint8_t **>(buf));
|
reinterpret_cast<uint8_t **>(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1064,7 +1074,7 @@ class FlatBufferBuilder {
|
|||||||
Offset<Vector<T>> CreateVectorScalarCast(const U *v, size_t len) {
|
Offset<Vector<T>> CreateVectorScalarCast(const U *v, size_t len) {
|
||||||
AssertScalarT<T>();
|
AssertScalarT<T>();
|
||||||
AssertScalarT<U>();
|
AssertScalarT<U>();
|
||||||
StartVector(len, sizeof(T));
|
StartVector<T>(len);
|
||||||
for (auto i = len; i > 0;) { PushElement(static_cast<T>(v[--i])); }
|
for (auto i = len; i > 0;) { PushElement(static_cast<T>(v[--i])); }
|
||||||
return Offset<Vector<T>>(EndVector(len));
|
return Offset<Vector<T>>(EndVector(len));
|
||||||
}
|
}
|
||||||
@@ -1173,7 +1183,7 @@ class FlatBufferBuilder {
|
|||||||
// Allocates space for a vector of structures.
|
// Allocates space for a vector of structures.
|
||||||
// Must be completed with EndVectorOfStructs().
|
// Must be completed with EndVectorOfStructs().
|
||||||
template<typename T> T *StartVectorOfStructs(size_t vector_size) {
|
template<typename T> T *StartVectorOfStructs(size_t vector_size) {
|
||||||
StartVector(vector_size * sizeof(T) / AlignOf<T>(), AlignOf<T>());
|
StartVector(vector_size * sizeof(T) / AlignOf<T>(), sizeof(T), AlignOf<T>());
|
||||||
return reinterpret_cast<T *>(buf_.make_space(vector_size * sizeof(T)));
|
return reinterpret_cast<T *>(buf_.make_space(vector_size * sizeof(T)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -382,7 +382,14 @@ struct EnumVal {
|
|||||||
Offset<reflection::EnumVal> Serialize(FlatBufferBuilder *builder,
|
Offset<reflection::EnumVal> Serialize(FlatBufferBuilder *builder,
|
||||||
const Parser &parser) const;
|
const Parser &parser) const;
|
||||||
|
|
||||||
bool Deserialize(const Parser &parser, const reflection::EnumVal *val);
|
bool Deserialize(Parser &parser, const reflection::EnumVal *val);
|
||||||
|
|
||||||
|
flatbuffers::Offset<
|
||||||
|
flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>>
|
||||||
|
SerializeAttributes(FlatBufferBuilder *builder, const Parser &parser) const;
|
||||||
|
|
||||||
|
bool DeserializeAttributes(Parser &parser,
|
||||||
|
const Vector<Offset<reflection::KeyValue>> *attrs);
|
||||||
|
|
||||||
uint64_t GetAsUInt64() const { return static_cast<uint64_t>(value); }
|
uint64_t GetAsUInt64() const { return static_cast<uint64_t>(value); }
|
||||||
int64_t GetAsInt64() const { return value; }
|
int64_t GetAsInt64() const { return value; }
|
||||||
@@ -392,6 +399,7 @@ struct EnumVal {
|
|||||||
std::string name;
|
std::string name;
|
||||||
std::vector<std::string> doc_comment;
|
std::vector<std::string> doc_comment;
|
||||||
Type union_type;
|
Type union_type;
|
||||||
|
SymbolTable<Value> attributes;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend EnumDef;
|
friend EnumDef;
|
||||||
@@ -653,6 +661,7 @@ struct IDLOptions {
|
|||||||
kRust = 1 << 14,
|
kRust = 1 << 14,
|
||||||
kKotlin = 1 << 15,
|
kKotlin = 1 << 15,
|
||||||
kSwift = 1 << 16,
|
kSwift = 1 << 16,
|
||||||
|
kNim = 1 << 17,
|
||||||
kMAX
|
kMAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -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 == 2 &&
|
static_assert(FLATBUFFERS_VERSION_MAJOR == 22 &&
|
||||||
FLATBUFFERS_VERSION_MINOR == 0 &&
|
FLATBUFFERS_VERSION_MINOR == 10 &&
|
||||||
FLATBUFFERS_VERSION_REVISION == 8,
|
FLATBUFFERS_VERSION_REVISION == 26,
|
||||||
"Non-compatible flatbuffers version included");
|
"Non-compatible flatbuffers version included");
|
||||||
|
|
||||||
namespace reflection {
|
namespace reflection {
|
||||||
@@ -334,7 +334,8 @@ struct EnumVal FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
|||||||
VT_NAME = 4,
|
VT_NAME = 4,
|
||||||
VT_VALUE = 6,
|
VT_VALUE = 6,
|
||||||
VT_UNION_TYPE = 10,
|
VT_UNION_TYPE = 10,
|
||||||
VT_DOCUMENTATION = 12
|
VT_DOCUMENTATION = 12,
|
||||||
|
VT_ATTRIBUTES = 14
|
||||||
};
|
};
|
||||||
const flatbuffers::String *name() const {
|
const flatbuffers::String *name() const {
|
||||||
return GetPointer<const flatbuffers::String *>(VT_NAME);
|
return GetPointer<const flatbuffers::String *>(VT_NAME);
|
||||||
@@ -354,6 +355,9 @@ struct EnumVal FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
|||||||
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *documentation() const {
|
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *documentation() const {
|
||||||
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_DOCUMENTATION);
|
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_DOCUMENTATION);
|
||||||
}
|
}
|
||||||
|
const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *attributes() const {
|
||||||
|
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>> *>(VT_ATTRIBUTES);
|
||||||
|
}
|
||||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||||
return VerifyTableStart(verifier) &&
|
return VerifyTableStart(verifier) &&
|
||||||
VerifyOffsetRequired(verifier, VT_NAME) &&
|
VerifyOffsetRequired(verifier, VT_NAME) &&
|
||||||
@@ -364,6 +368,9 @@ struct EnumVal FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
|||||||
VerifyOffset(verifier, VT_DOCUMENTATION) &&
|
VerifyOffset(verifier, VT_DOCUMENTATION) &&
|
||||||
verifier.VerifyVector(documentation()) &&
|
verifier.VerifyVector(documentation()) &&
|
||||||
verifier.VerifyVectorOfStrings(documentation()) &&
|
verifier.VerifyVectorOfStrings(documentation()) &&
|
||||||
|
VerifyOffset(verifier, VT_ATTRIBUTES) &&
|
||||||
|
verifier.VerifyVector(attributes()) &&
|
||||||
|
verifier.VerifyVectorOfTables(attributes()) &&
|
||||||
verifier.EndTable();
|
verifier.EndTable();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -384,6 +391,9 @@ struct EnumValBuilder {
|
|||||||
void add_documentation(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation) {
|
void add_documentation(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation) {
|
||||||
fbb_.AddOffset(EnumVal::VT_DOCUMENTATION, documentation);
|
fbb_.AddOffset(EnumVal::VT_DOCUMENTATION, documentation);
|
||||||
}
|
}
|
||||||
|
void add_attributes(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes) {
|
||||||
|
fbb_.AddOffset(EnumVal::VT_ATTRIBUTES, attributes);
|
||||||
|
}
|
||||||
explicit EnumValBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
explicit EnumValBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
||||||
: fbb_(_fbb) {
|
: fbb_(_fbb) {
|
||||||
start_ = fbb_.StartTable();
|
start_ = fbb_.StartTable();
|
||||||
@@ -401,9 +411,11 @@ inline flatbuffers::Offset<EnumVal> CreateEnumVal(
|
|||||||
flatbuffers::Offset<flatbuffers::String> name = 0,
|
flatbuffers::Offset<flatbuffers::String> name = 0,
|
||||||
int64_t value = 0,
|
int64_t value = 0,
|
||||||
flatbuffers::Offset<reflection::Type> union_type = 0,
|
flatbuffers::Offset<reflection::Type> union_type = 0,
|
||||||
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation = 0) {
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> documentation = 0,
|
||||||
|
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<reflection::KeyValue>>> attributes = 0) {
|
||||||
EnumValBuilder builder_(_fbb);
|
EnumValBuilder builder_(_fbb);
|
||||||
builder_.add_value(value);
|
builder_.add_value(value);
|
||||||
|
builder_.add_attributes(attributes);
|
||||||
builder_.add_documentation(documentation);
|
builder_.add_documentation(documentation);
|
||||||
builder_.add_union_type(union_type);
|
builder_.add_union_type(union_type);
|
||||||
builder_.add_name(name);
|
builder_.add_name(name);
|
||||||
@@ -415,15 +427,18 @@ inline flatbuffers::Offset<EnumVal> CreateEnumValDirect(
|
|||||||
const char *name = nullptr,
|
const char *name = nullptr,
|
||||||
int64_t value = 0,
|
int64_t value = 0,
|
||||||
flatbuffers::Offset<reflection::Type> union_type = 0,
|
flatbuffers::Offset<reflection::Type> union_type = 0,
|
||||||
const std::vector<flatbuffers::Offset<flatbuffers::String>> *documentation = nullptr) {
|
const std::vector<flatbuffers::Offset<flatbuffers::String>> *documentation = nullptr,
|
||||||
|
std::vector<flatbuffers::Offset<reflection::KeyValue>> *attributes = nullptr) {
|
||||||
auto name__ = name ? _fbb.CreateString(name) : 0;
|
auto name__ = name ? _fbb.CreateString(name) : 0;
|
||||||
auto documentation__ = documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0;
|
auto documentation__ = documentation ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*documentation) : 0;
|
||||||
|
auto attributes__ = attributes ? _fbb.CreateVectorOfSortedTables<reflection::KeyValue>(attributes) : 0;
|
||||||
return reflection::CreateEnumVal(
|
return reflection::CreateEnumVal(
|
||||||
_fbb,
|
_fbb,
|
||||||
name__,
|
name__,
|
||||||
value,
|
value,
|
||||||
union_type,
|
union_type,
|
||||||
documentation__);
|
documentation__,
|
||||||
|
attributes__);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Enum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
struct Enum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||||
|
|||||||
@@ -685,9 +685,6 @@ bool SetGlobalTestLocale(const char *locale_name,
|
|||||||
bool ReadEnvironmentVariable(const char *var_name,
|
bool ReadEnvironmentVariable(const char *var_name,
|
||||||
std::string *_value = nullptr);
|
std::string *_value = nullptr);
|
||||||
|
|
||||||
// MSVC specific: Send all assert reports to STDOUT to prevent CI hangs.
|
|
||||||
void SetupDefaultCRTReportMode();
|
|
||||||
|
|
||||||
enum class Case {
|
enum class Case {
|
||||||
kUnknown = 0,
|
kUnknown = 0,
|
||||||
// TheQuickBrownFox
|
// TheQuickBrownFox
|
||||||
|
|||||||
@@ -27,14 +27,15 @@ struct String;
|
|||||||
|
|
||||||
// An STL compatible iterator implementation for Vector below, effectively
|
// An STL compatible iterator implementation for Vector below, effectively
|
||||||
// calling Get() for every element.
|
// calling Get() for every element.
|
||||||
template<typename T, typename IT> struct VectorIterator {
|
template<typename T, typename IT, typename Data = uint8_t *>
|
||||||
|
struct VectorIterator {
|
||||||
typedef std::random_access_iterator_tag iterator_category;
|
typedef std::random_access_iterator_tag iterator_category;
|
||||||
typedef IT value_type;
|
typedef IT value_type;
|
||||||
typedef ptrdiff_t difference_type;
|
typedef ptrdiff_t difference_type;
|
||||||
typedef IT *pointer;
|
typedef IT *pointer;
|
||||||
typedef IT &reference;
|
typedef IT &reference;
|
||||||
|
|
||||||
VectorIterator(const uint8_t *data, uoffset_t i)
|
VectorIterator(Data data, uoffset_t i)
|
||||||
: data_(data + IndirectHelper<T>::element_stride * i) {}
|
: data_(data + IndirectHelper<T>::element_stride * i) {}
|
||||||
VectorIterator(const VectorIterator &other) : data_(other.data_) {}
|
VectorIterator(const VectorIterator &other) : data_(other.data_) {}
|
||||||
VectorIterator() : data_(nullptr) {}
|
VectorIterator() : data_(nullptr) {}
|
||||||
@@ -116,9 +117,12 @@ template<typename T, typename IT> struct VectorIterator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const uint8_t *data_;
|
Data data_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T, typename IT>
|
||||||
|
using VectorConstIterator = VectorIterator<T, IT, const uint8_t *>;
|
||||||
|
|
||||||
template<typename Iterator>
|
template<typename Iterator>
|
||||||
struct VectorReverseIterator : public std::reverse_iterator<Iterator> {
|
struct VectorReverseIterator : public std::reverse_iterator<Iterator> {
|
||||||
explicit VectorReverseIterator(Iterator iter)
|
explicit VectorReverseIterator(Iterator iter)
|
||||||
@@ -145,7 +149,7 @@ template<typename T> class Vector {
|
|||||||
public:
|
public:
|
||||||
typedef VectorIterator<T, typename IndirectHelper<T>::mutable_return_type>
|
typedef VectorIterator<T, typename IndirectHelper<T>::mutable_return_type>
|
||||||
iterator;
|
iterator;
|
||||||
typedef VectorIterator<T, typename IndirectHelper<T>::return_type>
|
typedef VectorConstIterator<T, typename IndirectHelper<T>::return_type>
|
||||||
const_iterator;
|
const_iterator;
|
||||||
typedef VectorReverseIterator<iterator> reverse_iterator;
|
typedef VectorReverseIterator<iterator> reverse_iterator;
|
||||||
typedef VectorReverseIterator<const_iterator> const_reverse_iterator;
|
typedef VectorReverseIterator<const_iterator> const_reverse_iterator;
|
||||||
|
|||||||
@@ -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>2.0.8</version>
|
<version>22.10.26</version>
|
||||||
<packaging>bundle</packaging>
|
<packaging>bundle</packaging>
|
||||||
<name>FlatBuffers Java API</name>
|
<name>FlatBuffers Java API</name>
|
||||||
<description>
|
<description>
|
||||||
@@ -37,6 +37,18 @@
|
|||||||
<tag>HEAD</tag>
|
<tag>HEAD</tag>
|
||||||
</scm>
|
</scm>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.13.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.truth</groupId>
|
||||||
|
<artifactId>truth</artifactId>
|
||||||
|
<version>1.1.3</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
<snapshotRepository>
|
<snapshotRepository>
|
||||||
@@ -45,7 +57,19 @@
|
|||||||
</snapshotRepository>
|
</snapshotRepository>
|
||||||
</distributionManagement>
|
</distributionManagement>
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>java</sourceDirectory>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<release>8</release>
|
||||||
|
<testExcludes>
|
||||||
|
<testExclude>MyGame/Example/MonsterStorageGrpc.java</testExclude>
|
||||||
|
<testExclude>MyGame/OtherNameSpace/TableBT.java</testExclude>
|
||||||
|
</testExcludes>
|
||||||
|
</configuration>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<profiles>
|
<profiles>
|
||||||
<profile>
|
<profile>
|
||||||
@@ -55,13 +79,6 @@
|
|||||||
</activation>
|
</activation>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<release>8</release>
|
|
||||||
</configuration>
|
|
||||||
<version>3.8.1</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
@@ -130,10 +147,10 @@
|
|||||||
<goal>sign</goal>
|
<goal>sign</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<gpgArguments>
|
<gpgArguments>
|
||||||
<arg>--pinentry-mode</arg>
|
<arg>--pinentry-mode</arg>
|
||||||
<arg>loopback</arg>
|
<arg>loopback</arg>
|
||||||
</gpgArguments>
|
</gpgArguments>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
@@ -154,4 +171,3 @@
|
|||||||
</profile>
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
@@ -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_2_0_8() {}
|
public static void FLATBUFFERS_22_10_26() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
@@ -173,6 +173,21 @@ public class FlexBuffersBuilder {
|
|||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert a null value into the buffer
|
||||||
|
*/
|
||||||
|
public void putNull() {
|
||||||
|
putNull(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert a null value into the buffer
|
||||||
|
* @param key key used to store element in map
|
||||||
|
*/
|
||||||
|
public void putNull(String key) {
|
||||||
|
stack.add(Value.nullValue(putKey(key)));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert a single boolean into the buffer
|
* Insert a single boolean into the buffer
|
||||||
* @param val true or false
|
* @param val true or false
|
||||||
@@ -502,7 +517,9 @@ public class FlexBuffersBuilder {
|
|||||||
* @return Value representing the created vector
|
* @return Value representing the created vector
|
||||||
*/
|
*/
|
||||||
private Value createVector(int key, int start, int length, boolean typed, boolean fixed, Value keys) {
|
private Value createVector(int key, int start, int length, boolean typed, boolean fixed, Value keys) {
|
||||||
assert (!fixed || typed); // typed=false, fixed=true combination is not supported.
|
if (fixed & !typed)
|
||||||
|
throw new UnsupportedOperationException("Untyped fixed vector is not supported");
|
||||||
|
|
||||||
// Figure out smallest bit width we can store this vector with.
|
// Figure out smallest bit width we can store this vector with.
|
||||||
int bitWidth = Math.max(WIDTH_8, widthUInBits(length));
|
int bitWidth = Math.max(WIDTH_8, widthUInBits(length));
|
||||||
int prefixElems = 1;
|
int prefixElems = 1;
|
||||||
@@ -673,6 +690,10 @@ public class FlexBuffersBuilder {
|
|||||||
this.iValue = Long.MIN_VALUE;
|
this.iValue = Long.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Value nullValue(int key) {
|
||||||
|
return new Value(key, FBT_NULL, WIDTH_8, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static Value bool(int key, boolean b) {
|
static Value bool(int key, boolean b) {
|
||||||
return new Value(key, FBT_BOOL, WIDTH_8, b ? 1 : 0);
|
return new Value(key, FBT_BOOL, WIDTH_8, b ? 1 : 0);
|
||||||
}
|
}
|
||||||
1
java/src/test/java/DictionaryLookup
Symbolic link
1
java/src/test/java/DictionaryLookup
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../../tests/DictionaryLookup
|
||||||
File diff suppressed because it is too large
Load Diff
1
java/src/test/java/MyGame
Symbolic link
1
java/src/test/java/MyGame
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../../tests/MyGame
|
||||||
1
java/src/test/java/NamespaceA
Symbolic link
1
java/src/test/java/NamespaceA
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../../tests/namespace_test/NamespaceA
|
||||||
1
java/src/test/java/NamespaceC
Symbolic link
1
java/src/test/java/NamespaceC
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../../tests/namespace_test/NamespaceC
|
||||||
1
java/src/test/java/optional_scalars
Symbolic link
1
java/src/test/java/optional_scalars
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../../tests/optional_scalars
|
||||||
1
java/src/test/java/union_vector
Symbolic link
1
java/src/test/java/union_vector
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../../../tests/union_vector
|
||||||
BIN
java/src/test/resources/monsterdata_test.mon
Normal file
BIN
java/src/test/resources/monsterdata_test.mon
Normal file
Binary file not shown.
@@ -1 +1 @@
|
|||||||
../../../../java/
|
../../../../java/src/main/java
|
||||||
@@ -51,7 +51,7 @@ using System.Buffers.Binary;
|
|||||||
#warning ENABLE_SPAN_T requires UNSAFE_BYTEBUFFER to also be defined
|
#warning ENABLE_SPAN_T requires UNSAFE_BYTEBUFFER to also be defined
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace FlatBuffers
|
namespace Google.FlatBuffers
|
||||||
{
|
{
|
||||||
public abstract class ByteBufferAllocator
|
public abstract class ByteBufferAllocator
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace FlatBuffers
|
namespace Google.FlatBuffers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class that collects utility functions around `ByteBuffer`.
|
/// Class that collects utility functions around `ByteBuffer`.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ using System.Text;
|
|||||||
/// @addtogroup flatbuffers_csharp_api
|
/// @addtogroup flatbuffers_csharp_api
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
namespace FlatBuffers
|
namespace Google.FlatBuffers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Responsible for building up and accessing a FlatBuffer formatted byte
|
/// Responsible for building up and accessing a FlatBuffer formatted byte
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace FlatBuffers
|
namespace Google.FlatBuffers
|
||||||
{
|
{
|
||||||
public static class FlatBufferConstants
|
public static class FlatBufferConstants
|
||||||
{
|
{
|
||||||
@@ -32,6 +32,6 @@ namespace 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_2_0_8() {}
|
public static void FLATBUFFERS_22_10_26() {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFrameworks>netstandard2.1;netstandard2.0;net46</TargetFrameworks>
|
|
||||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(UNSAFE_BYTEBUFFER)' == 'true'">
|
|
||||||
<DefineConstants>$(DefineConstants);UNSAFE_BYTEBUFFER</DefineConstants>
|
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(BYTEBUFFER_NO_BOUNDS_CHECK)' == 'true'">
|
|
||||||
<DefineConstants>$(DefineConstants);BYTEBUFFER_NO_BOUNDS_CHECK</DefineConstants>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(ENABLE_SPAN_T)' == 'true'">
|
|
||||||
<DefineConstants>$(DefineConstants);ENABLE_SPAN_T</DefineConstants>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup Condition="('$(ENABLE_SPAN_T)' == 'true') And (('$(TargetFramework)' == 'netstandard2.0') Or ('$(TargetFramework)' == 'net46'))">
|
|
||||||
<PackageReference Include="System.Memory" Version="4.5.4" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
46
net/FlatBuffers/Google.FlatBuffers.csproj
Normal file
46
net/FlatBuffers/Google.FlatBuffers.csproj
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>netstandard2.1;netstandard2.0;net46</TargetFrameworks>
|
||||||
|
<Description>A cross-platform memory efficient serialization library</Description>
|
||||||
|
<PackageVersion>22.10.26</PackageVersion>
|
||||||
|
<Authors>Google LLC</Authors>
|
||||||
|
<PackageProjectUrl>https://github.com/google/flatbuffers</PackageProjectUrl>
|
||||||
|
<RepositoryUrl>https://github.com/google/flatbuffers</RepositoryUrl>
|
||||||
|
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||||
|
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
|
||||||
|
<PackageIcon>flatbuffers.png</PackageIcon>
|
||||||
|
<PackageTags>Google;FlatBuffers;Serialization;Buffer;Binary;zero copy</PackageTags>
|
||||||
|
<Copyright>Copyright 2022 Google LLC</Copyright>
|
||||||
|
<IncludeSymbols>true</IncludeSymbols>
|
||||||
|
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||||
|
<SignAssembly>true</SignAssembly>
|
||||||
|
<AssemblyOriginatorKeyFile>flatbuffers.snk</AssemblyOriginatorKeyFile>
|
||||||
|
<DelaySign>false</DelaySign>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(UNSAFE_BYTEBUFFER)' == 'true'">
|
||||||
|
<DefineConstants>$(DefineConstants);UNSAFE_BYTEBUFFER</DefineConstants>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(BYTEBUFFER_NO_BOUNDS_CHECK)' == 'true'">
|
||||||
|
<DefineConstants>$(DefineConstants);BYTEBUFFER_NO_BOUNDS_CHECK</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(ENABLE_SPAN_T)' == 'true'">
|
||||||
|
<DefineConstants>$(DefineConstants);ENABLE_SPAN_T</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup Condition="('$(ENABLE_SPAN_T)' == 'true') And (('$(TargetFramework)' == 'netstandard2.0') Or ('$(TargetFramework)' == 'net46'))">
|
||||||
|
<PackageReference Include="System.Memory" Version="4.5.4" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\..\LICENSE.txt" Pack="true" PackagePath="" />
|
||||||
|
<None Include="flatbuffers.png" Pack="true" PackagePath="" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FlatBuffers
|
namespace Google.FlatBuffers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is the base for both structs and tables.
|
/// This is the base for both structs and tables.
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FlatBuffers
|
namespace Google.FlatBuffers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Offset class for typesafe assignments.
|
/// Offset class for typesafe assignments.
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2014 Google Inc. All rights reserved.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("FlatBuffers")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("FlatBuffers")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright (c) 2015 Google Inc")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("91c32e64-ef20-47df-9c9f-cec9207bc6df")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FlatBuffers
|
namespace Google.FlatBuffers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All structs in the generated code derive from this class, and add their own accessors.
|
/// All structs in the generated code derive from this class, and add their own accessors.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ using System;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace FlatBuffers
|
namespace Google.FlatBuffers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All tables in the generated code derive from this struct, and add their own accessors.
|
/// All tables in the generated code derive from this struct, and add their own accessors.
|
||||||
|
|||||||
BIN
net/FlatBuffers/flatbuffers.png
Normal file
BIN
net/FlatBuffers/flatbuffers.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
BIN
net/FlatBuffers/flatbuffers.snk
Normal file
BIN
net/FlatBuffers/flatbuffers.snk
Normal file
Binary file not shown.
7
nim/flatbuffers.nimble
Normal file
7
nim/flatbuffers.nimble
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
version = "2.0.8"
|
||||||
|
author = "flatbuffers"
|
||||||
|
description = "Flatbuffers"
|
||||||
|
license = "Apache 2.0"
|
||||||
|
srcDir = "flatbuffers"
|
||||||
|
|
||||||
|
requires "nim >= 1.4.0"
|
||||||
7
nim/flatbuffers/flatbuffers.nim
Normal file
7
nim/flatbuffers/flatbuffers.nim
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import
|
||||||
|
src/[
|
||||||
|
builder,
|
||||||
|
struct,
|
||||||
|
table
|
||||||
|
]
|
||||||
|
export flatbuffers.builder, flatbuffers.table, flatbuffers.struct
|
||||||
262
nim/flatbuffers/src/builder.nim
Normal file
262
nim/flatbuffers/src/builder.nim
Normal file
@@ -0,0 +1,262 @@
|
|||||||
|
import math
|
||||||
|
import table
|
||||||
|
|
||||||
|
|
||||||
|
const MAX_BUFFER_SIZE* = 2^31
|
||||||
|
|
||||||
|
|
||||||
|
type Builder* = ref object of RootObj
|
||||||
|
bytes*: seq[byte]
|
||||||
|
minalign*: int
|
||||||
|
current_vtable*: seq[uoffset]
|
||||||
|
objectEnd*: uoffset
|
||||||
|
vtables*: seq[uoffset] #?
|
||||||
|
head*: uoffset
|
||||||
|
nested*: bool
|
||||||
|
finished*: bool
|
||||||
|
vectorNumElems*: uoffset
|
||||||
|
|
||||||
|
using this: var Builder
|
||||||
|
|
||||||
|
func newBuilder*(size: int): Builder =
|
||||||
|
result = new Builder
|
||||||
|
result.bytes.setLen(size)
|
||||||
|
result.minalign = 1
|
||||||
|
result.head = size.uoffset
|
||||||
|
result.nested = false
|
||||||
|
result.finished = false
|
||||||
|
result.vectorNumElems = 0
|
||||||
|
|
||||||
|
proc FinishedBytes*(this): seq[byte] =
|
||||||
|
if not this.finished:
|
||||||
|
quit("Builder not finished, Incorrect use of FinishedBytes(): must call 'Finish' first.")
|
||||||
|
result = this.bytes[this.head..^1]
|
||||||
|
|
||||||
|
proc Output*(this): seq[byte] =
|
||||||
|
if not this.finished:
|
||||||
|
quit("Builder not finished, Incorrect use of Output(): must call 'Finish' first.")
|
||||||
|
|
||||||
|
result = this.bytes[this.head..^1]
|
||||||
|
|
||||||
|
func Offset*(this): uoffset =
|
||||||
|
result = this.bytes.len.uoffset - this.head
|
||||||
|
|
||||||
|
proc StartObject*(this; numfields: int) =
|
||||||
|
if this.nested:
|
||||||
|
quit("builder is nested")
|
||||||
|
|
||||||
|
this.current_vtable.setLen(numfields)
|
||||||
|
for i in this.current_vtable.mitems():
|
||||||
|
i = 0
|
||||||
|
this.objectEnd = this.Offset()
|
||||||
|
this.nested = true
|
||||||
|
|
||||||
|
proc GrowByteBuffer*(this) =
|
||||||
|
if this.bytes.len == MAX_BUFFER_SIZE:
|
||||||
|
quit("flatbuffers: cannot grow buffer beyond 2 gigabytes")
|
||||||
|
let oldLen = this.bytes.len
|
||||||
|
var newLen = min(this.bytes.len * 2, MAX_BUFFER_SIZE)
|
||||||
|
if newLen == 0:
|
||||||
|
newLen = 1
|
||||||
|
this.bytes.setLen(newLen)
|
||||||
|
var j = this.bytes.len - 1
|
||||||
|
while j >= 0:
|
||||||
|
if j >= newLen - oldLen:
|
||||||
|
this.bytes[j] = this.bytes[j - (newLen - oldLen)]
|
||||||
|
else:
|
||||||
|
this.bytes[j] = 0
|
||||||
|
dec(j)
|
||||||
|
|
||||||
|
proc Place*[T](this; x: T) =
|
||||||
|
this.head -= uoffset x.sizeof
|
||||||
|
WriteVal(this.bytes, this.head, x)
|
||||||
|
|
||||||
|
func Pad*(this; n: int) =
|
||||||
|
for i in 0..<n:
|
||||||
|
this.Place(0.byte)
|
||||||
|
|
||||||
|
proc Prep*(this; size: int; additionalBytes: int) =
|
||||||
|
if size > this.minalign:
|
||||||
|
this.minalign = size
|
||||||
|
var alignsize = (not (this.bytes.len - this.head.int + additionalBytes)) + 1
|
||||||
|
alignsize = alignsize and (size - 1)
|
||||||
|
|
||||||
|
while this.head.int < alignsize + size + additionalBytes:
|
||||||
|
let oldbufSize = this.bytes.len
|
||||||
|
this.GrowByteBuffer()
|
||||||
|
this.head = (this.head.int + this.bytes.len - oldbufSize).uoffset
|
||||||
|
this.Pad(alignsize)
|
||||||
|
|
||||||
|
proc PrependOffsetRelative*[T: Offsets](this; off: T) =
|
||||||
|
when T is voffset:
|
||||||
|
this.Prep(T.sizeof, 0)
|
||||||
|
if not off.uoffset <= this.Offset:
|
||||||
|
quit("flatbuffers: Offset arithmetic error.")
|
||||||
|
this.Place(off)
|
||||||
|
else:
|
||||||
|
this.Prep(T.sizeof, 0)
|
||||||
|
if not off.uoffset <= this.Offset:
|
||||||
|
quit("flatbuffers: Offset arithmetic error.")
|
||||||
|
let off2: T = this.Offset.T - off + sizeof(T).T
|
||||||
|
this.Place(off2)
|
||||||
|
|
||||||
|
|
||||||
|
proc Prepend*[T](this; x: T) =
|
||||||
|
this.Prep(x.sizeof, 0)
|
||||||
|
this.Place(x)
|
||||||
|
|
||||||
|
proc Slot*(this; slotnum: int) =
|
||||||
|
this.current_vtable[slotnum] = this.Offset
|
||||||
|
|
||||||
|
proc PrependSlot*[T](this; o: int; x, d: T) =
|
||||||
|
if x != d:
|
||||||
|
when T is uoffset or T is soffset or T is voffset:
|
||||||
|
this.PrependOffsetRelative(x)
|
||||||
|
else:
|
||||||
|
this.Prepend(x)
|
||||||
|
this.Slot(o)
|
||||||
|
|
||||||
|
proc AssertStuctInline(this; obj: uoffset) =
|
||||||
|
if obj != this.Offset:
|
||||||
|
quit("flatbuffers: Tried to write a Struct at an Offset that is different from the current Offset of the Builder.")
|
||||||
|
|
||||||
|
proc PrependStructSlot*(this; o: int; x: uoffset; d: uoffset) =
|
||||||
|
if x != d:
|
||||||
|
this.AssertStuctInline(x)
|
||||||
|
this.Slot(o)
|
||||||
|
|
||||||
|
proc Add*[T](this; n: T) =
|
||||||
|
this.Prep(T.sizeof, 0)
|
||||||
|
WriteVal(this.bytes, this.head, n)
|
||||||
|
|
||||||
|
proc VtableEqual*(a: seq[uoffset]; objectStart: uoffset; b: seq[byte]): bool =
|
||||||
|
if a.len * voffset.sizeof != b.len:
|
||||||
|
return false
|
||||||
|
|
||||||
|
var i = 0
|
||||||
|
while i < a.len:
|
||||||
|
var seq = b[i * voffset.sizeof..<(i + 1) * voffset.sizeof]
|
||||||
|
let x = GetVal[voffset](addr seq)
|
||||||
|
|
||||||
|
if x == 0 and a[i] == 0:
|
||||||
|
inc i
|
||||||
|
continue
|
||||||
|
|
||||||
|
let y = objectStart.soffset - a[i].soffset
|
||||||
|
if x.soffset != y:
|
||||||
|
return false
|
||||||
|
inc i
|
||||||
|
return true
|
||||||
|
|
||||||
|
proc WriteVtable*(this): uoffset =
|
||||||
|
this.PrependOffsetRelative(0.soffset)
|
||||||
|
|
||||||
|
let objectOffset = this.Offset
|
||||||
|
var existingVtable = uoffset 0
|
||||||
|
|
||||||
|
var i = this.current_vtable.len - 1
|
||||||
|
while i >= 0 and this.current_vtable[i] == 0: dec i
|
||||||
|
|
||||||
|
this.current_vtable = this.current_vtable[0..i]
|
||||||
|
for i in countdown(this.vtables.len - 1, 0):
|
||||||
|
let
|
||||||
|
vt2Offset: uoffset = this.vtables[i]
|
||||||
|
vt2Start: int = this.bytes.len - int vt2Offset
|
||||||
|
|
||||||
|
var seq = this.bytes[vt2Start..<this.bytes.len]
|
||||||
|
let
|
||||||
|
vt2Len = GetVal[voffset](addr seq)
|
||||||
|
metadata = 2 * voffset.sizeof # VtableMetadataFields * SizeVOffsetT
|
||||||
|
vt2End = vt2Start + vt2Len.int
|
||||||
|
vt2 = this.bytes[this.bytes.len - vt2Offset.int + metadata..<vt2End]
|
||||||
|
|
||||||
|
if VtableEqual(this.current_vtable, objectOffset, vt2):
|
||||||
|
existingVtable = vt2Offset
|
||||||
|
break
|
||||||
|
|
||||||
|
if existingVtable == 0:
|
||||||
|
for i in countdown(this.current_vtable.len - 1, 0):
|
||||||
|
var off: uoffset
|
||||||
|
if this.current_vtable[i] != 0:
|
||||||
|
off = objectOffset - this.current_vtable[i]
|
||||||
|
|
||||||
|
this.PrependOffsetRelative(off.voffset)
|
||||||
|
|
||||||
|
let objectSize = objectOffset - this.objectEnd
|
||||||
|
this.PrependOffsetRelative(objectSize.voffset)
|
||||||
|
|
||||||
|
let vBytes = (this.current_vtable.len + 2) * voffset.sizeof
|
||||||
|
this.PrependOffsetRelative(vBytes.voffset)
|
||||||
|
|
||||||
|
let objectStart: uoffset = (this.bytes.len.uoffset - objectOffset)
|
||||||
|
WriteVal(this.bytes, objectStart, (this.Offset - objectOffset).soffset)
|
||||||
|
this.vtables.add this.Offset
|
||||||
|
else:
|
||||||
|
let objectStart: uoffset = this.bytes.len.uoffset - objectOffset
|
||||||
|
this.head = objectStart
|
||||||
|
WriteVal(this.bytes, this.head,
|
||||||
|
(existingVtable.soffset - objectOffset.soffset))
|
||||||
|
|
||||||
|
this.current_vtable = @[]
|
||||||
|
result = objectOffset
|
||||||
|
|
||||||
|
proc EndObject*(this): uoffset =
|
||||||
|
if not this.nested:
|
||||||
|
quit("builder is not nested")
|
||||||
|
result = this.WriteVtable()
|
||||||
|
this.nested = false
|
||||||
|
|
||||||
|
proc End*(this: var Builder): uoffset =
|
||||||
|
result = this.EndObject()
|
||||||
|
|
||||||
|
proc StartVector*(this; elemSize: int; numElems: uoffset;
|
||||||
|
alignment: int) =
|
||||||
|
if this.nested:
|
||||||
|
quit("builder is nested")
|
||||||
|
this.nested = true
|
||||||
|
this.vectorNumElems = numElems
|
||||||
|
this.Prep(sizeof(uint32), elemSize * numElems.int)
|
||||||
|
this.Prep(alignment, elemSize * numElems.int)
|
||||||
|
|
||||||
|
proc EndVector*(this): uoffset =
|
||||||
|
if not this.nested:
|
||||||
|
quit("builder is not nested")
|
||||||
|
this.nested = false
|
||||||
|
this.Place(this.vectorNumElems)
|
||||||
|
this.vectorNumElems = 0
|
||||||
|
result = this.Offset
|
||||||
|
|
||||||
|
proc getChars*(str: seq[byte]): string =
|
||||||
|
var bytes = str
|
||||||
|
result = GetVal[string](addr bytes)
|
||||||
|
|
||||||
|
proc getBytes*(str: string | cstring): seq[byte] =
|
||||||
|
for chr in str:
|
||||||
|
result.add byte chr
|
||||||
|
result.add byte 0
|
||||||
|
|
||||||
|
proc Create*[T](this; s: T): uoffset = # Both CreateString and CreateByteVector functionality
|
||||||
|
if this.nested:
|
||||||
|
quit("builder is nested")
|
||||||
|
this.nested = true
|
||||||
|
when T is cstring or T is string:
|
||||||
|
let x = s.getBytes()
|
||||||
|
let l = x.len.uoffset
|
||||||
|
this.vectorNumElems = l-1
|
||||||
|
else:
|
||||||
|
let x = s
|
||||||
|
let l = x.len.uoffset
|
||||||
|
this.vectorNumElems = l
|
||||||
|
this.Prep(uoffset.sizeof, l.int * byte.sizeof)
|
||||||
|
this.head -= l
|
||||||
|
this.bytes[this.head..<this.head+l] = x
|
||||||
|
result = this.EndVector()
|
||||||
|
|
||||||
|
proc Finish*(this; rootTable: uoffset) =
|
||||||
|
if this.nested:
|
||||||
|
quit("builder is nested")
|
||||||
|
this.nested = true
|
||||||
|
|
||||||
|
this.Prep(this.minalign, uoffset.sizeof)
|
||||||
|
this.PrependOffsetRelative(rootTable)
|
||||||
|
this.finished = true
|
||||||
12
nim/flatbuffers/src/endian.nim
Normal file
12
nim/flatbuffers/src/endian.nim
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
template swapEndian*(outp, inp: pointer, size: int) =
|
||||||
|
var i = cast[cstring](inp)
|
||||||
|
var o = cast[cstring](outp)
|
||||||
|
for x in 0..<size:
|
||||||
|
o[x] = i[(0..<size).len - x - 1]
|
||||||
|
|
||||||
|
when system.cpuEndian == bigEndian:
|
||||||
|
func littleEndianX*(outp, inp: pointer, size: int) {.inline.} = swapEndian(outp, inp, size)
|
||||||
|
func bigEndianX*(outp, inp: pointer, size: int) {.inline.} = copyMem(outp, inp, size)
|
||||||
|
else:
|
||||||
|
func littleEndianX*(outp, inp: pointer, size: int) {.inline.} = copyMem(outp, inp, size)
|
||||||
|
func bigEndianX*(outp, inp: pointer, size: int) {.inline.} = swapEndian(outp, inp, size)
|
||||||
24
nim/flatbuffers/src/struct.nim
Normal file
24
nim/flatbuffers/src/struct.nim
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import table
|
||||||
|
|
||||||
|
|
||||||
|
type FlatObj* {.inheritable.} = object
|
||||||
|
tab*: Vtable
|
||||||
|
|
||||||
|
func Table*(this: var FlatObj): Vtable = this.tab
|
||||||
|
|
||||||
|
func Init*(this: var FlatObj; buf: seq[byte]; i: uoffset) =
|
||||||
|
this.tab.Bytes = buf
|
||||||
|
this.tab.Pos = i
|
||||||
|
|
||||||
|
# Cant define it in table.nim since it needs FlatObj and Init
|
||||||
|
func GetUnion*[T: FlatObj](this: var Vtable; off: uoffset): T =
|
||||||
|
result.Init(this.Bytes, this.Indirect(off))
|
||||||
|
|
||||||
|
func GetRootAs*(result: var FlatObj; buf: seq[byte]; offset: uoffset) =
|
||||||
|
var
|
||||||
|
vtable = Vtable(Bytes: buf[offset..^1], Pos: offset)
|
||||||
|
n = Get[uoffset](vtable, offset)
|
||||||
|
result.Init(buf, n+offset)
|
||||||
|
|
||||||
|
func GetRootAs*(result: var FlatObj; buf: string; offset: uoffset) =
|
||||||
|
result.GetRootAs(cast[seq[byte]](buf), offset)
|
||||||
149
nim/flatbuffers/src/table.nim
Normal file
149
nim/flatbuffers/src/table.nim
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
import endian
|
||||||
|
|
||||||
|
|
||||||
|
type
|
||||||
|
uoffset* = uint32 ## offset in to the buffer
|
||||||
|
soffset* = int32 ## offset from start of table, to a vtable
|
||||||
|
voffset* = uint16 ## offset from start of table to value
|
||||||
|
|
||||||
|
type Offsets* = uoffset | soffset | voffset
|
||||||
|
|
||||||
|
type Vtable* = object
|
||||||
|
Bytes*: seq[byte]
|
||||||
|
Pos*: uoffset
|
||||||
|
|
||||||
|
|
||||||
|
using this: Vtable
|
||||||
|
|
||||||
|
|
||||||
|
func GetVal*[T](b: ptr seq[byte]): T {.inline.} =
|
||||||
|
when T is float64:
|
||||||
|
result = cast[T](GetVal[uint64](b))
|
||||||
|
elif T is float32:
|
||||||
|
result = cast[T](GetVal[uint32](b))
|
||||||
|
elif T is string:
|
||||||
|
result = cast[T](b[])
|
||||||
|
else:
|
||||||
|
if b[].len < T.sizeof:
|
||||||
|
b[].setLen T.sizeof
|
||||||
|
result = cast[ptr T](unsafeAddr b[][0])[]
|
||||||
|
|
||||||
|
|
||||||
|
template Get*[T](this; off: uoffset): T =
|
||||||
|
var seq = this.Bytes[off..^1]
|
||||||
|
GetVal[T](addr seq)
|
||||||
|
|
||||||
|
template Get*[T](this; off: soffset): T =
|
||||||
|
var seq = this.Bytes[off..^1]
|
||||||
|
GetVal[T](addr seq)
|
||||||
|
|
||||||
|
template Get*[T](this; off: voffset): T =
|
||||||
|
var seq = this.Bytes[off..^1]
|
||||||
|
GetVal[T](addr seq)
|
||||||
|
|
||||||
|
func WriteVal*[T: not SomeFloat](b: var openArray[byte]; off: uoffset;
|
||||||
|
n: T) {.inline.} =
|
||||||
|
when sizeof(T) == 8:
|
||||||
|
littleEndianX(addr b[off], unsafeAddr n, T.sizeof)
|
||||||
|
elif sizeof(T) == 4:
|
||||||
|
littleEndianX(addr b[off], unsafeAddr n, T.sizeof)
|
||||||
|
elif sizeof(T) == 2:
|
||||||
|
littleEndianX(addr b[off], unsafeAddr n, T.sizeof)
|
||||||
|
elif sizeof(T) == 1:
|
||||||
|
b[off] = n.uint8
|
||||||
|
else:
|
||||||
|
discard
|
||||||
|
#littleEndianX(addr b[off], unsafeAddr n, T.sizeof)
|
||||||
|
#{.error:"shouldnt appear".}
|
||||||
|
|
||||||
|
func WriteVal*[T: not SomeFloat](b: var seq[byte]; off: uoffset;
|
||||||
|
n: T) {.inline.} =
|
||||||
|
when sizeof(T) == 8:
|
||||||
|
littleEndianX(addr b[off], unsafeAddr n, T.sizeof)
|
||||||
|
elif sizeof(T) == 4:
|
||||||
|
littleEndianX(addr b[off], unsafeAddr n, T.sizeof)
|
||||||
|
elif sizeof(T) == 2:
|
||||||
|
littleEndianX(addr b[off], unsafeAddr n, T.sizeof)
|
||||||
|
elif sizeof(T) == 1:
|
||||||
|
b[off] = n.uint8
|
||||||
|
else:
|
||||||
|
discard
|
||||||
|
#littleEndianX(addr b[off], unsafeAddr n, T.sizeof)
|
||||||
|
#{.error:"shouldnt appear".}
|
||||||
|
|
||||||
|
func WriteVal*[T: SomeFloat](b: var openArray[byte]; off: uoffset;
|
||||||
|
n: T) {.inline.} =
|
||||||
|
when T is float64:
|
||||||
|
WriteVal(b, off, cast[uint64](n))
|
||||||
|
elif T is float32:
|
||||||
|
WriteVal(b, off, cast[uint32](n))
|
||||||
|
|
||||||
|
func WriteVal*[T: SomeFloat](b: var seq[byte]; off: uoffset; n: T) {.inline.} =
|
||||||
|
when T is float64:
|
||||||
|
WriteVal(b, off, cast[uint64](n))
|
||||||
|
elif T is float32:
|
||||||
|
WriteVal(b, off, cast[uint32](n))
|
||||||
|
|
||||||
|
func Offset*(this; off: voffset): voffset =
|
||||||
|
let vtable = (this.Pos - this.Get[:uoffset](this.Pos)).voffset
|
||||||
|
let vtableEnd = this.Get[:voffset](vtable)
|
||||||
|
if off < vtableEnd:
|
||||||
|
return this.Get[:voffset](vtable + off)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
func Indirect*(this; off: uoffset): uoffset =
|
||||||
|
result = off + this.Get[:uoffset](off)
|
||||||
|
|
||||||
|
func VectorLen*(this; off: uoffset): int =
|
||||||
|
var newoff: uoffset = off + this.Pos
|
||||||
|
newoff += this.Get[:uoffset](newoff)
|
||||||
|
return this.Get[:uoffset](newoff).int
|
||||||
|
|
||||||
|
func Vector*(this; off: uoffset): uoffset =
|
||||||
|
let newoff: uoffset = off + this.Pos
|
||||||
|
var x: uoffset = newoff + this.Get[:uoffset](newoff)
|
||||||
|
x += (uoffset.sizeof).uoffset
|
||||||
|
result = x
|
||||||
|
|
||||||
|
func Union*(this; off: uoffset): Vtable =
|
||||||
|
let newoff: uoffset = off + this.Pos
|
||||||
|
result.Pos = newoff + this.Get[:uoffset](newoff)
|
||||||
|
result.Bytes = this.Bytes
|
||||||
|
|
||||||
|
func GetSlot*[T](this; slot: voffset; d: T): T =
|
||||||
|
let off = this.Offset(slot)
|
||||||
|
if off == 0:
|
||||||
|
return d
|
||||||
|
return this.Get[T](this.Pos + off)
|
||||||
|
|
||||||
|
func GetOffsetSlot*[T: Offsets](this; slot: voffset; d: T): T =
|
||||||
|
let off = this.Offset(slot)
|
||||||
|
if off == 0:
|
||||||
|
return d
|
||||||
|
return off
|
||||||
|
|
||||||
|
func ByteVector*(this; off: uoffset): seq[byte] =
|
||||||
|
let
|
||||||
|
newoff: uoffset = off + this.Get[:uoffset](off)
|
||||||
|
start = newoff + (uoffset.sizeof).uoffset
|
||||||
|
var newseq = this.Bytes[newoff..^1]
|
||||||
|
let
|
||||||
|
length = GetVal[uoffset](addr newseq)
|
||||||
|
result = this.Bytes[start..<start+length]
|
||||||
|
|
||||||
|
func String*(this; off: uoffset): string =
|
||||||
|
var byte_seq = this.ByteVector(off)
|
||||||
|
result = GetVal[string](addr byte_seq)
|
||||||
|
|
||||||
|
using this: var Vtable
|
||||||
|
|
||||||
|
proc Mutate*[T](this; off: uoffset; n: T): bool =
|
||||||
|
WriteVal(this.Bytes, off, n)
|
||||||
|
return true
|
||||||
|
|
||||||
|
func MutateSlot*[T](this; slot: voffset; n: T): bool =
|
||||||
|
let off: voffset = this.Offset(slot)
|
||||||
|
if off != 0:
|
||||||
|
return this.Mutate(this.Pos + off.uoffset, n)
|
||||||
|
return false
|
||||||
19
package.json
19
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "flatbuffers",
|
"name": "flatbuffers",
|
||||||
"version": "2.0.8",
|
"version": "22.10.26",
|
||||||
"description": "Memory Efficient Serialization Library",
|
"description": "Memory Efficient Serialization Library",
|
||||||
"files": [
|
"files": [
|
||||||
"js/**/*.js",
|
"js/**/*.js",
|
||||||
@@ -16,7 +16,8 @@
|
|||||||
"test": "tests"
|
"test": "tests"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "npm run compile && cd tests && python3 ./TypeScriptTest.py",
|
"test": "npm run compile && cd tests/ts && python3 ./TypeScriptTest.py",
|
||||||
|
"lint": "eslint ts",
|
||||||
"compile": "tsc && tsc -p tsconfig.mjs.json && rollup -c",
|
"compile": "tsc && tsc -p tsconfig.mjs.json && rollup -c",
|
||||||
"prepublishOnly": "npm install --only=dev && npm run compile"
|
"prepublishOnly": "npm install --only=dev && npm run compile"
|
||||||
},
|
},
|
||||||
@@ -35,12 +36,12 @@
|
|||||||
"homepage": "https://google.github.io/flatbuffers/",
|
"homepage": "https://google.github.io/flatbuffers/",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@bazel/typescript": "^5.2.0",
|
"@bazel/typescript": "5.2.0",
|
||||||
"@types/node": "17.0.21",
|
"@types/node": "18.7.16",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.12.0",
|
"@typescript-eslint/eslint-plugin": "^5.36.2",
|
||||||
"@typescript-eslint/parser": "^4.12.0",
|
"@typescript-eslint/parser": "^5.36.2",
|
||||||
"eslint": "^7.17.0",
|
"eslint": "^8.23.1",
|
||||||
"rollup": "^2.78.0",
|
"rollup": "^2.79.0",
|
||||||
"typescript": "^4.5.5"
|
"typescript": "^4.8.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"2.0.8"
|
__version__ = u"22.10.26"
|
||||||
|
|||||||
@@ -73,7 +73,32 @@ class EnumVal(object):
|
|||||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
||||||
return o == 0
|
return o == 0
|
||||||
|
|
||||||
def EnumValStart(builder): builder.StartObject(5)
|
# EnumVal
|
||||||
|
def Attributes(self, j):
|
||||||
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
||||||
|
if o != 0:
|
||||||
|
x = self._tab.Vector(o)
|
||||||
|
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
||||||
|
x = self._tab.Indirect(x)
|
||||||
|
from reflection.KeyValue import KeyValue
|
||||||
|
obj = KeyValue()
|
||||||
|
obj.Init(self._tab.Bytes, x)
|
||||||
|
return obj
|
||||||
|
return None
|
||||||
|
|
||||||
|
# EnumVal
|
||||||
|
def AttributesLength(self):
|
||||||
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
||||||
|
if o != 0:
|
||||||
|
return self._tab.VectorLen(o)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# EnumVal
|
||||||
|
def AttributesIsNone(self):
|
||||||
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
||||||
|
return o == 0
|
||||||
|
|
||||||
|
def EnumValStart(builder): builder.StartObject(6)
|
||||||
def Start(builder):
|
def Start(builder):
|
||||||
return EnumValStart(builder)
|
return EnumValStart(builder)
|
||||||
def EnumValAddName(builder, name): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
|
def EnumValAddName(builder, name): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
|
||||||
@@ -91,6 +116,12 @@ def AddDocumentation(builder, documentation):
|
|||||||
def EnumValStartDocumentationVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
def EnumValStartDocumentationVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
||||||
def StartDocumentationVector(builder, numElems):
|
def StartDocumentationVector(builder, numElems):
|
||||||
return EnumValStartDocumentationVector(builder, numElems)
|
return EnumValStartDocumentationVector(builder, numElems)
|
||||||
|
def EnumValAddAttributes(builder, attributes): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)
|
||||||
|
def AddAttributes(builder, attributes):
|
||||||
|
return EnumValAddAttributes(builder, attributes)
|
||||||
|
def EnumValStartAttributesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
||||||
|
def StartAttributesVector(builder, numElems):
|
||||||
|
return EnumValStartAttributesVector(builder, numElems)
|
||||||
def EnumValEnd(builder): return builder.EndObject()
|
def EnumValEnd(builder): return builder.EndObject()
|
||||||
def End(builder):
|
def End(builder):
|
||||||
return EnumValEnd(builder)
|
return EnumValEnd(builder)
|
||||||
@@ -113,6 +113,15 @@ class Table(object):
|
|||||||
numpy_dtype = N.to_numpy_type(flags)
|
numpy_dtype = N.to_numpy_type(flags)
|
||||||
return encode.GetVectorAsNumpy(numpy_dtype, self.Bytes, length, offset)
|
return encode.GetVectorAsNumpy(numpy_dtype, self.Bytes, length, offset)
|
||||||
|
|
||||||
|
def GetArrayAsNumpy(self, flags, off, length):
|
||||||
|
"""
|
||||||
|
GetArrayAsNumpy returns the array with fixed width that starts at `Vector(offset)`
|
||||||
|
with length `length` as a numpy array with the type specified by `flags`. The
|
||||||
|
array is a `view` into Bytes so modifying the returned will modify Bytes in place.
|
||||||
|
"""
|
||||||
|
numpy_dtype = N.to_numpy_type(flags)
|
||||||
|
return encode.GetVectorAsNumpy(numpy_dtype, self.Bytes, length, off)
|
||||||
|
|
||||||
def GetVOffsetTSlot(self, slot, d):
|
def GetVOffsetTSlot(self, slot, d):
|
||||||
"""
|
"""
|
||||||
GetVOffsetTSlot retrieves the VOffsetT that the given vtable location
|
GetVOffsetTSlot retrieves the VOffsetT that the given vtable location
|
||||||
@@ -125,5 +134,5 @@ class Table(object):
|
|||||||
|
|
||||||
off = self.Offset(slot)
|
off = self.Offset(slot)
|
||||||
if off == 0:
|
if off == 0:
|
||||||
return d
|
return d
|
||||||
return off
|
return off
|
||||||
|
|||||||
@@ -12,54 +12,14 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import fileinput
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from datetime import datetime
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
|
|
||||||
def _update_version_attr(new_version):
|
|
||||||
for line in fileinput.input('flatbuffers/_version.py', inplace=True):
|
|
||||||
if line.startswith('__version__'):
|
|
||||||
line = re.sub(r'".*"', '"{}"'.format(new_version), line)
|
|
||||||
sys.stdout.write(line)
|
|
||||||
|
|
||||||
|
|
||||||
def version():
|
|
||||||
version = os.getenv('VERSION', None)
|
|
||||||
if version:
|
|
||||||
# Most git tags are prefixed with 'v' (example: v1.2.3) this is
|
|
||||||
# never desirable for artifact repositories, so we strip the
|
|
||||||
# leading 'v' if it's present.
|
|
||||||
version = version[1:] if version.startswith('v') else version
|
|
||||||
else:
|
|
||||||
# Default version is an ISO8601 compiliant datetime. PyPI doesn't allow
|
|
||||||
# the colon ':' character in its versions, and time is required to allow
|
|
||||||
# for multiple publications to master in one day. This datetime string
|
|
||||||
# uses the "basic" ISO8601 format for both its date and time components
|
|
||||||
# to avoid issues with the colon character (ISO requires that date and
|
|
||||||
# time components of a date-time string must be uniformly basic or
|
|
||||||
# extended, which is why the date component does not have dashes.
|
|
||||||
#
|
|
||||||
# Publications using datetime versions should only be made from master
|
|
||||||
# to represent the HEAD moving forward.
|
|
||||||
version = datetime.utcnow().strftime('%Y%m%d%H%M%S')
|
|
||||||
print("VERSION environment variable not set, using datetime instead: {}"
|
|
||||||
.format(version))
|
|
||||||
|
|
||||||
_update_version_attr(version)
|
|
||||||
|
|
||||||
return version
|
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='flatbuffers',
|
name='flatbuffers',
|
||||||
version=version(),
|
version='22.10.26',
|
||||||
license='Apache 2.0',
|
license='Apache 2.0',
|
||||||
author='FlatBuffers Contributors',
|
author='Derek Bailey',
|
||||||
author_email='me@rwinslow.com',
|
author_email='derekbailey@google.com',
|
||||||
url='https://google.github.io/flatbuffers/',
|
url='https://google.github.io/flatbuffers/',
|
||||||
long_description=('Python runtime library for use with the '
|
long_description=('Python runtime library for use with the '
|
||||||
'`Flatbuffers <https://google.github.io/flatbuffers/>`_ '
|
'`Flatbuffers <https://google.github.io/flatbuffers/>`_ '
|
||||||
@@ -81,4 +41,4 @@ setup(
|
|||||||
'Documentation': 'https://google.github.io/flatbuffers/',
|
'Documentation': 'https://google.github.io/flatbuffers/',
|
||||||
'Source': 'https://github.com/google/flatbuffers',
|
'Source': 'https://github.com/google/flatbuffers',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
45
readme.md
45
readme.md
@@ -20,33 +20,46 @@ maximum memory efficiency. It allows you to directly access serialized data with
|
|||||||
* MacOS X
|
* MacOS X
|
||||||
* Linux
|
* Linux
|
||||||
* Android
|
* Android
|
||||||
* And any others with a recent C++ compiler.
|
* And any others with a recent C++ compiler (C++ 11 and newer)
|
||||||
|
|
||||||
## Supported programming languages
|
## Supported programming languages
|
||||||
* C++
|
|
||||||
* C#
|
Code generation and runtime libraries for many popular languages.
|
||||||
* C
|
|
||||||
* Dart
|
1. C
|
||||||
* Go
|
1. C++ - [snapcraft.io](https://snapcraft.io/flatbuffers)
|
||||||
* Java
|
1. C# - [nuget.org](https://www.nuget.org/packages/Google.FlatBuffers)
|
||||||
* JavaScript
|
1. Dart - [pub.dev](https://pub.dev/packages/flat_buffers)
|
||||||
* Lobster
|
1. Go - [go.dev](https://pkg.go.dev/github.com/google/flatbuffers/go)
|
||||||
* Lua
|
1. Java - [Maven](https://search.maven.org/artifact/com.google.flatbuffers/flatbuffers-java)
|
||||||
* PHP
|
1. JavaScript - [NPM](https://www.npmjs.com/package/flatbuffers)
|
||||||
* Python
|
1. Kotlin
|
||||||
* Rust
|
1. Lobster
|
||||||
* Swift
|
1. Lua
|
||||||
* TypeScript
|
1. PHP
|
||||||
|
1. Python - [PyPi](https://pypi.org/project/flatbuffers/)
|
||||||
|
1. Rust - [crates.io](https://crates.io/crates/flatbuffers)
|
||||||
|
1. Swift
|
||||||
|
1. TypeScript - [NPM](https://www.npmjs.com/package/flatbuffers)
|
||||||
|
|
||||||
*and more in progress...*
|
*and more in progress...*
|
||||||
|
|
||||||
|
1. [Nim](https://github.com/google/flatbuffers/pull/7362)
|
||||||
|
|
||||||
## Contribution
|
## Contribution
|
||||||
* [FlatBuffers Google Group][] to discuss FlatBuffers with other developers and users.
|
|
||||||
* [FlatBuffers Issues Tracker][] to submit an issue.
|
* [FlatBuffers Issues Tracker][] to submit an issue.
|
||||||
* [stackoverflow.com][] with [`flatbuffers` tag][] for any questions regarding FlatBuffers.
|
* [stackoverflow.com][] with [`flatbuffers` tag][] for any questions regarding FlatBuffers.
|
||||||
|
|
||||||
*To contribute to this project,* see [CONTRIBUTING][].
|
*To contribute to this project,* see [CONTRIBUTING][].
|
||||||
|
|
||||||
|
## Community
|
||||||
|
|
||||||
|
* [FlatBuffers Google Group][] to discuss FlatBuffers with other developers and users.
|
||||||
|
* [Discord Server](https:///discord.gg/6qgKs3R)
|
||||||
|
* [Gitter](https://gitter.im/google/flatbuffers)
|
||||||
|
|
||||||
|
|
||||||
## Security
|
## Security
|
||||||
|
|
||||||
Please see our [Security Policy](SECURITY.md) for reporting vulnerabilities.
|
Please see our [Security Policy](SECURITY.md) for reporting vulnerabilities.
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ table EnumVal {
|
|||||||
object:Object (deprecated);
|
object:Object (deprecated);
|
||||||
union_type:Type;
|
union_type:Type;
|
||||||
documentation:[string];
|
documentation:[string];
|
||||||
|
attributes:[KeyValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
table Enum {
|
table Enum {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "flatbuffers"
|
name = "flatbuffers"
|
||||||
version = "2.1.2"
|
version = "22.9.29"
|
||||||
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"
|
||||||
@@ -12,15 +12,13 @@ categories = ["encoding", "data-structures", "memory-management"]
|
|||||||
rust = "1.51"
|
rust = "1.51"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["thiserror"]
|
default = ["std"]
|
||||||
no_std = ["core2", "thiserror_core2"]
|
std = []
|
||||||
serialize = ["serde"]
|
serialize = ["serde"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
smallvec = "1.6.1"
|
|
||||||
bitflags = "1.2.1"
|
bitflags = "1.2.1"
|
||||||
serde = { version = "1.0", optional = true }
|
serde = { version = "1.0", optional = true }
|
||||||
thiserror = { version = "1.0.30", optional = true }
|
|
||||||
core2 = { version = "0.4.0", optional = true }
|
[build-dependencies]
|
||||||
# This version is compliant with mainline 1.0.30
|
rustc_version = "0.4.0"
|
||||||
thiserror_core2 = { version = "2.0.0", default-features = false, optional = true }
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user