├── python
├── __init__.py
├── .gitignore
├── setup.cfg
└── flatbuffers
│ ├── __init__.py
│ └── packer.py
├── tests
├── MyGame
│ ├── __init__.py
│ ├── Example
│ │ ├── __init__.py
│ │ ├── TestEnum.py
│ │ ├── Race.py
│ │ ├── Race.lua
│ │ ├── AnyUniqueAliases.lua
│ │ ├── Any.lua
│ │ ├── AnyAmbiguousAliases.lua
│ │ ├── Color.py
│ │ ├── TestEnum.cs
│ │ ├── Race.cs
│ │ ├── Color.lua
│ │ ├── TestEnum.java
│ │ ├── TestEnum.kt
│ │ ├── Race.java
│ │ ├── AnyUniqueAliases.java
│ │ ├── AnyAmbiguousAliases.java
│ │ ├── AnyUniqueAliases.kt
│ │ ├── Race.kt
│ │ ├── AnyAmbiguousAliases.kt
│ │ ├── Color.cs
│ │ ├── Any.java
│ │ ├── Any.kt
│ │ ├── Race.php
│ │ ├── AnyUniqueAliases.php
│ │ ├── Color.java
│ │ ├── AnyAmbiguousAliases.php
│ │ ├── Race.go
│ │ ├── Any.php
│ │ ├── Color.php
│ │ ├── Color.kt
│ │ ├── Color.go
│ │ ├── Test.lua
│ │ ├── Ability.lua
│ │ ├── AnyAmbiguousAliases.py
│ │ ├── AnyUniqueAliases.py
│ │ ├── Any.py
│ │ ├── Test.kt
│ │ ├── Ability.kt
│ │ ├── Referrable.lua
│ │ ├── Ability.php
│ │ ├── Test.php
│ │ ├── Test.java
│ │ ├── TestSimpleTableWithEnum.lua
│ │ ├── Ability.java
│ │ ├── Test.go
│ │ └── Stat.lua
│ ├── Example2
│ │ ├── __init__.py
│ │ ├── Monster.lua
│ │ ├── Monster.kt
│ │ ├── Monster.go
│ │ └── Monster.java
│ ├── InParentNamespace.lua
│ ├── InParentNamespace.kt
│ ├── InParentNamespace.go
│ └── InParentNamespace.java
├── FlatBuffers.Test
│ ├── Resources
│ │ └── .gitkeep
│ ├── packages.config
│ ├── FlatBuffersTestMethodAttribute.cs
│ ├── FlatBuffersTestClassAttribute.cs
│ ├── Lcg.cs
│ └── NetTest.sh
├── namespace_test
│ ├── NamespaceA
│ │ ├── __init__.py
│ │ ├── NamespaceB
│ │ │ ├── __init__.py
│ │ │ ├── EnumInNestedNS.py
│ │ │ ├── EnumInNestedNS.lua
│ │ │ ├── EnumInNestedNS.cs
│ │ │ ├── EnumInNestedNS.java
│ │ │ ├── EnumInNestedNS.kt
│ │ │ ├── EnumInNestedNS.php
│ │ │ ├── EnumInNestedNS.go
│ │ │ ├── StructInNestedNS.lua
│ │ │ ├── StructInNestedNS.kt
│ │ │ ├── TableInNestedNS.lua
│ │ │ ├── StructInNestedNS.php
│ │ │ └── StructInNestedNS.java
│ │ ├── SecondTableInA.lua
│ │ ├── TableInC.py
│ │ └── TableInC.go
│ ├── NamespaceC
│ │ └── __init__.py
│ ├── namespace_test1.fbs
│ ├── namespace_test2.fbs
│ └── namespace_test1_generated.lobster
├── docker
│ ├── TODO.Dockerfile.testing.python.cpython_with_conda
│ ├── TODO.Dockerfile.testing.python.cpython_with_numpy
│ ├── languages
│ │ ├── Dockerfile.testing.golang.1_11
│ │ ├── Dockerfile.testing.rust.1_37_0
│ │ ├── Dockerfile.testing.java.openjdk_10_0_2
│ │ ├── Dockerfile.testing.java.openjdk_11_0_1
│ │ ├── Dockerfile.testing.swift_5_1
│ │ ├── Dockerfile.testing.csharp.mono_5_18
│ │ ├── Dockerfile.testing.php.zend_7_3
│ │ ├── Dockerfile.testing.python.cpython_2_7_15
│ │ ├── Dockerfile.testing.python.cpython_3_7_1
│ │ ├── Dockerfile.testing.python.numpy.cpython_3_7_1
│ │ ├── Dockerfile.testing.python.numpy.cpython_2_7_15
│ │ ├── Dockerfile.testing.node.10_13_0
│ │ ├── Dockerfile.testing.node.11_2_0
│ │ └── Dockerfile.testing.rust.big_endian.1_37_0
│ ├── TODO.Dockerfile.testing.python.pypy_6_0_0_py2
│ ├── TODO.Dockerfile.testing.python.pypy_6_0_0_py3
│ ├── Dockerfile.testing.build_flatc_debian_stretch
│ ├── Dockerfile.testing.cpp.debian_buster
│ ├── build_flatc.run.sh
│ ├── cpp_test.run.sh
│ └── TODO.Dockerfile.testing.php.hhvm_2019_01_16
├── javatest.bin
├── arrays_test.bfbs
├── monster_test.bfbs
├── monsterdata_test.mon
├── monsterdata_python_wire.mon
├── prototest
│ ├── imported.proto
│ ├── test_include.golden
│ ├── test.golden
│ ├── test_union_include.golden
│ ├── test_union.golden
│ ├── test_suffix.golden
│ └── test_union_suffix.golden
├── FlatBuffers.GRPC.Swift
│ ├── README.md
│ ├── Sources
│ │ └── Model
│ │ │ └── greeter.fbs
│ └── Package.swift
├── FlatBuffers.Test.Swift
│ ├── monsterdata_test.mon
│ ├── Tests
│ │ └── LinuxMain.swift
│ ├── SwiftTest.sh
│ └── Package.swift
├── LuaTest.bat
├── phpUnionVectorTest.sh
├── include_test
│ ├── include_test1.fbs
│ └── sub
│ │ └── include_test2.fbs
├── native_type_test.fbs
├── fuzzer
│ ├── fuzzer_assert.h
│ └── flatbuffers_verifier_fuzzer.cc
├── evolution_test
│ ├── evolution_v1.json
│ ├── evolution_v1.fbs
│ ├── evolution_v2.json
│ └── evolution_v2.fbs
├── native_type_test_impl.cpp
├── union_vector
│ ├── union_vector.json
│ ├── Character.java
│ ├── Character.kt
│ ├── union_vector.fbs
│ ├── Character.php
│ ├── Rapunzel.kt
│ ├── BookReader.kt
│ ├── Rapunzel.php
│ ├── BookReader.php
│ ├── Rapunzel.java
│ ├── BookReader.java
│ └── Rapunzel.cs
├── arrays_test.fbs
├── monsterdata_extra.json
├── arrays_test.golden
├── unicode_test.json
├── FlatBuffers.Benchmarks.swift
│ └── Package.swift
├── monster_extra.fbs
├── rust_usage_test
│ ├── Cargo.toml
│ └── bin
│ │ └── monster_example.rs
├── native_type_test_impl.h
├── JavaScriptTest.sh
├── LuaTest.sh
├── FlatBuffers.Benchmarks
│ ├── FlatBuffers.Benchmarks.csproj
│ └── Program.cs
├── RustTest.bat
├── JavaTest.bat
├── TestAll.sh
├── JavaTest.sh
├── DartTest.sh
├── RustTest.sh
├── monsterdata_test.golden
├── TypeScriptTest.sh
├── monsterdata_test.json
└── KotlinTest.sh
├── docs
├── source
│ ├── CONTRIBUTING.md
│ ├── groups
│ ├── gRPC
│ │ └── CppUsage.md
│ ├── README_TO_GENERATE_DOCS.md
│ └── GoApi.md
├── images
│ ├── ftv2mnode.png
│ ├── ftv2pnode.png
│ └── fpl_logo_small.png
└── footer.html
├── samples
├── monster.bfbs
├── android
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── jni
│ │ ├── schemas
│ │ │ └── animal.fbs
│ │ └── Application.mk
│ └── res
│ │ └── values
│ │ └── strings.xml
├── lua
│ └── MyGame
│ │ └── Sample
│ │ ├── Equipment.lua
│ │ ├── Color.lua
│ │ ├── Vec3.lua
│ │ └── Weapon.lua
├── monsterdata.json
├── monster.fbs
├── android_sample.sh
└── sample_text.lobster
├── .gitattributes
├── go
├── doc.go
├── struct.go
├── lib.go
├── BUILD.bazel
└── grpc.go
├── android
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── jni
│ ├── main.cpp
│ └── Application.mk
├── .project
└── res
│ └── values
│ └── strings.xml
├── grpc
├── tests
│ └── java-grpc-test.sh
├── samples
│ └── greeter
│ │ ├── greeter.fbs
│ │ └── Makefile
├── build_grpc.sh
├── src
│ └── compiler
│ │ └── python_generator.h
├── README.md
└── flatbuffers-java-grpc
│ └── pom.xml
├── lua
├── flatbuffers.lua
└── flatbuffers
│ └── compat.lua
├── conan
├── appveyor
│ ├── build.py
│ └── install.py
├── travis
│ ├── build.sh
│ └── install.sh
├── test_package
│ ├── CMakeLists.txt
│ ├── conanfile.py
│ └── test_package.cpp
└── CMakeLists.txt
├── CMake
├── FlatbuffersConfig.cmake
├── DESCRIPTION.txt
├── FlatbuffersConfigVersion.cmake.in
├── Version.cmake
└── PackageRedhat.cmake
├── .editorconfig
├── src
├── clang-format-all.sh
└── clang-format-git.sh
├── dart
├── CHANGELOG.md
├── pubspec.yaml
├── README.md
└── publish.sh
├── swift
├── README.md
├── Sources
│ └── FlatBuffers
│ │ ├── Offset.swift
│ │ ├── Struct.swift
│ │ ├── FlatBuffersUtils.swift
│ │ └── Int+extension.swift
├── Package.swift
└── FlatBuffers.podspec
├── .bazelci
└── presubmit.yml
├── .clang-format
├── .travis
├── deploy-python.sh
├── check-sources.sh
├── check-sources.sh.py
└── check-generate-code.sh
├── composer.json
├── net
└── FlatBuffers
│ ├── FlatBuffers.Core.csproj
│ ├── IFlatbufferObject.cs
│ ├── Struct.cs
│ ├── ByteBufferUtil.cs
│ ├── Offset.cs
│ └── FlatBufferConstants.cs
├── rust
└── flatbuffers
│ └── Cargo.toml
├── .github
├── ISSUE_TEMPLATE.md
├── stale.yml
└── PULL_REQUEST_TEMPLATE.md
├── WORKSPACE
├── php
├── Constants.php
└── Struct.php
├── reflection
├── generate_code.bat
└── generate_code.sh
├── snap
└── snapcraft.yaml
└── package.json
/python/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/MyGame/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/MyGame/Example/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/MyGame/Example2/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/FlatBuffers.Test/Resources/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/namespace_test/NamespaceA/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/namespace_test/NamespaceC/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/docs/source/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ../../CONTRIBUTING.md
--------------------------------------------------------------------------------
/python/.gitignore:
--------------------------------------------------------------------------------
1 | /dist/
2 | /*.egg-info/
3 |
--------------------------------------------------------------------------------
/python/setup.cfg:
--------------------------------------------------------------------------------
1 | [bdist_wheel]
2 | universal=1
3 |
--------------------------------------------------------------------------------
/tests/namespace_test/NamespaceA/NamespaceB/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/docker/TODO.Dockerfile.testing.python.cpython_with_conda:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/docker/TODO.Dockerfile.testing.python.cpython_with_numpy:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/samples/monster.bfbs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LUX/flatbuffers/master/samples/monster.bfbs
--------------------------------------------------------------------------------
/tests/javatest.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LUX/flatbuffers/master/tests/javatest.bin
--------------------------------------------------------------------------------
/tests/arrays_test.bfbs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LUX/flatbuffers/master/tests/arrays_test.bfbs
--------------------------------------------------------------------------------
/docs/images/ftv2mnode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LUX/flatbuffers/master/docs/images/ftv2mnode.png
--------------------------------------------------------------------------------
/docs/images/ftv2pnode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LUX/flatbuffers/master/docs/images/ftv2pnode.png
--------------------------------------------------------------------------------
/tests/monster_test.bfbs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LUX/flatbuffers/master/tests/monster_test.bfbs
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Set the default behavior, in case people don't have core.autocrlf set.
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/tests/monsterdata_test.mon:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LUX/flatbuffers/master/tests/monsterdata_test.mon
--------------------------------------------------------------------------------
/docs/images/fpl_logo_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LUX/flatbuffers/master/docs/images/fpl_logo_small.png
--------------------------------------------------------------------------------
/tests/monsterdata_python_wire.mon:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LUX/flatbuffers/master/tests/monsterdata_python_wire.mon
--------------------------------------------------------------------------------
/go/doc.go:
--------------------------------------------------------------------------------
1 | // Package flatbuffers provides facilities to read and write flatbuffers
2 | // objects.
3 | package flatbuffers
4 |
--------------------------------------------------------------------------------
/tests/prototest/imported.proto:
--------------------------------------------------------------------------------
1 | package proto.test;
2 |
3 | message ImportedMessage {
4 | optional int32 a = 26;
5 | }
6 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LUX/flatbuffers/master/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/grpc/tests/java-grpc-test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # NOTE: make sure `mvn install` in /gprc is executed before running this test
4 | mvn test
5 |
--------------------------------------------------------------------------------
/samples/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LUX/flatbuffers/master/samples/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/tests/FlatBuffers.GRPC.Swift/README.md:
--------------------------------------------------------------------------------
1 | # FlatBuffers.GRPC.Swift
2 |
3 | The following is Swift example on how GRPC would be with Swift Flatbuffers
4 |
--------------------------------------------------------------------------------
/tests/FlatBuffers.Test.Swift/monsterdata_test.mon:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LUX/flatbuffers/master/tests/FlatBuffers.Test.Swift/monsterdata_test.mon
--------------------------------------------------------------------------------
/tests/LuaTest.bat:
--------------------------------------------------------------------------------
1 | set buildtype=Release
2 | if "%1"=="-b" set buildtype=%2
3 |
4 | ..\%buildtype%\flatc.exe --lua -I include_test monster_test.fbs
5 |
6 | lua53.exe luatest.lua
--------------------------------------------------------------------------------
/tests/FlatBuffers.Test/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/go/struct.go:
--------------------------------------------------------------------------------
1 | package flatbuffers
2 |
3 | // Struct wraps a byte slice and provides read access to its data.
4 | //
5 | // Structs do not have a vtable.
6 | type Struct struct {
7 | Table
8 | }
9 |
--------------------------------------------------------------------------------
/tests/phpUnionVectorTest.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | ../flatc --php -o php union_vector/union_vector.fbs
6 | php phpUnionVectorTest.php
7 |
8 | echo 'PHP union vector test passed'
9 |
--------------------------------------------------------------------------------
/tests/docker/languages/Dockerfile.testing.golang.1_11:
--------------------------------------------------------------------------------
1 | FROM golang:1.11-stretch as base
2 | WORKDIR /code
3 | ADD . .
4 | RUN cp flatc_debian_stretch flatc
5 | WORKDIR /code/tests
6 | RUN go version
7 | RUN ./GoTest.sh
8 |
--------------------------------------------------------------------------------
/tests/MyGame/Example/TestEnum.py:
--------------------------------------------------------------------------------
1 | # automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | # namespace: Example
4 |
5 | class TestEnum(object):
6 | A = 0
7 | B = 1
8 | C = 2
9 |
10 |
--------------------------------------------------------------------------------
/tests/FlatBuffers.Test.Swift/Tests/LinuxMain.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 |
3 | import FlatBuffers_Test_SwiftTests
4 |
5 | var tests = [XCTestCaseEntry]()
6 | tests += FlatBuffers_Test_SwiftTests.__allTests()
7 |
8 | XCTMain(tests)
9 |
--------------------------------------------------------------------------------
/tests/docker/TODO.Dockerfile.testing.python.pypy_6_0_0_py2:
--------------------------------------------------------------------------------
1 | FROM pypy:2-6.0.0-slim as base
2 | WORKDIR /code
3 | ADD . .
4 | RUN cp flatc_debian_stretch flatc
5 | WORKDIR /code/tests
6 | RUN pypy --version
7 | RUN ./PythonTest.sh
8 |
--------------------------------------------------------------------------------
/tests/docker/TODO.Dockerfile.testing.python.pypy_6_0_0_py3:
--------------------------------------------------------------------------------
1 | FROM pypy:3-6.0.0-slim as base
2 | WORKDIR /code
3 | ADD . .
4 | RUN cp flatc_debian_stretch flatc
5 | WORKDIR /code/tests
6 | RUN pypy --version
7 | RUN ./PythonTest.sh
8 |
--------------------------------------------------------------------------------
/tests/docker/languages/Dockerfile.testing.rust.1_37_0:
--------------------------------------------------------------------------------
1 | FROM rust:1.37.0-slim-stretch as base
2 | WORKDIR /code
3 | ADD . .
4 | RUN cp flatc_debian_stretch flatc
5 | WORKDIR /code/tests
6 | RUN rustc --version
7 | RUN ./RustTest.sh
8 |
--------------------------------------------------------------------------------
/lua/flatbuffers.lua:
--------------------------------------------------------------------------------
1 | local m = {}
2 |
3 | m.Builder = require("flatbuffers.builder").New
4 | m.N = require("flatbuffers.numTypes")
5 | m.view = require("flatbuffers.view")
6 | m.binaryArray = require("flatbuffers.binaryarray")
7 |
8 | return m
--------------------------------------------------------------------------------
/tests/docker/languages/Dockerfile.testing.java.openjdk_10_0_2:
--------------------------------------------------------------------------------
1 | FROM openjdk:10.0.2-jdk-slim-sid as base
2 | WORKDIR /code
3 | ADD . .
4 | RUN cp flatc_debian_stretch flatc
5 | WORKDIR /code/tests
6 | RUN java -version
7 | RUN ./JavaTest.sh
8 |
--------------------------------------------------------------------------------
/tests/docker/languages/Dockerfile.testing.java.openjdk_11_0_1:
--------------------------------------------------------------------------------
1 | FROM openjdk:11.0.1-jdk-slim-sid as base
2 | WORKDIR /code
3 | ADD . .
4 | RUN cp flatc_debian_stretch flatc
5 | WORKDIR /code/tests
6 | RUN java -version
7 | RUN ./JavaTest.sh
8 |
--------------------------------------------------------------------------------
/conan/appveyor/build.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | import os
4 |
5 | if os.getenv("APPVEYOR_REPO_TAG") != "true":
6 | print("Skip build step. It's not TAG")
7 | else:
8 | os.system("python conan/build.py")
9 |
--------------------------------------------------------------------------------
/tests/MyGame/Example/Race.py:
--------------------------------------------------------------------------------
1 | # automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | # namespace: Example
4 |
5 | class Race(object):
6 | None_ = -1
7 | Human = 0
8 | Dwarf = 1
9 | Elf = 2
10 |
11 |
--------------------------------------------------------------------------------
/conan/appveyor/install.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | import os
4 |
5 | if os.getenv("APPVEYOR_REPO_TAG") != "true":
6 | print("Skip step. It's not TAG")
7 | else:
8 | os.system("pip install conan conan-package-tools")
9 |
--------------------------------------------------------------------------------
/tests/docker/languages/Dockerfile.testing.swift_5_1:
--------------------------------------------------------------------------------
1 | FROM swift:5.1
2 | WORKDIR /code
3 | ADD . .
4 | RUN cp flatc_debian_stretch flatc
5 | WORKDIR /code/tests
6 | RUN swift --version
7 | WORKDIR /code/tests/FlatBuffers.Test.Swift
8 | RUN sh SwiftTest.sh
9 |
--------------------------------------------------------------------------------
/tests/include_test/include_test1.fbs:
--------------------------------------------------------------------------------
1 | include "sub/include_test2.fbs";
2 | include "sub/include_test2.fbs"; // should be skipped
3 | include "include_test1.fbs"; // should be skipped
4 |
5 | table TableA {
6 | b:MyGame.OtherNameSpace.TableB;
7 | }
8 |
--------------------------------------------------------------------------------
/CMake/FlatbuffersConfig.cmake:
--------------------------------------------------------------------------------
1 | include("${CMAKE_CURRENT_LIST_DIR}/FlatbuffersTargets.cmake" OPTIONAL)
2 | include("${CMAKE_CURRENT_LIST_DIR}/FlatcTargets.cmake" OPTIONAL)
3 | include("${CMAKE_CURRENT_LIST_DIR}/FlatbuffersSharedTargets.cmake" OPTIONAL)
4 |
5 |
--------------------------------------------------------------------------------
/tests/docker/languages/Dockerfile.testing.csharp.mono_5_18:
--------------------------------------------------------------------------------
1 | FROM mono:5.18 as base
2 | WORKDIR /code
3 | ADD . .
4 | RUN cp flatc_debian_stretch flatc
5 | WORKDIR /code/tests
6 | RUN mono --version
7 | WORKDIR /code/tests/FlatBuffers.Test
8 | RUN sh NetTest.sh
9 |
--------------------------------------------------------------------------------
/tests/docker/languages/Dockerfile.testing.php.zend_7_3:
--------------------------------------------------------------------------------
1 | FROM php:7.3-cli-stretch as base
2 | WORKDIR /code
3 | ADD . .
4 | RUN cp flatc_debian_stretch flatc
5 | WORKDIR /code/tests
6 | RUN php --version
7 | RUN php phpTest.php
8 | RUN sh phpUnionVectorTest.sh
9 |
--------------------------------------------------------------------------------
/tests/namespace_test/NamespaceA/NamespaceB/EnumInNestedNS.py:
--------------------------------------------------------------------------------
1 | # automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | # namespace: NamespaceB
4 |
5 | class EnumInNestedNS(object):
6 | A = 0
7 | B = 1
8 | C = 2
9 |
10 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 | # Don't set line endings to avoid conflict with core.autocrlf flag.
3 | # Line endings on checkout/checkin are controlled by .gitattributes file.
4 | [*]
5 | indent_style = space
6 | indent_size = 2
7 | insert_final_newline = true
8 |
--------------------------------------------------------------------------------
/samples/lua/MyGame/Sample/Equipment.lua:
--------------------------------------------------------------------------------
1 | -- automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | -- namespace: Sample
4 |
5 | local Equipment = {
6 | NONE = 0,
7 | Weapon = 1,
8 | }
9 |
10 | return Equipment -- return the module
--------------------------------------------------------------------------------
/samples/lua/MyGame/Sample/Color.lua:
--------------------------------------------------------------------------------
1 | -- automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | -- namespace: Sample
4 |
5 | local Color = {
6 | Red = 0,
7 | Green = 1,
8 | Blue = 2,
9 | }
10 |
11 | return Color -- return the module
--------------------------------------------------------------------------------
/tests/docker/languages/Dockerfile.testing.python.cpython_2_7_15:
--------------------------------------------------------------------------------
1 | FROM python:2.7.15-slim-stretch as base
2 | WORKDIR /code
3 | ADD . .
4 | RUN cp flatc_debian_stretch flatc
5 | WORKDIR /code/tests
6 | RUN python --version
7 | RUN pip install coverage
8 | RUN ./PythonTest.sh
9 |
--------------------------------------------------------------------------------
/tests/docker/languages/Dockerfile.testing.python.cpython_3_7_1:
--------------------------------------------------------------------------------
1 | FROM python:3.7.1-slim-stretch as base
2 | WORKDIR /code
3 | ADD . .
4 | RUN cp flatc_debian_stretch flatc
5 | WORKDIR /code/tests
6 | RUN python --version
7 | RUN pip install coverage
8 | RUN ./PythonTest.sh
9 |
--------------------------------------------------------------------------------
/CMake/DESCRIPTION.txt:
--------------------------------------------------------------------------------
1 | FlatBuffers is a cross platform serialization library architected for
2 | maximum memory efficiency. It allows you to directly access serialized
3 | data without parsing/unpacking it first, while still having great
4 | forwards/backwards compatibility.
5 |
--------------------------------------------------------------------------------
/tests/namespace_test/namespace_test1.fbs:
--------------------------------------------------------------------------------
1 | namespace NamespaceA.NamespaceB;
2 |
3 | table TableInNestedNS
4 | {
5 | foo:int;
6 | }
7 |
8 | enum EnumInNestedNS:byte
9 | {
10 | A, B, C
11 | }
12 |
13 | struct StructInNestedNS
14 | {
15 | a:int;
16 | b:int;
17 | }
--------------------------------------------------------------------------------
/tests/MyGame/Example/Race.lua:
--------------------------------------------------------------------------------
1 | -- automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | -- namespace: Example
4 |
5 | local Race = {
6 | None = -1,
7 | Human = 0,
8 | Dwarf = 1,
9 | Elf = 2,
10 | }
11 |
12 | return Race -- return the module
--------------------------------------------------------------------------------
/conan/travis/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 | set -x
5 |
6 | if [[ "$(uname -s)" == 'Darwin' ]]; then
7 | if which pyenv > /dev/null; then
8 | eval "$(pyenv init -)"
9 | fi
10 | pyenv activate conan
11 | fi
12 |
13 | conan user
14 | python conan/build.py
15 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 19 11:54:59 PDT 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
7 |
--------------------------------------------------------------------------------
/samples/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jun 19 11:54:59 PDT 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
7 |
--------------------------------------------------------------------------------
/tests/namespace_test/NamespaceA/NamespaceB/EnumInNestedNS.lua:
--------------------------------------------------------------------------------
1 | -- automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | -- namespace: NamespaceB
4 |
5 | local EnumInNestedNS = {
6 | A = 0,
7 | B = 1,
8 | C = 2,
9 | }
10 |
11 | return EnumInNestedNS -- return the module
--------------------------------------------------------------------------------
/tests/MyGame/Example/AnyUniqueAliases.lua:
--------------------------------------------------------------------------------
1 | -- automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | -- namespace: Example
4 |
5 | local AnyUniqueAliases = {
6 | NONE = 0,
7 | M = 1,
8 | TS = 2,
9 | M2 = 3,
10 | }
11 |
12 | return AnyUniqueAliases -- return the module
--------------------------------------------------------------------------------
/tests/docker/Dockerfile.testing.build_flatc_debian_stretch:
--------------------------------------------------------------------------------
1 | FROM debian:9.6-slim as base
2 | RUN apt -qq update >/dev/null
3 | RUN apt -qq install -y cmake make build-essential >/dev/null
4 | FROM base
5 | WORKDIR /code
6 | ADD . .
7 | RUN cmake -G "Unix Makefiles"
8 | RUN make flatc
9 | RUN ls flatc
10 |
--------------------------------------------------------------------------------
/tests/docker/languages/Dockerfile.testing.python.numpy.cpython_3_7_1:
--------------------------------------------------------------------------------
1 | FROM python:3.7.1-slim-stretch as base
2 | WORKDIR /code
3 | ADD . .
4 | RUN cp flatc_debian_stretch flatc
5 | WORKDIR /code/tests
6 | RUN python --version
7 | RUN pip install numpy
8 | RUN pip install coverage
9 | RUN ./PythonTest.sh
10 |
--------------------------------------------------------------------------------
/tests/include_test/sub/include_test2.fbs:
--------------------------------------------------------------------------------
1 | include "include_test1.fbs";
2 | include "sub/include_test2.fbs"; // should be skipped
3 |
4 | namespace MyGame.OtherNameSpace;
5 |
6 | enum FromInclude:long { IncludeVal }
7 |
8 | struct Unused { a:int; }
9 |
10 | table TableB {
11 | a:TableA;
12 | }
13 |
--------------------------------------------------------------------------------
/tests/MyGame/Example/Any.lua:
--------------------------------------------------------------------------------
1 | -- automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | -- namespace: Example
4 |
5 | local Any = {
6 | NONE = 0,
7 | Monster = 1,
8 | TestSimpleTableWithEnum = 2,
9 | MyGame_Example2_Monster = 3,
10 | }
11 |
12 | return Any -- return the module
--------------------------------------------------------------------------------
/tests/docker/languages/Dockerfile.testing.python.numpy.cpython_2_7_15:
--------------------------------------------------------------------------------
1 | FROM python:2.7.15-slim-stretch as base
2 | WORKDIR /code
3 | ADD . .
4 | RUN cp flatc_debian_stretch flatc
5 | WORKDIR /code/tests
6 | RUN python --version
7 | RUN pip install numpy
8 | RUN pip install coverage
9 | RUN ./PythonTest.sh
10 |
--------------------------------------------------------------------------------
/src/clang-format-all.sh:
--------------------------------------------------------------------------------
1 | # Running it twice corrects some bugs in clang-format.
2 | for run in {1..2}
3 | do
4 | clang-format -i -style=file include/flatbuffers/* src/*.cpp tests/*.cpp samples/*.cpp grpc/src/compiler/schema_interface.h grpc/tests/*.cpp
5 | done
6 | git checkout include/flatbuffers/reflection_generated.h
7 |
--------------------------------------------------------------------------------
/src/clang-format-git.sh:
--------------------------------------------------------------------------------
1 | # Running it twice corrects some bugs in clang-format.
2 | for run in {1..2}
3 | do
4 | git clang-format HEAD^ -- include/flatbuffers/* src/*.cpp tests/*.cpp samples/*.cpp grpc/src/compiler/schema_interface.h grpc/tests/*.cpp
5 | done
6 | git checkout include/flatbuffers/reflection_generated.h
7 |
--------------------------------------------------------------------------------
/tests/MyGame/Example/AnyAmbiguousAliases.lua:
--------------------------------------------------------------------------------
1 | -- automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | -- namespace: Example
4 |
5 | local AnyAmbiguousAliases = {
6 | NONE = 0,
7 | M1 = 1,
8 | M2 = 2,
9 | M3 = 3,
10 | }
11 |
12 | return AnyAmbiguousAliases -- return the module
--------------------------------------------------------------------------------
/tests/docker/languages/Dockerfile.testing.node.10_13_0:
--------------------------------------------------------------------------------
1 | FROM node:10.13.0-stretch as base
2 | WORKDIR /code
3 | ADD . .
4 | RUN cp flatc_debian_stretch flatc
5 | WORKDIR /code/tests
6 | RUN node --version
7 | RUN ../flatc -b -I include_test monster_test.fbs unicode_test.json
8 | RUN node JavaScriptTest ./monster_test_generated
9 |
--------------------------------------------------------------------------------
/tests/docker/languages/Dockerfile.testing.node.11_2_0:
--------------------------------------------------------------------------------
1 | FROM node:11.2.0-stretch as base
2 | WORKDIR /code
3 | ADD . .
4 | RUN cp flatc_debian_stretch flatc
5 | WORKDIR /code/tests
6 | RUN node --version
7 | RUN ../flatc -b -I include_test monster_test.fbs unicode_test.json
8 | RUN node JavaScriptTest ./monster_test_generated
9 |
--------------------------------------------------------------------------------
/tests/native_type_test.fbs:
--------------------------------------------------------------------------------
1 | native_include "native_type_test_impl.h";
2 |
3 | namespace Geometry;
4 |
5 | struct Vector3D (native_type:"Native::Vector3D") {
6 | x:float;
7 | y:float;
8 | z:float;
9 | }
10 |
11 | table ApplicationData {
12 | vectors:[Vector3D];
13 | }
14 |
15 | root_type ApplicationData;
16 |
--------------------------------------------------------------------------------
/tests/fuzzer/fuzzer_assert.h:
--------------------------------------------------------------------------------
1 | #ifndef FUZZER_ASSERT_IMPL_H_
2 | #define FUZZER_ASSERT_IMPL_H_
3 |
4 | // Declare Debug/Release independed assert macro.
5 | #define fuzzer_assert_impl(x) (!!(x) ? static_cast(0) : __builtin_trap())
6 |
7 | extern "C" void __builtin_trap(void);
8 |
9 | #endif // !FUZZER_ASSERT_IMPL_H_
10 |
--------------------------------------------------------------------------------
/dart/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # CHANGELOG
2 |
3 | ## 1.9.2
4 |
5 | - Ensure `_writeString` adds enough padding to null terminate strings.
6 |
7 | ## 1.9.1
8 |
9 | - Changed constant identifiers to be compatible with Dart 2.x
10 | - No longer supports Dart 1.x
11 |
12 | ## 1.9.0
13 |
14 | - Initial release, supports Dart 1.x and many dev versions of Dart 2.x
--------------------------------------------------------------------------------
/swift/README.md:
--------------------------------------------------------------------------------
1 | FlatBuffers swift can be found in both SPM
2 |
3 | `.package(url: "https://github.com/mustiikhalil/flatbuffers.git", .branch("swift"))`
4 |
5 | and Cocoapods
6 |
7 | `pod 'FlatBuffers', :git => 'https://github.com/mustiikhalil/flatbuffers.git' :branch => 'swift'`
8 |
9 | To report any error please use the main repository.
10 |
11 |
--------------------------------------------------------------------------------
/.bazelci/presubmit.yml:
--------------------------------------------------------------------------------
1 | ---
2 | buildifier: latest
3 | platforms:
4 | ubuntu1604:
5 | build_targets:
6 | - "..."
7 | test_targets:
8 | - "..."
9 | ubuntu1804:
10 | build_targets:
11 | - "..."
12 | test_targets:
13 | - "..."
14 | macos:
15 | build_targets:
16 | - "..."
17 | test_targets:
18 | - "..."
19 |
--------------------------------------------------------------------------------
/.clang-format:
--------------------------------------------------------------------------------
1 | ---
2 | Language: Cpp
3 | BasedOnStyle: Google
4 | DerivePointerAlignment: false
5 | PointerAlignment: Right
6 | IndentPPDirectives: AfterHash
7 | Cpp11BracedListStyle: false
8 | AlwaysBreakTemplateDeclarations: false
9 | AllowShortCaseLabelsOnASingleLine: true
10 | SpaceAfterTemplateKeyword: false
11 | AllowShortBlocksOnASingleLine: true
12 | ...
13 |
14 |
--------------------------------------------------------------------------------
/conan/test_package/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(test_package CXX)
2 | cmake_minimum_required(VERSION 2.8.11)
3 |
4 | include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
5 | conan_basic_setup()
6 |
7 | add_executable(${PROJECT_NAME} test_package.cpp)
8 | target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
9 | set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
10 |
--------------------------------------------------------------------------------
/grpc/samples/greeter/greeter.fbs:
--------------------------------------------------------------------------------
1 | table HelloReply {
2 | message:string;
3 | }
4 |
5 | table HelloRequest {
6 | name:string;
7 | }
8 |
9 | table ManyHellosRequest {
10 | name:string;
11 | num_greetings:int;
12 | }
13 |
14 | rpc_service Greeter {
15 | SayHello(HelloRequest):HelloReply;
16 | SayManyHellos(ManyHellosRequest):HelloReply (streaming: "server");
17 | }
18 |
--------------------------------------------------------------------------------
/tests/MyGame/Example/Color.py:
--------------------------------------------------------------------------------
1 | # automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | # namespace: Example
4 |
5 | # Composite components of Monster color.
6 | class Color(object):
7 | Red = 1
8 | # \brief color Green
9 | # Green is bit_flag with value (1u << 1)
10 | Green = 2
11 | # \brief color Blue (1u << 3)
12 | Blue = 8
13 |
14 |
--------------------------------------------------------------------------------
/tests/FlatBuffers.Test.Swift/SwiftTest.sh:
--------------------------------------------------------------------------------
1 | swift_dir=`pwd`
2 | cd ..
3 | test_dir=`pwd`
4 |
5 | ${test_dir}/../flatc --swift --gen-mutable -I ${test_dir}/include_test ${test_dir}/monster_test.fbs ${test_dir}/union_vector/union_vector.fbs
6 | cd ${test_dir}
7 | mv *_generated.swift ${swift_dir}/Tests/FlatBuffers.Test.SwiftTests
8 | cd ${swift_dir}
9 | swift build --build-tests
10 | swift test
--------------------------------------------------------------------------------
/.travis/deploy-python.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4 | PROD_REPOSITORY="https://upload.pypi.org/legacy/"
5 | TEST_REPOSITORY="https://test.pypi.org/legacy/"
6 |
7 | twine upload \
8 | --username "$PYPI_USERNAME" \
9 | --password "$PYPI_PASSWORD" \
10 | --repository-url "$PROD_REPOSITORY" \
11 | "$DIR/../python/dist/"*
12 |
13 |
--------------------------------------------------------------------------------
/tests/MyGame/Example/TestEnum.cs:
--------------------------------------------------------------------------------
1 | //
2 | // automatically generated by the FlatBuffers compiler, do not modify
3 | //
4 |
5 | namespace MyGame.Example
6 | {
7 |
8 | [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
9 | public enum TestEnum : sbyte
10 | {
11 | A = 0,
12 | B = 1,
13 | C = 2,
14 | };
15 |
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/samples/monsterdata.json:
--------------------------------------------------------------------------------
1 | {
2 | pos: {
3 | x: 1.0,
4 | y: 2.0,
5 | z: 3.0
6 | },
7 | hp: 300,
8 | name: "Orc",
9 | weapons: [
10 | {
11 | name: "axe",
12 | damage: 100
13 | },
14 | {
15 | name: "bow",
16 | damage: 90
17 | }
18 | ],
19 | equipped_type: "Weapon",
20 | equipped: {
21 | name: "bow",
22 | damage: 90
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/tests/FlatBuffers.GRPC.Swift/Sources/Model/greeter.fbs:
--------------------------------------------------------------------------------
1 | table HelloReply {
2 | message:string;
3 | }
4 |
5 | table HelloRequest {
6 | name:string;
7 | }
8 |
9 | table ManyHellosRequest {
10 | name:string;
11 | num_greetings:int;
12 | }
13 |
14 | rpc_service Greeter {
15 | SayHello(HelloRequest):HelloReply;
16 | SayManyHellos(ManyHellosRequest):HelloReply (streaming: "server");
17 | }
18 |
--------------------------------------------------------------------------------
/tests/MyGame/Example/Race.cs:
--------------------------------------------------------------------------------
1 | //
2 | // automatically generated by the FlatBuffers compiler, do not modify
3 | //
4 |
5 | namespace MyGame.Example
6 | {
7 |
8 | [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
9 | public enum Race : sbyte
10 | {
11 | None = -1,
12 | Human = 0,
13 | Dwarf = 1,
14 | Elf = 2,
15 | };
16 |
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/tests/evolution_test/evolution_v1.json:
--------------------------------------------------------------------------------
1 | {
2 | "a": 42,
3 | "b": true,
4 | "c_type": "TableB",
5 | "c": {
6 | "a": 15
7 | },
8 | "d": "King",
9 | "e": {
10 | "a": 3.1452,
11 | "b": 325
12 | },
13 | "f":{
14 | "a": 16,
15 | "b": 243.980943
16 | },
17 | "g": [ 7, 8, 9],
18 | "h": [
19 | {
20 | "a": 212
21 | },
22 | {
23 | "a": 459
24 | }
25 | ]
26 | }
--------------------------------------------------------------------------------
/conan/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8)
2 |
3 | message(STATUS "Conan FlatBuffers Wrapper")
4 |
5 | include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
6 | conan_basic_setup()
7 |
8 | if (WIN32 AND MSVC AND FLATBUFFERS_BUILD_SHAREDLIB)
9 | set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
10 | endif(WIN32 AND MSVC AND FLATBUFFERS_BUILD_SHAREDLIB)
11 |
12 | include(${CMAKE_SOURCE_DIR}/CMakeListsOriginal.txt)
13 |
--------------------------------------------------------------------------------
/tests/MyGame/Example/Color.lua:
--------------------------------------------------------------------------------
1 | -- automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | -- namespace: Example
4 |
5 | -- Composite components of Monster color.
6 | local Color = {
7 | Red = 1,
8 | -- \brief color Green
9 | -- Green is bit_flag with value (1u << 1)
10 | Green = 2,
11 | -- \brief color Blue (1u << 3)
12 | Blue = 8,
13 | }
14 |
15 | return Color -- return the module
--------------------------------------------------------------------------------
/tests/docker/Dockerfile.testing.cpp.debian_buster:
--------------------------------------------------------------------------------
1 | FROM debian:10.1-slim as base
2 | RUN apt -qq update >/dev/null
3 | RUN apt -qq install -y cmake make build-essential >/dev/null
4 | RUN apt -qq install -y autoconf git libtool >/dev/null
5 | RUN apt -qq install -y clang >/dev/null
6 | FROM base
7 | # Travis machines have 2 cores. Can be redefined with 'run --env PAR_JOBS=N'.
8 | ENV JOBS=2
9 | WORKDIR /flatbuffers
10 | ADD . .
11 |
--------------------------------------------------------------------------------
/tests/namespace_test/NamespaceA/NamespaceB/EnumInNestedNS.cs:
--------------------------------------------------------------------------------
1 | //
2 | // automatically generated by the FlatBuffers compiler, do not modify
3 | //
4 |
5 | namespace NamespaceA.NamespaceB
6 | {
7 |
8 | [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
9 | public enum EnumInNestedNS : sbyte
10 | {
11 | A = 0,
12 | B = 1,
13 | C = 2,
14 | };
15 |
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/tests/native_type_test_impl.cpp:
--------------------------------------------------------------------------------
1 | #include "native_type_test_impl.h"
2 |
3 | #include "native_type_test_generated.h"
4 |
5 | namespace flatbuffers {
6 | Geometry::Vector3D Pack(const Native::Vector3D &obj) {
7 | return Geometry::Vector3D(obj.x, obj.y, obj.z);
8 | }
9 |
10 | const Native::Vector3D UnPack(const Geometry::Vector3D &obj) {
11 | return Native::Vector3D(obj.x(), obj.y(), obj.z());
12 | }
13 | } // namespace flatbuffers
14 |
--------------------------------------------------------------------------------
/go/lib.go:
--------------------------------------------------------------------------------
1 | package flatbuffers
2 |
3 | // FlatBuffer is the interface that represents a flatbuffer.
4 | type FlatBuffer interface {
5 | Table() Table
6 | Init(buf []byte, i UOffsetT)
7 | }
8 |
9 | // GetRootAs is a generic helper to initialize a FlatBuffer with the provided buffer bytes and its data offset.
10 | func GetRootAs(buf []byte, offset UOffsetT, fb FlatBuffer) {
11 | n := GetUOffsetT(buf[offset:])
12 | fb.Init(buf, n+offset)
13 | }
14 |
--------------------------------------------------------------------------------
/swift/Sources/FlatBuffers/Offset.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | /// Offset object for all the Objects that are written into the buffer
4 | public struct Offset {
5 | /// Offset of the object in the buffer
6 | public var o: UOffset
7 | /// Returns false if the offset is equal to zero
8 | public var isEmpty: Bool { return o == 0 }
9 |
10 | public init(offset: UOffset) { o = offset }
11 | public init() { o = 0 }
12 | }
13 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "google/flatbuffers",
3 | "type": "library",
4 | "description": "FlatBuffers for PHP",
5 | "keywords": ["google", "flatbuffers", "serialization"],
6 | "homepage": "https://github.com/google/flatbuffers",
7 | "license": "Apache-2.0",
8 | "require": {
9 | "php": ">=5.4"
10 | },
11 | "require-dev": {
12 | },
13 | "autoload": {
14 | "psr-4": {
15 | "Google\\FlatBuffers\\": "php"
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/tests/docker/build_flatc.run.sh:
--------------------------------------------------------------------------------
1 | set -e
2 |
3 | JOBS=${JOBS:-1}
4 | config=$1
5 | echo ""
6 | echo "Build 'flatc' compiler for '$config'"
7 |
8 | cmake . -DCMAKE_BUILD_TYPE=$config \
9 | -DFLATBUFFERS_BUILD_FLATC=1 -DFLATBUFFERS_STATIC_FLATC=1 \
10 | -DFLATBUFFERS_BUILD_TESTS=0 -DFLATBUFFERS_INSTALL=0
11 | cmake --build . --target flatc --clean-first -- -j$JOBS
12 |
13 | echo "Check generated code"
14 | .travis/check-generate-code.sh
15 | echo "Done"
16 |
--------------------------------------------------------------------------------
/tests/MyGame/Example/TestEnum.java:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | package MyGame.Example;
4 |
5 | public final class TestEnum {
6 | private TestEnum() { }
7 | public static final byte A = 0;
8 | public static final byte B = 1;
9 | public static final byte C = 2;
10 |
11 | public static final String[] names = { "A", "B", "C", };
12 |
13 | public static String name(int e) { return names[e]; }
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/tests/MyGame/Example/TestEnum.kt:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | package MyGame.Example
4 |
5 | @Suppress("unused")
6 | class TestEnum private constructor() {
7 | companion object {
8 | const val A: Byte = 0
9 | const val B: Byte = 1
10 | const val C: Byte = 2
11 | val names : Array = arrayOf("A", "B", "C")
12 | fun name(e: Int) : String = names[e]
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/CMake/FlatbuffersConfigVersion.cmake.in:
--------------------------------------------------------------------------------
1 | set(PACKAGE_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@")
2 |
3 | # Check whether the requested PACKAGE_FIND_VERSION is compatible
4 | if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
5 | set(PACKAGE_VERSION_COMPATIBLE FALSE)
6 | else()
7 | set(PACKAGE_VERSION_COMPATIBLE TRUE)
8 | if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
9 | set(PACKAGE_VERSION_EXACT TRUE)
10 | endif()
11 | endif()
12 |
--------------------------------------------------------------------------------
/net/FlatBuffers/FlatBuffers.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/tests/docker/languages/Dockerfile.testing.rust.big_endian.1_37_0:
--------------------------------------------------------------------------------
1 | FROM rust:1.37.0-slim-stretch as base
2 | RUN apt -qq update -y && apt -qq install -y \
3 | gcc-mips-linux-gnu \
4 | libexpat1 \
5 | libmagic1 \
6 | libmpdec2 \
7 | libreadline7 \
8 | qemu-user
9 | RUN rustup target add mips-unknown-linux-gnu
10 | WORKDIR /code
11 | ADD . .
12 | RUN cp flatc_debian_stretch flatc
13 | WORKDIR /code/tests
14 | RUN rustc --version
15 | RUN ./RustTest.sh mips-unknown-linux-gnu
16 |
--------------------------------------------------------------------------------
/tests/union_vector/union_vector.json:
--------------------------------------------------------------------------------
1 | {
2 | "main_character_type": "Rapunzel",
3 | "main_character": {
4 | "hair_length": 6
5 | },
6 | "characters_type": [
7 | "Belle",
8 | "MuLan",
9 | "BookFan",
10 | "Other",
11 | "Unused"
12 | ],
13 | "characters": [
14 | {
15 | "books_read": 7
16 | },
17 | {
18 | "sword_attack_damage": 5
19 | },
20 | {
21 | "books_read": 2
22 | },
23 | "Other",
24 | "Unused"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/tests/arrays_test.fbs:
--------------------------------------------------------------------------------
1 | namespace MyGame.Example;
2 |
3 | enum TestEnum : byte { A, B, C }
4 |
5 | struct NestedStruct{
6 | a:[int:2];
7 | b:TestEnum;
8 | c:[TestEnum:2];
9 | d:[int64:2];
10 | }
11 |
12 | struct ArrayStruct{
13 | a:float;
14 | b:[int:0xF];
15 | c:byte;
16 | d:[NestedStruct:2];
17 | e:int32;
18 | f:[int64:2];
19 | }
20 |
21 | table ArrayTable{
22 | a:ArrayStruct;
23 | }
24 |
25 | root_type ArrayTable;
26 | file_identifier "ARRT";
27 | file_extension "mon";
28 |
--------------------------------------------------------------------------------
/lua/flatbuffers/compat.lua:
--------------------------------------------------------------------------------
1 | local m = {}
2 |
3 | local getAlignSize
4 | if _VERSION == "Lua 5.3" then
5 | getAlignSize = function(k, size)
6 | return ((~k) + 1) & (size - 1)
7 | end
8 | else
9 | getAlignSize = function(self, size, additionalBytes)
10 | local alignsize = bit32.bnot(#self.bytes-self:Head() + additionalBytes) + 1
11 | return bit32.band(alignsize,(size - 1))
12 | end
13 | end
14 |
15 | m.GetAlignSize = getAlignSize
16 |
17 | return m
--------------------------------------------------------------------------------
/tests/monsterdata_extra.json:
--------------------------------------------------------------------------------
1 | {
2 | // Initialize with non-default values.
3 | d0 : -nan, // match with default
4 | d1 : +inf,
5 | d2 : -inf,
6 | d3: nan,
7 | f0 : +nan, // match with default
8 | f1 : -nan, // match with default
9 | f2 : +inf, // match with default
10 | f3 : -inf, // match with default
11 | // Values should have exact binary representation
12 | // to avoid rounding effects in tests.
13 | dvec : [2.0, +inf, -inf, nan,],
14 | fvec : [1.0, -inf, +inf, nan],
15 | }
16 |
--------------------------------------------------------------------------------
/tests/namespace_test/NamespaceA/NamespaceB/EnumInNestedNS.java:
--------------------------------------------------------------------------------
1 | // automatically generated by the FlatBuffers compiler, do not modify
2 |
3 | package NamespaceA.NamespaceB;
4 |
5 | public final class EnumInNestedNS {
6 | private EnumInNestedNS() { }
7 | public static final byte A = 0;
8 | public static final byte B = 1;
9 | public static final byte C = 2;
10 |
11 | public static final String[] names = { "A", "B", "C", };
12 |
13 | public static String name(int e) { return names[e]; }
14 | }
15 |
16 |
--------------------------------------------------------------------------------
/swift/Sources/FlatBuffers/Struct.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | public struct Struct {
4 | public private(set) var bb: ByteBuffer
5 | public private(set) var postion: Int32
6 |
7 | public init(bb: ByteBuffer, position: Int32 = 0) {
8 | self.bb = bb
9 | self.postion = position
10 | }
11 |
12 | public func readBuffer(of type: T.Type, at o: Int32) -> T {
13 | let r = bb.read(def: T.self, position: Int(o + postion))
14 | return r
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/docs/footer.html:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |