Compare commits

...

1548 Commits

Author SHA1 Message Date
Wouter van Oortmerssen
9e7e8cbe9f Bumped version to 1.11.0
Change-Id: I0c87ad2cf8f8768cf40c5b7abea0add087a5518a
2019-04-24 11:34:53 -07:00
Clément Julliard
b72a75f87d Doc: use correct ref types for flatcc string creation. (#5305)
Some string definitions were typed as ns(Weapon_ref_t) while they should
be flatbuffers_string_ref_t. Note that the former was also compiling &
running correctly as both ref types boil down to the same underlying ref
type.
2019-04-24 10:34:21 -07:00
Philipp Wollermann
6cfcd8628a Don't test on Ubuntu 14.04 (#5302)
Ubuntu 14.04 is about to be end-of-life and Bazel CI will stop supporting it shortly afterwards.

Context: https://groups.google.com/d/msg/bazel-dev/_D6XzfNkQQE/8TNKiNmsCAAJ
2019-04-24 10:28:35 -07:00
Damien Lespiau
ddb12c0192 [Javascript] Remove newly introduced trailing whitespace in flatbuffer.js (#5300)
* Remove newly introduced trailing whitespace in flatbuffer.js

The newly introduced clear function has some trailing white space in an
otherwise whitespace clean file. Remove it.

* Remove spurious new line in the BytesBuffer construction

Another spurious white space introduced by the clear() PR.
2019-04-22 11:48:56 -07:00
Wouter van Oortmerssen
2032b94f61 Fixed file access test in the wrong location.
Change-Id: I520339b442306204563d97743efe988eab459c08
2019-04-22 09:58:29 -07:00
Damien Lespiau
860dc803fe docs: Fix where to find the Typescript typings (#5298)
This is what currently rendered:

  /flatubffers

in https://google.github.io/flatbuffers/flatbuffers_guide_use_typescript.html

Besides the typo, @types is being swallowed, the hope is that puting it between
backticks will improve the situation.
2019-04-19 13:09:26 -07:00
Wouter van Oortmerssen
5b43e4bbb8 Fix heap-buffer-overflow if there is a struct within a union
The validator previously did not check if a struct within a union was
valid, causing a heap buffer overflow.  Add a check to make sure that
the struct is valid in this case.

Change-Id: I87d41b12fdfc2a99406789531ba92b841c063c76
2019-04-19 11:49:49 -07:00
Omer Akram
ecd76e898d Update snap include path instruction (#5297) 2019-04-18 15:15:21 -07:00
Wouter van Oortmerssen
f55d4388e0 Update snap to use "flatbuffers" as name 2019-04-18 13:50:04 -07:00
Omer Akram
e7340c390f Add Linux Snap Packaging (#5293)
* SNAP: cleanup

* Lets keep it in devel mode as it requires more testing

* add better description
2019-04-18 12:22:43 -07:00
Nils Berg
90441c2078 fix check for Enum defaults (#5292)
fixes #5288
2019-04-15 11:38:44 -07:00
Nils Berg
cef8f928bb Struct typetable (#5291)
* C++: Generate MiniReflectTypeTable for Structs as well as Tables

* Update generated code

* add test
2019-04-15 11:38:00 -07:00
Vladimir Glavnyy
98b9b5a933 Add logging of warnings from the flatc compiler (#5289) 2019-04-15 11:34:09 -07:00
Wouter van Oortmerssen
d07a3d2f4c Fixed VS2010 build.
Change-Id: I3ee68c5f250d6baa02060ab2ecbc0f0fe254a9d8
2019-04-11 16:14:38 -07:00
Wouter van Oortmerssen
640df2c1f5 Allow Set() methods to handle reference types
Change-Id: I487ded77d28490189dd5d38236cb04bffaf5f11a
2019-04-11 14:18:21 -07:00
Vladimir Glavnyy
60340ac529 Fix the proto-enum leaking issue (#5286)
* Detect leak with sanitizer

* Fix proto-enum leak issue
2019-04-11 13:52:01 -07:00
Vladimir Glavnyy
2bd4a27550 Detect leak with sanitizer (#5283) 2019-04-11 10:15:11 -07:00
Vladimir Glavnyy
23bb57401c Add basic test for enum defaults (#5280) 2019-04-08 10:21:30 -07:00
Vladimir Glavnyy
dd6daa709b Part of #5265, neutral changes (#5281) 2019-04-08 10:05:50 -07:00
Vladimir Glavnyy
dd85c3b721 Enable MSVC assert report box [Abort|Retry|Ignore] if a debugger is present (#5279) 2019-04-08 10:01:41 -07:00
Henry Lee
94cb1ff9ea Add files generated by CMake to git ignore (#5278) 2019-04-05 12:35:40 -07:00
Henry Lee
3ff6cdf491 [C++]Sync the sample monster.fbs file with the tutorial (#5277)
* Fix the header file path in the tutorial doc

* Add the path field in sample/monster.fbs to match the tutorial

* Update the lobster sample file

* Update the binary sample file
2019-04-05 12:34:53 -07:00
Matt Mastracci
c329d6fa90 Ensure we don't subtract with underflow getting enum names (#5246)
* Ensure we don't subtract with underflow getting enum names

* Yep - forgot to run this
2019-04-05 12:30:58 -07:00
Anthony Liot
249f3b3714 Add method GenerateTextFromTable issue #5249 (#5266)
* Create a function GenerateGenerateTextFromTable in order to create a json from any Table

Signed-off-by: Anthony Liot <anthony.liot@gmail.com>

* Update the test to failed if loadfile or parser return false

Signed-off-by: Anthony Liot <anthony.liot@gmail.com>

* Fix snake_case name typo + space before &/*

Signed-off-by: Anthony Liot <anthony.liot@gmail.com>

* use auto

Signed-off-by: Anthony Liot <anthony.liot@gmail.com>

* Use clang-format on the added code

Signed-off-by: Anthony Liot <anthony.liot@gmail.com>
2019-04-05 11:51:29 -07:00
Kamil Rojewski
2d67de3151 Fix for build break in c# vector of unions (#5271) 2019-04-05 11:49:12 -07:00
unexge
5cdbd02404 Fix typo in Go tutorial (#5274) 2019-04-04 12:28:09 -07:00
Vladimir Glavnyy
b2ce86ef8a Add compile-time checking of numerical limits in C++ code. (#5270)
* Add checking of numerical_limits<T> in C++ code.

* Add integer suffixes (LL/ULL) to int64 values in the IntegerBoundaryTest
2019-04-01 12:03:51 -07:00
tymcauley
8e7acae013 Update grammar to reflect required type signature for enum declarations. (#5269) 2019-03-28 10:48:40 -07:00
Austin Schuh
343bbe808e Add missing test data file to BUILD file (#5264)
$ cat
/home/austin/.cache/bazel/_bazel_austin/4b3182bfa237d7e256d9f18ffe58322f/execroot/com_github_google_flatbuffers/bazel-out/k8-opt/testlogs/flatbuffers_test/test.log
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //:flatbuffers_test
-----------------------------------------------------------------------------
VALUE: "0"
EXPECTED: "1"
TEST FAILED: tests/test.cpp:2029, flatbuffers::LoadFile( (test_data_path
+ "union_vector/union_vector.json").c_str(), false, &jsonfile) in
VALUE: "0"
EXPECTED: "1"
TEST FAILED: tests/test.cpp:2100, parser.Parse(jsonfile.c_str()) in
VALUE: "0"
EXPECTED: "1"
TEST FAILED: tests/test.cpp:2103, VerifyMovieBuffer(jverifier) in
2019-03-25 16:17:18 -07:00
László Csomor
cb9ab2fe58 Bazel CI: fix bad value in yml (#5262)
Use the "simple format" defined here:
69cf7ec23d/buildkite/bazelci.py (L1453)

This will unbreak the "Bazel / FlatBuffers"
pipeline on Bazel CI, see
https://buildkite.com/bazel/flatbuffers
2019-03-25 12:27:35 -07:00
Nikolay Kuznetsov
4cbff97c43 Fix a warning on compiling with clang (#5258) 2019-03-25 12:06:00 -07:00
LouisP
88abae649c Add inequality operator (inspired from #263) (#5257) 2019-03-25 12:04:51 -07:00
Henry Lee
a7461433c6 [C++] Changes in the flathash program (#5255)
* Correct the usage in the flathash program

As it is possible to have -- before the occurrence of the first
input STRING.

* Exit with 1 in the flathash program when an error occurs
2019-03-21 16:23:32 -07:00
Ashay Shirwadkar
440a70f4a3 Fixed tutorial markdown file (#5248)
Path specified in tutorial file was pointing to invalid location.
2019-03-21 15:51:51 -07:00
Wouter van Oortmerssen
02e73e1ae9 Further fixes to make minireflect compatible with old behavior.
Change-Id: I92c257ec4ab4a0cf4676bd98523b766ce25bf4f6
2019-03-21 15:08:04 -07:00
Vladimir Glavnyy
f93d0f6ac1 Unify line ending rules in '.editorconfig' and '.gitattributes' (#5231)
* Unify line ending rules in '.editorconfig' and '.gitattributes'

* Revert '.gitattributes'

- fix invalid comments in the check-source.py
2019-03-18 12:47:07 -07:00
Wouter van Oortmerssen
fd51fadaac Fixed vector_delimited excluding delimiter
Change-Id: I3e758d44b9845d6df91332bb609b4b7ad88659ac
2019-03-18 12:07:36 -07:00
Wouter van Oortmerssen
11198f10f5 Fixed shadowing warning in older gcc for vector_delimited
Change-Id: Ia4d56a5eb086f86eb5d1ad6ddae64e4a51bf3aa3
2019-03-18 10:03:43 -07:00
Wouter van Oortmerssen
3b23ff18ea Made ToStringVisitor backwards compatible with older behavior.
This to support code that relied on tables being multiline,
but not vectors.

This behavior was changed in:
b1a925dfc2 (diff-c45c8fbffbc64f7ff4aa2978612b10d8)

Change-Id: I4c95471b643b2b3fab95e06b1294e19d686b492c
2019-03-14 12:00:44 -07:00
Wouter van Oortmerssen
4f066c39ce Made JS enum declarations compatible with google closure
Original change by: https://github.com/alexames

Change-Id: Ib65bd02156d1c3637ed278a8334a2307caacaa44
2019-03-11 14:33:07 -07:00
Wouter van Oortmerssen
ca68d8b043 Disabled constexpr for hashing functions.
This was incompatible with -Wc++98-c++11-compat on some platforms,
due to local variables in the function.

Change-Id: Idef510c2cefe944eef2e0656f5a219c2158063e6
2019-03-11 14:02:20 -07:00
Vladimir Glavnyy
407fb5d537 Narrows template ascii routines to prevent a possible signed overflow in generic code. (#5232) 2019-03-11 10:26:28 -07:00
Randal Stevens
73a648b685 Fix typo in dart documentation (#5230) 2019-03-11 09:49:17 -07:00
Wouter van Oortmerssen
eb2a81f73d [C++] Object API: document custom string type requirements,
implement better custom string type constructor alternative
for Unpack() and fix bug with vector of custom string types
in Pack().

Squashed commit of the following:

commit e9519c647e
Author: Luca Longinotti <luca.longinotti@inivation.com>
Date:   Tue Mar 5 18:24:49 2019 +0100

    tests: regenerate code, reverts change to CreateVectorOfStrings().

commit 117e3b0679
Author: Luca Longinotti <luca.longinotti@inivation.com>
Date:   Tue Mar 5 18:15:05 2019 +0100

    idl_gen_cpp.cpp: move clang-format on/off outside of declaration, so they are kept properly aligned automatically.

commit 4791923806
Author: Luca Longinotti <luca.longinotti@inivation.com>
Date:   Tue Mar 5 18:11:40 2019 +0100

    idl_gen_cpp.cpp: full clang-format run with provided Google format file, enforce 80 lines width.

commit 2f0402f9ff
Author: Luca Longinotti <luca.longinotti@inivation.com>
Date:   Tue Mar 5 18:09:32 2019 +0100

    CppUsage: address requested changes.
    idl_gen_cpp.cpp: fix formatting, keep CreateVectorOfStrings for normal string cases.

commit 371d4e0b79
Author: Luca Longinotti <luca.longinotti@inivation.com>
Date:   Fri Mar 1 16:35:29 2019 +0100

    Fix compile error with a vector of non-std::strings. CreateVectorOfStrings() expects a vector of std::string types, but that's not always the case.

commit 92b90d7f0f
Author: Luca Longinotti <luca.longinotti@inivation.com>
Date:   Fri Mar 1 16:15:36 2019 +0100

    Document requirement for custom string types to implement empty() and be constructible from std::string.
    Add new option --cpp-str-flex-ctor to construct custom string types not via std::string, but (char * + length).

commit 28cb2e92d5
Author: Luca Longinotti <luca.longinotti@inivation.com>
Date:   Fri Mar 1 14:31:17 2019 +0100

    idl_gen_cpp.cpp: clang-format run, to better separate changes in content from formatting.

Change-Id: I4887ba2f2c632b9e7a8c938659b088cd95690870
2019-03-11 09:42:02 -07:00
bspeice
3968d00568 [Rust] Don't use inner attributes for allow (#5212)
* Don't use inner attributes for `allow`
Messes with being able to easily include elsewhere

* Regenerate tests

* No-op to retrigger CI

* Add the rest of the `allow` attributes
2019-03-09 12:58:27 -08:00
Mathias Svensson
4f10da8d99 Small usability tweaks to the rust codegen. (#5213) 2019-03-08 13:54:57 -08:00
tymcauley
9e82ee2527 Fix rust crate for big-endian targets (#5229)
Thanks for tackling this, @tymcauley !

* big endian docker test -- wip

* tweaks

* tweaks

* tweaks

* docker tweaks

* fix conditional compilation issues

* reactivate other docker tests

* try some more cross-platform config (from tymcauley)

* Update tests/docker/languages/Dockerfile.testing.rust.big_endian.1_30_1

Co-Authored-By: rw <rw@users.noreply.github.com>

* Update tests/docker/languages/Dockerfile.testing.rust.big_endian.1_30_1

Co-Authored-By: rw <rw@users.noreply.github.com>

* Update tests/docker/languages/Dockerfile.testing.rust.big_endian.1_30_1

Co-Authored-By: rw <rw@users.noreply.github.com>

* Resolved Rust warnings during big-endian builds.

* Unify Rust test suites for x86 and MIPS builds.

Note that I had to add four extra packages to the MIPS `Dockerfile`:
`libexpat1`, `libmagic1`, `libmpdec2`, and `libreadline7`. For a reason
I couldn't identify, even the simplest Rust MIPS binaries run with
`qemu-mips` would fail with a segfault when run through this
`Dockerfile`. After installing the `gdb-multiarch` package to attempt to
debug the issue, the binaries ran successfully. I pared down the
packages installed by `gdb-multiarch`, and these four packages are the
minimum subset necessary to get Rust MIPS binaries running under
`qemu-mips`.

* Changed Rust tests to use `Vector`s instead of direct-slice-access.

The direct-slice-access method is not available on big-endian targets,
but `flatbuffers::Vector`s provide an array interface that is available
on all platforms.

* Resolved FooStruct endianness issues using explicit struct constructor.

This more closely resembles how FlatBuffers structs are constructed in
generated Rust code.

* Added explanation of how `FooStruct` parallels generated struct code.

Also collected duplicate implementations of `FooStruct` into a common
location.
2019-03-08 01:06:25 -08:00
Wouter van Oortmerssen
e237f53bfc Removed -Wc++98-compat-extra-semi for compatibility with older clang.
Change-Id: I6dfadb5289a4396ad2f3d16baf1bdb99c7534174
2019-03-07 15:15:22 -08:00
Austin Schuh
98be491e72 Bazel ci (#5228)
* Stop building for Windows until the build passes

ERROR: D:/b/bk-windows-java8-bd0z/bazel/flatbuffers/BUILD:123:1: Couldn't build file _objs/flatbuffers_test/test.obj: undeclared inclusion(s) in rule '//:flatbuffers_test':
this rule is missing dependency declarations for the following files included by 'tests/test.cpp':
  'tests/monster_test_generated.h'
  'tests/monster_extra_generated.h'

The files in tests are being found instead of the generated files since
Windows doesn't have any sandboxing.  For now, let's disable the rules
and come back to it.

* Fix buildifier warnings

Clean up docstrings and add a module docstring.
2019-03-07 15:09:30 -08:00
Wouter van Oortmerssen
71628dad0d Fixed vector of union JSON parsing.
This for some reason never had a test case, and was broken.

Change-Id: If832f5eb8b6c5ba8a75257464892634b38719c55
2019-03-07 15:05:00 -08:00
jean-airoldie
cb7b2bf87e [Rust] Fixed codegen documentation for Tables (#5227) 2019-03-06 12:00:58 -08:00
David Reiss
bfa430309a [Go] Add mutation functions for vector elements (#5221)
Fixes #5206
2019-03-05 21:16:26 -08:00
ll-antn
1c7d91cc55 Clean-up nested_parser on all paths (#5179) (#5184)
* Clean-up nested_parser on all paths (#5179)

* Added test for parsing json with invalid nested flatbuffer

* Removed utf-8 BOM from test.cpp
2019-03-04 11:35:10 -08:00
Laurent Stacul
2e865f4d4e [Fix #5112] flatc generates constructors with memset for non-trivial types (#5222) 2019-03-04 11:10:18 -08:00
csukuangfj
13c9c674fd [doc] fix typos in doc. (#5217) 2019-02-28 21:39:26 +01:00
naure
034275c6e2 Rust: Fix lifetime in union _as_ accessors (#5140)
* Fix lifetime in union _as_ accessors

In the accessors for union field, the return value is implicitly taking the lifetime of &self.
This is irrelevant and prevents usages of the returned value, because it is needlessly bound to the parent field lifetime.

This patch makes the return value inherit the lifetime of the data, like other methods do.
2019-02-26 23:48:54 -08:00
Kulikov Alexey
4e5152d886 Java: Calculation of vtable and vtable size moved to the __init method. (#5210)
vtable and vtable size depends only on `Table#bb_pos` but calculated in
`Table#_offset` method on each field lookup.
Doing this with every call of `Table#__offset` is redundant.

These values can be read once with change of `Table#bb_pos` and reused
for any field lookup.
2019-02-25 23:45:29 +01:00
Kulikov Alexey
dc61512f20 Java: Removed unused duplicate of bytebuffer from "Table#__string" method. (#5211) 2019-02-25 23:28:13 +01:00
Искандаров Егор
1d60824d56 Lua library: fix vtable reuse. (#5214)
Fixed a bug that prevented vtable reuse during buffer construction in the lua library.

Also fixed a bug in vtable equality check that was revealed after the first fix.
2019-02-25 23:27:42 +01:00
Wouter van Oortmerssen
f89badd30f Attempting to make travis not kill the Android build.
Change-Id: Icdff8a90338bd2ff79ff76fe1ebaa3481da8dea4
2019-02-25 14:10:56 -08:00
Marcus Comstedt
1b9d1b0110 IterateValue: Use ReadScalar instead of unportable reinterpret_casts (#5209)
This fixes the testcase MiniReflectFlatBuffersTest.
2019-02-25 21:45:11 +01:00
Brian Wellington
6e2d530d61 Fix incorrect code generation on Solaris Sparc. (#5208)
On Solaris Sparc, calling NumToString() with a char called the primary
version, not the signed char or unsigned char specializations, which
caused integer to string conversions to be missed.
2019-02-25 21:41:31 +01:00
Wouter van Oortmerssen
9bf9b18f0a Added -Wc++98-compat-extra-semi
And fixed 2 more extra semi-colons.

Change-Id: I1ee08e5b2f67cd0c886847c05cd4d63cfcafec3e
2019-02-25 11:42:37 -08:00
Wouter van Oortmerssen
537c6ec1e6 Added -Wextra-semi to Clang build.
Also fixed warnings this generated.

Change-Id: If3607907b2dd609f854b7b81225d9cf66af75a60
2019-02-25 09:14:56 -08:00
Brian Wellington
a1f14005ab Fix big-endian build. (#5205)
For some reason, Offset<T> is being considered a scalar, which
causes EndianSwap to be passed an Offset<T>.  This doesn't work,
as it does not support types with non-trivial constructors.  This
change adds an overload to WriteScalar(), which works around this.
2019-02-22 01:50:05 +01:00
Eric Erhardt
0cdacdfb35 Remove byte* property in ByteBufferAllocator (#5191)
* Remove byte* property in ByteBufferAllocator.

This allows consumers to read/write into native memory, but without
having to always pin the managed `byte[]` when working with managed
memory. This allows for users to not need to Dispose() ByteBuffers
when they are using the default ByteArrayAllocator class.

Instead, we use `Span<byte> GetSpan()` methods to get access to the
underlying memory buffer.

Fix #5181

* Add a set of benchmark tests.

* Add ReadOnly spans.

This allows consumers to use ReadOnlyMemory<byte> as the backing storage
for ByteBuffers, which is useful in read-only scenarios.

* Run tests using ENABLE_SPAN_T in appveyor.

* Fix FlatBuffers.Test.csproj to work on older MSBuild versions.

* Change the test script to test UNSAFE_BYTEBUFFER

* Address PR feedback.

Remove IDisposable from ByteBuffer.

* Respond to PR feedback.
2019-02-21 23:36:55 +01:00
bwelling
bb58442054 Improve endian detection. (#5204)
Add support for using __BYTE_ORDER__, to support platforms where g++
doesn't explicitly define __BIG_ENDIAN__, like Solaris Sparc.
2019-02-21 22:45:11 +01:00
Marc Butler
4567b13115 Add RPM packaging support (#5177)
* Add RPM packaging support

Using the existing PackageDebian as template add support for
generating an rpm with the package target.

* Restore debian package target

Also add an option to advertise the fact.

* Update package description

C-n-p from README.md

* Update rpm package maintainer
2019-02-21 20:06:04 +01:00
Kamil Rojewski
8f8fb2b367 Fixed vector of unions crash in java (#5190)
* Fixed vector of unions crash in java

* Regenerated test code

* Fixed windows tests
2019-02-21 19:50:13 +01:00
Efe Burak
69d761d15e Added .net core project (#5187) 2019-02-21 19:47:19 +01:00
csukuangfj
4f32cbf268 Fix an error in cpp code. (#5189)
Change monster_generate.h to monster_generated.h
2019-02-19 20:23:10 +01:00
Vladimir Glavnyy
0eaaf18192 Utility for checking the encoding and line ending of source files (#5188)
* Add utility for checking the encoding of source files

- accept source files with ASCII or UTF-8 without BOM
- accept only CRLF line ending

* Fix non-ascii symbol in idl_parcer.cpp

* Remove BOM from test.cpp
2019-02-19 20:22:25 +01:00
Wouter van Oortmerssen
957d167199 Fixed use of WIN32 needs to be _WIN32.
Change-Id: Ie1f88ac5613cc09ed1074608dd6517ae20c7973d
2019-02-19 10:49:55 -08:00
Austin Schuh
e9d9d64527 Add presubmit.yml for bazel CI configuration (#5193)
https://github.com/bazelbuild/continuous-integration/tree/master/buildkite#configuring-a-pipeline
2019-02-19 02:55:50 +01:00
Wouter van Oortmerssen
78c50e340b Fix AppVeyor script not including CMake dir
Change-Id: I737a74dd4d31ca6d1559958f4c76e61e1f0a2c64
2019-02-14 16:21:07 -08:00
Christopher Cifra
9d483a3f0b Changed the JavaScript generation to emit createX helper functions just like the TypeScript code generation. I also added code so that the create methods have documentation in both JavaScript and TypeScript. (#5168) 2019-02-15 01:00:33 +01:00
Eric Erhardt
b650dfba49 [C#] Fix FlatBuffers.Tests when ENABLE_SPAN_T is defined (#5182)
There is a test code error that causes the CanReadCppGeneratedWireFile test to fail when ENABLE_SPAN_T is defined. When TestarrayofboolsLength is not 0, then the GetTestarrayofboolsBytes() should have a length.
2019-02-15 00:53:36 +01:00
Aleix Pol
6980818337 Install flatc as requested (#5180)
If FLATBUFFERS_BUILD_FLATC and FLATBUFFERS_INSTALL are set, flatc should
be installed regardless of the configuration.
2019-02-14 22:19:36 +01:00
Kamil Rojewski
224f7527e3 Generting imports for external enums in TS (#5175) 2019-02-14 22:08:55 +01:00
Austin Schuh
a66a88034a Fix bazel build (#5174)
rules_go was out of date.  Update that.  Also, a dependency
monster_extra_cc_fbs snuck in.  So, let's add that.

Fixes: #5163
2019-02-14 22:05:46 +01:00
Gabriel Nützi
e1defaae5e Add flag to make short names in JS/TS. (#5152)
* Add flag to make short names in JS/TS.

* Synced all missing docs in Compiler.md <-> flatc.cpp.

* Review changes.
2019-02-11 21:34:10 +01:00
Enrico Olivelli
78fdce28c7 Make ByteBufferFactory an abstract class in order to make FlatBuffers compatible with Java7. (#5155)
Introduce a HeapByteBufferFactory singleton instance in order to reduce allocations.
Clarify the usage of LITTLE_ENDIAN ByteBuffers in ByteBufferFactory.
2019-02-11 21:02:32 +01:00
iceboy
60e94cf083 Implement (shared) attribute for C++ (#5157)
* Implement native_shared attribute for C++.

Fixes #5141. See also #5145.

* Refine comment in idl.h

* Also refine docs

* Revert "Also refine docs"

This reverts commit 09dab7b45c.

* Also refine docs again.

* grumble
2019-02-11 20:53:45 +01:00
Wouter van Oortmerssen
cf47f27164 Turn on -Werror=unused-private-field for Clang.
Change-Id: Ibabc1456baf190eba191ebe0b81e3d73a4acc98f
2019-02-11 09:55:48 -08:00
Wouter van Oortmerssen
cc7f9b89f3 Made FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE #ifdef out less
This is to protect against cases where part of a project is
compiled with or without this flag, making for very fragile
and hard to find bugs, such as sizeof(Verifier) changing.

Change-Id: I01c895cdc5b44f860e4b0b9c9613bff1983e2b9d
See: https://bugs.chromium.org/p/chromium/issues/detail?id=929847
2019-02-07 16:34:25 -08:00
Wouter van Oortmerssen
600f3fbcd4 Reduced force_align in tests to 8, to work with --object-api.
More detail:
https://github.com/google/flatbuffers/projects/6#card-17401359

See also the .md changes in this commit.

Change-Id: Idfa68b2fd3bdb19979833737d3a3cf83ec1d6775
2019-02-07 14:51:04 -08:00
Charlie Harrison
76a024137f Removing 'using namespace' usage in test_builder (#5154)
* Removing 'using namespace' usage in test_builder

* Fix GRPC tests
2019-02-05 02:07:05 +01:00
Travis Staley
31e34faa15 Changing array to be an associative array so that the Name function can work with non-sequential enums as well as those beginning at something other than zero. (#5151)
Also including the resulting changes in php files.
2019-02-04 23:33:57 +01:00
Jon Kunkee
4d98faa515 Only use __movsb on architectures that support it (#5147)
With the introduction of Windows 10 on ARM (ARM64), code that assumes
that Windows targets are always x86 or x86_64 targets needs to be
updated.

The hot function ReadUInt64 has been optimized in MSVC builds using the
compiler intrinsic __movsb. Since this does not exist on ARM64 Windows,
this change uses the pure C++ path that other platforms use instead.
2019-02-04 18:57:34 +01:00
Henry Lee
d8210d5a83 Make changes on the make_unsigned type trait (#5136)
Fix a typo in the static assert message in `make_unsigned`

Support more specifications for `make_unsigned`
2019-01-28 17:31:58 -08:00
Vladimir Glavnyy
7d3930a2fd Repair fallthrough was broken by d4493165 (#5115) (#5139)
- GCC: fixed broken `fallthrough` (checked with 7.3 and 8.2)
- Clang: added `fallthrough` support
- Clang: added `-Wimplicit-fallthrough` checking
2019-01-28 10:16:12 -08:00
find
347dba8501 delete zero width space characters <U+200B>'s to avoid MSVC warning C4819 (#5133) 2019-01-24 15:02:48 -08:00
Vladimir Glavnyy
fcacb46d01 Replace deprecated Vector::Length() with Vector::size() (#5131)
- enable FLATBUFFERS_ATTRIBUTE if C++17 or higher
2019-01-24 13:33:19 -08:00
Vladimir Glavnyy
3f388ec747 Repair MSVC-CRT leakage detector and enable this detection with Appveyor-CI (#5105) 2019-01-24 13:30:11 -08:00
jean-airoldie
38bf4cfc03 [Rust] Added global namespace imports (#5121)
* [Rust] Added global namespace imports

* Documented the need for global imports

* Added white_space params to GenNamespaceImports

* Removed a \n from GenNamespaceImports
2019-01-24 13:25:56 -08:00
Henry Lee
c2f40c37b2 [C++]Support reverse iterator in Vector (#5128)
* Add `const` keyword to the `operator-(const uoffset_t &)` function in
`VectorIterator`

* Support reverse iterator in Vector

Introduced a new VectorReverseIterator type. We cannot directly use
`std::reverse_iterator<VectorIterator>` because the signature of
`operator*` and `operator->` in the VectorIterator class are not
standard signatures.

Also added `rbegin()`, `rend()`, `cbegin()`, `cend()`, `crbegin()`
and `crend()` in the Vector class.
2019-01-24 13:24:01 -08:00
Vlad Frolov
63d51afd11 [docs] [rust] Add "Useful tools created by others" section (#5127) 2019-01-17 11:56:52 -08:00
Vladimir Glavnyy
d44931656a Fix high certainty warnings from PVS-studio (#5115)
* Fix high certainty warnings from PVS-studio

- Introduced FLATBUFFERS_ATTRIBUTE macro to use [[attribute]] if modern C++ compiler used

* Update the note about __cplusplus usage in the MSVC
2019-01-17 09:49:27 -08:00
Robert
bbfd12eb11 Docker tests for Zend PHP and Mono C#; Python coverage; TODO for HHVM PHP (#5125)
* Docker test for Zend PHP 7.3

* hhvm

* move failing hhvm test to TODO zone

* c# mono 5.18 test

* python coverage reports
2019-01-16 16:41:02 -08:00
cor3ntin
7c94ff6c30 Reference::ToString should be const (#5118) 2019-01-14 09:39:58 -08:00
Vladimir Glavnyy
4fa4d36706 Add default NaN/Inf to C#, Java, Python (#5107)
* Add default NaN/Inf to C#, Java, Python

* Python NaN/Inf test added

* Remove MSVC2010/13 dependent code
2019-01-14 09:23:42 -08:00
unintellisense
46208b1e91 JS- support clear() method on builder (#5109)
* support clearing flatBuffer builder in js

* remove unused member
 reset force_defaults
dont actually need to clear data in bytebuffer
2019-01-14 09:21:42 -08:00
Vladimir Glavnyy
b99332efd7 Move all platform dependent headers and code to util.cpp module (#5106) 2019-01-07 10:12:57 -08:00
Vladimir Glavnyy
dd288f71f3 Add NaN and Inf defaults to the C++ generated code. (#5102)
* Add `NaN` and `Inf` defaults to the C++ generated code.

* Refactoring: add FloatConstantGenerator

* Refactoring-2:

- remove isnan checking for all float/double values
- add most probable implementation of virtual methods of FloatConstantGenerator

* Add conditional (FLATBUFFERS_NAN_DEFAULTS) isnan checking
2019-01-07 10:04:44 -08:00
Yong Tang
155c55900f Add repository name to build_defs.bzl (#5104)
In flatbuffers, build_defs.bzl has been updated to have the
bazel rule `flatbuffer_cc_library` defined. Therefore, it should
be possible to build another application and using `flatbuffer_cc_library`
directly (by `load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")`)

However, when I tried to do the above, I saw the following errors in bazel:
```
ERROR: /root/.cache/bazel/_bazel_root/c27e9809996ce9a9c0ed8dd79ef0897b/external/arrow/BUILD.bazel:12:1: in deps attribute of cc_library rule @arrow//:arrow_format: target '@arrow//:runtime_cc' does not exist. Since this rule was created by the macro 'flatbuffer_cc_library', the error might have been caused by the macro implementation in /root/.cache/bazel/_bazel_root/c27e9809996ce9a9c0ed8dd79ef0897b/external/com_github_google_flatbuffers/build_defs.bzl:216:16
```

The reason for the bazel error was that `//:runtime_cc` and `//:flatc` does not have
the repo name prefixed.

By prefix `` the above bazel build error could be resolved.

This fix should help other programs to use flatbuffers directly through bazel.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2019-01-07 09:55:55 -08:00
Robert
0eb7b3beb0 [Go] Namespaced imports fix (#5097)
Track and emit required FlatBuffers namespace imports in generated Go code.

Update Go code generator by moving most functionality into the generator class, to facilitate namespace tracking. (Note that the git diff in this combined commit may appear large due to this refactoring, but very little code was actually changed.)
Update Go code generator by tracking namespace imports when generating FlatBuffers code.
Update Go code generator by emitting package imports to correctly reference code in other FlatBuffers namespaces.
Create Go test that checks the usage of InParentNamespace objects (as defined in the example schema).
Create Docker test that checks the Go language port.
Fixes #4883
Fixes #3927

Individual commits:

* remove "static" from soon-to-be method functions
* move almost all functions into class as methods
* set current namespace and emit package names if needed
* track imported namespaces
* parent namespaces work
* docker test for go ^1.11
* update base image name for go docker test
* remove cerr debugging
* formatting fixes
* re-run generate_code.sh
* explicitly test namespace imports and usage
2018-12-27 20:57:19 -05:00
Wouter van Oortmerssen
a821b15634 Added -Werror=implicit-fallthrough=2 to GCC 7 build.
Change-Id: I3f23bb1478763334dbc7e43579555518fb2412c2
2018-12-26 16:03:07 -08:00
Peter Dillinger
87704e987e Performance improvement to generated+supporting PHP (#5080)
By avoiding redundant alignment+alloc checks (startVector does prep) and virtual calls
(by making the class final) in inner loops.
2018-12-20 16:10:20 -08:00
Owen O'Malley
cb99116aca Java: Pulling in protobuf's faster UTF-8 encoder. (#5035)
* Pulling in protobuf's faster UTF-8 encoder.

* Remove Utf8 unsafe code.
2018-12-17 13:53:49 -08:00
Vladimir Glavnyy
9ad73bf5a7 Fix 'no_sanitize_undefined' attribute for GCC4.8 (#5090) 2018-12-17 11:50:31 -08:00
tira-misu
dba962ebb8 Enable flatbuffer to initialize Parser from bfbs (#4283) (#5077)
* Enable flatbuffer to initialize Parser from bfbs (#4283)

Now its possible to generate json data from bfbs data type and flatbuffers data
and visa versa.

* add deserialize functionality in parser from bfbs
* add small usage sample

* Fix build break

* Merge branch 'pr/1' into fix-issue4283

* Fix buildbreak

* Build monster_test.bfbs with --bfbs-builtins

Attribute flexbuffer has be included in bfbs. Only with this attribute test
will run. By initialization a parser by a bfbs the attribute has to be known
for this filed. monsterdata_test.golden has a flexbuffer field so parse would
fail.

* Fix generate_code.sh

* Revert automatic indent changes by IDE

* Auto detect size prefixed binary schema files

* Use identifier (bfbs) to detect schema files
2018-12-13 11:59:27 -08:00
Christian Lang
60a0f35fbc generated cmake command for flatc generation should depend on source file (#5087) 2018-12-13 11:56:51 -08:00
Rob Agar
58e8552da0 Get rid of reproducible build warning by removing build date & time from flatc version (#5086)
* disable reproducible build warning due to date/time macros

* wrapped GCC pragmas in #ifdef _GNUC_

* removed __DATE__ and __TIME__ macros from flatc.cpp
2018-12-10 12:48:09 -08:00
Austin Schuh
d56a4055da Add flatbuffer_cc library support (#5061)
* Add flatbuffer_cc library support

* Update flags so all the tests pass

Tests now all pass!

* Modify the tests to use the generated code

This should be a simple serialize/deserialize test of the new generated
code to make sure the bazel rules are doing something sane.

* Use generated monster_test.fb in testing/test.cpp

cmake drops it's generated code in tests/monster_test_generated.h
Instead of checking that in, let's generate it with bazel.

* Make grpc tests depend on monster_test_generated.h

* Remove redundant cmake dependency

This should address @aardappel's feedback.

* Run flatc for Android as well

This will fix the last travis.ci failure

* Add generated output folder and fix flags

* Move flatbuffers_header_build_rules to the library that uses it

* Use --cpp-ptr-type to fix android

Android was the only target using the STL emulation layer.  It needed
the --cpp-ptr-type flatbuffers::unique_ptr flag to work.  Add it!

* Roll back changes to use autogenerated monster_test_generated.

Flip tests/test.cpp to use the autogenerated file as well.
2018-12-10 12:23:40 -08:00
Kamil Rojewski
30c4948541 Renamed JS generator to explicitly state it generates TS too (#5043) 2018-12-06 11:12:06 -08:00
Simon.S.King
80d148b175 [net] Fix issue #5036 when write a double value into bytebuffer at big endian machine with unsafe mode. (#5076) 2018-12-03 09:50:26 -08:00
Matt Frantz
2aa0d9a54d Support nulls in String compare, CreateSharedString (#5060) 2018-12-03 09:48:50 -08:00
Robert
79cd55bd3a CI: Dockerized language port tests (#5066)
This runs a script in TravisCI that executes a bunch of small Docker image
scripts to test the language ports in isolated environments. This allows us to
test multiple language versions with little additional complexity.

Covers:

+ Java OpenJDK 10.0.2
+ Java OpenJDK 11.0.1
+ Node 10.13.0
+ Node 11.2.0
+ Python CPython 2.7.15
+ Python CPython 3.7.1
+ Rust 1.30.1
2018-11-29 22:03:06 -08:00
Robert
b378b8eb69 Fix create_vector_of_strings to use the stack, and test it. (#5074) 2018-11-29 11:47:28 -08:00
Sumant Tambe
9635d494b3 Fix Java generator bug that ignores bidi streaming attribute (#5063)
* Fix Java generator bug that ignores streaming: bidi attribute
Tests

* Java gRPC client streaming test

* Java gRPC Bidi Streaming Test
2018-11-29 10:33:17 -08:00
Robert
0143f4e364 disable unimportant RAM-heavy test b/c Windows (#5047) 2018-11-16 22:03:51 -08:00
Russell Chou
e161ade68c Make Parser skip files it's seen already. (#5048)
The use case is so we can batch compile a bunch of schemas, some which can depend on each other, without caring about their order.
2018-11-16 17:11:23 -08:00
Wouter van Oortmerssen
f575b02fda Make string/vector field serialization order not depend on optimizer.
Multiple calls of e.g. CreateString inside a call to a CreateTable
could cause those strings to end up in different locations in the
wire format, since order or argument evaluation is undefined.

This is allowed by the FlatBuffer format, but it is not helpful,
especially when debugging the contents of binaries, or comparing
against a "golden" binary for tests etc.

Now making sure that all the CreateTableDirect calls first serialize
sub strings/vectors before calling CreateTable.

Also made similar changes to the serialization of "binary schemas".

Change-Id: I5747c4038b37a0d400aca2bc592bec751cf5c172
2018-11-16 17:08:35 -08:00
Vladimir Glavnyy
5f32f94810 Make the Parser independent from the global C-locale (#5028)
* Make the Parser independent from the global C-locale

* Set a specific test locale using the environment variable FLATBUFFERS_TEST_LOCALE

* Remove redundant static qualifiers
2018-11-16 09:24:06 -08:00
Kamil Rojewski
d6b1ce09cf Fixed double generated file name postfix (#5046)
* Fixed double generated file name postfix

* Fixed missing file postfix on imports without reexports
2018-11-16 09:20:29 -08:00
Austin Schuh
f23009f04f Make flatbuffer C++ tests work when vendored with bazel (#5040)
Tests for third_party code are run out of the main workspace.  This
isn't an issue when the main workspace is the
com_github_google_flatbuffers workspace, but is an issue when you are
running the tests from another repository.

To reproduce, use "git_repository" to add flatbuffers to a project and
then run:
  bazel test @com_github_google_flatbuffers//:flatbuffers_test
2018-11-16 09:19:34 -08:00
Kamil Rojewski
30bae01ea3 Convenient createX methods for TS (#5044) 2018-11-16 09:17:54 -08:00
Shivendra Agarwal
9068b0ee63 flexbuffers blob to string implementation (#5039) 2018-11-15 14:57:05 -08:00
Robert
f8a0d3889b Fix missing doxygen link to Rust docs 2018-11-13 11:10:03 -08:00
Antonio Park
688fc77460 Wrong int32 min-max range definition on numTypes.lua (#5031)
* Update numTypes.lua

int32 range was wrongly defined.

* Update numTypes.lua

Fix number 32 to 31
2018-11-12 09:40:24 -08:00
Uilian Ries
dd8922878d Update Conan version Automatically (#5027)
* #5026 Add FindFlatBuffers.cmake to Conan Package

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* #5026 Build Flatbuffers on OSX 10

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* #5026 Auto update Conan package version

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* #5026 Update Conan docker images

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* #5026 Update tag var on Appveyor

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* #5026 Filter appveyor brach name

Signed-off-by: Uilian Ries <uilianries@gmail.com>
2018-11-12 08:49:42 -08:00
Shivendra Agarwal
ab54e61805 FlexBuffer to JSON convertor for typed and fixedTypedvectors (#4947)
* FlexBuffer to JSON convertor for typed and fixedTypedvectors

* moving the common implementation to template

* signed unsigned comparison fix

* fix a formatting ({

* changing logic to append comma in vector of elements in json
2018-11-12 08:49:11 -08:00
Wouter van Oortmerssen
f445c1eb4a Fixed STLPort build
Change-Id: I2b9508f547667695475be64fa56f64f129603fd4
2018-11-05 16:33:35 -08:00
Wouter van Oortmerssen
980a6d66d3 Fixed vectors of enums in object API serialized incorrectly.
And also added tests for them.

Change-Id: I91af1904105435601287291412e82d5066f476a5
Tested: on Linux.
2018-11-05 14:33:36 -08:00
Wouter van Oortmerssen
21591916af Fixed missing code from @javax.annotation PR.
https://github.com/google/flatbuffers/pull/4986 missed part of the
implementation.

Change-Id: Ie41771eb018a550c289c77ebe9ef5c50d1ad6751
2018-11-02 11:40:21 -07:00
Sumant Tambe
b6c3d7b899 Fix a memory leak in builder test (#5021)
* Fix a memory leak in builder test

* using RAII to free memory
2018-11-02 10:04:58 -07:00
Gabriel Nützi
db0fcdd906 --keep-prefix for JS generator (#5018)
* keep include path

* add option --keep-prefix for js

* format contribution (format whole files before merge!)

* revert util.h : IsAbsPath ...

* JS Generator: only support relatives paths (keep it as it was)
2018-11-02 08:54:43 -07:00
Frank Benkstein
91fe9ba93f make unions with type aliases more usable (#5019)
Some generic C++ and Rust code is not generated when unions use type
aliases because of potential ambiguity. Actually check for this
ambiguity and only disable offending code only if it is found.
2018-11-01 12:51:25 -07:00
Robert
4c3b6c247d Rust: test that no heap allocs happen on hot paths (#5022) 2018-10-31 18:08:14 -07:00
Wouter van Oortmerssen
160e8f2fdc Disallowed 0 byte structs.
This is because they are incompatible with C++ and possibly other
languages that make them minimum size 1 (to make sure multiple
such objects don't reside at the same address). Forcing them to size
1 was also not practical, as that is requires updating the logic
of a lot of implementations and thus possibly backwards incompatible.

More here: https://github.com/google/flatbuffers/issues/4122

Change-Id: I2bfdc8597b7cfd2235bb4074bb2ae06f81f8e57d
2018-10-29 17:40:19 -07:00
Wouter van Oortmerssen
705577de51 Revert "Convert net/FlatBuffers project to be compatible with netstandard (#4811)"
This reverts commit 72b05bc865.

Change-Id: I17510b7fa49b9861ce0a870b16f5c14a41082db5
2018-10-29 17:21:30 -07:00
Vladimir Glavnyy
0fb1d44bc4 Add 'fsanitize=address,undefined' to tests and flatc targets (#5009)
* Add '-fsanitize' optional flags to flattests and flatc targets

Control: -DFLATBUFFERS_CODE_SANITIZE=(ON | OFF | "=memory,undefined")
Travis-CI: building with -DFLATBUFFERS_CODE_SANITIZE=ON

* Fix -pie flag

* Cleanup
2018-10-29 11:29:05 -07:00
Wouter van Oortmerssen
bd20a60d6a Fixed Java gRPC version numbers.
Change-Id: Iff00a48b370f45f80d68e6c6929483d608ce1885
2018-10-25 13:48:41 -07:00
Wouter van Oortmerssen
b78c4332be Fixed npm publish appending multiple copies into .mjs
Change-Id: Id8c373b0f77d9a0f4922257339abb4e01e06c2d4
2018-10-25 13:48:41 -07:00
csmoe
636b516492 clean up unnecessary outer rust gen-snippet (#5013)
* clean up unneeded outer rust gen-snippet

* update generated rust file
2018-10-23 20:16:18 -07:00
Felix Hanley
560718e976 Use stdlib context in generated Go files (#4904) 2018-10-22 16:28:58 -07:00
Doug Muir
ff687ae9c1 Make alignment checking optional. (#5011) 2018-10-22 16:14:44 -07:00
Frank Benkstein
ca417426c7 make flatbuffers::IsFieldPresent safer (#4988)
Give the vtable offset enum inside each table the name
"FlatBuffersVTableOffset" and base type voffset_t so it can be used as a
dependent type in IsFieldPresent. This makes that function slightly
safer since it prevents calling it with arbitrary, non-table types.
Now, the only way to use IsFieldPresent incorrectly is to create your
own type which does not inherit from flatbuffers::Table but has a
dependent voffset convertible type "FlatBuffersVTableOffset".
2018-10-22 15:57:45 -07:00
Vladimir Glavnyy
55b30827f2 Add fuzzer test for scalar numbers in json. (#4996)
* Add fuzzer test for scalar numbers in json. Grammar-based regex used to check correctness.

* Fix conversation
2018-10-22 15:44:18 -07:00
Frank Benkstein
efbb11e093 CI check generate code (#4998)
* call reflection code generation from tests

This simplifies instructions to contributors so they don't forget to update
reflection code.

* add error handling to generate_code scripts

Let them propagate their errors instead of swallowing them so they show
up when called in CI.

* apply editorconfig to shell scripts

* use ordered map in dart codegen

Using an unordered map in the codegen can lead to spurious diffs in the
generated dart code.

* add CI check for generate_code being run

* update reflection_generated.h

* disable diff-check for monster_test.bfbs

Work around #5008.
2018-10-22 15:41:12 -07:00
Frank Benkstein
5c0f914f38 forbid enum values that are out of range (#4977)
* forbid enum values that are out of range

Enum values that are out of range can lead to generated C++ code that does
not compile.  Also forbid boolean enums.

* update enum and union documentation slightly
2018-10-18 10:39:08 -07:00
Sumant Tambe
802639e40d Efficient Conversion of a FlatBufferBuilder to a MessageBuilder (#4980)
* Efficient conversion of FlatBufferBuilder to grpc::MessageBuilder

* Added a variety of tests to validate correctness of the MessageBuilder move operations.
Disable MessageBuilder half-n-half tests on MacOS.

* Fix failing Android build

* Generalized the MessageBuilder move constructor to accept a deallocator
2018-10-18 10:32:59 -07:00
Felix Frank
ad8b1e5dbd [Python] Fast serialization of numpy vectors (#4829)
[Python] Fast serialization of numpy vectors (#4829)
2018-10-15 17:07:08 -07:00
kostya-sh
76d31e1b5e Go - Use Go bool type for bool fields (#4962)
* Use Go bool type for bool fields, and store non-default bool field to test data
2018-10-15 16:55:59 -07:00
Frank Benkstein
20396a1760 disallow c style casts (#4981)
Fixes #4857.
2018-10-15 15:11:31 -07:00
Frank Benkstein
a3d8391f7b don't use std::function in flatbuffers::Parser (#4995)
std::function makes code harder to debug because it requires stepping
through a separate destructor and call operator.  It's use unnecessary
in the Parser since the functions taking functors are private and are
only used within idl_parser.cpp.  Therefore the definitions can stay in
idl_parser.cpp as well.  Only care must be taken that the definitions
appear before use but that's already true and all compilers will
complain equally if it get's violated.  This change might also improve
performance since it might allow inlining where it wasn't possible
before but I haven't measured that.
2018-10-15 12:26:35 -07:00
iceboy
241e87d143 add :runtime_cc target (#4994) 2018-10-15 12:18:15 -07:00
Frank Benkstein
35f0b41fed fix missing newline in flatc help message (#4992) 2018-10-11 15:54:01 -07:00
Frank Benkstein
cb5422c398 fix #4974 (#4989) 2018-10-11 12:40:41 -07:00
Vladimir Glavnyy
4ed6fafdfa Refactoring of idl_parser (#4948)
* Refactoring of numbers parser

More accurate parse of float and double.
Hexadecimal floats.
Check "out-of-range" of uint64 fields.
Check correctness of default values and metadata.

* Remove locale-independent code strtod/strtof from PR #4948.

* small optimization

* Add is_(ascii) functions

* is_ascii cleanup

* Fix format conversation

* Refine number parser

* Make code compatible with Android build

* Remove unnecessary suppression of warning C4127
2018-10-11 10:37:47 -07:00
Frank Benkstein
53ce80ce91 better output on TestError (#4979)
Print a slightly better error message when a TestError fails.
2018-10-11 10:33:12 -07:00
Rikard Lundmark
233976c821 Add @javax.annotation.Generated to generated flatbuffer Java types (#4986)
* Add @javax.annotation.Generated to generated flatbuffer Java types.

* Updating test goldens.
2018-10-08 15:29:22 -07:00
Frank Benkstein
99fe1dc80f don't crash when calling EnumNameXXX on sparse enum (#4982)
Make an out-of-bounds check for enum values before using them to index the
names array.  For consistency with non-sparse enums an empty string is
returned.

Fixes #4821
2018-10-08 14:37:35 -07:00
Michael Edwards
a4f9d1bfcc Fix expected type of enum values in reflection tables (#4944)
Fixes #4930
2018-10-08 14:29:29 -07:00
kostya-sh
a4c362a1ba Use enum types in generated read/mutate methods for Go (#4978) 2018-10-08 14:25:37 -07:00
cor3ntin
7c3c027295 Add missing const on Reference::As<> (#4975)
Reference::As<> was needlessly mutable wich made them
less safe and harder to use
2018-10-08 12:52:01 -07:00
Stewart Miles
569492e890 Disable armeabi builds for Android and re-enable CI builds. (#4970)
armeabi support was removed from the Android NDK so we should no
longer build it.  Since this fixes the Android build failures this
commit also re-enables Travis Android builds.

While re-enabling Android builds, some recent changes broke C++98
support so this fixes those issues as well which include:
- Conditionally compiling use of move constructors, operators and
  std::move.
- Changing sample to use flatbuffers::unique_ptr rather than
  std::unique_ptr.

Finally, added the special "default_ptr_type" value for the
"cpp_ptr_type" attribute.  This expands to the value passed to
the "--cpp-ptr-type" argument of flatc.
2018-10-08 12:43:57 -07:00
Taj Morton
d840856093 In Javascript, generate bidirectional mappings for enums, between Name: Value and between Value: Name. (#4960) 2018-10-04 10:37:22 -07:00
Vladimir Glavnyy
925c1d77fc Fix recursion counter check. Add control to override depth of nested … (#4953)
* Fix recursion counter check. Add control to override depth of nested objects.

* Change if-condition to `>=`
2018-10-04 09:27:37 -07:00
Wouter van Oortmerssen
c0698cc33f Bumped version to 1.10.1 for all languages.
Change-Id: I9a6256d90ea800834a887afdcf888df412018933
2018-10-03 12:48:47 -07:00
Wouter van Oortmerssen
ea8a4296e7 Updated TestAll.sh with Rust.
Change-Id: I751f3bbd85eb1b521e1533c68f95442af0d18b8a
2018-10-03 12:27:27 -07:00
Jason Neufeld
f85af46262 Adds __reset method to Struct and Table (#4966)
This allow recycling/pooling instances without leaking ByteBuffers, by
providing a mechanism to reset instance to newly constructed state.
2018-10-03 12:09:30 -07:00
Vladimir Glavnyy
7a43775661 Assert tests on the first failure. (#4952)
* Assert tests on the first failure. Disable pop-up message box on assertion.

* Fix format and code style

* Move MSVC dependent code to ifdef
2018-10-03 12:04:14 -07:00
kostya-sh
062dcf7007 Use standard header for generated Go files (#4961)
As recommended by https://golang.org/pkg/cmd/go/internal/generate/:

  To convey to humans and machine tools that code is generated,
  generated source should have a line early in the file that
  matches the following regular expression (in Go syntax):

        ^// Code generated .* DO NOT EDIT\.$
2018-10-03 11:19:40 -07:00
Taj Morton
ebb410062b Allow tables that are entirely composed of native inlines to be copied. (#4958) 2018-10-01 16:27:54 -07:00
Sumant Tambe
4b864fd172 Turn on gRPC tests in travis build (#4955)
Download and build with a known grpc version
2018-10-01 15:59:04 -07:00
Vladimir Glavnyy
7e711f80d7 Parser error message reports both the line number and the cursor position. (#4954) 2018-10-01 14:57:36 -07:00
Matt Mastracci
bf871ffd7f Remove lifetime specifier on table getter methods (#4949)
With the old-style code, the test fails with a borrow-checker error:

```
  #[inline]
  pub fn name(&'a self) -> &'a str {
    self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Monster::VT_NAME, None).unwrap()
  }
```

```
error[E0597]: `e` does not live long enough
   --> tests/integration_test.rs:273:57
    |
273 |         let enemy_of_my_enemy = monster.enemy().map(|e| e.name());
    |                                                         ^      - `e` dropped here while still borrowed
    |                                                         |
    |                                                         borrowed value does not live long enough
274 |         assert_eq!(enemy_of_my_enemy, Some("Fred"));
275 |     }
    |     - borrowed value needs to live until here
```
2018-09-28 20:11:05 -07:00
kzvi
a89be8739c loosen lifetimes in type signature of Table::get (#4925) 2018-09-27 20:56:49 -07:00
Shivendra Agarwal
0bffce5aef Add more apis to query vector types from a reference (#4823)
* Add more apis to query vector types from a reference

https://github.com/google/flatbuffers/issues/4818

* changing order of apis

* another reordering

* removed vector element type api as not needed as for now
2018-09-27 12:34:27 -07:00
Vladimir Glavnyy
d48f08acfe Add missed defined(clang) and fix the wrong placement of #pragma push/pop for MSVC compiler (#4946) 2018-09-27 12:31:43 -07:00
kzvi
43132560f9 don't return Option from required table field accessors (#4926) 2018-09-26 21:11:25 -07:00
jean-airoldie
c56fff88a2 rust: Fixed MakeCamelCase (#4932) (#4936)
* Fixed MakeCamelCase behavior when supplied Upper_Camel_Case,
snake_case and UPPERCASE strings.
* Modified the rust integration test to reflect changes.
2018-09-26 13:35:02 -07:00
Sumant Tambe
49fed8c4f6 Add FlatBufferBuilder move semantics tests to the main test suite (#4902)
* Add FlatBufferBuilder move semantics tests to main

Do not eagerly delete/reset allocators in release and release_raw functions
Update android, vs2010 build files
New tests for various types of FlatBufferBuilders and move semantics

* Improve test failure output with function names
2018-09-24 12:03:31 -07:00
Michael Edwards
b1a925dfc2 ToStringVisitor settings to allow pretty formatted JSON (#4933) 2018-09-24 09:29:49 -07:00
Thomas
33791dc7b0 Add compare operator to code generated for c++ (#4940)
* Add operator== for c++ genated code

New "--gen-compare" option for flatc to generate compare operators. The operators are defined based on object based api types.

Inspired by issue #263.

* Improve compare operator for c++.
Thanks for the code review.

- Improve robustness against future schema extensions
- Code style
- Fix --rust generation in generate_code.sh
2018-09-21 16:53:59 -07:00
Wouter van Oortmerssen
873a60b0d8 Updated readme.md
Change-Id: I9b0664a3bde44a4ee44ef0fd117d0e4bedc132d9
2018-09-21 10:42:00 -07:00
Wouter van Oortmerssen
4b10656f9b Changed JS/TS codegen to use stable non-compiler dependent hash.
Different implementations of std::hash kept littering commits with
namespace changes.

Change-Id: Ic2d4fdcd76f8fef9802bc1572eb74ae7427085e3
2018-09-21 09:42:43 -07:00
Wouter van Oortmerssen
e317b148dc Added missing Dart codegen files.
Change-Id: Ic97f5b50fa191f967672c404f737d302462fc6ac
2018-09-21 09:42:43 -07:00
Christopher Cifra
ed03faaf07 [C#] Fix compile issue when compiling with older versions of C# (#4938)
* C# support for directly reading and writting to memory other than byte[].  For example, ByteBuffer can be initialized with a custom allocator which uses shared memory / memory mapped files.

Public access to the backing buffer uses Span<T> instead of ArraySegment<T>.

Writing to the buffer now supports Span<T> in addition to T[].

To maintain backwards compatibility ENABLE_SPAN_T must be defined.

* Remove usage of expression bodied method so that ByteBuffer can be compiled with older version of C#.
2018-09-20 15:07:03 -07:00
Robert
02a7807dd8 Add Rust to Appveyor config. (#4928) 2018-09-12 11:44:51 -07:00
Enrico Olivelli
615885e889 Add ByteBufferFactory#releaseByteBuffer (#4914)
This adds the ability to dispose unused buffers or to return them to an object pool
2018-09-06 11:08:08 -07:00
Robert
528ccdd458 rust: more builder lifetimes predicates (#4923) 2018-09-05 18:15:30 -07:00
Robert
c23ba6756f rust: more builder lifetimes logic (#4917) 2018-09-04 21:53:39 -07:00
Onur Karaman
10e1d1a69e fix rust flatbuffers create_vector docs (#4913)
Manual vector creation begins with start_vector, not create_vector.
2018-09-04 14:30:31 -07:00
Robert
660c491265 rust generator: fix builder lifetime switch (#4912) 2018-09-04 14:29:27 -07:00
Robert
c504a45404 rust generator: fix enum member comments (#4911) 2018-09-04 13:52:31 -07:00
Robert
919c929d30 readme.md: add Rust as a supported language 2018-09-03 23:38:41 -07:00
Robert
ba4a02b46a Update Cargo.toml for Crates.io package 2018-09-03 19:42:25 -07:00
Robert
be3d0b9c64 delete and ignore Cargo.lock files (#4906) 2018-09-03 19:33:38 -07:00
Chris Holcombe
872fad049e Fix extern crate in root namespace (#4905)
Imports the Rust FlatBuffers runtime crate even when not using a namespace in a schema.
2018-09-03 19:09:38 -07:00
Robert
9e648c392b Rust: Add basic crate-level documentation 2018-09-03 18:01:31 -07:00
Robert
d4f65bb8a3 Update Rust runtime crate version for publishing 2018-09-03 17:13:10 -07:00
Robert
3c54fd964b Port FlatBuffers to Rust (#4898)
This is a port of FlatBuffers to Rust. It provides code generation and a
runtime library derived from the C++ implementation. It utilizes the
Rust type system to provide safe and fast traversal of FlatBuffers data.

There are 188 tests, including many fuzz tests of roundtrips for various
serialization scenarios. Initial benchmarks indicate that the canonical
example payload can be written in ~700ns, and traversed in ~100ns.

Rustaceans may be interested in the Follow, Push, and SafeSliceAccess
traits. These traits lift traversals, reads, writes, and slice accesses
into the type system, providing abstraction with no runtime penalty.
2018-09-02 18:26:55 -07:00
Sumant Tambe
e7578548a5 Add move semantics to MessageBuilder, FlatBufferBuilder, SliceAllocator, and vector_downward (#4893)
Unit tests
Update flatbuffers + gRPC build instructions
Update CMakeLists.txt with cmake variables for grpc and protobuf install paths
Update tests for travis build
2018-08-30 16:43:22 -07:00
Gabriel Nützi
99acd0bcd7 DetachedBuffer cannot be rewrapped (#4885)
* Simple ReleaseRaw implemented

* [doc]

* clear_buffer and clear_allocator introduced

* auto

* typos

* rename because of -Werror=shadow
2018-08-24 10:57:57 -07:00
Christopher Cifra
d0321df8cf C# support for directly reading and writting to memory other than byte[]. For example, ByteBuffer can be initialized with a custom allocator which uses shared memory / memory mapped files. (#4886)
Public access to the backing buffer uses Span<T> instead of ArraySegment<T>.

Writing to the buffer now supports Span<T> in addition to T[].

To maintain backwards compatibility ENABLE_SPAN_T must be defined.
2018-08-23 10:05:31 -07:00
Derek Bailey
e1f48ad35a Updated preprocessor check for template aliases. (#4888) 2018-08-23 09:48:03 -07:00
Derek Bailey
d8f49e18d7 Mono Fix for Unsafe Mode (#4887)
* Added preprocessor define for C++ if Template Aliases are supported by the compiler

* Revert "Revert "Performance Increase of Vector of Structures using .NET BlockCopy (#4830)""

This reverts commit 1f5eae5d6a.

* Put<T> method was inside #if UNSAFE_BYTEBUFFER which caused compilation failure when building in unsafe mode

* Revert "Added preprocessor define for C++ if Template Aliases are supported by the compiler"

This reverts commit a75af73521.
2018-08-20 16:31:44 -07:00
Wouter van Oortmerssen
1f5eae5d6a Revert "Performance Increase of Vector of Structures using .NET BlockCopy (#4830)"
This reverts commit 7b50004ec9.

Change-Id: I09d6869c16aa3c7fadc537fc9c76eaa3cf7ee7ea
2018-08-20 12:08:21 -07:00
Wouter van Oortmerssen
ea9d60bbdf Added missing dart/ts test changes.
Change-Id: I836091193485b890710f1df779d4d770f729a27a
2018-08-20 12:05:37 -07:00
Andy Martin
c2c3a84aaf Add C#/Java generator behaviour for 'private' attribute (#4882)
* Added 'private' attribute, supported when generating C# and Java

* Added use of 'private' attribute in monster_test
2018-08-16 15:25:33 -07:00
Uilian Ries
1f03becd24 Conan build packages on CI (#4590) (#4594)
* Build Conan package on Travis CI (#4590)

- Added multi package support on Linux, running on Travis CI
- Only upload when branch is a tag and named "vX.Y.Z"
- Replace Conan injection by Conan wrapper
- Removed os_build os_arch -- Conan 1.0.1 hotfix

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Build Conan package on OSX (#4590)

- Added jobs to build Flatbuffers on OSX running on Travis

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Build Conan package on Windows (#4590)

- Added support necessary to build Flatbuffers on Windows (conan)
- Added Appveyor jobs to build Conan package
- Only build Conan package when release (tag)

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Reduce Conan CI support to simple scripts (#4590)

- Removed msvc 10 x86_64 workaround
- Updated conan remote address
- Added Bincrafters' package tools

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Add fPIC option on Conan recipe (#4590)

- Add fPIC as optional. It works on Linux and OSX
- Update recipe metadata: author, homepage, license
- Checking for flatc and flathash on Conan package

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Build Conan package on CI (#4590)

- Add rule to run conan job only for tags
- Run Conan on Linux, OSX and Windows
- Update package tool to new interface

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Update Conan username (#4590)

- Use google as default username

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Update OSX version on CI (#4590)

- Use latest OSX 9.3 version to build Conan package

Signed-off-by: Uilian Ries <uilianries@gmail.com>
2018-08-16 12:17:52 -07:00
kulswanand
c721009491 Proposing use of C++ header files and functions (#4869)
* Proposing use of C++ header files and functions 

Proposing use of C++ header files and functions instead of C header file and functions. 
Here are few examples for comparison : 

C                            C++
<cstdio>                <iostream> & <fstream>
printf()                     cout 
fopen()                    ifstream
etc ...

Please let me know if there are any comments.

* Updated diff based on review comments
2018-08-13 16:36:11 -07:00
iceboy
55289c55bf Use string_view if _HAS_CXX17 is true (#4876)
Current version of VC2017 is not setting __cplusplus to correct value, instead they use _MSC_VER, _MSVC_LANG and _HAS_CXX17 macros.
2018-08-13 16:19:51 -07:00
Wouter van Oortmerssen
ed2415eb72 Fixed use of uoffset_t in verifier could cause wrap around.
The verifier must be resilient against any corrupt data, so
now using size_t thru-out to ensure any 64-bit offsets can
be represented.

Also added verification of alignment.

Change-Id: I87a22aa6b045c2d83b69b47a47153f2e15ad7e06
Tested: on Linux, also with libfuzzer.
2018-08-13 14:52:50 -07:00
Matias Cudich
aaa89429d3 Update JavaScript IDL generator to remove invalid Closure JSDoc comments (#4873)
* Update JavaScript IDL generator to remove invalid Closure JSDoc comments

* Revert erroneous changes

* A few more tweaks

* Updated generated code
2018-08-10 15:27:51 -07:00
iceboy
12e5cf0b29 Remove FLATBUFFERS_COPTS from bazel BUILD (#4872)
fixes #4868
2018-08-10 13:43:48 -07:00
cubeleo
75601b81cc Correctly generate identifier for enums. (#4871)
This should allow the EnumName* function to work with enums generated
using the --scoped-enum flag.
2018-08-10 13:41:32 -07:00
Andrew Selle
e203882d54 Clarify flatbuffer reflection struct sizes to be less error-prone. (#4870) 2018-08-10 10:55:54 -07:00
iceboy
b9f1103b8a Add licenses to BUILD (#4867)
This allows to build flatbuffers from third_party directory.
2018-08-10 08:21:17 -07:00
Dan Field
fd40cc61a4 Ensure strings are null terminated when written from Dart (#4862)
* Update for Dart 2.x constants

* Fix strings, update test, add CHANGELOG for Dart
2018-08-09 09:50:54 -07:00
Wouter van Oortmerssen
38a6623f34 Temporarily disabled Android CI until fix.
Change-Id: I0c6758db7b4007e84b7ab8daaecd233711df8cab
2018-08-06 16:52:09 -07:00
Vladimir Glavnyy
27e4f43b77 Attach header directory information to the "flatbuffers" library target (#4849)
* Attach header directory information to the "flatbuffers" library target, if the CMake version supports it.

* Cleanup and documentation update
2018-08-06 14:59:29 -07:00
Kamil Rojewski
42515cfd33 Publishing flatc with conan (#4852)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

* Vector of unions for ts/js

* Sanity check for languages

* Indentation fix + output test files

* Vectors of unions for php

* Fixes to union vector handling + tests

* Fix for strictPropertyInitialization

* Fix for new aligned operator new for gcc >= 7.1

* Not generating imports/ns prefixes with --gen-all

* TypeScript docs

* Missing imports of enums

* Missing TS links

* Enabled vector of unions for java, since it seems to work

* Added jitpack config

* Added obj to vector of unions getter

* Removed unneeded accessor

* Bumped jdk version in pom.xml

* Vector of unions support for c#

* Missing TypeScript doc processing

* Option to NOT force libc++ when building with clang

* Publishing flatc with conan
2018-08-06 12:45:35 -07:00
Charlie Harrison
5d3648b88a Remove using namespace std; (#4851) 2018-08-06 12:08:49 -07:00
Wouter van Oortmerssen
fc3ce7d1ab Fixed VS2010 compile error.
Change-Id: Ibd970d30b51f77a2ac9c125e400c9f1b19a81cbc
2018-08-06 12:06:59 -07:00
aardappel
4898809eca FlatBuffers implementation for the Lobster programming language
Language, see: http://strlen.com/lobster/ and https://github.com/aardappel/lobster
2018-07-29 13:23:00 -07:00
shassani
ca5aaf62d3 Adds multi-line to FLatBufferToString (#4847)
Adding multi-line option to FlatBufferToString method in minireflect to allow more readable output for larger flatbuffers.
2018-07-27 12:45:12 -07:00
Wouter van Oortmerssen
c80f8d18c1 Fixed FlatBufferBuilder::Required not checking vtable size.
As reported in: https://github.com/google/flatbuffers/issues/4846
Tested: on Linux.

Change-Id: Id5e82dc5a46a681119cfe5a15415d522aac0e1f2
2018-07-27 12:41:50 -07:00
cubeleo
0d1559bdd4 For sparse enums, use a switch statement to generate EnumNameXXX(). (#4845) 2018-07-27 08:32:19 -07:00
Robert
8b39a0ee53 Merge pull request #4843 from rw/2018-07--explicit-enumish-types
go: give enums their own scalar types
2018-07-26 16:57:01 -07:00
rw
f675f6433c go: give enums their own scalar types 2018-07-26 16:46:35 -07:00
Paul Reimer
118093b613 Update FLATBUFFERS_HAS_STRING_VIEW __cplusplus checks to the versions provided by the standard feature test macros. (#4841) 2018-07-26 15:40:41 -07:00
Robert
1bb2a3bd08 Merge pull request #4820 from nairb774/master
[Go] encode.go performance changes
2018-07-26 15:35:45 -07:00
Dan Field
2361dfb66a Update for Dart 2.x constants (#4842) 2018-07-26 14:21:23 -07:00
Derek Bailey
7b50004ec9 Performance Increase of Vector of Structures using .NET BlockCopy (#4830)
* Added Get<vector_name>Array() method for accessing vectors of structures in C# using Buffer.Blockcopy().

* Added Get<vector_name>Array() method for accessing vectors of structures in C# using Buffer.Blockcopy().

Added Create<Name>VectorBlock() method to add a typed array using Buffer.BlockCopy() to speed up creation of vector of arrays

New Lua files for namespace test

* fixed c++ style issue
2018-07-26 13:44:40 -07:00
Wouter van Oortmerssen
6e185d06a7 Fixed minalign in Lua being reset on StartObject
Change-Id: I9cd62b38c8dc526f069726a88baef63e4b0dae57
2018-07-23 16:36:21 -07:00
Robert
c949229395 go: do not clobber minalign when we create objects (#4834) 2018-07-23 16:34:08 -07:00
Robert
e1d5fda5d4 python: do not clobber minalign when we create objects (#4833) 2018-07-23 16:29:45 -07:00
Evan Moran
a2603ec27e Add missing public header minireflect.h to bazel build (#4832) 2018-07-23 16:28:49 -07:00
Evan Moran
5f1b1ad42c Fixing bazel build's missing lua file (#4831) 2018-07-23 16:28:09 -07:00
shassani
4235a25640 Adds ForceStringAlignment to flatbuffers. (#4828)
ForceStringAlignment is useful for memory aligning string fields in flatbuffers.
2018-07-19 16:00:31 -07:00
Shivendra Agarwal
88cd182349 Restricting (typed=false, fixed=true) combination in flexbuffer CreateVector (#4825)
https://github.com/google/flatbuffers/issues/4815
2018-07-19 14:59:06 -07:00
Shivendra Agarwal
7c824ef690 Fixing an assert in flexbuffers CreateVector (#4824)
An assert was blocking the creation of typedvectors. It was wrongly checking for limited types even though vector was not of fixedTyped.
2018-07-19 14:55:06 -07:00
Kamil Rojewski
6bfa107f4e Option to NOT force libc++ when building with clang (#4826)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

* Vector of unions for ts/js

* Sanity check for languages

* Indentation fix + output test files

* Vectors of unions for php

* Fixes to union vector handling + tests

* Fix for strictPropertyInitialization

* Fix for new aligned operator new for gcc >= 7.1

* Not generating imports/ns prefixes with --gen-all

* TypeScript docs

* Missing imports of enums

* Missing TS links

* Enabled vector of unions for java, since it seems to work

* Added jitpack config

* Added obj to vector of unions getter

* Removed unneeded accessor

* Bumped jdk version in pom.xml

* Vector of unions support for c#

* Missing TypeScript doc processing

* Option to NOT force libc++ when building with clang
2018-07-19 09:40:28 -07:00
Wouter van Oortmerssen
0cd8daf14e Missing Lua generated files
Change-Id: Id668ade474805dd9c7e108a478db3551d6a62b48
2018-07-16 16:44:49 -07:00
Wouter van Oortmerssen
79f2adc50a Renamed Verifier methods
The name Verify was getting too overloaded, and confused
the VS compiler

Change-Id: I26423a4d513e4def2f4e41d7f278bb683fc12518
2018-07-16 16:42:10 -07:00
Wouter van Oortmerssen
dcfe38c58f Dart generated code changes
Change-Id: I1110974a375acb9668552294632658d9d1779772
2018-07-16 16:42:10 -07:00
shassani
51d9641de6 flatbuffer force-empty option (#4822) 2018-07-16 16:05:06 -07:00
Wouter van Oortmerssen
af6c0e6839 Updated fuzzer scripts
Point to new Chromium location
Also enable UBSan

Change-Id: I4ba182e3c6a967ad89090b776d05762fa9ae6e40
2018-07-16 15:51:28 -07:00
Wouter van Oortmerssen
7c3cb5caa1 Fixed assert in ParseSingleValue (found by fuzzer)
Change-Id: I84674eaab75b2b455e918b04e3027920430678ac
2018-07-16 15:51:28 -07:00
Wouter van Oortmerssen
8f1bebba05 C++ verifier now primarily uses offsets instead of pointers.
Fix for: https://bugs.chromium.org/p/chromium/issues/detail?id=834710

Before, the verifier would create pointers to objects, and then
verify they are inside the buffer. But since even constructing pointers
that are outside a valid allocation is Undefinied Behavior in C++, this
can trigger UBSAN (with -fsanitize=pointer-overflow).

Now instead the bounds checking is first performed using offsets
before pointers are even created.

Change-Id: If4d376e90df9847e543247e70a062671914dae1b
Tested: on Linux.
2018-07-16 15:51:28 -07:00
xgdgsc
cda1525f84 📝 release mode in building doc (#4819) 2018-07-16 12:56:14 -07:00
Damien Pontifex
72b05bc865 Convert net/FlatBuffers project to be compatible with netstandard (#4811) 2018-07-16 09:13:36 -07:00
Brian Atkinson
b3e4d9169b [Go] Force a single, early bounds check on read and write paths.
As an example, GetInt64 used to perform 8 bounds checks, one for each
slice access. By performing a bound check on the highest index, the
number of checks is reduced to one through bounds-check-elimination.
2018-07-15 16:49:21 -07:00
Brian Atkinson
e2eb6af3e3 [Go] Unroll WriteUint64 and WriteInt64.
This enables both WriteUint64 and WriteInt64 to both be inlined as
well as implemented with a single assembly instruction. The current Go
compiler refuses to inline functions with for loops. The compiler is
also not smart enough to produce a single assembly instruction for the
for-loop.
2018-07-15 16:47:17 -07:00
Wouter van Oortmerssen
b188fde27e Fixed Uint() method actually storing a signed int.
Also fixed two constructors missing explicit.

Change-Id: I147b2d2517bb660d92d4b0167992c115ed65dca7
2018-07-06 12:30:43 -07:00
Derek Bailey
ba5eb3b5cf Lua (5.3) Language addition (#4804)
* starting Lua port of python implmention. Syncing commit

* Bulk of Lua module port from Python done. Not tested, only static analysis. Need to work on binary strings. Started work on flatc lua code generation

* Fixed all the basic errors to produced a binary output from the builder, don't know if it is generated correctly, but it contains data, so that must be good

* fixed binary set command that was extending the array improperly

* continued improvement

* Moved lua submodules down a directory so their names don't clash with potential other modules. Added compat module to provide Lua versioning logic

* Successful sample port from Python

* working on testing Lua code with formal tests

* continued to work on tests and fixes to code to make tests pass

* Added reading buffer test

* Changed binaryarray implmentation to use a temporary table for storing data, and then serialize it to a string when requested. This double the rate of building flatbuffers compared to the string approach.

* Didn't need encode module as it just added another layer of indirection that isn't need

* profiled reading buffers, optimizations to increase read performance of monster data to ~7 monster / millisecond

* Writing profiler improvments. Get about
~2 monsters/millisecond building rate

* removed Numpy generation from Lua (came from the Python port)

* math.pow is deprecated in Lua 5.3, so changed to ^ notation. Also added .bat script for starting Lua tests

* adding results of generate_code.bat

* simple edits for code review in PR.

* There was a buffer overflow in inserting the keywords into the unorder set for both the Lua and Python code gens. Changed insertion to use iterators.

* fixed spacing issue

* basic documenation/tutorial updates. Updated sample_binary.lua to reflect the tutorial better

* removed windows-specific build step in Lua tests
2018-07-05 15:55:57 -07:00
Vladimir Glavnyy
8ea293b988 Issue #4799 fixed. Generator for KeyCompareWithValue is extracted. (#4802)
* Issue #4799 fixed. Generator for KeyCompareWithValue is extracted.

* format fix
2018-07-05 09:23:40 -07:00
Woody Guo
f19803d364 Dart: Add missing imports (#4803) 2018-07-03 08:44:27 -07:00
shassani
b2d69aacf4 Helper function to get empty string on nullptr (#4800)
Adds helper function to get empty string when String is nullptr.

This is to get over the fact that flat buffer builders will record null when data
is not present.
2018-07-02 09:34:18 -07:00
Woody Guo
3331805a1c Dart: Fix default values (#4795) 2018-06-28 10:12:18 -07:00
Kapil Sharma
ea06768ad1 Go GRPC generator Updates - Fixes #4787 (#4797)
* Fix for #4787

- Updated the grpc generator for go to use full namespace for service
rpc method names

* Formatting Fix

- Set to Google Style Formatting
2018-06-27 09:57:40 -07:00
Paul Reimer
741c63052d Add --force-defaults option to flatc [C++, parser] (#4729)
* Add --force-defaults option to flatc

To emit default values for fields which are not present or which are set
to the default value.

* flatc option --force-defaults should have a default value (false) and take action on the builder_ within the Parser constructor

* Add help text from flatc --force-defaults to Compiler.md doc

* Clarified docs for flatc --force-defaults, and imply that this behaviour is not normally needed.

* Updated docs and flatc help text for --force-defaults option
2018-06-27 09:12:52 -07:00
Wouter van Oortmerssen
e9912e9298 Added setup.cfg to default to python 2/3 wheels for pypi.
Change-Id: I64cf42aca79c32d21cd15c1415125ba97665d134
2018-06-25 15:08:06 -07:00
Polynomdivision
7dbc8f564a docs: fix flatc instructions (#4794) 2018-06-25 14:55:18 -07:00
Wouter van Oortmerssen
a2fe49b498 Fixed documentation comments at the start of a file.
Change-Id: Ic24018a6cd604c71b4d8d3cd35dc7a583fb18394
2018-06-25 14:02:12 -07:00
Wouter van Oortmerssen
7dd5cfb510 Fixed empty structs generating bad constructor.
This was fixed previously here:
5fd0fefab6
but somehow got undone in intermediate refactors.

Change-Id: I86e45a3f96f67a2b3d84d44081403baef6798921
2018-06-25 12:28:01 -07:00
Shivendra Agarwal
00b741e5fb Comment update for ForceDefaults. (#4788)
Current comment is a bit ambiguous. Default values can be read either if field is not written (like in table), or if they are written explicitly by client but not serialized due to optimization. Impression from current comment is that all the default values which are coming during read are from binaries when we turn-on Force-Defaults. However, that will be a wrong interpretation.

Force_Defaults = true ensures to turn OFF later optimization. In case a field is not written, during read we will get default values but they will still not be serialized.
2018-06-21 08:50:36 -07:00
Shivendra Agarwal
bb321fbe19 CreateUnitializedVectorOfStructs and tests (#4781)
* CreateUnitializedVectorOfStructs and tests

* Incorporating review comments

* snake_case variable names
2018-06-18 10:12:26 -07:00
Wouter van Oortmerssen
7330436713 Protected parser against infinite recursion.
Will error-out after e.g. 64 levels of nested JSON tables.

Change-Id: I3ab66cdd509378bfab87b85f85c07ab42aded788
Tested: on Linux.
2018-06-14 16:17:19 -07:00
Wouter van Oortmerssen
f9c64891dd Fixed ASan array out of bounds.
Change-Id: I53366bd14548aa41c3d25bcd187d7436d47e8665
Tested: on Linux.
2018-06-14 15:13:01 -07:00
zejal
b752e4a9bb Fix misaligned nested buffers (#4785) 2018-06-14 09:21:42 -07:00
Kamil Rojewski
3e3c770c4e Fixed TypeScript links in docs (#4783)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

* Vector of unions for ts/js

* Sanity check for languages

* Indentation fix + output test files

* Vectors of unions for php

* Fixes to union vector handling + tests

* Fix for strictPropertyInitialization

* Fix for new aligned operator new for gcc >= 7.1

* Not generating imports/ns prefixes with --gen-all

* TypeScript docs

* Missing imports of enums

* Missing TS links

* Enabled vector of unions for java, since it seems to work

* Added jitpack config

* Added obj to vector of unions getter

* Removed unneeded accessor

* Bumped jdk version in pom.xml

* Vector of unions support for c#

* Missing TypeScript doc processing
2018-06-12 11:37:10 -07:00
Woody Guo
5a3f18d17d Dart: Generate the enum from 0 if value is null and fix inconsistent naming when generating object builder (#4782)
* Dart: Generate the enum from 0 if value is null

* Dart: Fix inconsistent naming when generating object builder
2018-06-12 11:35:40 -07:00
Wouter van Oortmerssen
10bdcefa4a Re-enable clang / os x in .travis
Change-Id: I45f6326f1b7da2d83eeee72fe44fd9626a288b5b
2018-06-08 11:20:57 -07:00
Wouter van Oortmerssen
9bab626cbf Removed biicode from repo.
Change-Id: I8b517fb8eaf02772052d95ca55bdaa0efbffa65a
2018-06-08 11:03:34 -07:00
Wouter van Oortmerssen
effb608027 Added missing Dart generated files.
Change-Id: I27986e8aaf2f672145af9beae6ab659b272c9721
2018-06-08 10:59:46 -07:00
Michael Seifert
a96f2bd6ca Python: Escape enum member names if they correspond to a Python keyword (#4772)
* Python: Generated enum member names are now escaped if they correspond to a Python keyword.

* Keyword list in Python generator is now a const char* instead of an std::string array.

* Moved static functions and keyword list of Python generator into the PythonGenerator class.

* Python generator escapes keyword identifiers in all definitions.
2018-06-08 10:55:19 -07:00
Tin Tvrtković
ab3b721a54 Python: fix default bool value. (#4773)
* Python: fix default bool value.

* Small style tweak.
2018-06-07 12:02:35 -07:00
Wouter van Oortmerssen
4cfe36ae8e Enforcing CreateUninitializedVector is only used with scalars.
This function cannot work with any offset types (since offsets
must always point forward) so this avoid possible mistakes.

Change-Id: I1b3dfbefc8d40da630345b9b04f9aff4a990e8e5
2018-06-07 08:49:38 -07:00
Vladimir Glavnyy
c7a797b966 Makes VectorIterator compatible with STL iterators. (#4768) 2018-06-04 12:02:08 -07:00
Vladimir Glavnyy
ecc07e7793 Fix a small problem with add_subdirectory(${FLATBUFFERS_DIR}) from top level project. (#4764) 2018-06-01 08:22:17 -07:00
Christian Helmich
43944a0ab1 renamed flexbuffers::Type enum values TYPE_ -> FBT_ (#4761)
reason: TYPE_BOOL is a macro defined in some iOS build configurations.
2018-05-31 11:06:44 -07:00
Wouter van Oortmerssen
27ce09860a Fixed typo in Java/C# tutorial.
Change-Id: I956b27f37b11988e67d0403a596c0569eacbfc2a
2018-05-31 09:53:47 -07:00
Wouter van Oortmerssen
3a2f6d5300 Fixed ASAN false positive.
Change-Id: I79d9b2cddc61df5919bc4a93627fba2aa69e5d49
Tested: on Linux.
2018-05-31 09:49:05 -07:00
Steve Barman
06d3229dc3 adds https to landing page link so it resolves (#4757) 2018-05-31 09:37:51 -07:00
Gautham B A
348fcb5b88 Fix typo in tutorial for Go (#4756)
Fixed a typo in serialising the inventory for Orc.
2018-05-31 09:17:34 -07:00
Nathan Mitchell
b4ca4d3cde Javascript: Add suppport for ES6 style exports (#4754)
* Add suppport for ES6 style exports

Adds support for ECMAScript 6 module exports during Javascript
generation. This is useful as many development projects are
switching to this new standard and away from custom module
solutions. By integrating support into flatbuffers, users
do not need to perform additional post-processing of generated
files in order to use flatbuffers output directly in their
codebases.

Reference to ECMAScript 6 modules:
https://www.ecma-international.org/ecma-262/6.0/#sec-exports

Changes:
* Added `--es6-js-export` option to cli parser tool
* Added conditional code to generate a ES6 style export
  line, replacing the normal NodeJS/RequireJS line.

* Fixed missing export statements

Added exports for definition and struct names that were not inside namespaces

* Updated Compiler.md with new generator option

Added entry to Compiler.md in docs for the `--es6-js-export` flag, including a brief description of the effects and usefulness.
2018-05-31 08:29:58 -07:00
Wouter van Oortmerssen
0848f58cdd Changed how the default allocator is handled.
This is to not need static variables, which could trip up users
with destruction order problems.

This potentially makes these operations slightly slower, but I
think they're infrequent enough that this should not be noticable.

Also there is one breaking API change, for a method that is not
used by any code in FlatBuffers and is assumed to affect very
few if any users. A namechange and comment ensures that those
affected, if any, will not run into trouble silently.

Change-Id: I16c1352d1dfc9092c816ddb7e353ed7f5f417444
Tested: on Linux.
2018-05-18 14:48:59 -07:00
Vitaly Bondar
8e42f44807 Fix of namespace problem described in #4747 (#4752) 2018-05-18 12:21:08 -07:00
Dan Field
88912640d0 Add [Dart] support (#4676)
* Add [Dart] support

* fix enum vectors

* Allow for opt out of string interning

* fix comment style, make interning opt in

* remove Offset<T>, prefer int

* avoid creating unnecessary vtable objects

* start work on tests - do not generate builder if struct has 0 fields - add int64

* support reading structs properly

* correctly handle reading vectors of structs, dartfmt

* support structs, fix unnecessary prepares

* fix bool customizations

* undo unintentional removal of file

* docs updates, complete tutorial, bug fix for codegen

* more documentation

* Update docs, add to doxygen file

* update package structure, add samples script/code

* rearrange sample

* Tests

* Add readme for pub

* cleanup package for pub

* update docs for renamed file

* remove custom matcher, use `closeTo` instead

* remove unintentional file

* remove unintended file checkin

* use auto, move method, cleanup

* refactor to ObjectBuilders, add Builders

* Update tests, examples

* Add files missing from previous commit

* documentation and example updates

* Update LICENSE, make dartanalyzer happy, fix minor bugs, get rid of duplicate files, publish script

* fix sample for slightly different schema

* Update pubspec.yaml
2018-05-18 11:06:15 -07:00
joligarson
c43a0beff0 Fix undertermined execution behavior (#4751)
Fix for the issue #4744: Ambiguous side-effect execution on vector_downward::make_space() method.
C++ does not impose evaluation order on the two expressions on the right side of the assignment, so compiler can freely decide. As ensure_space() method can change the value of "cur_" variable, the result of the subtraction may be different depending on the evaluation order, which is ambiguous in C++.
In order to make this code deterministic and correct, cur_ must be evaluated after ensure_space() is called.
2018-05-18 09:15:20 -07:00
Tin Tvrtković
a9640bd9e1 [BREAKING CHANGE] Python: handle bool table fields properly. (#4736)
* Python: handle bool table fields properly.

* Small refactor.

* Use snake_case instead of camelCase. Use auto.
2018-05-14 13:30:10 -07:00
Kamil Rojewski
f11ffedb2b Vector of unions support for java and c# (#4735)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

* Vector of unions for ts/js

* Sanity check for languages

* Indentation fix + output test files

* Vectors of unions for php

* Fixes to union vector handling + tests

* Fix for strictPropertyInitialization

* Fix for new aligned operator new for gcc >= 7.1

* Not generating imports/ns prefixes with --gen-all

* TypeScript docs

* Missing imports of enums

* Missing TS links

* Enabled vector of unions for java, since it seems to work

* Added jitpack config

* Added obj to vector of unions getter

* Removed unneeded accessor

* Bumped jdk version in pom.xml

* Vector of unions support for c#
2018-05-14 11:12:24 -07:00
Keef Aragon
5d42c8352e Set Working Directory for flatc commands (#4737) 2018-05-14 09:20:49 -07:00
Paul Reimer
7c1203d44c Add define/ifdef blocks, alternate sprintf implementation via FLATBUFFERS_PREFER_PRINTF [C++] (#4700)
* Add define/ifdef blocks for FLATBUFFERS_PREFER_PRINTF to avoid using std::*streams for idl_parser

* Use string::size() as limit in snprintf

* Refactored FLATBUFFERS_PREFER_PRINTF guarded feature into NumToStringImplWrapper around sprintf

* Remove '.0' where not needed from IntToDigitCount

* Remove leading dot from name in GetFullyQualifiedName when FLATBUFFERS_PREFER_PRINTF is enabled

* Return string directly from conversion functions where possible when FLATBUFFERS_PREFER_PRINTF is enabled

* Use string instead of stringstream for GetFullyQualifiedName

* Revert removing leading dot from GetFullyQualifiedName, it does need to be there for parity with the stringstream implementation

* Dot is single char in Namespace::GetFullyQualifiedName

* Remove trailing (duplicate) null-byte from NumToStringImplWrapper when using FLATBUFFERS_PREFER_PRINTF.

* Update preprocessor indenting (and use clang-format off/on) for FLATBUFFERS_PREFER_PRINTF

* Reduce whitespace, unneeded braces in FLATBUFFERS_PREFER_PRINTF string width functions

* Remove unneeded use of iostream from idl_parser.cpp, std::string is used instead

* Tell snprintf to use the trailing null byte expected at the end of std::string buffer
2018-05-10 13:31:02 -07:00
Paul Reimer
a0a33d94a7 Add string view [C++] (#4730)
* Add view() method on flatbuffers::String, to return a string_view type
if support for std::string_view (or alternately
std::experimental::string_view) is found

* Move detection/definition of FLATBUFFERS_STRING_VIEW to base.h, use the
macro (if it is defined) as the argument type for an overload of CreateString

* Rename String::view() to String::string_view() and use the existing c_str() method for the data pointer

* Add and explain minimum C++ standard version checks for FLATBUFFERS_STRING_VIEW implementations

* Updated preprocessor indenting for FLATBUFFERS_STRING_VIEW

* Convert FLATBUFFERS_STRING_VIEW macro to typedef in flatbuffers:: namespace, and boolean feature toggle macro FLATBUFFERS_HAS_STRING_VIEW

* Prepend flatbuffers:: namespace to disambiguate flatbuffers::string_view typedef from String::string_view()

* clang-format as-she-is-spoke for FLATBUFFERS_HAS_STRING_VIEW
2018-05-10 13:30:35 -07:00
Tin Tvrtković
b10123ff63 Python: return None for missing strings. (#4733)
[BREAKING CHANGE] Python: return None for missing strings.
2018-05-10 10:34:20 -07:00
Mike Mansell
3a2c535592 Remove @Nullable (Java) for required fields (fixes #4724) (#4726)
@Nullable is only a compiler informational attribute.
Removing for required fields improves compiler warnings
but doesn't impact any running code.
2018-05-10 09:27:23 -07:00
Paul Reimer
6621424308 Add --root-type option to flatc [C++, parser, JSON] (#4728)
* Add --root-type option to flatc

To select or override a root_type

* Add help text from flatc --root-type to Compiler.md doc
2018-05-07 16:07:52 -07:00
Wouter van Oortmerssen
d215852f52 Several pom.xml files did not have their version bumped to 1.9.0
Change-Id: I7c9bb5406ae8df951afe12a008f0d071e0195bfa
2018-05-07 08:46:34 -07:00
Vladimir Glavnyy
12c4c2238c Output JSON strings as natural UTF-8 text without escapes (#4710)
* Added support for the non-escaped print of utf-8 string.

* EscapeString: the first invalid symbol resets print_natural_utf8 flag to false.

* Move the test to ParseAndGenerateTextTest. Fixes.

* Removed dependence between `natural_utf8` and `allow_non_utf8` flags.
2018-05-03 12:10:45 -07:00
iceboy
85faa46fb3 Fix union escaping order. (#4722)
* Fix union escaping order.

Fixes #4712

* style
2018-05-03 11:59:30 -07:00
iceboy
cc354ea368 Delete ByteBuffer.exe (#4721) 2018-05-03 11:58:29 -07:00
husobee
bed19a5340 Addition of Go FinishWithFileIdentifier (#4720)
* Addition of Go FinishWithFileIdentifier, allows for Go flatbuffer data to contain a file identifier

* adding panic as per review if fileIdentifier does not match length, letting prep pad the file identifier

* updated error message to not use fmt.Sprintf

* using minalign for alignment for file identifier
2018-04-30 14:37:24 -07:00
Tobias Oberstein
9bb88a026a Include services in reflection data (fixes #4639) (#4713)
* include service in reflection data (fixes #4639)

* changes from review

* regenerated test data
2018-04-27 13:31:18 -07:00
Mark Henderson
34cb163e38 Adding JS function to get the File Identifier (#4715)
* Adding JS  function to get the File Identifier

* Update flatbuffers.js
2018-04-23 12:54:20 -07:00
Vladimir Glavnyy
a66f9e769b The asserts replaced by FLATBUFFERS_ASSERT. (#4701)
* The asserts replaced by FLATBUFFERS_ASSERT. Several asserts have converted to static_asserts.

* Regenerate header monster generate_code.sh
2018-04-16 08:57:59 -07:00
Sergey Avseyev
86153fd740 Remove unnecessary const qualifier (#4698)
In file included from include/flatbuffers/flexbuffers.h:24,
                 from src/idl_gen_text.cpp:20:
include/flatbuffers/util.h: In function 'int flatbuffers::FromUTF8(const char**)':
include/flatbuffers/util.h:324:45: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers]
   if ((static_cast<const unsigned char>(**in) << len) & 0x80) return -1;  // Bit after leading 1's must be 0.
                                             ^
cc1plus: all warnings being treated as errors
make[2]: *** [CMakeFiles/flatbuffers_shared.dir/build.make:92: CMakeFiles/flatbuffers_shared.dir/src/idl_gen_text.cpp.o] Error 1
2018-04-06 11:33:07 -07:00
Vladimir Glavnyy
7eb4c6098e An user-defined attribute name validation (#4689)
* User-declared attribute should be either identifier or string with the identifier.

* Attribute can be identifier or string in metadata.
2018-04-06 09:07:59 -07:00
Paul Reimer
af3c598189 Rename MANUALLY_ALIGNED_STRUCT to add FLATBUFFERS_ prefix in generated code within tests/. Via running cd tests && sh generate_code.sh (#4696) 2018-04-05 16:36:42 -07:00
Paul Reimer
eac0bc6490 Add FLATBUFFERS_ prefix to defines [C++] (#4695)
* Rename STRUCT_END to add FLATBUFFERS_ prefix, now FLATBUFFERS_STRUCT_END. Via running `ag -l STRUCT_END | xargs rpl STRUCT_END FLATBUFFERS_STRUCT_END`

* Rename MANUALLY_ALIGNED_STRUCT to add FLATBUFFERS_ prefix, now FLATBUFFERS_MANUALLY_ALIGNED_STRUCT. Via running `ag -l MANUALLY_ALIGNED_STRUCT | xargs rpl MANUALLY_ALIGNED_STRUCT FLATBUFFERS_MANUALLY_ALIGNED_STRUCT && cd tests && sh generate_code.sh`

* Rename DEFINE_BITMASK_OPERATORS to add FLATBUFFERS_ prefix, now FLATBUFFERS_DEFINE_BITMASK_OPERATORS. Via running `ag -l DEFINE_BITMASK_OPERATORS | xargs rpl DEFINE_BITMASK_OPERATORS FLATBUFFERS_DEFINE_BITMASK_OPERATORS`
2018-04-05 16:00:54 -07:00
Wouter van Oortmerssen
20a400e940 Update version number to 1.9
Change-Id: I0b0ed43129c4d8fc88a177792df50adfeb52a1e3
2018-04-05 15:11:52 -07:00
Wouter van Oortmerssen
676f0248aa Added missing generated code files.
Change-Id: I59af6ca1825870461c0badc7e7a045b97befdc1a
2018-04-05 15:01:35 -07:00
Kamil Rojewski
34b8b80f15 Missing TS links in docs (#4693)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

* Vector of unions for ts/js

* Sanity check for languages

* Indentation fix + output test files

* Vectors of unions for php

* Fixes to union vector handling + tests

* Fix for strictPropertyInitialization

* Fix for new aligned operator new for gcc >= 7.1

* Not generating imports/ns prefixes with --gen-all

* TypeScript docs

* Missing imports of enums

* Missing TS links
2018-04-05 09:54:37 -07:00
Juyeon Yoon
0998861e0f Remove line break of CMakeLists.txt (#4691)
Fix #4650
2018-04-05 09:17:33 -07:00
David Stephan
2e3d3cbcb5 Fix typos in C++ tutorial (#4685)
CreateMonster and MonsterBuilder examples fixed for C++
2018-04-02 09:25:05 -07:00
Kamil Rojewski
d3a00f7730 Fix for missing enum imports (#4683)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

* Vector of unions for ts/js

* Sanity check for languages

* Indentation fix + output test files

* Vectors of unions for php

* Fixes to union vector handling + tests

* Fix for strictPropertyInitialization

* Fix for new aligned operator new for gcc >= 7.1

* Not generating imports/ns prefixes with --gen-all

* TypeScript docs

* Missing imports of enums
2018-03-26 10:29:45 -07:00
Kamil Rojewski
cc54963830 TypeScript docs (#4680)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

* Vector of unions for ts/js

* Sanity check for languages

* Indentation fix + output test files

* Vectors of unions for php

* Fixes to union vector handling + tests

* Fix for strictPropertyInitialization

* Fix for new aligned operator new for gcc >= 7.1

* Not generating imports/ns prefixes with --gen-all

* TypeScript docs
2018-03-23 09:01:39 -07:00
Flaviu
79f62ee353 Const correctness in generated code and in code generators. Added missing \reflection\generate_code.bat file. (#4679) 2018-03-23 08:58:07 -07:00
Andreas Bergmeier
c0a6e5120d [C++, Go, Bazel]: Fix up Bazel support (#4672)
* Add Bazel support for Go library

* Make flatc compile again.

Was missing java_generator, which is now referenced from source.
2018-03-15 12:31:16 -07:00
Robert Schmidtke
08cf50c54a Java/C#/Python prefixed size support (#4445)
* initial changes to support size prefixed buffers in Java

* add slice equivalent to CSharp ByteBuffer

* resolve TODO for slicing in CSharp code generation

* add newly generated Java and CSharp test sources

* fix typo in comment

* add FinishSizePrefixed methods to CSharp FlatBufferBuilder as well

* add option to allow writing the prefix as well

* generate size-prefixed monster binary as well

* extend JavaTest to test the size prefixed binary as well

* use constants for size prefix length

* fuse common code for getRootAs and getSizePrefixedRootAs

* pulled file identifier out of if

* add FinishSizePrefixed, GetSizePrefixedRootAs support for Python

* Revert "extend JavaTest to test the size prefixed binary as well"

This reverts commit 68be4420dd.

* Revert "generate size-prefixed monster binary as well"

This reverts commit 2939516fdf.

* fix ByteBuffer.cs Slice() method; add proper CSharp and Java tests

* fix unused parameter

* increment version number

* pulled out generated methods into separate utility class

* pulled out generated methods into separate utility class for Python

* fix indentation

* remove unnecessary comment

* fix newline and copyright

* add ByteBufferUtil to csproj compilation

* hide ByteBuffer's internal data; track offset into parent's array

* test unsafe versions as well; compile and run in debug mode

* clarify help text for size prefix

* move ByteBuffer slicing behavior to subclass

* fix protection levels

* add size prefix support for text generation

* add ByteBufferSlice to csproj compilation

* revert size prefix handling for nested buffers

* use duplicate instead of slice for removing size prefix

* remove slice subclass and use duplicate for removing size prefix

* remove slice specific tests

* remove superfluous command line option
2018-03-12 11:30:46 -07:00
Sergey Avseyev
6b3f057bdc Remove unnecessary const qualifier from cast (#4666)
Const does not make sense here, and compiler actually throws warning
(error with -Werror) when you would try to compile it.

    In file included from include/flatbuffers/flexbuffers.h:24,
                     from include/flatbuffers/idl.h:26,
                     from include/flatbuffers/code_generators.h:22,
                     from src/code_generators.cpp:17:
    include/flatbuffers/util.h: In function ‘int flatbuffers::FromUTF8(const char**)’:
    include/flatbuffers/util.h:325:44: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers]
       if ((static_cast<const unsigned char>(tmp) << len) & 0x80) return -1;  // Bit after leading 1's must be 0.
                                            ^
    cc1plus: all warnings being treated as errors

This warning caught by gcc8:

    $ g++ --version
    g++ (GCC) 8.0.1 20180222 (Red Hat 8.0.1-0.16)
2018-03-12 08:22:17 -07:00
ianXian
60de374486 Convert to unsigned char before applying bit shift operator (#4664)
* Convert to unsigned char before applying bit shift operator

* convert to const unsigned char inline

* convert to unsigned char inline
2018-03-09 09:45:47 -08:00
desqaz
e78825e7a0 Json : Add --size-prefixed option to flatc (#4645)
to be able to convert to json size prefixed buffers.
2018-03-09 08:21:28 -08:00
Montoli
cc158e7009 Swapped the order of two conditions in an assert. (#4663)
An assert in flexbuffers was bit-shifting a 64-bit number by
64 bits, which throws up warnings in some automated tools.

The same assert also checks to see if the number of bytes
being shifted is 8.  Swapped the order, so that the bitshift
only occurs if the number of bits being shifted is not 64.

Should be the same behavior, but plays nicer with diagnostic
tools.
2018-03-08 14:18:41 -08:00
desqaz
5377957b14 Update .gitignore with Ninja stuff (#4659) 2018-03-08 10:36:27 -08:00
Wouter van Oortmerssen
4bc6de9a88 Fix broken Java/C# codegen 2018-03-05 16:37:04 -08:00
Wouter van Oortmerssen
3a62813f0e Added missing generated code files.
Change-Id: Ie1cab284cb6e0fe5bd2b2c293c3136c148927ac3
2018-03-05 15:47:16 -08:00
Nik Hemmings
fb94af8899 Protobufs: Added '--oneof-union' option. (#4647)
* Added '--oneof-union' option.

Used with the .proto -> .fbs converter, will translate protobuff oneofs to flatbuffer unions.
Updated proto test to check both methods of converting oneofs.

* Added '--oneof-union' option.

Used with the .proto -> .fbs converter, will translate protobuff oneofs to flatbuffer unions.
Updated proto test to check both methods of converting oneofs.

* FlatBuffers: Moved MakeCamel() into idl_parser.cpp

Removes library dependency on Java/C# generator code.
2018-03-05 08:45:25 -08:00
smillius
77b458bee5 Make nested flatbuffer lookup consistent. (#4656)
Lookup type of nested flatbuffer field with either raw name or fully qualified name as already done in the parser.
LookupCreateStruct tries both the raw name and the fully qualified one.
Without this, we cannot reference types outside of the current namespace, e.g. in a different module.
2018-03-05 08:44:14 -08:00
Christian Helmich
9ce98dd77d Support attribute "cpp_ptr_type" on table elements marked as "hash" (#4643)
* added intended use-cases to monster_test.fbs

* added check for `cpp_ptr_type` on hashed fields
added default value 'naked' to `cpp_ptr_type` on hashed fields

* added C++ generation of cpp_type vectors
removed ctor call for vector fields
added condition !vector for cpp_type check
added Pack() and UnPack() code generation for vector of hashes
added generation of correct resolve/rehash for cpp_type elements

* added attribute 'cpp_ptr_type_get' to hold accessor for pointer types possible where '.get()' does not work
use case: cpp_ptr_type:"std::weak_ptr", cpp_ptr_type_get:".lock().get()"

* run flatc to re-generate headers

* added bool param is_ctor to GetDefaultScalarValue() to differentiate between usage places

* modified monster_test.fbs to remove usage of shared_ptr/weak_ptr
reason: STLport does not support std::shared_ptr and std::weak_ptr

* run flatc again to re-generate headers

* fixed symbol unique_ptr not in namespace std when building with STLport
2018-03-05 08:40:55 -08:00
Mitchel
4ea1be53d4 Java + C#, reuse object in lookup_by_key (#4648)
* Java + C#, reuse object in lookup_by_key

* Java + C#, reuse object in lookup_by_key
2018-03-02 15:22:46 -08:00
Mitchel
0068b25132 Fix for Java infinite loop encoding into 0-sized buffer (#4654) 2018-03-02 15:21:08 -08:00
Christian Helmich
ec74f58b94 made HashFnv functions constexpr (#4640)
* added FLATBUFFERS_CONSTEXPR_CPP14 define for C++14 and above constexpr

* made HashFnv functions constexpr (depending on FLATBUFFERS_CONSTEXPR)
2018-03-02 09:13:55 -08:00
Kamil Rojewski
48d8232584 Not generating imports/ns prefixes with --gen-all (#4644)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

* Vector of unions for ts/js

* Sanity check for languages

* Indentation fix + output test files

* Vectors of unions for php

* Fixes to union vector handling + tests

* Fix for strictPropertyInitialization

* Fix for new aligned operator new for gcc >= 7.1

* Not generating imports/ns prefixes with --gen-all
2018-02-26 08:56:04 -08:00
Mitchel
55ddb84eb2 In Java, allow reusing ByteBuffer in getters (#4633)
* In Java, allow reusing ByteBuffer in getters

* In Java, allow reusing ByteBuffer in getters

* In Java, allow reusing ByteBuffer in getters
2018-02-23 14:01:05 -08:00
Christian Helmich
6e2e909b5c template specialized Hash functions for 16-bit hash types (#4631)
added access to HashFunction for 16 bit
2018-02-23 10:29:37 -08:00
Philip S Doctor
b24c0b07a3 When Java raises a CharacterCodingException, the catch block rethrows this exception as a java.lang.Error. Per the docs https://docs.oracle.com/javase/8/docs/api/java/lang/Error.html an Error is a serious problem that applications should not attempt to catch such as ThreadDeath. In this case, it is reasonable for a consumer to try to catch this error as it likely indicates a problem with the underlying data. (#4630)
As Error does not inherit from Exception, a generic `catch(Exception ex)` will not catch this error.

A simple change from `Error` to `Exception` is not sufficient as an `Exception` is checked by the compiler, so in order to keep this issue unchecked, I am proposing raising a `RuntimeException` which is not checked, but is still a subclass of `Exception`.

The only possible breaking change would be if a consumer was explicitly catching `Error` already for this library.

https://github.com/google/flatbuffers/issues/4629
2018-02-22 14:54:35 -08:00
Christian Helmich
59e26017cb added support for parsing hash on vector elements (#4502)
* added support for parsing hash on vector elements

reversed check for scalar to check for vector

added C++ generation of cpp_type vectors

removed ctor call for vector fields
added condition !vector for cpp_type check

added Pack() and UnPack() code generation for vector of hashes

* schema change:
added table Referrable and weak references towards it from Monster

added single_weak_reference to Monster table
changed order with vector_of_weak_references

* re-generated monster schema dependent code

added Referrable.cs to FlatBuffers.Test.csproj
2018-02-22 11:04:26 -08:00
desqaz
132e6a8220 Add new c++ helpers to ease usage of size prefixed FlatBuffers (#4626)
It was missing some helpers when we choose to use
size prefixed FlatBuffers.

* Add general helper : GetPrefixedSize
* Add generated helpers :
 * GetSizePrefixedXXX
 * VerfifySizePrefixedXXXBuffer
 * FinishSizePrefixedXXXBuffer
2018-02-22 09:19:08 -08:00
Masato Nagai
19c81b11b3 [C++] better type mismatch error (#4623)
* better parse error

* pass str as a pointer instead of a reference for more efficient performance
2018-02-16 08:32:50 -08:00
Alexander Gallego
36f8564846 C++: mini_reflect: Add DefaultTypeTable (#4614)
* mini_reflect: Add DefaultTypeTable

Currently it's very easy to make a mistake when it comes to
instantiating the TypeTable to print a buffer because it is not type
safe.

This will allow us to write safer cpp code:

flatbuffers::FlatBufferToString(reinterpret_cast<const uint8_t *>(&t),
                                decltype(t)::DefaultTypeTable());

* c++: mini_reflect: update generated code

* Ensure types and names are set for mini_reflect

* c++: mini_refelct: update unit tests with new typed TypeTable

* Adding PR feedback of sylte and naming convention
2018-02-15 14:58:06 -08:00
Dmitry Volosnykh
daf0a420be Support version compatibility checks via find_package command (#4625) 2018-02-15 13:39:15 -08:00
Kamil Rojewski
474ba68bba Fix for aligned new for gcc >= 7.1 (#4621)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

* Vector of unions for ts/js

* Sanity check for languages

* Indentation fix + output test files

* Vectors of unions for php

* Fixes to union vector handling + tests

* Fix for strictPropertyInitialization

* Fix for new aligned operator new for gcc >= 7.1
2018-02-12 08:37:51 -08:00
vglavnyy
9de0861104 Fix vector_data failure under debug (#4606) 2018-02-08 15:15:17 -08:00
Wouter van Oortmerssen
b513db86c7 Misc fixes from internal integration / clang tidy.
Change-Id: Ic5e8f6a423b426abb9f8b90d39db0f85f28b94be
Tested: on Linux.
2018-02-08 14:58:16 -08:00
Sergey Avseyev
6a1acdc23b Fix compiler errors in parser (#4612)
src/idl_parser.cpp: In member function 'flatbuffers::CheckedError flatbuffers::Parser::ParseHexNum(int, uint64_t*)':
src/idl_parser.cpp:220:62: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers]
     if (!isxdigit(static_cast<const unsigned char>(cursor_[i])))
                                                              ^
src/idl_parser.cpp: In member function 'flatbuffers::CheckedError flatbuffers::Parser::Next()':
src/idl_parser.cpp:260:62: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers]
         if(!isdigit(static_cast<const unsigned char>(*cursor_))) return NoError();
                                                              ^
cc1plus: all warnings being treated as errors
2018-02-05 12:04:55 -08:00
Joe Schafer
c696422558 Add initial Bazel WORKSPACE and BUILD (#4608)
For #4574.

To test:

    bazel test --verbose_failures //:flatbuffers_test
2018-02-05 10:23:15 -08:00
Wouter van Oortmerssen
e93d2bda07 Cleaned up & fixed buffer alignment handling.
- Fixed ForceVectorAlignment (and possibly other call-sites) not
  setting minalign_.
- Fixed flipped alignment parameters in CopyTable (reflection).
- Made aligment for FlatBufferBuilder internal buffer configurable
  (useful when reading a constructed buffer directly).
- Ensured Alignment rounding is always up.

Change-Id: I33ca4887d92a09cb11a369c14a109f4b07ae707a
Tested: on Linux.
2018-01-29 11:46:30 -08:00
Wouter van Oortmerssen
bbf4dac6a3 Made doubles output with higher precision in JSON and elsewhere.
Change-Id: I5dd8f3a7c315c40b86a67aba5c2cca4d36363523
Tested: on Linux.
2018-01-22 10:24:45 -08:00
Wouter van Oortmerssen
8df2d9a3ef Removed truncating of enum vals to int in ReverseLookup.
Some implementations (e.g. C++98) won't support 64-bit enum values,
but there is no reason to silently truncate them.

Change-Id: I8629563523a96e887068f9c0efcd53741f60e0d6
Tested: on Linux.
2018-01-22 09:51:17 -08:00
Li-Deng
462ce03ebe Fix the spell mistake (#4599) 2018-01-22 09:08:13 -08:00
Wouter van Oortmerssen
020012e69c Fixed native_include not requiring a ; terminator.
Change-Id: Ic4f49e94c67ba23f07e5ba7e87ca94e8db5d5906
Tested: on Linux.
2018-01-22 09:06:13 -08:00
Wouter van Oortmerssen
f431a96523 New error: declaring an enum field without a default in range of the enum.
Change-Id: I4db7f032440c00d31c7434975b8a3f17c29d74b9
Tested: on Linux.
2018-01-18 12:06:01 -08:00
Wouter van Oortmerssen
3694ae0817 Disallow defaults on structs.
Change-Id: Ia098126c92ea6f8abe94561bd9c09b29ac8f61f5
Context: https://github.com/google/flatbuffers/issues/4591
Tested: on Linux.
2018-01-18 11:41:43 -08:00
Wouter van Oortmerssen
2265129e14 Removed date/time from generated code, causing commit polution.
Change-Id: I79724416110a3d2241d7eeecf0e12aa6d5b760a0
2018-01-18 11:21:10 -08:00
Wouter van Oortmerssen
4bddc6cc0c Added missing generated code.
Change-Id: I9420bf01d2bdb6ccfe3703c835297be73457c0d7
2018-01-18 11:20:58 -08:00
vglavnyy
e162366b3f Removed internal variable with name "data" inside a generated method _nested_root(). Local variable with name "data" violates [-Werror=shadow]. (#4587) 2018-01-18 11:15:31 -08:00
Wouter van Oortmerssen
fee9afd80b Use CreateVectorOfStructs when creating a vector of structs.
(mirrored from cl/180944741)

Change-Id: Ib9f1613ccc355528c5c495fd953a9b3944ecb4ce
2018-01-18 11:07:37 -08:00
Daniel Lin
98f681deb0 Author: Daniel Lin <danielin@umich.edi> (#4595)
Date:   Mon Jan 15 11:38:20 2018 -0200

Compilation failure with grpc.h

If cmake run with flag FLATBUFFERS_BUILD_GRPCTEST=ON
compilation fails.

Fix :
	-Fix argument list for overriden function in grpc.
	-Fix member function name called by FlatBufferBuilder from
	buf() to scratch_data()
2018-01-18 08:51:57 -08:00
Wouter van Oortmerssen
5cee340ad3 Cleaned up FlatBufferBuilder clearing.
Change-Id: I81cf4d268670bdd11d1d56ca9f2de78c120df842
Tested: on Linux.
2018-01-16 10:17:20 -08:00
Uilian Ries
f0769b60ab #4522 Conan package support (#4590)
- Added Conan recipe to build Flatbuffers
- Added Travis job to create Conan package

Signed-off-by: Uilian Ries <uilianries@gmail.com>
2018-01-12 08:18:20 -08:00
Wouter van Oortmerssen
79b80f84df Reduced FlatBufferBuilder from 3 buffers to 1
Previously, FlatBufferBuilder used 3 resizable buffers:
- serialization (vector_downward)
- field offsets (std::vector)
- vtable offsets (std::vector)

Since the serialization buffer grows downwards, the bottom part of
it can be used as a "scratchpad" storage for the other two. Since
field offsets are only accumulated during table construction, and
vtable offsets only after table construction, the two can trivially
share the same storage.

Not only does this reduce the amount of allocation, it also removes
the bulk of std::vector usage from FlatBufferBuilder which was
the #1 cause of slow-down in debug mode, see e.g.:
https://stackoverflow.com/questions/36085285/any-way-to-improve-flatbuffer-performance-in-debug-c-msvc

Change-Id: I0224cf2f2a863d2d7ef762bc9163b52fdc149522
Tested: on Linux.
2018-01-11 11:13:23 -08:00
Andrew Gunnerson
dfe68566e4 Add char * overload for FlatBufferBuilder::CreateString() (#4583)
Without this change, the compiler tries to select the following overload
when CreateString is passed a `char *`:

    template<typename T>
    Offset<String> CreateString(const T &str) {
      return CreateString(str.c_str(), str.length());
    }

which is not valid since char pointers don't have methods.

(Fixes #4579)

Signed-off-by: Andrew Gunnerson <chenxiaolong@cxl.epac.to>
2018-01-08 08:26:19 -08:00
brianhall77
0aa36101f4 Portable range check for *cursor_ value. (#4582)
Avoids the following compile error when char is unsigned:

error: comparison of unsigned expression >= 0 is always true [-Werror,-Wtautological-unsigned-zero-compare]
2018-01-04 16:03:03 -08:00
vglavnyy
70f345012d GenerateText generate a text string for default identifier of enum and float scalar. An enum identifier printed as the strictly quoted string. (#4527) 2018-01-04 10:12:18 -08:00
Andrei Polushin
a056402f56 Remove unused declarations (#4578) 2018-01-04 10:01:41 -08:00
Darío Hereñú
d7b1d418ee Update URL (#4576) 2018-01-04 09:10:03 -08:00
Bastien Brunnenstein
9dae3eac60 Fix error in ConCatPathFileName (#4575) 2018-01-04 09:09:09 -08:00
Yuri Finkelstein
99a8a68a80 new maven jar called flatbuffers-java-grpc which contains utility … (#4558)
* new maven jar called flatbuffers-java-grpc which contains utility class supporting generated code for grpc over flatbuffers; grpc java unit test based on maven and junit (maven is used only for simplicity of testing); removed straneous namespace_test/NamespaceA/TableInC.java which is not longer used in the test and no longer generated but contains complilation errors if java compiler picks it up

* moved java grpc tests files according to review request

* Added missing generated code for Java gRPC.

Change-Id: Iada090fe2e99b80a4b7c2f8e39c838a992a1feae

* added missing name and url
2017-12-28 15:26:29 -08:00
Wouter van Oortmerssen
0c86929e39 Added missing nullptr check in vector of union verifiers.
Change-Id: Iec720991e68ad27580537135bfd8eb4159333921
Tested: on Linux.
2017-12-28 10:09:48 -08:00
Wouter van Oortmerssen
b24f2016a1 Disabled python in travis.yml pending fix.
Change-Id: I6d2a9cc8b32c531d4a1e272ddf29974a0a1a2ee3
2017-12-28 09:56:57 -08:00
Josh Ventura
1d73b3b9fc Various build fixes; update checked-in codegen. (#4572) 2017-12-28 09:10:55 -08:00
Yuri Finkelstein
a4dbe13486 fixed java codegen bug documented in #4563 (#4565)
* grpc bindings generator for Java and a few minor supporting changes in improvements

* restored formatting before my previous changes for ease of review

* Fixed grpc java code generation bug resulting in duplicate extractor declarations in case the same is used in more than a single RPC method

* fixed previous merge issue

* removed extra space

* restored extra space

* restored extra space

* fixed java codegen bug documented in https://github.com/google/flatbuffers/issues/4563
2017-12-21 13:32:34 -08:00
Wouter van Oortmerssen
89711c9c47 Made all C++ files clang-formatted.
Also added missing generated files.

Change-Id: Ifd22a643a08e3f2edfce92812ed57b87fc0e1875
2017-12-21 11:45:02 -08:00
Yuri Finkelstein
5d9930aa0d added config files for popular formatting tools (#4554)
* added config files for popular formatting tools

* edited and moved formatting files to root per review suggestion
2017-12-21 10:18:20 -08:00
Yuri Finkelstein
8518b3fb4e grpc bindings generator for Java and a few minor supporting changes i… (#4553)
* grpc bindings generator for Java and a few minor supporting changes in improvements

* restored formatting before my previous changes for ease of review

* Fixed grpc java code generation bug resulting in duplicate extractor declarations in case the same is used in more than a single RPC method
2017-12-21 09:55:57 -08:00
Yuri Finkelstein
61f4a46c43 synchronized grpc cpp_generator with latest version as of today: grpc-1.8.1. (#4556)
* updateed cpp_generator.cc to be compatible with the latest grpc version

* preserved the original license

* synchronized grpc cpp_generator with latest version as of today: GRPC 1.8.1. Regenerated test/monster_test.grpc.fb.* files and verified that grpctest is nicely passing

* fixed merge glitch
2017-12-21 08:49:00 -08:00
Yuri Finkelstein
dd73b53e28 updated cpp_generator.cc to be compatible with the latest grpc version (#4551)
* updateed cpp_generator.cc to be compatible with the latest grpc version

* preserved the original license
2017-12-18 14:17:59 -08:00
xgdgsc
c1901f2c01 update mutation status in doc (#4549) 2017-12-18 09:14:15 -08:00
Robert
4071b6f68b Merge pull request #4516 from mikeholler/travis
Add support for Python lib continuous deployment.
2017-12-14 13:20:18 -08:00
Kamil Rojewski
142401f50a Fix for strictPropertyInitialization for TS (#4540)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

* Vector of unions for ts/js

* Sanity check for languages

* Indentation fix + output test files

* Vectors of unions for php

* Fixes to union vector handling + tests

* Fix for strictPropertyInitialization
2017-12-14 08:30:02 -08:00
Mike Holler
7799642270 Change mikeholler to PYPI_USERNAME 2017-12-13 15:14:01 -06:00
Wouter van Oortmerssen
67b29d4e43 Fixed CreateStruct not testing for nesting.
Change-Id: I16bf46682ad68c62b778ed1514b6b706c8cb8f6f
Tested: on Linux.
2017-12-07 11:16:19 -08:00
Bastien Brunnenstein
85b131a719 Replace the non standard M_PI with a constant (#4528) 2017-12-04 15:06:13 -08:00
Paul Taylor
0e8a21854c publish additional js/flatbuffers.mjs to npm to support ESModules in node (#4504) 2017-12-01 14:18:43 -08:00
rmawatson
53a897731e this is allow custom allocator for obj-api structs/tables. (#4520)
added "native_custom_alloc" attribute to tables/structs, eg.

table parent_table( native_custom_alloc:"custom_alloc_name" ) {
...
}

with a custom allocator defined as

template <typename T> class custom_alloc_name : public std::allocator<T> {
public:

 typedef T*       pointer;

 template <class U>
 struct rebind {
  typedef custom_alloc_name<U> other;
 };

 pointer allocate(const std::size_t n) {
      return ....;
 }

 void deallocate(T* ptr, std::size_t n) {
    ...
 }

 custom_alloc_name() throw() {}
 template <class U> custom_alloc_name(const custom_alloc_name<U>&) throw() {}
};
};
2017-12-01 09:15:41 -08:00
Bastien Brunnenstein
ba08b0ec02 Add include directory to CMake install targets (#4510) 2017-11-30 08:45:58 -08:00
Mike Holler
da0bda6be3 Fixed prod PyPI URL and deploy block list. 2017-11-27 16:10:43 -06:00
Mike Holler
617bbc9b0c Added all_branches to tags: true block 2017-11-27 13:59:01 -06:00
Michael Holler
0c8b4c7614 Add support for Python lib continuous deployment.
Use a combination of travis and twine to publish to PyPI. New
publications will be made:

* When `master` is updated. This will trigger the publication of a
  the Python artifact versioned an iso-compliant build datetime. In this
  way, the cutting edge version will always be available via PyPI.
* When a new git tag is pushed. Tag pushes trigger the publication of
  a python artifact with the same version as the git tag, with the
  leading `v` stripped if present (`v1.2.3` becomes `1.2.3`).

Publications rely on Travis having a PYPI_PASSWORD environment set in
the project settings. See the Travis CI documentation for information on
[setting environment variables which containing sensitive data][1]. Make
extra sure the "Display value in build log" switch is OFF.

In addition to setting the previously mentioned `PYPI_PASSWORD`
environment variable, the owner of the PyPI `flatbuffers` repository
should, after merging this commit into master, add his own commit to
change `mikeholler` in `.travis/deploy-python.sh` to his username. It's
also recommended that the owner of `flatbuffers` use a separate account
in the unlikely event that the environment variable somehow becomes
compromised. Again, this is very unlikely, since the environment
variable is only set for "safe" builds approved by maintainers (not on
random pull requests).

[1]: https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings
2017-11-27 13:14:33 -06:00
Wouter van Oortmerssen
34aea4361f Updated version numbers to 1.8.0
Change-Id: I9cf9fe1e2572d3f9c4066624a87249ca1e62a297
2017-11-20 09:46:03 -08:00
Wouter van Oortmerssen
be1ad33910 Missing generated code files.
Change-Id: I8808b0b419981ba7d0699da4a1effb0b660a21cb
2017-11-20 09:19:35 -08:00
MikkelFJ
0cf04ad9d5 Document type aliases (#4499) 2017-11-17 08:57:01 -08:00
Dan Douglas
fe483fa380 fix typo (#4495)
`Equipment` is a union, not an enum.
2017-11-16 16:03:16 -08:00
Wouter van Oortmerssen
8a8dc4e111 Fixed potential strict-aliasing violation in big-endian code.
Also added a test.

Tested on: Linux.

Change-Id: I7b3230f8f6043eec139d5e3e8c9cb45814124274
2017-11-16 14:21:11 -08:00
red1939
7e803c410c Add exports for all targets (#4491)
Each target that will be installed will also generate a target that will be
included by CMake config file.
2017-11-16 12:51:25 -08:00
Hong Wu
1336d26252 c++ Tutorial fix (#4494) 2017-11-16 10:09:48 -08:00
Louis-Paul CORDIER
853f7033e0 Remove copy constructor to make flatbuffers struct trivially copyable… (#4476)
* Remove copy constructor to make flatbuffers struct trivially copyable + add tests.

* Add support non c++11 compliant compilers.

* Fix std::trivially_copyiable test for non-C++11 compliant compilers.

* Fix trivially_copyable not part of glibc < 5 even with c++11 switch enabled.
2017-11-16 10:08:41 -08:00
David Komer
e2c7196ea8 tutorial docs (#4492) 2017-11-16 08:51:35 -08:00
Angela Sheu
61fe2a4fac Fix valid params limit exceeded for generated table constructor (#4490) 2017-11-13 13:39:49 -08:00
Wouter van Oortmerssen
d233b38008 Made stl_emulation.h usable by itself.
Change-Id: I1d9d301412fe0a036f12eb2cc82a3fbee5bb838d
2017-11-09 15:48:35 -08:00
Sergey Avseyev
ca52bfefc0 Specify ABI version for shared library (#4479) 2017-11-09 14:39:32 -08:00
Sergey Avseyev
2edb1dcdda Use CMake install directories instead of hardcoded (#4481) 2017-11-06 10:38:53 -08:00
Sergey Avseyev
6eb031de9a Text files should not have executable bit set (#4480) 2017-11-06 10:20:22 -08:00
Lawrence Chan
5f2af34e02 Link grpctest with libgrpc_unsecure explicitly (#4474) 2017-11-06 08:43:22 -08:00
Wouter van Oortmerssen
f3f113b24a Updated pom.xml to be able to deploy to Maven central.
Change-Id: Ie28dda5e1854eeff3e254e975925ff846c137008
2017-10-26 16:14:16 -07:00
stefan301
6bb0a728d3 Added missing EndTable() call to VerifyObject() (#4468)
VerifyObject called VerifyTableStart() but not EndTable(). This made Verifier::VerifyComplexity() increase depth_ with each table, not with the depth of tables.

https://groups.google.com/forum/#!topic/flatbuffers/OpxtW5UFAdg
2017-10-23 09:15:18 -07:00
Alex Ames
97face1527 Changed how vector_data works. (#4467)
In some debug environments using vector[i] does bounds checking even
though the standard specifies that it should not. Using
*(vector.begin()) sidesteps this though, giving the same result without
the bounds checking.
2017-10-20 16:49:15 -07:00
Alex Ames
f2627e16ac Fixed CMake build issue when building with Clang. (#4465) 2017-10-20 16:29:51 -07:00
Yonggang Li
01bac38c84 Nullable java (#4455)
* add _Nullable Support for C++ interface

* generate @Nullable for Java generated code
2017-10-16 09:24:11 -07:00
Stewart Miles
a1b5f565d9 Merge pull request #4459 from stewartmiles/master
Report a build failure when any Android build fails.
2017-10-13 17:55:51 -07:00
Stewart Miles
0780a7db24 Report a build failure when any Android build fails.
The travis script was only failing if the last Android build fails.
This changes the script to report a failure if any of the Android
projects fail to build.
2017-10-13 17:35:57 -07:00
Stewart Miles
9234ddcf11 Fixed Android build failure caused by use of C++11 limits.
f2b3705c2c caused Android builds
to fail.  This switches limit constants to use limits templates in
stl_emulation.h.
2017-10-13 17:35:57 -07:00
Stewart Miles
6d9a226f75 Merge pull request #4458 from a-maurice/master
Use flatbuffer unique_ptr instead of std's.
2017-10-13 16:44:02 -07:00
Anthony
b0fd1a8c66 Use flatbuffer unique_ptr instead of std's.
Stlport does not have std unique_ptr, so using the one provided by
flatbuffers.
Also fixing a problem with the flatbuffer unique_ptr, and a test.
2017-10-13 16:21:34 -07:00
Wouter van Oortmerssen
a0e5d78353 Add new flatbuffer_go_library to generate Go library for flatbuffers
This CL also introduces the following changes to allow the generation of the
Go library for flatbuffers:

- add support for --gen-onefile for Go to simplify the build rule (mapping each
  input .fbs to a single separate .go file)

- add a new --go-import flag to override the default import line (currently
  github.com/google/flatbuffers/go)

- add new go_library in BUILD for flatbuffer (for files in flatbuffers/go)

(mirrored from cr/171126159)

Change-Id: I83e705a9a9d9544837af0baf9366ec37757799aa
2017-10-09 09:27:30 -07:00
Brian Chavez
bc8a1608a8 Spelling error in C# and Java documentation (#4454) 2017-10-09 08:42:34 -07:00
Yonggang Li
30e7d16104 _Nullable cpp interface (#4451)
* add _Nullable Support for C++ interface

* add _Nullable Support for C++ interface
2017-10-09 08:40:17 -07:00
Wouter van Oortmerssen
9c3920d0ab Improved .proto conversion.
- Allowed enums to be declared before use.
- Generalized parsing of `required`.
- Reworked escaping of namespaces.
- Escaping field names that are C++ keywords.
- Many smaller fixes.

Change-Id: Ie580de7b70dc208f676f4f71bb0d061808648b8d
Tested: on Linux.
2017-10-06 16:08:00 -07:00
Aaron
5b4acf809e [C++] Add explicit keyword on generated constructors for Builder structs (#4452)
* Add explicit keyword on C++ generated constructors for Builder structs

* Add missing generated code for review
2017-10-06 08:50:24 -07:00
Robert
86fb05d320 Python: CreateByteVector function in builder. (#4453) 2017-10-06 08:34:07 -07:00
Dariusz Ostolski
5e4739184f Fix issue #4389, if field is ommitted the return type is the same for… (#4444)
* Fix issue #4389, if field is ommitted the return type is the same for python generator

* Fix issue #4389, bytes is returned when field is omitted

* Fix issue #4389, added generated python code after generator modification
2017-10-05 14:07:42 -07:00
Louis-Paul CORDIER
971a68110e Add template version for As method. (#4443)
* Add template version for As method.

* Fix compilation error on Linux.

* Fix linux issue (2).

* Linux fix (3)

* Add few tests.
2017-10-02 14:38:38 -07:00
Wouter van Oortmerssen
7a6b2bf521 Fixed TypeTable function not being inline.
Change-Id: Id335980daf909e885ed26a21b64623b78d01fb49
Tested: on OS X.
2017-09-25 11:44:58 -07:00
Wouter van Oortmerssen
03e2899985 Made the parser not have any hard-coded keywords.
This prevented any keywords showing up as JSON field names, for example.

Change-Id: Ie9d0cada96778e06016ca02ca96d052410a37038
Tested: on Linux.
2017-09-22 16:30:26 -07:00
Wouter van Oortmerssen
72a99abfb7 Added support for mini-reflection tables.
Change-Id: I83453d074685fa57bbf1c7c87b1d9392ce972085
Tested: on Linux.
2017-09-22 16:17:02 -07:00
endorph-soft
21a8121982 Add constant accessors to C++ unions (#4433)
* Add constant accessors to C++ unions

* Remove redundant const pointer return type

* Update generate_code.bat to reflect generate_code.sh

* Add updated generated files

* Remove extra space from generated code

* Update generated files

* Change directory back to tests after generating code
2017-09-21 14:06:20 -07:00
Khem Raj
28920aff8f Fix build with clang on big-endian targets (#4440)
* flatbuffers: Move EndianSwap template to flatbuffers/base.h

Clang complains
call to function 'EndianSwap' that is neither visible in the template definition nor found by argument-dependent lookup
     return EndianSwap(t);

This seems to be due to limitation of two-phase lookup of dependent names in template definitions

Its not being found using associated namespaces therefore
it has to be made visible at the template definition site as well

Signed-off-by: Khem Raj <raj.khem@gmail.com>

* use __builtin_bswap16 when building with clang

clang pretends to be gcc 4.2.0 and therefore the code does
not use __builtin_bswap16 but tries to synthesize it

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2017-09-21 08:51:08 -07:00
schoetbi
77b22aed5a idl_gen_json_schema.cpp: Fixed detection of enum types (#4438) 2017-09-14 09:25:43 -07:00
Lukas Bergdoll
cc25516d3e [C++] Fix DetachedBuffer move assignment lifetime (#4437)
* Fix DetachedBuffer move assignment lifetime

DetachedBuffer move assignment now destroys it's own content,
rather than waiting for the destructor of other.
See more under #4435

Add missing function return type

* Rename empty_assign to reset

Reset after destroy
reset() now operates on itself
2017-09-14 09:22:55 -07:00
Wouter van Oortmerssen
1d444f63d3 Fixed .proto not being accepted as schema file.
Change-Id: I1ccd52a847930fa636d24f9490d57577b8775d08
2017-09-12 11:36:38 -07:00
Wouter van Oortmerssen
5fa00630af Forgot to bump flatc version to 1.7.1
Change-Id: I480a08f445858bce3d0336c2b22da30d64f90012
2017-09-07 14:35:59 -07:00
rouzier
97af3d798b Update doc (#4427) 2017-09-07 11:52:58 -07:00
schoetbi
bb736091f3 Every type gets additionalProperties set to "false" (#4424)
#4423
2017-08-31 08:56:04 -07:00
endorph-soft
d5b4db0692 C++ Customise prefix/suffix of object API [Issue #4419] (#4422)
* Allow prefix/suffix of C++ Object API classes to be customised

* Address review comments
2017-08-31 08:54:03 -07:00
Wouter van Oortmerssen
5808f7fb03 Updated C# test project. 2017-08-25 11:47:19 -07:00
Wouter van Oortmerssen
42611f9a83 Fixed VS memory tracking leaking into user code 2017-08-25 11:29:58 -07:00
Wouter van Oortmerssen
1f0bd12851 Disabled numpy test in appveyor due to timeout.
It pulls in a LOT of dependencies, this will need to be done better.

Change-Id: Ib27effead194f6836facca01e9454a6037ad837a
2017-08-24 13:46:46 -07:00
Wouter van Oortmerssen
321a1c9dc0 Cleaned up namespace handling.
A Namespace object is now guaranteed unique.
This cleaned up some old workarounds and latent bugs.

Change-Id: Ic3f12d89947871b03b2c449ba51b3186f953adde
Tested: on Linux.
Bug: 21336857
2017-08-24 13:39:45 -07:00
Wouter van Oortmerssen
ac1015e3c4 Trimmed vtables of trailing zeroes.
This is something the format supports, but none of the builders
were doing. Can save 10-20% on FlatBuffer binary size!

Also fixed the Go tests.

Change-Id: I616c56ce9bbcfcaee23aa24f0532fcb60b6a8c75
Tested: on Linux.
2017-08-24 09:35:54 -07:00
Younguk Kim
513958ea72 Fix use of min and max when Windows.h is imported (#4411) 2017-08-17 09:35:50 -07:00
Wouter van Oortmerssen
2f2e4cced4 Noted that benchmarks are for C++
Change-Id: I12fbba7ffd2db47502a05eb06cedab49fd99c366
2017-08-14 16:36:42 -07:00
Wouter van Oortmerssen
f779962e3e Explained GetRoot<Monster> vs GetMonster.
Change-Id: Ic302096c07551b5c1aff0b261a329c46964cf337
2017-08-14 15:34:15 -07:00
Wouter van Oortmerssen
69776b9e7e Fixed .proto -> .fbs translating type bytes incorrectly.
Change-Id: Idb607360123d12c73dd1e045305007120b12131b
Tested: on Linux.
2017-08-14 14:45:29 -07:00
Wouter van Oortmerssen
00d726fc4c Further grammar.md fixes: union types, idents, string constants.
Change-Id: I51db0511c52c79f2b322a1fdef798b061941887b
2017-08-14 12:18:06 -07:00
Wouter van Oortmerssen
ad0f48d7e7 Fixed up grammar.md with rpc's and new scalar types.
Change-Id: Ie2965f48810bf24cccf098b69a9d471583efc3bf
2017-08-14 11:58:25 -07:00
Wouter van Oortmerssen
801e1b7699 Missing FieldDef initializer.
Change-Id: I5ed1f77868e201d7231102a106e08f3376b6adcf
2017-08-14 10:52:25 -07:00
Wouter van Oortmerssen
432e7582c6 Fixed file_identifier/extension leaking from included file.
Change-Id: I470143411e4ce6322e018a27bcc9cd40c15d9bf1
Tested: on Linux.
2017-08-14 10:41:39 -07:00
Wouter van Oortmerssen
d76113100a Cleaned up test output.
Change-Id: I4bec0e728cc162aa3f19091a0d154124ffbccdff
2017-08-14 09:30:10 -07:00
Wouter van Oortmerssen
dca33ddb75 Fixed root_type leaking in from included files.
Change-Id: I9378e375901f8a883eaeb2182955d690c358ed4b
Tested: on Linux.
2017-08-14 09:28:14 -07:00
rouzier
76744a4345 C++ Add new type vector_bool flexbuffers (#4410)
* Add new type vector_bool

* Update stl_emulation.h

Fix Is same typo

* Update stl_emulation.h
2017-08-14 08:44:56 -07:00
rouzier
b4e91091ec Internal doc (#4409)
* Add information about flexbuffer bool and null encoding

* Fix spelling errors

* Fix encoding example for flexbuffer map
2017-08-14 08:33:38 -07:00
Wouter van Oortmerssen
d5f5d382eb Added VS crtdbg memory leak tracking 2017-08-11 12:24:33 -07:00
Wouter van Oortmerssen
ffddbdc7ab Added missing generated code.
Change-Id: I7201d6891f56094178656a76bf0f87cf36d12554
2017-08-11 09:28:06 -07:00
Kamil Rojewski
46bb05d952 Vector of unions for TS/JS and PHP (#4404)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

* Vector of unions for ts/js

* Sanity check for languages

* Indentation fix + output test files

* Vectors of unions for php

* Fixes to union vector handling + tests
2017-08-11 09:24:36 -07:00
Kamil Rojewski
7cc72e4b11 Copying required field to union type vector (#4407)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

* Copying required field to union type vector

* Removed unneccessary bool
2017-08-11 09:19:28 -07:00
Wouter van Oortmerssen
a6a3f59253 Make flatc not silently skip schema files not ending in .fbs
Change-Id: I58463b321703b2ef0dc3f3062633909b86eca1a9
Tested: on Linux.
2017-08-10 16:31:25 -07:00
Wouter van Oortmerssen
8a58aafda1 Make it an error if a field has the same name as a table.
Change-Id: Ie5a3bb5a3643cd48e1cc75fe170a7b8a7c2cc8ed
Tested: on Linux.
2017-08-10 14:22:03 -07:00
Wouter van Oortmerssen
8dc1641c8a Forgot to update pom.xml in recent 1.7.1 release.
Change-Id: Ia6d6967546c0a2a5340a93e54c46d2630fff92fe
2017-08-10 11:35:58 -07:00
Wouter van Oortmerssen
4b27c92910 Misc documentation fixes.
Change-Id: Id7be5baba7d8a11ca050e8d94d95857406690378
2017-08-10 11:25:13 -07:00
Wouter van Oortmerssen
7fe281295f Fixed clang-tidy warnings.
Change-Id: Ib94ef29254c116b60e4ff298baa2ce323ac9655c
Tested: on Linux.
2017-08-07 15:33:36 -07:00
Wouter van Oortmerssen
917ff81b46 Added missing generated code from past commits.
Change-Id: I43e8de5a2ac224836a79661cc03bf37ac6d509fe
2017-08-07 14:55:05 -07:00
Wouter van Oortmerssen
8a2cc7cc4e Linked to Mikkel's binary format documentation.
Change-Id: I5054e37833d59bbe925cac2000a453fbee8ef54b
2017-08-07 14:53:54 -07:00
Wouter van Oortmerssen
a64d968473 Public accessor for buffer size of flexbuffers::Builder
Change-Id: Iff7895aebeba9c2940e26a3edbdf2d3f1b0d9b17
2017-08-07 13:24:42 -07:00
rouzier
a2b1bfc107 [c++] Add support for boolean types in flexbuffers (#4386)
* Add support for boolean types in flexbuffers

* Simplify casting number <=> boolean

* Added comments for tests

* Add proper support for Booleans

* Bad rebase

* No special case for strings

* Removed unused test

* Simplify logic
2017-08-04 08:04:28 -07:00
MikkelFJ
f2b3705c2c Add scalar type aliases for int8, uint8, ..., f32, f64 (#4400)
* Add type aliases

* Add generated code

* Rebase master
2017-08-02 08:07:43 -07:00
Kevin Rose
3282a84e30 [Python] (scalar) vector reading speedup via numpy (#4390)
* Add numpy accessor to python flatbuffers scalar vectors

* Update python tests to test numpy vector accessor

* Update appveyor CI to run Python tests, save generated code as artifact

* Update example generated python code

* Add numpy info to python usage docs

* Update test schema and python tests w/ multi-byte vector

* did not mean to push profiling code

* adding float64 numpy tests
2017-08-01 08:34:00 -07:00
Christian Helmich
89a68942ac Added support for nested flatbuffers serializing to json (#4391)
* added bool for nested_flatbuffer
setting bool flag nested_flatbuffer according to attributes
setting nested type

* added JSON serialization for nested flatbuffers

* simplified lookup of nested_flatbuffer StructDef

* added nested_flatbuffer parsing workound relying on flexbuffers

* moved nested flatbuffer parsing into its own function for clarity
removed flexbuffers workound to simplify and speed up nested_flatbuffer parsing
added support for 'legacy' nested_flatbuffers, ubyte arrays

* inlined functions for nested parser init/clean since only used once

* whitespace formatting

* changed type of FieldDef.nested_flatbuffer from bool to StructDef*
removed subsequent type lookups

* removed copies of unrequired data when initializing nested parser

* applied changes requested by reviewer

* removed superfluous lookup of nested_flatbuffer field attributes

* renamed camelCased variables to snake_case
2017-07-28 10:27:51 -07:00
Manuel Kroiss
360c34467c Adding accessors for IsBlob and Blob.data (#4398) 2017-07-27 09:06:02 -07:00
Stewart Miles
265e43faf0 Merge pull request #4395 from stewartmiles/master
Test case for CreateVectorOfStructs() using a callback.
2017-07-24 15:35:16 -07:00
Stewart Miles
f064a6cc60 Test case for CreateVectorOfStructs() using a callback.
Fixes issue #4392, also fixed C++98 compatible code generation in tests.

Change-Id: Ia5833026e615ad19d24a0439bdba2e3b45c5f86c
2017-07-24 14:19:49 -07:00
Christian Helmich
7fead0f140 forwarding IDLOptions.strict_json to flexbuffers .ToString() (#4394) 2017-07-24 09:33:40 -07:00
Stewart Miles
d6f14b704f Merge pull request #4383 from stewartmiles/master
C++98 (stlport) support for core FlatBuffers and FlexBuffers.
2017-07-20 12:24:38 -07:00
Stewart Miles
a892322203 C++98 (stlport) support for core FlatBuffers and FlexBuffers.
* Added internal - limited - implementation of flatbuffers::unique_ptr
  for STLs that don't ship with std::unique_ptr.  In C++11 and beyond
  this is just an alias for std::unique_ptr.
* Aliased used type traits structs is_scalar is_floating_point is_unsigned
  into flatbuffers namespace so they can be replaced in C++98 implementations.
  Right now these point at stlport's TR1 implementations.
* Wrapped vector::data() in vector_data().
* Wrapped vector::emplace_back() in vector_emplace_back().
* Wrapper string::back() in string_back().
* Added variants of FlatBufferBuilder::CreateVector() and
  FlatBufferBuilder::CreateVectorOfStructs() that allow the use of plain
  function pointers.
  Generated code has also been modified to use plain functions to build objects
  rather than std::function() so all generated code will work in C++98
  applications.
* Added flexbuffers::Builder::Vector(), flexbuffers::Builder::TypedVector()
  and flexbuffers::Builder::Map() methods that allow the use of plain function
  pointers.
* Changed Parser to internally use plain function pointers when parsing table
  and vector delimiters.
* Added specializations of NumToString() for 64-bit types that aren't supported
  by stringstream in stlport.
* Overloaded numeric_limits for 64-bit types not supported by stlport.
* Replaced build_apk.sh (which was broken by deprecation of the
  "android" tool in the Android SDK) with build.gradle and the
  appropriate gradle wrapper to build an APK.
* Switched Android build to build against all STL variants.
* Updated travis configuration to build Android test and sample.

Tested:
* Verified all tests continue to work on Linux, OSX and Android.
* Verified Travis build is green.

Change-Id: I9e634363793f85b9f141d21454b10686020a2065
2017-07-20 11:01:00 -07:00
schoetbi
2e2063cbeb idl_parser.cpp ignores $schema in input json (#4382)
* idl_parser.cpp ignores $schema in input json
#4381

* idl_parser.cpp: Fixed ci error signed unsigned comparison

* idl_parser.cpp: replaced case insensitive search for $schema with case sensitive search

* idl_parser.cpp: Expecting a string constant after $schema
#4382
2017-07-19 08:58:48 -07:00
Alex Wasserman
625c989875 Java: Added ByteBufferFactory interface and sizedInputStream method. (#4379)
The ByteBufferFactory interface gives the user an option to specify
the method in which the internal ByteBuffer is allocated. This provides
flexibility in the type of ByteBuffer that can be used.
The sizedInputStream method is an alternative to sizedByteArray that
does not make a copy of the data in memory.
2017-07-13 08:33:32 -07:00
schoetbi
f20204180d Json schema (#4369)
* Added empty generator for json schema (idl_gen_json_schema.cpp)
#4360

* JsonSchemaGenerator: output of tables implemented

current problems:
- typenames are not correct
- array types need to be deduced

#4360

* JsonSchemaGenerator: Corrected generation of typenames
Current problems: enum types not written correctly
#4360

* JsonSchemaGenerator: Added generation of enum types
#4360

* idl_gen_json_schema.cpp: Write required properties to schema
#4360

* idl_gen_json_schema.cpp: Export Types including namespace
#4360

* idl_gen_json_schema.cpp: Fixed Json format
#4360

* idl_gen_json_schema.cpp: Formatted according to google code style
#4360

* Checked in monster_test.bfbs with changes from master

* Added idl_gen_json_schema.cpp in CMakeLists.txt

* generate_code.bat: Added generation of json schema

* Added todo.md

* generate_code.sh: Added generation of json schema

* Addressed some review issues
- removed command line arg -S
- removed new lines
- fixed codestyle in template functions
- removed usage of stringstream
- idented json schema
#4360

* removed auto in idl_gen_json_schema.cpp

* idl_gen_json_schema.cpp: changed iterator declarations to auto
#4360

* deleted todo.md

* idl_gen_json_schema.cpp: Removed keyword "override" so that vs2010 can compile

* idl_gen_json_schema.cpp: switch statement in GenType handeles all enum-members

* idl_gen_json_schema.cpp: Removed cerr output

* idl_gen_json_schema.cpp: Avoid vector copying

* idl_gen_json_schema.cpp: Fixed identation of json schema output

* idl_gen_json_schema.cpp: Do not output empty descriptions
2017-07-10 08:05:59 -07:00
Robbie McElrath
0e85eeef2c Make inter-file cycles compile (#4364) 2017-06-26 09:07:02 -07:00
Andrei Stoica
b0fa5e0f42 Make flatbuffers work with ArduinoSTL (#4357) (#4361)
*Keep legacy compatibility with StandardCplusplus lib (utility.h)
2017-06-21 08:26:37 -07:00
Wouter van Oortmerssen
25a15950f5 Avoiding wrong template specialization on new CreateVector
Change-Id: I0da57cc71318ea13c10b547e2dfe3a2d4f32b4d9
Tested: on OS X.
2017-06-20 09:42:07 -07:00
Wouter van Oortmerssen
6f94fb51b1 Updated version numbers to 1.7.0
Change-Id: If2802ca48b61cfa7e5ec131e2a268400523217e2
2017-06-16 16:15:02 -07:00
Christopher Berner
57f3752d5e Optimize CreateVector for types > 1 byte on little endian (#4355)
This gives a 10x speed up in my test, when creating a Vector of floats
2017-06-16 15:29:47 -07:00
Wouter van Oortmerssen
f52f848b95 Added move assignment operator to DetachedBuffer.
Change-Id: I4610946ac27d9d0d73c2fc2e4834bd2cfed88cdc
Tested: on Linux.
2017-06-16 15:22:40 -07:00
Wouter van Oortmerssen
3c3742a54a Adding a method to get the file identifier from a flatbuffer.
Change-Id: Ie28fd1f0b463aac23647d38921600f15c8b7c10a
2017-06-16 12:30:36 -07:00
Wouter van Oortmerssen
f325cce6fd Initial support for parsing (and generating) Protobuf ASCII.
Change-Id: I955b4b3eed27f26773d7dc0acceff13c88d1333d
Tested: on Linux.
2017-06-16 11:57:58 -07:00
Wouter van Oortmerssen
88a85ffbbd Added convenient schema registry.
Change-Id: I9d71375059369fbc538d0d051d8d2885e467bf29
Tested: on Mac OS X.
2017-06-16 11:10:07 -07:00
Wouter van Oortmerssen
35cbd23f63 Fixed missing lambda return type.
Change-Id: I48d41a240c8bf362b1f931f20a3ed9ae64f2d295
2017-06-16 09:54:25 -07:00
Stephen Lane-Walsh
210a1ab969 Fixed build error in Visual Studio 2017 (#4353)
flatbuffers.h(591): error C2220: warning treated as error - no 'object' file generated
flatbuffers.h(591): warning C4267: 'return': conversion from 'size_t' to 'flatbuffers::uoffset_t', possible loss of data
2017-06-16 09:53:53 -07:00
Lawrence Chan
90c8ded449 gRPC: fix memory leak (#4351)
SerializationTraits<T>::Deserialize _transfers_ ownership of the buffer,
so we must destroy it.

This commit also includes some misc fixes:
- Use grpc::Status::OK rather than default ctor for clarity.
- Check for a null buffer passed into Deserialize, and handle it the
  same way as the protobuf deserializer.
2017-06-13 08:50:27 -07:00
Wouter van Oortmerssen
8f864aad7b Added (nested) FlexBuffer JSON parsing and output.
FlexBuffer parser is just 40 lines of code (on top of existing parser!).

Change-Id: Idebebadafb661ca5333f5621139031f6df3c3e1a
Tested: on Linux.
2017-06-12 16:40:47 -07:00
Wouter van Oortmerssen
dddd0865cb Added nested FlexBuffer parsing
Change-Id: I918b66eb5646d035e3aae675f745802eb54b03ea
2017-06-12 14:34:45 -07:00
Christopher Berner
0a81eb6463 Fix memory leak in Message move operator (#4344) 2017-06-12 11:23:55 -07:00
Guillaume Giraud
b1740688bf [cpp] Json parsing: adding support for parsing nested lists and top level lists (#4338)
* Extended json parsing capability: add support for parsing nested lists and top level lists

* Stylistic conformance with surrounding code + generalized comments

* More code tidy-up for stylistic conformance with surrounding code

* Blank lines

* Reverted changes related to top-level list parsing

* Styling: newline before else

* Taking out ProcessTableFields which is no longer needed as the top level list change was reverted.
2017-06-07 16:58:19 -07:00
Stephan T. Lavavej
86b505e412 [C++] Remove std::iterator usage (#4340) (#4341)
* [C++] Remove std::iterator usage (#4340)

Inheriting from std::iterator has never been required, and it's
deprecated in C++17. It can be replaced by directly providing typedefs.

Include <iterator> for std::random_access_iterator_tag.

Note that structs default to public access control.

* [C++] Change whitespace style in typedefs.
2017-06-07 16:26:06 -07:00
Lawrence Chan
da67c0a71f [C++] Improve flatbuffers + gRPC integration (#4310)
* Rework flatbuffers + gRPC integration

- Introduce `flatbuffers::grpc::Message<T>`, a `grpc_slice`-backed
message buffer that handles refcounting and allows flatbuffers to
transfer ownership to gRPC efficiently. This replaces
`flatbuffers::BufferRef<T>`, which required a copy call and was also
unsafe w.r.t. buffer lifetime.
- Introduce `flatbuffers::grpc::MessageBuilder`, a gRPC-specific builder
that forces a `grpc_slice`-backed allocator and also adds some helpful
`Message<T>`-related methods.
- Update serializers accordingly (now zero-copy between flatbuffers and
gRPC).

* gRPC: verify messages by default, but allow user to override

* gRPC: fix some formatting issues

* Disable verification by default, but add helper method

* Make FlatBufferBuilder fields protected + remove vec accessor

* Use bool add_ref parameter to toggle refcount incr

* Remove unnecessary inline specifiers

* Fix formatting

* Use auto

* Remove empty lines

* Use grpc_slice helper macros

* Simplify reset code

* Disable Message copy ctor and assignment by default

* Remove unused member

* Enable gRPC verification by default

* Use auto

* Bake in message verification (remove template specialization)

* Add RoundUp func

* Consolidate gRPC message copy flag

* Make vector_downward allocations fully lazy

* Test message verification failure code/message

* Add grpctest verification test comments

* Simplify reallocate implementation

* Make initial_size a size_t

* Use ternary op for growth_policy

* Use truthiness rather than dont explicit nullptr check

* Indent preprocessor directives

* Remove grpc message copy/assignment

* Fix a few bugs

* Add gRPC example

* Add basic gRPC docs

* Use doxygen EXAMPLE_PATH + @include

* Reference example fbs in grpc docs

* Move gRPC examples into grpc/samples

* Fix pointer/reference formatting

* Use std::function rather than templated callback func

* Create fresh message builder for each request

* Use Clear() in Reset() impl

* Use FLATBUFFERS_CONSTEXPR
2017-06-07 13:56:49 -07:00
rufeooo
dadd1a926e Generate a C++ function for EnumValues{{ENUM_NAME}} (#4337)
* enables "for each" logic on enumeration types
2017-06-07 13:49:56 -07:00
vabr-g
01c50d57a6 [C++] Remove std::move around a raw pointer in flatbuffers.h (#4339)
* Remove std::move around a raw pointer

Calling std::move on a raw pointer has no advantage to just copying its value. Moreover, it is confusing, because it indicates that the argument is movable in some non-trivial way (e.g., is it actually meant to be a smart pointer?). More context in https://crbug.com/729393.

* Remove the move constructor altogether
2017-06-05 10:33:04 -07:00
Wouter van Oortmerssen
e9f1f4d9b7 Disallowing field name same as table name.
Change-Id: I4b5d822cc4eda975949d1b7cf33674c5bbf9d4b1
Tested: on Linux.
2017-06-02 15:55:02 -07:00
Wouter van Oortmerssen
dd05f3249a Added test for nested FlatBuffers functionality.
Also fixed that the parsing test wasn't calling the buffer
testing function.

Change-Id: I5baae071bf0832c7797b4ef1d19d9b015e3ff5bc
Tested: on Linux.
2017-06-02 12:36:18 -07:00
AntonYudintsev
43611fcc0b refactor flatbuffers.h and util.h so FlexBuffers do not depend on flatbuffers.h (#4331)
FlexBuffers are actually completely unrelated to FlatBuffers and can be used separately.
However, since they utilize several utility functions from flatbuffer.h, they require this header file, which creates unreasonable dependency.
By moving those utility functions to separate base header, both libraries can use same code but still be independent
2017-06-02 10:26:11 -07:00
Pavel Kalinnikov
642254bee6 Track included files in PATH-agnostic way. (#4329)
* Track included files in PATH-agnostic way.

Use full paths as keys in the map of included files. Store logical
include path as a value, in order to put it to the generated file.

* Fix tests by accepting null |include_filename|.

* Fix self-includes code generators.
2017-06-02 08:50:18 -07:00
Wouter van Oortmerssen
22743ca45a Fixed --keep-prefix functionality.
Changing to keep include prefixes had two side effects: the main
file being parsed wasn't filtered out anymore, and include directory
paths would be added to the path in the include statement.

Also moved the include_test*.fbs files to sub directories so we
can actually test the handling of -I etc.

tested: on Linux.

Change-Id: Ibae095cea7ab0cccbac15cfb5171719f6b5cad8c
2017-05-24 16:26:57 -07:00
Lawrence Chan
fb87c0d3c6 [C++] Improve Allocator handling (#4312)
* Improve Allocator handling

- Templatize Allocator on vector_downward, and make it own the allocator
instance so it can manage lifetimes.
- Templatize + rename FlatBufferBuilderT accordingly, and add a typedef
to FlatBufferBuilder so old code continues to work.
- Fix some issues with the release deleter
- More details in github issue #4311

* Fix constexpr for older MSVC

* Reimplement allocator improvements via inheritance

Instead of templates, use an abstract base class and some unique_ptrs to
implement the new and improved allocator.

* Fix misplaced newline

* Add missing override keyword

* Add macro for func delete to support older compilers

* Explicitly move BufferDeleter (maybe fixes VS 10?)

* Revert previous attempt at VS10 fix

* Try yet another workaround for MS 10

* Use FLATBUFFERS_NOEXCEPT macro

* Add FLATBUFFERS_OVERRIDE macro

* Fix some issues with MSVC 16 hack

* Remove dep on unique_ptr

* Update DEPRECATED macro with a message

* Sigh, no delegating ctors before c++11

* Fix simple_allocator stub

* Relax FlatBufferBuilder ctor

* Add vector_downward reset + assert in clear

* Rename DetachedBuffer to FlatBuffer + remove unnecessary deprecations

* Add flatbuffers::FlatBufferBuilder::Release()

* Address remaining allocator-improvements comments
2017-05-24 13:55:15 -07:00
Wouter van Oortmerssen
398ae0cb6b Some code in the samples and docs still used old C# API.
Change-Id: I7914c88ad7b31baa7586771423069dc2b90d534f
Tested: on Linux.
2017-05-22 15:14:46 -07:00
Wouter van Oortmerssen
aaf5598a03 Standardized internal path handling on Posix separators.
There were several possible bugs involving paths not being
recognized as being the same on Windows. Rather than trying
to ensure all code deals with / and \ correctly, paths now
get transformed to / on input, fixing all current and
future such bugs.

Tested: on OS X.
2017-05-18 17:22:47 -07:00
Kamil Rojewski
3d2cf554d7 Fix for invalid null returns (#4318)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors
2017-05-18 10:30:30 -07:00
sfariv
55dec4d2f8 added check for presence of required fields. (flatc) c++ (#4316)
* added check for presence of required fields.

* updates to resolve Travis CI build error.

* fixes for resolving appveyor build errors.

* fixes for resolving appveyor build errors.

* fixes for resolving appveyor build errors.

* updates per aardappel's comments.

* updated a variable's name.

* updates per aardappel's comments.
2017-05-18 09:32:04 -07:00
schoetbi
0f5f7faa9f C#: Added <autogenerated> in cs generator file header comment (#4291)
* Added <autogenerated> in cs generator file header comment
#4287

* CS: Added xml-correct file header comment including "<auto-generated>...</auto-generated>"
code_generators.cpp: FlatBuffersGeneratedWarning() function replaced by compile time constant "GeneratedWarning"
 also removed extra newlines at end of GeneratedWarning to be able to generate a xml well formed file comment for cs files
#4291

* code_generators: Changed static string GeneratedWarning back to function FlatBuffersGeneratedWarning()
#4291

* Added modified Unit-Test files
#4291

* idl_gen_general: Add autogenerated only in C# code
#4291
2017-05-16 14:28:34 -07:00
Wouter van Oortmerssen
90daabd5b1 Made root test path configurable.
Change-Id: I9629a7648f0c3346c4724ca8938fed47d7828018
Tested: on Linux.
2017-05-15 16:57:39 -07:00
Wouter van Oortmerssen
262e1d7bf9 Updated tutorial with a vector of structs example.
Since it wasn't documented and very different from a vector of
tables, this has caused a lot of confusion in the past.

Change-Id: Iab47c61b55c19abe5c4f25c86d71335a6b6321ca
2017-05-15 13:41:27 -07:00
Wouter van Oortmerssen
c559eb451e Made codegen always output a file, even on an empty schema.
Previously, we had a check to simply skip such files, but this
tends to make build systems unhappy.

This only affects C++ and JS, since other language output per-class
files.

Change-Id: I54224642725bbafb9f6e1654ed3693e62ca9f7d7
Tested: on Linux.
2017-05-12 16:08:58 -07:00
Lawrence Chan
6a7ec85e83 [C++] Fix code gen indentation when empty Print (#4313)
* Fix C++ code gen indentation when empty Print

* Also commit modified tests/monster_test.bfbs
2017-05-12 14:36:35 -07:00
akamat-ibm
81ecc98e02 Adding support for s390x (#4297)
* changes to support s390x

* added flag for s390x

* Adding support for Linux s390x
2017-05-12 10:12:19 -07:00
Per Grön
9aeeddf5ac C++/Go: Update gRPC related code to work with gRPC 1.3+ (#4305)
* Don't fail the build on unused parameters

gRPC headers have unused parameters so this breaks the test build.

* Pull in updated compiler files from gRPC

There have been some API breaks in gRPC lately. This commit
pulls in the most recent version of the files in this repo
that are just copied from gRPC.

* Modify the gRPC files so that they can work with Flatbuffers

The files taken from gRPC do not work out-of-the-box with Flatbuffers.
This commit modifies them so that they work. Hopefully this commit
will be able to serve as a guide or maybe even be cherry-picked on
top of new versions of those files as newer versions from gRPC are
pulled in.

* Adjust the rest of Flatbuffers to work with the new gRPC

* Change idl_gen_grpc.cpp to work with the new API
* Add missing #include in flatbuffers/grpc.h
* Run tests/generate_code.sh and check in the results
* Don't link with grpc++_unsecure and (secure) grpc. That's just weird

* Revert unrelated JS/TS test changes

* Simplify compiler/config.h

There is no need to import this file from gRPC. In fact, it probably
makes sense to not do so, since it seems to be intended to have
project specific configuration in it.

* Don't emit C++ types in the Go gRPC code generator

* Don't emit C++ #includes in generated gRPC code

Before this PR, there was a Go-specific additional_includes method
in schema_interface.h, which is shared with the gRPC repo. The
additional parameter to FlatBufFile in idl_gen_grpc.cpp makes that
unnecessary, which means we need less Flatbuffer-specific changes
in gRPC.
2017-05-12 09:48:17 -07:00
Wouter van Oortmerssen
c7bfe06c54 Reverting part of PR #4286
This is because it trips up the Closure compiler with errors like:

ERROR - assignment to property bb of SomeTable
found : undefined
required: (flatbuffers.ByteBuffer|null)
this.bb = undefined;
^^^^^^^^^^^^^^^^^^^

Change-Id: Iaf032b5249ec655e151331e81532e549c12bcd78
2017-05-10 18:04:53 -07:00
Wouter van Oortmerssen
349a391208 Removed unnecessary check for Offset in AssertScalarT()
This will avoid it accidentally accepting structs of size 4.

Change-Id: I251285ae1e4bffb859367dcf89562741a3980bba
Tested: on Linux.
2017-05-10 18:00:27 -07:00
Wouter van Oortmerssen
9d01bfaea3 Added error message for union values out of range.
Change-Id: I481afcde6a554d1cad519ff95acac7f38a7f4ee5
Tested: on Linux.
2017-05-10 17:21:47 -07:00
Travis Wellman
cfbab31fb1 cleaning up JavaTest.sh - quote paths, and less error-prone deletion (#4301) 2017-05-10 16:45:08 -07:00
Wouter van Oortmerssen
cb2481efdc Ensured flatc.exe is statically linked on Windows 2017-05-10 16:20:53 -07:00
Wouter van Oortmerssen
d7ac3788e8 Clarified the semantics of the Offset type.
Change-Id: Iccc36d24321ac4d556692ac715c0cc69a2c9e09e
Tested: on Linux.
2017-05-10 14:55:11 -07:00
Wouter van Oortmerssen
a0a313b101 Added missing js/ts generated code.
Change-Id: I146e9e1b8f997c11d1675dbef1b958ddbd181092
2017-05-10 13:25:51 -07:00
Wouter van Oortmerssen
93c0960c3a Added --keep-prefix to not strip schema include path in C++ includes.
Change-Id: I3c6356fc6664072796f273096df64829108b4a34
Tested: on Linux.
2017-05-10 13:21:20 -07:00
Wouter van Oortmerssen
04d734d6d2 Added more test scripts: Mono on Linux, and one for all.
Change-Id: Ia107557225db27b396f0d666c5c5b1b324ea22fa
Tested: on Linux.
2017-05-10 12:55:27 -07:00
Wouter van Oortmerssen
8468ea1ab4 Fixed LookupByKey for Java & C#
Change-Id: I05c02223675dee241d1ae8cb466e5186444058c8
Tested: on Linux.
2017-05-10 12:55:27 -07:00
水樹素子
0920d663d5 [C++] Add grpc/streaming test and fix Deserialize (#4296)
* [C++] Add delete msg->buf

* [C++] Add grpc streaming test

* Use free instead of delete

* Refactoring grpctest
2017-05-08 13:49:34 -07:00
Heiko Becker
bbb72f0b73 Tweak fallthrough comments to get recognized by gcc7 (#4298)
GCC gained a new warning, -Wimplicit-fallthrough, which warns about
implicitly falling through a case statement. The regular expressions
used at the default level (-Wimplicit-fallthrough=3) don't match with
a colon at the end. The comment also needs to be followed (after
optional whitespace and other comments) by a 'case' or 'default'
keyword, i.e. it will not be recognized with a '}' between the comment
and the keyword.
2017-05-08 13:35:55 -07:00
moti
8f8a27d6e5 [C++] Add grpc_slice_unref(slice) (#4294) 2017-05-04 15:44:31 -07:00
Kamil Rojewski
86777bd66b Generating the most strict TS code possible (#4286)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible
2017-05-01 16:05:53 -07:00
Wouter van Oortmerssen
8b92122f33 Made the verifier catch zero-offsets.
Zero offsets are non-sensical in FlatBuffers (since offsets are
relative to themselves) but were allowed by the verifier. This could
cause buffers made up of all zeroes to be interpreted as correct
buffers with an empty root object.

Generally, not allowing such offsets will make the verifier more
likely to catch problems earlier.

Change-Id: I54010bea29721b326ff8e5348fcd9fe78e5e7506
Tested: on Linux.
2017-04-26 14:26:18 -07:00
Wouter van Oortmerssen
e93a5652d0 Fixes for VS 2015 build.
Change-Id: I23280e611163a89b8eba7b9b0016c297fea2396e
2017-04-24 10:48:35 -07:00
Wouter van Oortmerssen
0c80b3a7cc Added VS 2015 test to AppVeyor CI.
Change-Id: I354c13fbe6f159058fbeff47100ef357e99c6cd5
2017-04-24 10:06:55 -07:00
Wouter van Oortmerssen
f52ddfbd68 Fix Android STLPort build.
Change-Id: Iceca7b8b455c8463d9b82b928332a875dee3d19e
2017-04-21 10:50:03 -07:00
Kamil Rojewski
808b44f87a TS tests fixes (#4265)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes
2017-04-21 09:29:42 -07:00
Wouter van Oortmerssen
340d1a3447 Fix FlexBuffers writing incomplete length for 64-bit vectors. 2017-04-19 17:51:52 -07:00
Carlos Sanchez
ba20d9bff3 Added a clear function for purging all data that is holded by the FlatBuffer. (#4259) 2017-04-19 17:06:33 -07:00
Dmitry Ermolov
370693a200 Specify `std' namespace for remove function (#4268) 2017-04-19 16:55:41 -07:00
Christian Helmich
33932ceea4 Fixed CreateVectorOfStructs for native_type (2nd try) (#4276)
* Added support for serializing native_type with CreateVectorOfNativeStructs

* Added support for serializing native_type with CreateVectorOfSortedNativeStructs

* Added C++ code generation for vectors of native_types
2017-04-19 10:14:31 -07:00
Per Eckerdal
fb03f78fb4 Fix minor const correctness issue (#4271) 2017-04-19 08:56:55 -07:00
Wouter van Oortmerssen
523f3833eb VS fix for ambiguous union assignment operator.
Change-Id: I1c37db1ced462fd558d3e893a501341f3eca6379
2017-04-17 18:00:41 -07:00
Wouter van Oortmerssen
46497e4f9a Fixed hashed values in JSON for signed ints.
Change-Id: Iae389c6dc9776058b39f4017d30efbf9580aced1
Tested: on Linux.
2017-04-17 17:40:02 -07:00
Wouter van Oortmerssen
b627b7c6c6 Undo PR: make flatbuffers.js into a UMD module (#4228)
This PR did not work in all JS environments and caused
downstream breakage.

Change-Id: Ib565129e26622d02bad2d45816bd05f6b961b994
2017-04-17 17:31:03 -07:00
Wouter van Oortmerssen
e093f72d00 Improved union copy constructor.
It now at least works in simple cases.

Change-Id: I3af0738e676e62166b69accaa6bd19f531fbe5ee
Tested: on Linux.
2017-04-17 17:27:20 -07:00
Wouter van Oortmerssen
728bb64fed Fixed clang needing union copy constructor.
Move constructors are present, which it should use instead.

This is a temp fix to make it compile, but eventually we should
generate a proper copy constructor just in-case people want to
copy objects with unions.

Tested on: Linux, OS X.

Change-Id: Idf85419995c96f5959061882157541573e306083
2017-04-17 14:01:43 -07:00
Jason Stubbs
a07f0d428d [C++] fix bounds checking on integer parsing (#4250)
* fix bounds checking on integer parsing

the previous code was allowing 255 for int8_t, similar for int16_t
and int32_t, and even negative values for unsignd types.

this patch fixes bounds checking for 8-bit, 16-bit and 32-bit types.
testing for both acceptable values and unacceptable values at the
boundaries are also improved.

bounds checking on 64-bit types isn't addressed by this patch.

* fix 'unary minus operator applied to unsigned type, result still unsigned'

* fix & placement
2017-04-17 11:19:43 -07:00
Wouter van Oortmerssen
b90d4e049d VS warning fixes.
Change-Id: I19662241d56560c064cff73dbebfb2a81d226934
2017-04-12 17:56:19 -07:00
Wouter van Oortmerssen
b0752e179b Added support for structs and strings in unions.
(C++ only for now).
Also fixed vector of union support in the object API.

Bug: 36902939
Change-Id: I935f4cc2c303a4728e26c7916a8ec0adcd6f84cb
Tested: on Linux.
2017-04-12 17:47:47 -07:00
schoetbi
1fc12e0e5b C++ fixed compile error C2678 with msvc when using std::find_if on vectors (#4262)
In Debug mode it is checked that iterator begin is less than end
therefore the operator< in class VectorIterator is needed
2017-04-12 16:37:22 -07:00
chronoxor
e6fa7b1133 Fix Visual Studio 2017 new warning (C4244: 'argument': conversion fro… (#4261)
* Fix Visual Studio 2017 new warning (C4244: 'argument': conversion from 'int' to 'const char', possible loss of data)

* Fix Visual Studio 2017 pedantic warnings

* Fix Visual Studio 2017 pedantic warnings
2017-04-12 13:13:10 -07:00
Kamil Rojewski
28e7dbd3d3 TypeScript support (#4232)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data
2017-04-10 10:01:13 -07:00
Iain van der Bloat
adc50051e0 make flatbuffers.js into a UMD module (#4228) 2017-04-07 17:14:01 -07:00
moti
2aec880347 [C++]Use noexcept in union type move ctor/Add move assingment (#4249)
* Use noexcept in union type move ctor/Add move assingment

* Add NOEXCEPT macro to deal with _MS_VER/Remove delegating ctor in union type class

* Add FLATBUFFERS_NOEXCEPT to generated union class
2017-03-29 18:00:20 -07:00
Wouter van Oortmerssen
238a8ebb15 Suppress warning in Flatbuffer VS2010 builds.
Change-Id: I4f66a96ba581704c1a384cc700b8fb731d3eeed4
2017-03-29 12:01:11 -07:00
Wouter van Oortmerssen
86992476da Update StackOverflow links to have relevant queries.
Change-Id: I59159fb7205e4802f041b749d502a8f305d4176c
2017-03-29 11:58:42 -07:00
Wouter van Oortmerssen
751aeabc80 Updated .gitignore for C#
Change-Id: I6c253b0ded187a4945f5e862aae721cf4fda6398
2017-03-29 11:55:20 -07:00
Wouter van Oortmerssen
b4bb1b103f Fix flatc code gen.
Mutable functions should return a non-const reference to the member variable.

Change-Id: I833077d2c9a38a5d71868e43aca6b250d79b6625
2017-03-29 11:51:20 -07:00
Wouter van Oortmerssen
cffd187fc7 Added missing generated code for C#
Change-Id: I1affced255eb96977119d8480793b5bba42f065f
2017-03-29 11:51:02 -07:00
Spencer Bench
ccfa317486 C#: Fixed possible conflicts between usings and user-supplied namespace (#4247)
* C#: Fixed possible conflicts between usings and user-supplied namespace

C#: Added the global qualifier to using directives to prevent possible conflicts with the user-supplied namespace. Also prevents unintentional type hiding. Resolves issue #4242.

* Updated C# generated code files
2017-03-29 11:09:25 -07:00
tianyapiaozi
a5cc2092a6 Support binary search for struct in cpp (#4245)
* Support binary search for struct in cpp

CreateVectorOfSortedStruct is provided for convenience.

* fix continuous-integration error

* add generated files

* compile Ability.cs in csharp test

* compile Ability.cs in csharp

* modify according to code review
2017-03-29 09:51:12 -07:00
Wouter van Oortmerssen
89041a1686 Add a VectorCast function that safely casts from
Vector<Offset<T>> to Vector<Offset<U>> if U is a base
class of T.

This is useful for when you want to generically
iterate over a vector of objects that derive from
flatbuffers::Table.

Change-Id: I59161e3b9f40501f72e02b46509be9dc8ab86c6b
2017-03-27 17:50:30 -07:00
Wouter van Oortmerssen
7a36419f24 Fixing closure compile compatibility when --gen-mutable is used.
Change-Id: I8bf575ba6dc795d2d2eec02fa8977dcc2594eaa6
2017-03-27 17:50:30 -07:00
Jesper Stemann Andersen
281284fa5d Fixed building and warnings on Arduino (16 bit platform). (#4197)
Building on Arduino fixed by conditional includes of cstdint and utility. In the Standard C++ for Arduino (port of uClibc++):
* cstdint is not present.
* utility is named utility.h.

Replaced size_t with uoffset_t for Verifier::max_tables_, max_depth_, depth_, and num_tables_ to ensure 32-bit values are used (and not 16-bit) - gave rise to a warning.
2017-03-27 09:38:04 -07:00
Lawrence Chan
1a27c7017a C++: Add default value handling to mutation/SetField code (#4230)
* Add default value handling to mutation/SetField code

* Shorten reflection SetField impl

* Modify impl to work with C++03

* Add more mutation tests

* Fail SetField if non-scalar

* Add IsScalar/IsInteger/IsFloat for reflection::BaseType

* Use new IsScalar/IsInteger/IsFloat in reflection SetField

* Assume scalar is either int or float
2017-03-20 17:36:27 -07:00
Flier Lu
b8f5f84437 add command line argument for go namespace (#4222) 2017-03-20 16:08:35 -07:00
Alexander Gallego
f2071e4f80 Add arbitrary string type to the native object API (#4218)
* Custom strings are very common for optimizations around small objects
  or growth style optimizations, i.e.: grow at 1.57 times vs doubling vs..

  A second common strategy is to cooperate w/ the memory allocator
  see FBString[1] and seastar[2] string for examples.

[1] fbstring: https://github.com/facebook/folly/blob/master/folly/docs/FBString.md
[2] sstring: https://github.com/scylladb/seastar/blob/master/core/sstring.hh
2017-03-20 16:02:04 -07:00
Jun Hyeon, Nam
9c25ecdcd1 C++: add String::str() function (#4234)
for convenience
2017-03-18 10:09:56 -07:00
Jun Hyeon, Nam
1beed12e59 fixed duplicate symbol error in flexbuffers.h (#4233)
1. modified the function that omitted inline.
2. changed the static global functions to inline functions.
2017-03-18 10:08:39 -07:00
Flier Lu
4cd71d67f1 GO: add _ postfix to identiy conflict golang keyword (#4221)
* add _ postfix to identiy conflict golang keyword

* make VS2010 happy
2017-03-15 18:34:53 -07:00
Aaron Hudon
d9bc5ec047 fixed flag for javascript (#4223)
--javascript flag does not work in the 1.6 flatc.exe, changed to --js
2017-03-15 15:16:43 -07:00
Koichi Shiraishi
c04c143cf0 tests: update monster_test.bfbs binary file with generate_code.sh (#4220)
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
2017-03-15 14:53:37 -07:00
Koichi Shiraishi
c6aae45364 sample: update auto-generated monster_generated.h (#4219)
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
2017-03-15 14:52:47 -07:00
Alexander Theißen
7f2a1c90d5 Prevent flatbuffers::Vector and flatbuffers::VectorOfAny to be copied (#4217) 2017-03-13 08:53:30 -07:00
chronoxor
f5387387de Pedantic Visual Studio build (/W4 /WX) (#4214)
* Pedantic Visual Studio build (/W4 /WX)

* Pedantic Visual Studio build (/W4 /WX)

* Pedantic Visual Studio build (/W4 /WX)

* Remove /wd4512 from CMakeLists.txt

* Suppress Visual Studio 4512 warning ('class' : assignment operator could not be generated)
2017-03-10 10:27:30 -08:00
Louis-Paul CORDIER
e7e4dc755d NoError was returning on DoParse method when file was empty (#4208)
* NoError was returning on DoParse method when file was empty.

* change NoError message in DoParse.
2017-03-10 08:50:44 -08:00
chronoxor
b8224809ad VS2015 warning "conditional expression is constant" (#4210)
* VS2015 warning "conditional expression is constant"

* VS2015 warning "conditional expression is constant"
2017-03-08 13:34:38 -08:00
Dale Lukas Peterson
bb22fb5756 Fix broken symlink to CONTRIBUTING.md (#4212) 2017-03-08 13:16:11 -08:00
Christian Helmich
ff274771ba fixed path being ignored in GenerateCppGRPC (#4207) 2017-03-08 09:08:40 -08:00
Hadriel Kaplan
15bf626191 Add a backwards-compatible version of VerifyBuffer() (#4201) 2017-03-08 08:25:37 -08:00
Zarian Waheed
ac106e835c Fixing broken link and added missing <map> header include. (#4199) 2017-03-03 09:47:52 -08:00
xiaohaoliang
640b525e83 optimization of FlatBufferBuilder::CreateVector() (#4198)
optimization of FlatBufferBuilder::CreateVector()
1. optimization of FlatBufferBuilder::CreateVector() for "1 == sizeof(T)" ( such as [byte], [ubyte]).
2. For my project, it was about 10x improvement on flatbuffers serialization.
3. why not "string": "string, which may only hold UTF-8 or 7-bit ASCII. For other text encodings or general binary data use vectors ([byte] or [ubyte]) instead."
2017-03-03 09:40:43 -08:00
Raman
0b379211dc Fixed problem with uint keys (#4172)
* Fixed problem with uint keys

* removed excess check

* Resolved problem with big uint, ubyte keys in Java
2017-02-28 14:16:50 -08:00
Louis-Paul CORDIER
bb223da258 C++ generator: Pre-allocating std::vector in UnPack methods. (#4187) 2017-02-25 22:10:17 -08:00
Andrei Lebedev
17c5f89d4f Fixed move constructor in generated union class (#4192)
* Fixed move constructor in generated union class

* Removed delegating constructor
2017-02-25 22:06:48 -08:00
Andrei Lebedev
695d26183a Remove libc++ and c++abi requirement on Linux with clang (#4189) 2017-02-25 21:47:57 -08:00
Kameiha
f5120a2aaf more safer (#4186)
push_small(T little_endian_t) => push_small(const T& little_endian_t)
2017-02-25 21:24:43 -08:00
Franken
037314a059 [C++] Additional accessors for fields of union types. (#4184)
* Additional accessors for fields of union types.

* Reveal the hidden parameter.

* External explicit specializations for templated accessors.

* Changes according to code style. Generated code included as well.
2017-02-25 21:23:32 -08:00
litianzhao
ebcfbbadf0 fix #4180: Long.prototype.toFloat64() overflow (#4182) 2017-02-20 11:20:56 -08:00
Wouter van Oortmerssen
6561c7a31f Temporarily disabled VS2010 warning 4512.
Change-Id: Ib75b4cc651ac8f67cd262c8293fca1ac590f6b71
2017-02-15 17:46:00 -08:00
Wouter van Oortmerssen
a6d98fb067 Fixed VS x64 warnings in flexbuffers.h 2017-02-15 17:41:00 -08:00
Wouter van Oortmerssen
3a2d3a232f Removed spurious "aa" from flatc usage message.
Change-Id: Ia1812d594882ce6c51002d07827ccec267d138bb
2017-02-15 14:59:25 -08:00
Wouter van Oortmerssen
cebdad4d23 Updated version numbers to 1.6
Change-Id: I215fcc7581253f14171b513d4fc75da960b2064a
2017-02-15 14:36:51 -08:00
Sahil Jain
d798100be9 Round vector_downward initial size up (#4179) 2017-02-15 11:42:01 -08:00
Wouter van Oortmerssen
1fb6b9ee6f Added doc comments to the binary schema.
Change-Id: I87f291ab6e07b1425850cae25ed500db594f17c8
Tested: on Linux.
2017-02-13 16:47:17 -08:00
Wouter van Oortmerssen
2d6e8f096b Fixed sorting assertion with some std::sort implementations.
Change-Id: Idd925c9cc5cd2a35e06f4d832734180f5c38378e
Tested: on Linux.
2017-02-13 09:50:35 -08:00
Shintaro Abe
ec8038cc3d JS: add package.json to publish the npm pacakge (#4166)
* JS: add package.json to publish the npm pacakge

* JS: update package.json to set version and author
2017-02-10 14:19:11 -08:00
Wouter van Oortmerssen
2df3d1c965 Added missing generated code.
Change-Id: If3d2e11627b6d08bc6433941208ead577aa0e3b9
2017-02-10 13:28:15 -08:00
Wouter van Oortmerssen
2272229983 Added --prefix-include option for generated includes.
Change-Id: I288cda33345362f9aec5cbe309e590bf64f328e1
Tested: on Linux.
2017-02-10 13:24:54 -08:00
水樹素子
b7bfecb4ee Add move constructor to generated union class. (#4167)
* Add move constructor to generated union class.

* Unused default

* Add generated code
2017-02-10 10:32:34 -08:00
sjoblom65
c7c4bbfce2 Error C2668: 'Service::Version2::CreateServiceValues' : ambiguous call to overloaded function (#4161)
* Update idl_gen_cpp.cpp

Fix for: error C2668: 'Service::Version2::CreateServiceValues' : ambiguous call to overloaded function #4145

* Update idl_gen_cpp.cpp

Also needed the same change in the getPostTable

* Add files via upload

New generation from running generate_test.bat

* Add files via upload

Lets try this without added line feeds

* Added a test for a potential "ambiguous call to overloaded function"

* Change to a better name of the table.

Didn't like the Service in the name.

* Reverted back to the original
2017-02-10 10:25:11 -08:00
Wouter van Oortmerssen
d7ba17dfe5 Changes to make flatbuffers javascript compatible with the closure compiler.
Change-Id: Iab8d66a8f34910029deb8a5ff5ec7ba50c5b3421
2017-02-08 17:14:35 -08:00
Wouter van Oortmerssen
60b11435e6 Fixed missing '
Change-Id: I25110bbb171a27626ec6416b810399069d590279
2017-02-08 17:04:44 -08:00
Wouter van Oortmerssen
ed2110d7b3 Fixed link to Google C++ Style Guide.
Change-Id: Ifb955f3daefedae2cb9930a365c4c7e0641776b4
2017-02-08 16:37:25 -08:00
Wouter van Oortmerssen
a9514de978 Fixed vector test on Windows 2017-02-08 15:59:52 -08:00
Wouter van Oortmerssen
c57ab92e60 Fixes for Windows compiler errors.
Change-Id: I909ea6866089f36f9cb79d435bbecd29623fd8f7
2017-02-08 15:38:18 -08:00
Wouter van Oortmerssen
f878024d0b Fixed the Android build.
Change-Id: Iabb9448b4f161bba465d455c28bb826529649d30
Tested: on Android.
2017-02-08 15:13:57 -08:00
Wouter van Oortmerssen
aac6be1153 First attempt at SchemaLess FlatBuffers.
Change-Id: I86b9d002f3441ef9efdb70e059b8530ab2d74bb8
Tested: on Linux.
2017-02-08 15:13:56 -08:00
Wouter van Oortmerssen
dabe030890 Added PULL_REQUEST_TEMPLATE.md
Change-Id: Iad9c09434f87219e384b294d6221f4cac7a839eb
2017-02-08 10:15:26 -08:00
Wouter van Oortmerssen
29574282a2 JSON parser wasn't handling ulong values correctly.
It passed all scalar ints thru a int64_t, which would truncate
uint64_t values with the upper bit set.

Change-Id: I38fb8c68c911ae44d9863f8e35c2429ca0ab51e5
Tested: on Linux.
2017-02-01 14:18:28 -08:00
Benjamin Lerman
2dd6ba57d1 Add utility method to build a vector of struct in-place. (#4153)
Change-Id: I6df195cbae621cf2bf6b4f3b56f68be80dc23152
2017-02-01 09:22:56 -08:00
Wouter van Oortmerssen
6cc2307c71 Remove max_message_size arg, which is not passed to Deserialize func.
Change-Id: Icc7b4c1cf626f49d0529ff4f66503ea8381bf67c
2017-01-30 14:54:51 -08:00
Wouter van Oortmerssen
74c8c7137a A bug fix to the union vector feature in FlatBuffers.
Change-Id: I302245969f6ec2443572799732fce2aa7c071879
2017-01-30 14:02:40 -08:00
Wouter van Oortmerssen
f9055ff9a7 Merge branch 'master' of https://github.com/google/flatbuffers 2017-01-27 15:30:27 -08:00
Wouter van Oortmerssen
9b3d8b318a Added tracking of order of types declared.
Change-Id: Iade313c99f119dcf1619674260648a33f61dc030
2017-01-27 15:30:08 -08:00
Wouter van Oortmerssen
87e29b25de Some small speed optimizations to the core copying functions.
Change-Id: Id8c1afb84f4ab0e2edca4290e3de5589fa06e578
Tested: on Linux.
2017-01-27 11:26:35 -08:00
Robert
f7bc9bd51b Merge pull request #4146 from zchee/go-test-fix_struct
go: fix unknown field 'UOffset' to 'Pos'
2017-01-26 20:45:49 -08:00
Wouter van Oortmerssen
3dee617c86 Fix unused variable build warning on Mac.
Change-Id: I330187be6a96bfd388c2776f676d47a9145d5e4a
2017-01-25 14:39:14 -08:00
Wouter van Oortmerssen
2fb25e2bb3 Moved union vector test to file dependent section.
Change-Id: I3a1fcf167eb0d0a51ef838e54246ef867e752218
2017-01-25 14:09:18 -08:00
Wouter van Oortmerssen
b395359b6e Allow the flatbuffer compiler (flatc) to be built as a library.
Change-Id: I71baff427243f96be1596b01ff3405fdf39386d7
2017-01-25 13:41:34 -08:00
gbeili
fd61d70205 minor fixes to the union vector code styles (#4149) 2017-01-25 09:34:37 -08:00
jsanmiya
4f4495a693 Merge pull request #4148 from gbeili/vector_unions
C++ Union Vector
2017-01-24 14:33:32 -08:00
Bei Li
68bbe983e9 Union Vector 2017-01-24 11:52:36 -08:00
Florin Pățan
bbef92c17d Reword comment so that code editors can mark deprecation correctly (#4147) 2017-01-23 13:40:50 -08:00
Koichi Shiraishi
25c884158f go: fix unknown field 'UOffset' to 'Pos'
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
2017-01-22 20:16:52 +09:00
Wouter van Oortmerssen
3f936c5655 More native code gen functionality.
Allow tables to be mapped to native types directly.  For example, a table
representing a vector3 (eg. table Vec3 { x:float; y:float; z:float; }) can
be mapped to a "mathfu::vec3" native type in NativeTables.  This requires
users to provide Pack and UnPack functions that convert between the
Table and native types.  This is done by adding the "native_type" attribute
to the table definition.

To support user-defined flatbuffers::Pack and flatbuffers::UnPack functions,
support a "native_include" markup that will generate a corresponding

Also add an UnPackTo function which allows users to pass in a pointer to
a NativeTable object into which to UnPack the Table.  The existing UnPack
function is now simply:

  NativeTable* UnPack() {
    NativeTable* obj = new NativeTable();
    Table::UnPackTo(obj);
    return obj;
  }

Finally, allow native types to be given a default value as well which are
set in the NativeTable constructor.  This is done by providing a
"native_default" attribute to the member of a table.

Change-Id: Ic45cb48b0e6d7cfa5734b24819e54aa96d847cfd
2017-01-18 16:23:35 -08:00
Wouter van Oortmerssen
42a265b419 Add no-op for padding variables to prevent clang compiler warning.
Change-Id: I119ee7109bfa2b0be0f468d2b2be459f45d1bb11
2017-01-18 16:17:08 -08:00
Wouter van Oortmerssen
4bc4979acc Fix compiler warning on Visual Studio.
Change-Id: Ifda5f2c32c6484508d5e12a463d6373798f1f523
2017-01-18 16:09:35 -08:00
Wouter van Oortmerssen
b095367d17 Merge branch 'master' of https://github.com/google/flatbuffers 2017-01-18 14:58:09 -08:00
Wouter van Oortmerssen
eac2905568 Fixed unions not being parsed correctly in JSON.
This would happen if they were supplied in an order that does not match
the schema relative to other fields. It now supports any ordering.

Change-Id: I9d309cd4e6e5c470f01d9d431806eba4f9f46559
Tested: on Linux.
2017-01-18 14:54:16 -08:00
Georges Savoundararadj
12fd0c6838 GenEnum: bit_flags: Remove useless conditions (#4141)
The conditions to add the "NONE" or "ANY" value in the enum were useless
because the user cannot provide a zero value or a bitmask (for "ANY") in
the bit_flags enum type.
2017-01-18 09:59:13 -08:00
Wouter van Oortmerssen
19101826a8 Fix unused field warning in clang.
Change-Id: I71d590a1e5b2709f0e2dcf97faaebda5cb918fc7
Tested: on Linux.
2017-01-13 18:30:57 -08:00
Wouter van Oortmerssen
7b94eab2b1 Add CodeWriter utility class.
Helps simplify code generation code.  Instead of this:
  code += "inline const " + cpp_qualified_name + " *Get";
  code += name;
  code += "(const void *buf) {\n  return flatbuffers::GetRoot<";
  code += cpp_qualified_name + ">(buf);\n}\n\n";

You do this:
  code.SetValue("NAME", struct_def.name);
  code.SetValue("CPP_NAME", cpp_qualified_name);
  code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {";
  code += "  return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);";
  code += "}";
  code += "";

Updated the CPP code generator to use the CodeWriter class.  Most of the
changes in the generated code are white-space changes, esp. around new
lines (since the code generator class automatically appends new lines
when appending a string).  Actual code changes include:

* Renamed "rehasher" to "_rehasher" for consistency with other args in
  Pack function.

* Renamed "union_obj" to "obj: in UnPack function.

* Always do "(void)_o;" to prevent unused variable warning in Create
  function (instead of only doing it if there are no fields) in order
  to avoid two-passes.

* Renamed padding variables from __paddingX to paddingX__.
  "Each name that contains a double underscore (_ _) [...] is reserved
   to the implementation for any use."  C++ standards 17.4.3.1.2.

* Add braces around switch cases.

* Calculate index as a separate statement in EnumName function, eg.
    const size_t index = ...;
    return EnumNamesX()[index];
  vs.
    return EnumNamesX()[...];

* Stored end table offset in variable in Finish() functions, eg.
    const auto end = fbb_.EndTable(start_, ...);
    auto o = flatbuffers::Offset<T>(end);
  vs.
    auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...));

* Separate reinterpret_cast calls from function calls in Union
  functions, eg.
    auto ptr = reinterpret_cast<const T *>(obj);
    return ptr->UnPack(resolver);
  vs.
    return reinterpret_cast<const T *>(obj)->UnPack(resolver);

* Removed unecessary (void)(padding__X) no-ops from constructors, eg.
    Test(int16_t a, int8_t b) : ... {
      (void)__padding0;  // <-- Removed this line.
    }

In the idl_gen_cpp.cpp file itself, I refactored some code generation into
new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders,
GenUnpackFieldStatement, and GenCreateParam.

Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
2017-01-13 17:44:42 -08:00
gbeili
1a21b54560 Add a builder option to enable/disable vtables deduplication. (#4132)
* Add a builder option to enable/disable vtables deduplication.

* address code review comments
2017-01-11 10:36:18 -08:00
Pascal S. de Kloe
b55f18649a Resolve Go fmt and vet warnings (#4134)
* Resolve Go fmt and vet warnings.

* Undo generated code gofmt.
2017-01-09 17:13:44 -08:00
Wouter van Oortmerssen
e2373668d9 Merge branch 'master' of https://github.com/google/flatbuffers 2017-01-09 15:55:18 -08:00
Wouter van Oortmerssen
8c1a723ba5 Fixed GRPC method name generation.
Change-Id: I827b7e9aee1edb77752322455f7b6fafac16fb1d
Tested: on Linux.
2017-01-09 15:54:31 -08:00
Mateusz Pusz
ab7949dc16 Cold part of make_space() code moved to reallocate member function. (#4130)
Change makes make_space() code much friendlier for the compiler to inline which makes significant (measurable) performance improvements.
2017-01-09 10:10:11 -08:00
Wouter van Oortmerssen
2c4dce5ba7 Re-applied reverted fix, adding missing codegen files.
Change-Id: I301d29835fb0baffd859950eb0fb3056e4f4d66b
2017-01-04 10:41:31 -08:00
Wouter van Oortmerssen
cc84240098 Misc idl_gen_cpp cleanup
- Update to be const-correct where possible.
- Consistently pass |code| as pointer instead of non-const-ref.
- No newlines (\n) characters in the middle of code strings.
- Use if-else if-else statements instead of nested ternary operators.
- Ensure all lines end at 80 chars.
- Make utility functions static.

From cl/143505731.

Change-Id: If0fab9ee75de5af963367a948dddf53af93f73b4
2017-01-04 10:12:39 -08:00
Wouter van Oortmerssen
b29ba4c70c Updated version to 1.5
Change-Id: I34007829cdd3ad024df21f68bb369016d5d21131
2017-01-03 14:56:44 -08:00
Yonggang Li
fea6b525ee fix memory leak (#4126) 2017-01-03 13:54:15 -08:00
CarsarSky
69dc71b5ed Fix C++ gRPC test with streaming method (#4123) 2016-12-28 11:50:41 -08:00
Wouter van Oortmerssen
1a89682251 Merge branch 'master' of https://github.com/google/flatbuffers 2016-12-21 18:06:10 -08:00
Wouter van Oortmerssen
5fd0fefab6 Fixed empty structs generating illegal constructor in C++.
Change-Id: I60418d597b497c3cfa655ad76b3128351e9139f2
2016-12-21 18:04:31 -08:00
Ankur Dave
f8a964d2b0 Fix call to Verifier::VerifyBuffer from BufferRef (#4124)
3a1f776132 added a required identifier parameter
to Verifier::VerifyBuffer but did not update the templated call site in
BufferRef. This causes errors like the following when trying to instantiate the
call site by calling BufferRef::Verify():

    include/flatbuffers/flatbuffers.h: In instantiation of ‘bool flatbuffers::BufferRef<T>::Verify() [with T = MyType]’:
    MyApp.cpp:16:3:   required from here
    include/flatbuffers/flatbuffers.h:1421:37: error: no matching function for call to ‘flatbuffers::Verifier::VerifyBuffer()’
         return verifier.VerifyBuffer<T>();
                                         ^
    include/flatbuffers/flatbuffers.h:1421:37: note: candidate is:
    include/flatbuffers/flatbuffers.h:1352:29: note: template<class T> bool flatbuffers::Verifier::VerifyBuffer(const char*)
       template<typename T> bool VerifyBuffer(const char *identifier) {
                                 ^
    include/flatbuffers/flatbuffers.h:1352:29: note:   template argument deduction/substitution failed:
    include/flatbuffers/flatbuffers.h:1421:37: note:   candidate expects 1 argument, 0 provided
         return verifier.VerifyBuffer<T>();
                                         ^

This commit fixes the BufferRef call site by adding a nullptr argument.
2016-12-21 17:49:45 -08:00
Zarian Waheed
84033ae035 Added helper methods to access struct through reflection. (#4120)
* Added helper methods to access struct through reflection. Also added unit test for it.

* Added a TODO comment to check for the is_struct flag.
2016-12-21 17:48:21 -08:00
Wouter van Oortmerssen
b9efbf6a3d Fixed more Windows build errors.
Change-Id: I556e1c103e8501dc144b16c8698463253de6f4fb
2016-12-21 17:45:27 -08:00
Wouter van Oortmerssen
13194ececa Fixed Windows compiler warning.
Change-Id: I12b31227d4545a8897f638754d6a9ccd029f177e
2016-12-21 16:16:52 -08:00
wvo
9ec9303abb Go related style fixes.
Change-Id: Ie854ace69a21ef685e1ade5584f9d9ce4e8b41f1
2016-12-21 14:32:44 -08:00
Wouter van Oortmerssen
03ee3db240 Fixed Windows build errors.
Change-Id: I11548bfa3cfe307598eb59c56412974c349d614d
2016-12-19 17:04:35 -08:00
Wouter van Oortmerssen
cf825b8819 Added missing generated code from previous commits.
Change-Id: Id7053e4cb5a085a4b047c86ff1f2269329ff7f54
2016-12-19 16:28:06 -08:00
Wouter van Oortmerssen
377a8ba6b2 Merge branch 'master' of https://github.com/google/flatbuffers 2016-12-19 16:26:57 -08:00
Wouter van Oortmerssen
13cf6e66e3 Merge "Documentation improvements: style guide & guide lines." into ub-games-master 2016-12-20 00:25:31 +00:00
Wouter van Oortmerssen
81b6bacead Documentation improvements: style guide & guide lines.
Bug: 22346508
Change-Id: I3f6e6b2811adaaf9d79faca8cdd00af3927299b5
2016-12-19 16:04:08 -08:00
Wouter van Oortmerssen
e6fa14a08d Add default values (if they exist) to native tables.
From cl/142307012.

Change-Id: I54d550573f6506b92ad18e7cc90bcd8589259e52
2016-12-19 15:43:03 -08:00
Wouter van Oortmerssen
c66683f27f Add ::Set function to Unions to make memory ownership clear.
Unions own the NativeTable* value member because they need to destroy them
when the Union goes out of scope.  Currently, the data is destroyed by calling
delete, which means that the member needs to be allocated with new.  However,
making the allocation the responsibility of the client and the destruction
the responsibility of the Union can lead to potential errors.  Adding a
Set function will ensure that the memory is allocated correctly so that it
can be deleted later.

From cl/142161569.

Change-Id: I4605f26d2749164819bfae0140e5fae08442b50a
2016-12-19 15:21:08 -08:00
Zarian Waheed
6d6271db2f Changes for verifying a buffer dynamically using reflection. (#4102)
* Changes for verifying a buffer dynamically using reflection.

* Fixing build issues on linux and applied code reformatting.

* Fixing the file order in cmake file that was messing up the macro based code inclusion.

Added tests for reflection based verification.

* Changes for verifying a buffer dynamically using reflection.

Fixing build issues on linux and applied code reformatting.

Fixing the file order in cmake file that was messing up the macro based code inclusion.

Added tests for reflection based verification.

* Incorporated the code review changes that were requested:

1. Changed the Verify function signature.
2. Changed the variable names to use snake_case.
3. Added better comments.
4. Refactored duplicate code.
5. Changed the verifier class so that it has the same size when compiled with or without FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE macro.

* Setting FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE and FLATBUFFERS_DEBUG_VERIFICATION_FAILURE through cmake for flattests so that it gets propagted to all translation units of flattests.

* Making the Verifier struct fields the same in all cases. Also reverting the target_compile_definitions change in cmake file because build machine on travis does not have cmake version 3.0 or higher which was the version when target_compile_definitions was added in cmake.

* Defining macros through cmake in a portable way using functions that are available in cmake 2.8.
2016-12-16 08:46:30 -08:00
krupnov
ab76c57ec8 random access iterator for vector added (#4119)
* random access iterator for vector added

* Style changes
2016-12-16 08:37:04 -08:00
Wouter van Oortmerssen
d1e8899310 Fixed JS outputting helper for Int64Array.
Change-Id: I7d23fa3416feb78ea18d2c451e7b4e1d9be11bfc
2016-12-14 10:35:26 -08:00
Wouter van Oortmerssen
ccba2edb7c Made GRPC generator missing into a warning.
Change-Id: Iceb1f5b78cff6227905b8a23eb70e9ef6ce909ed
2016-12-14 10:32:44 -08:00
Wouter van Oortmerssen
2a7a44be33 Improving AppVeyor CI with other languages.
Change-Id: Iff630905b5f90814c5f728e3c0e10f7fcd67c7fe
2016-12-12 18:02:13 -08:00
Ricardo Quesada
6301da75d1 add weapon + equipment to json example (#4114)
update json with documentation

removed comments
2016-12-12 14:12:56 -08:00
Robert
059661b9ac Merge pull request #4112 from manolama/tweaks
Restore the ''import "unsafe'' removed in 36daedf35fd0cc2ad0e5e24d187…
2016-12-09 14:29:57 -08:00
Manolama
dc5975ba7a Restore the ''import "unsafe'' removed in 36daedf35f.
This was causing build failures with tools dependent on Flatbuffers in Go.
E.g.
go/src/github.com/google/flatbuffers/go/sizes.go:50: undefined: unsafe in unsafe.Pointer
2016-12-08 22:19:33 -08:00
Robert
0de4f3f75b Create basic issue template (#4107)
* Create basic issue template

* Update ISSUE_TEMPLATE.md
2016-12-07 14:17:30 -08:00
Robert
b59aafc659 Merge pull request #3791 from mmastrac/master
Avoid unsafe when sizing types
2016-12-07 11:51:11 -08:00
Robert
92a6ae93fa Merge pull request #3977 from gonzaloserrano/feature/go-generic-deserialitzation
Add a generic way to deserialize a flatbuffer in Go.
2016-12-07 11:17:55 -08:00
Ronak Jain
a31ddd2bb3 Support for Golang GRPC (Experimental) (#4082)
* support for grpc golang

* refactored grpc go generator

* added grpc-go test and refactored

* refactored idl_gen_grpc.cpp

* fixed grpc generate method name

* refactored flatc and fixed line length issue

* added codec to go lib and fixed formatting issues

* fixed spacing issues
2016-12-05 13:20:38 -08:00
Wouter van Oortmerssen
bc2ec7119b Adds typedefs and functions to help write generic code.
The following changes have been made to the C++ codegen to enable writing generic code
that uses the Table and NativeTable types.

- Adds TableType and NativeTableType typedefs to NativeTable and Table structs.
- Adds GetFullyQualifiedName() to NativeTables if --gen-name-strings is set.
- Adds a static Pack function to Tables that simply calls the global CreateX functions.

See cr/140391505 as an example of improved usage.

From cl/140529288.

Change-Id: Idec137c16129e15c1783f94fabdcea24aeeaaef6
2016-12-02 14:25:39 -08:00
Wouter van Oortmerssen
641b397f8b Allows structs to be stored directly as member variables.
Introduce a "native_inline" attribute that can be applied on fields that are structs.
This results in NativeTable code generation that sets the struct "inline" rather than
storing it in a pointer.

From cl/140527470.

Change-Id: I208724f552b8b921b20923e0bf82f42cb3582416
2016-12-02 14:25:08 -08:00
Wouter van Oortmerssen
d342918790 Merge branch 'master' of https://github.com/google/flatbuffers
Change-Id: I02b00b22cdd2d1bd32de3273ff69185c9b0f4e5b
2016-11-21 15:20:33 -08:00
The Gitter Badger
c4377390a8 Add Gitter badge (#4075) 2016-11-18 11:42:50 -08:00
benssson
5608be0f96 Fixed javascript helper for typed arrays of scalars not taking into (#4068)
account underlying buffer's byte offset.
2016-11-18 11:42:50 -08:00
Antoine Descamps
dbecdf209d [PHP] Use mb_detect_encoding when available (#3952)
I've faced an issue where I want to serialize UTF-8 emojis and FlatBufferBuilder::is_utf8 would return false on them.
I was not able to add the corresponding hexadecimal code because I don't understand how the whole thing works but what i've done is using the `mb_detect_encoding` function which handles correctly all supposed UTF-8 characters.
2016-11-16 09:54:57 -08:00
garretmcgraw
c05803bf96 Making flatbuffers JSON parsing deal with unexpected null values when unknown JSON is allowed. (#4083) 2016-11-09 14:38:48 -08:00
Michael Paulson
d298adc4e6 chore(lint) (#4079)
* chore(lint)

I accidentally let 2 pieces of lint in with my generated code.

* fix(generate-code): I did not generate all the required code for tests.
2016-11-07 10:27:26 -08:00
Wouter van Oortmerssen
c2050aa0e3 Merge branch 'master' of https://github.com/google/flatbuffers 2016-11-07 10:09:42 -08:00
Wouter van Oortmerssen
290e9f270b Fixes to support GCC 4.4.7
Fixed generation of a trailing comma and removed unnecessary use of a lambda.

Change-Id: I9993f6eb83e2ebc36fc40295a2059c340c1fbe03
Tested: on Linux.
2016-11-07 09:51:28 -08:00
The Gitter Badger
76ae10df42 Add Gitter badge (#4075) 2016-11-02 14:05:31 -07:00
benssson
cf0d7829a6 Fixed javascript helper for typed arrays of scalars not taking into (#4068)
account underlying buffer's byte offset.
2016-10-26 10:29:36 -07:00
Wouter van Oortmerssen
af21b9064d Change docs to not encourage use of 1 byte buffers.
Change-Id: Ib0b1692044f35e374a0f7c0359c94319f4a25619
2016-10-24 10:29:09 -07:00
Wouter van Oortmerssen
e31fbb0b23 Fixed STLPort error for missing vector::data()
Change-Id: I06fb61edf018adf0f26a81de4596b4972226e466
Tested: on Android.
Bug: 30263829
2016-10-21 17:35:41 -07:00
Wouter van Oortmerssen
43ba7c6369 Merge branch 'master' of https://github.com/google/flatbuffers 2016-10-21 16:57:50 -07:00
Wouter van Oortmerssen
dae513e0e7 Made nesting vs inline clearer in the docs.
Also fixed structs not being created inline in the tutorial,
which would actually have bad consequences if used.

Change-Id: Idce215c61a1b24a297cee76f625052bb2722e970
2016-10-21 15:22:14 -07:00
cajun-rat
d8944e45a2 Fix Closure Compiler warnings (#4067)
* Make parameter order in jsdocs match function

When the order doesn't match the Google Closure Javascript compiler generates
warnings

* Prefix optional parameters with opt_

The Closure Compiler emits warnings when this isn't the case
2016-10-21 14:52:42 -07:00
Baptiste Lepilleur
5b5fcbfc00 Java: fix unsigned default value code generation and add 'L' suffix for long default value (#4051)
* Java: emit "signed" equivalent of unsigned default value in generated code and add "L" suffix to long default value.

* Updated generated code

* Only convert ulong to "signed" equivalent. ubyte and ushort don't need specific handling as "user facing" type is int. uint need 'L' suffix as "user facing" type is long.

* Added missing cast to primitive type of default value which is in "user facing" type in builder.add<type>() calls.

* Do not cast default value to actual type in C#.
2016-10-21 14:27:15 -07:00
Wouter van Oortmerssen
6862b2ff08 Added functionality to obtain a buffer pointer from a root.
Change-Id: Ia63e41d0304e8668ea4ce09a4c31dd999eb96994
Tested: on Linux.
Bug: 32218623
2016-10-19 16:24:24 -07:00
Wouter van Oortmerssen
22e87071dd Fixed lambda return value error on VS2010.
Change-Id: I6d0e8469bfa5b4c8a3f1cb119e186f4cf62c76ae
2016-10-17 15:04:12 -07:00
Wouter van Oortmerssen
606098cac8 Fixed unused variable warnings, and made sure they are on.
Tested on Linux.

Change-Id: Ie18d6857f9ae8b1c3953a116203b4a8bb70a2ede
2016-10-17 13:06:11 -07:00
Wouter van Oortmerssen
b5c622762b Fixed broken traits codegen for --scoped-enums.
Change-Id: I5f538d12ea37d11d2e239ddde32eefcdd91e347b
Tested: on Linux.
2016-10-17 11:53:28 -07:00
Wouter van Oortmerssen
2beb985fcc Merge branch 'master' of https://github.com/google/flatbuffers 2016-10-17 10:46:14 -07:00
Zhe Wang
fd97404c51 Add missing include (#4052) 2016-10-17 09:57:46 -07:00
Wouter van Oortmerssen
d9fe4e2769 Allow other pointer types than unique_ptr for object API.
Change-Id: I945890ce667a2f5a6c0495e78fd5326ed33b9914
Tested: on Linux.
Bug: 30135763
2016-10-17 09:54:52 -07:00
Wouter van Oortmerssen
424fc0c3ac Fixed inconsistent use of namespace directory prefixing.
Change-Id: I2cab7a1f68b8e643c1057e0a366572421a94ed41
Tested: on Linux.
2016-10-12 16:05:57 -07:00
Wouter van Oortmerssen
c81239f6ea Fix lambda compilation error in VS.
Change-Id: I814008b6eeffec9bd4b8810e4b29db9ea6218bb8
2016-10-12 14:51:02 -07:00
Wouter van Oortmerssen
b830dac266 Added missing generated code files.
Change-Id: Ifb977411b65f8721cf9db891d7a62798bd593c0c
2016-10-12 14:40:35 -07:00
Wouter van Oortmerssen
dc38f93ca8 Merge branch 'master' of https://github.com/google/flatbuffers 2016-10-12 14:39:36 -07:00
Wouter van Oortmerssen
f9025eeb52 Clarified tutorial w.r.t reading/writing buffers.
Bug: 30736848

Signed-off-by: Wouter van Oortmerssen <wvo@google.com>
2016-10-12 14:30:31 -07:00
Wouter van Oortmerssen
486c048a0d Added support for size prefixed buffers.
These are useful for streaming FlatBuffers. The functionality
ensures proper alignment of the whole buffer.

Tested: on OS X.
Bug: 27123865

Change-Id: Ic7d75a618c1bb470ea44c4dcf202ff71f2b3f4f1
Signed-off-by: Wouter van Oortmerssen <wvo@google.com>
2016-10-12 14:30:31 -07:00
Wouter van Oortmerssen
ab51b03093 Fixed line numbers being off in multi-line comments.
Change-Id: I4c27892c249527980d8f52a2cca801dace70289f
2016-10-12 11:22:20 -07:00
Wouter van Oortmerssen
dc2fa215b8 External references for the object API thru a resolver function.
This allows hashed string fields to be used for lookup of any
C++ objects, a pointer to which are then stored in the object
besides the original hash for easy access.

Change-Id: I2247a13c349b905f1c54660becde2c818ad23e97
Tested: on Linux.
Bug: 30204449
2016-10-12 11:22:20 -07:00
Baptiste Lepilleur
199157e8f4 flatc java generator: namespace_test2.fbs is missing namespace prefix for referToA2() return type (#4040)
* Fix flatc generating incorrect java/c# code for namespace_test2.fbs. In code for TableInC, method referToA2() returned type SecondTableInA instead of NamespaceA.SecondTableInA.

* Updated generated code.

* Fixed indendation.
2016-10-07 09:42:29 -07:00
Andrew Hundt
520d68449f CMake now accepts external toolchain configuration (#4045)
Resolves #4038
Related to https://github.com/ruslo/hunter/pull/529
2016-10-05 13:20:30 -07:00
jbrads
b075b8c49d Generate type traits for unions to map a type to the corresponding u… (#4032)
*  Generate type traits for unions to map a type to the corresponding union enum value.

* Fixed break with union enum type traits when type is in a namespace.

* Fixed spacing and variable names in type traits generation to match style guidelines.

*  Fixed spacing in type traits generation to match style guidelines.

* Regenerated test schema header.
2016-10-03 14:14:25 -07:00
Wouter van Oortmerssen
f6c1a1ebcf Merge pull request #4025 from paszea/reflection_fqn
serialize fully qualified struct & enum name in schema binary
2016-09-21 11:06:34 -07:00
Wouter van Oortmerssen
c4aede2268 Merge pull request #4027 from kimsin3003/csharp
Added IFlatbufferObject.cs file to project for .net.
2016-09-19 10:02:50 -07:00
FTT\kimsin
4a43c2bb2c Added IFlatbufferObject.cs file to project for .net.
Before edition, IFlatbufferObject.cs file wasn't in the project and building the project throwed error.
2016-09-19 16:16:15 +09:00
Jason Sanmiya
b2e55c556e Merge "Fix Windows warnings." into ub-games-master 2016-09-15 18:42:42 +00:00
Xun Liu
df0991b7de serialize fully qualified struct & enum name in schema binary 2016-09-15 10:42:23 -07:00
Wouter van Oortmerssen
3368407aff Add a --conform-includes flag to specify include path for the conform schema
(mirrored from cl 133146933)

Change-Id: I61385289728777cae83139fef0229001d92382ca
2016-09-14 11:39:33 -07:00
Wouter van Oortmerssen
25f3f358a0 Merge pull request #4021 from mogemimi/remove-extra-semi
Remove extra semicolon
2016-09-14 09:18:40 -07:00
mogemimi
00e8aa87b3 Remove extra semicolon 2016-09-13 20:59:57 +09:00
Wouter van Oortmerssen
09ee46a83e Merge pull request #4020 from albertofem/feature/allow_public_accessor_net
Allow access to underlying ByteBuffer in C#
2016-09-12 10:35:16 -07:00
Alberto Fernández
02dfa64a89 Allow access to underlying ByteBuffer 2016-09-12 09:35:08 +02:00
Wouter van Oortmerssen
f136570417 Merge pull request #4004 from sahiljain/fix-3909
Return error when full string cannot be parsed into int
2016-09-09 17:01:05 -07:00
Sahil Jain
b6ba322a04 Return error when full string cannot be parsed into int 2016-09-09 19:47:20 -04:00
Wouter van Oortmerssen
4b79ff5351 Merge pull request #4017 from changnet/master
option to build shared library,defeault off
2016-09-09 16:21:27 -07:00
Wouter van Oortmerssen
edd77ae2f3 Merge pull request #4010 from rgilles/master
Isolate the complied Java classes into a target folder.
2016-09-09 15:28:37 -07:00
Jason Sanmiya
985de211af Fix Windows warnings.
Cmake issued a warning when the variable is in quotation marks
in an if statement.

Visual Studio upgrades constants to int and issues a truncation
warning, so inserted a cast.

Change-Id: I60cdcb5c2565cd5e97f80b9c2ff1e6abc32b1deb
Tested: Builds without warning on VS2015.
2016-09-09 14:51:33 -07:00
Wouter van Oortmerssen
8e3fa336eb Merge pull request #3998 from aardappel/master
Switched C# accessors from classes to structs
2016-09-07 16:59:42 -07:00
Romain Gilles
582fd90c4a Use the find -exec instead of find ... | xargs otherwise when there is error log in the output of the build. 2016-09-06 23:28:22 +02:00
changnet
a15659e9f8 option to build shared library,defeault off 2016-09-07 01:12:04 +08:00
Romain Gilles
afd230af8d Remove commented line. Add a last step that remove the target folder after the build and the tests execution. 2016-09-01 13:01:07 +02:00
Wouter van Oortmerssen
52ca75506a Switched C# accessors from classes to structs 2016-08-31 17:34:51 -07:00
Romain Gilles
3bb9b839b8 Add remove of remaining class files before running the build 2016-08-30 10:18:47 +02:00
Romain Gilles
5e7bfd0461 Isolate the complied Java classes into a target folder + log java version.
It is a common practice to put all the compiled classes into a
dedicated folder in order to:
 - avoid to mix the code and the complied classes
 - to allow a simple way to remove the complied classes

Add log of java version in order to make it explicit to the end user.
2016-08-29 11:26:31 +02:00
Wouter van Oortmerssen
d05d114523 Merge pull request #4007 from TGIshib/key
lookupByKey corrections
2016-08-26 15:26:40 -07:00
TGIshib
722b903f89 Remove languages check 2016-08-27 01:21:15 +03:00
TGIshib
2ff6152204 Update idl_gen_general.cpp 2016-08-27 00:42:06 +03:00
TGIshib
98f9af8ecc Merge remote-tracking branch 'refs/remotes/google/master' into key
# Conflicts:
#	src/idl_gen_general.cpp
2016-08-27 00:35:06 +03:00
Wouter van Oortmerssen
481d332e72 Fixed compile error in LookupByKey fix.
Change-Id: Ice94f09197235cf71b41a22d0767bd7b119284e1
2016-08-26 14:18:04 -07:00
TGIshib
1a18122e3f Last idl_gen_general.cpp update 2016-08-27 00:04:25 +03:00
Wouter van Oortmerssen
ee56418cef Undo compile Java classes into target folder.
This was causing class loader errors on Java 1.6.

Change-Id: Id1d9e7e369aad639115664c43a867c4d3a82f9f1
Tested: on Linux.
2016-08-26 14:02:00 -07:00
Wouter van Oortmerssen
e1f8037cb5 Fixed Java LookupByKey functionality for Java 1.6
Tested: on Linux.

Change-Id: Iea336f75a3b6e722743563813c3c9ed9db4d02fe
2016-08-26 13:58:16 -07:00
TGIshib
ea9ee4c99e Update idl_gen_general.cpp 2016-08-26 23:47:23 +03:00
TGIshib
4026117ba1 Correct idl_gen_general 2016-08-26 23:15:25 +03:00
Wouter van Oortmerssen
49ee30a207 Merge pull request #3978 from TGIshib/key
Find by key on C# and Java (2)
2016-08-26 12:03:28 -07:00
TGIshib
7c69c5dc3d Fix lookupByKey, improve compareStrings 2016-08-26 19:41:32 +03:00
Wouter van Oortmerssen
223ebebbeb Merge pull request #4003 from rgilles/master
Isolate the complied Java classes into a target folder.
2016-08-26 09:22:29 -07:00
Romain Gilles
f96eb472b3 Isolate the complied Java classes into a target folder.
It is a common practice to put all the compiled classes into a
dedicated folder in order to:
 - void to mixing the code and the complied classes
 - to allow a simple way to remove the complied classes
2016-08-25 10:40:41 +02:00
Wouter van Oortmerssen
c1b0abe079 Merge branch 'master' of https://github.com/google/flatbuffers 2016-08-24 18:07:18 -07:00
Wouter van Oortmerssen
b04e21db16 Fixed --scoped-enums not always generating type prefixes.
Change-Id: Ib5b0ae75617e18094ac31eb5e11d10e5d592cf9b
Tested: on Linux.
2016-08-24 18:05:49 -07:00
Wouter van Oortmerssen
756050b62c Fixed "unknown command-line argument" output format.
Change-Id: Idd49bc61118c29d6d7364d2cd54a6f7932917570
2016-08-24 17:09:25 -07:00
Wouter van Oortmerssen
ef67a58410 Merge pull request #4001 from vitalyisaev2/master
Debianization with CPack
2016-08-24 15:03:31 -07:00
Wouter van Oortmerssen
2da0821286 Merge pull request #3994 from royalharsh/python_grpc
Initial grpc support for other languages
2016-08-24 14:59:32 -07:00
Vitaly Isaev
928effd198 Debianization with CPack 2016-08-25 00:00:22 +03:00
Harsh Vardhan
2e7806ede0 Initial support to add other languages to flatbuffers 2016-08-24 23:42:59 +05:30
Wouter van Oortmerssen
67967476b2 Merge pull request #4000 from sahiljain/fix-3966
Remove Struct::GetPointer() useless method
2016-08-24 10:34:32 -07:00
Wouter van Oortmerssen
79d127c863 Merge pull request #2133 from evolutional/cs-bounds-check
C#: added #define BYTEBUFFER_NO_BOUNDS_CHECK
2016-08-24 09:26:06 -07:00
Sahil Jain
4f3e1c2831 Remove Struct::GetPointer() useless method 2016-08-24 04:12:25 -04:00
gonzaloserrano
199a49b5b3 Add a generic way to deserialize a flatbuffer in Go.
Similar to what protobufs does with its `Message` interface, introduce here such interface and create a generic `GetRootAs` method to deserialize a flatbuffer.
2016-08-23 16:38:22 +02:00
Wouter van Oortmerssen
96ab6ade5a Merge pull request #3993 from bhamiltoncx/generate-text-failure
Allow GenerateText() to indicate failure to encode flatbuffer to JSON
2016-08-22 11:32:52 -07:00
TGIshib
9f16090f90 Improve LookupByKey , update docs 2016-08-22 18:10:52 +03:00
Robert
63b240ec7b Merge pull request #3995 from rw/go-remove-unused-initializer
Remove invalid vector item heap alloc
2016-08-20 22:07:10 -07:00
rw
c4ba502f57 Remove invalid vector item heap alloc
Fixes #3986
2016-08-20 20:33:36 -07:00
Ben Hamilton
94d5643f97 Allow GenerateText() to indicate failure to encode flatbuffer to JSON (i.e., non-UTF-8 string data) 2016-08-18 10:23:26 -07:00
Wouter van Oortmerssen
f0d91fa143 Merge pull request #3992 from akazakov/master
Add byte array and unintialized array creation to FlatBufferBuilder
2016-08-17 09:03:46 -07:00
Artem Kazakov
726a5f523e add byte array and unintialized array creation to FlatBufferBuilder 2016-08-16 16:26:53 -04:00
Wouter van Oortmerssen
eba6b6f7c9 1.4 prep fixes
Change-Id: I001ad8dd5f95e6e5ad43daf956663218d19f5c96
2016-08-15 17:29:35 -07:00
TGIshib
fa74ce6d16 Update idl_gen_general.cpp 2016-08-15 13:30:30 +03:00
TGIshib
8fdced4e11 Update 2016-08-14 14:58:51 +03:00
TGIshib
9031597f49 Merge remote-tracking branch 'refs/remotes/google/master' into key 2016-08-13 16:28:38 +03:00
Wouter van Oortmerssen
a0b8f669ee Added "Direct" suffix to vector/string object creation functions.
They were overloaded, but also had default arguments, so would
become ambiguous when used with few arguments.

Change-Id: Ifac7f3ea3a6391d971dfeda8e33129c8c38d6f12
Tested: on Linux.
2016-08-12 11:12:12 -07:00
Wouter van Oortmerssen
18d67ed83b Clarified in the docs how to get to the serialized bytes.
This was a frequent source of confusion, since in all implementations
the data doesn't start at offset 0 in the buffer.

Change-Id: I045966e65928e9acd9def84e215914ecb5510653
2016-08-10 17:53:40 -07:00
Wouter van Oortmerssen
205ddb175f Added union namespacing test case.
Change-Id: I9a4f90889c311c454a9c19e78c7db3c79800b44e
Tested: on Linux.
2016-08-10 11:52:09 -07:00
Wouter van Oortmerssen
be908939da Fixed __builtin_bswap16 not being available on GCC <4.8
See e.g. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624

Change-Id: Idae99196c47e015a2ba2416aaf1526f77498ce5d
2016-08-10 10:49:17 -07:00
Wouter van Oortmerssen
c96fc7fcef Added missing generated code from previous commits.
Change-Id: Ie2f1f65be451979d9f8d4da999b1c10737e867af
2016-08-08 12:18:07 -07:00
Wouter van Oortmerssen
026c6ddb17 Merge branch 'master' of https://github.com/google/flatbuffers 2016-08-08 12:17:10 -07:00
Wouter van Oortmerssen
3eebba789f Fixed incorrect generated code on convenient vector constructors.
Change-Id: Ib283eade157a436e0f3ca0e68d74e7dc6c51c65b
2016-08-08 12:16:10 -07:00
Robert
b36bd67b39 Merge pull request #3976 from gonzaloserrano/fix/gofmt
Make most of the Go code comply with gofmt (except enums).
2016-08-03 17:41:10 -04:00
TGIshib
dc7f5bc0d8 Remake 2016-08-03 13:29:50 +03:00
gonzaloserrano
ec20233fab Make most of the Go code comply with gofmt (except enums).
Enums are not fixed because depending on they have comments or not they
will be aligned alogn the asssignment character.
2016-08-02 18:21:47 +02:00
TGIshib
867dfc5957 Merge remote-tracking branch 'refs/remotes/google/master' 2016-08-02 12:41:20 +03:00
Wouter van Oortmerssen
73d5bf46b4 Merge pull request #3975 from bhamiltoncx/validate-utf8
Allow Unicode values > U+FFFF in string literals, validate UTF-8 by default
2016-08-01 15:06:23 -07:00
Ben Hamilton
f6416d8471 Validate UTF-8 by default when parsing IDL. Support Unicode values > U+FFFF in parse 2016-08-01 14:05:24 -07:00
TGIshib
52acb4b347 Merge remote-tracking branch 'refs/remotes/google/master' 2016-07-31 17:08:25 +03:00
Wouter van Oortmerssen
d70f5ac6b0 Added backwards compatible --no-union-value-namespacing
Change-Id: Ia78dd3b0f213e9ffa49dcec699dcbb21fe6517da
Tested: on Linux.
2016-07-29 11:35:08 -07:00
Wouter van Oortmerssen
c9b9fd0407 Merge remote-tracking branch 'mbp/mutable-js' into ghfix 2016-07-29 11:32:00 -07:00
Caleb Epstein
6897bb99bb Use fully qualified names of structs in UnPack 2016-07-28 15:22:29 -04:00
TGIshib
4c861daa3e Merge remote-tracking branch 'refs/remotes/google/master' 2016-07-28 21:58:45 +03:00
Caleb Epstein
c9ee9fb99d Merge branch 'master' of https://github.com/google/flatbuffers
* 'master' of https://github.com/google/flatbuffers:
  Added AppVeyor CI.
  Removed pre-made VS2010 and XCode projects.
2016-07-28 08:33:35 -04:00
Caleb Epstein
50e13ef9c6 Need unique_ptr.get not pointee.get 2016-07-28 08:31:19 -04:00
Wouter van Oortmerssen
f624065eaa Added AppVeyor CI.
Change-Id: I01cf630026e25382b585785b471bad21153338f6
2016-07-27 18:38:27 -07:00
Wouter van Oortmerssen
03adfa7b1a Merge branch 'master' of https://github.com/google/flatbuffers 2016-07-27 17:20:35 -07:00
Wouter van Oortmerssen
97a9a82324 Removed pre-made VS2010 and XCode projects.
CMake is now required on all platforms.

Change-Id: Iad81d9244a05ed70ce8b8860d6b729a873f137c1
Tested: on Windows and OS X.
2016-07-27 17:10:37 -07:00
Wouter van Oortmerssen
307694e397 Merge pull request #3965 from Bklyn/master
Fix docs for object API usage
2016-07-27 13:41:22 -07:00
Michael Paulson
d268d11ca2 feat(test): Added mutation testing for scalar values.
This is a port of the tests found in test.cpp
2016-07-27 13:32:53 -07:00
Caleb Epstein
094f4d1bad Fix docs for object API usage 2016-07-27 16:15:55 -04:00
Wouter van Oortmerssen
a0398ce0f5 Merge branch 'master' of https://github.com/google/flatbuffers 2016-07-27 12:29:21 -07:00
Jason Sanmiya
30c07f4e55 Fix Mac build.
The new line in the set(CMAKE_CXX_FLAGS...) line was getting insert
verbatim into the Makefile. Makefiles don't like new lines in their
assignment operators.

The newline escape fix works for CMake 3.0 and above, but since
we support 2.x, we need to use the legacy solution, which is to
split into two separate statements.

Tested: cmake -G"Unix Makefiles" works now on Mac.
Change-Id: I6f4655981b85087c4760c3d26ed0c97c4469ba93
2016-07-26 07:26:25 -07:00
Robert
fc19f746b0 Merge pull request #210 from splhack/add_enumnames_to_go
Add EnumNames to Go code
2016-07-25 20:44:33 -07:00
Michael Paulson
a351124cfd chore(generate-code): Generate the JS code after mutation has been added. 2016-07-25 20:00:22 -07:00
Michael Paulson
0230a7173f feat(mutable-js): The mutable Scalar generation.
This is just the initial commit to start the conversation on adding mutation to javascript.
2016-07-25 20:00:22 -07:00
Kazuki Sakamoto
5f351a35a2 Add EnumNames to Go code
Tested: on Darwin
2016-07-25 19:37:16 -07:00
Wouter van Oortmerssen
2d427e0502 Pulled out EndianSwap into its own function.
Change-Id: I4a587102db8c435b739c92b6c464c94c4ea1fe42
2016-07-25 16:26:50 -07:00
Wouter van Oortmerssen
1bba4fd9ea Fixed reflection.h not modifying certain table configurations.
It would write 64bits offsets instead of 32bit ones, and update
the vtable pointer before the fields were processed.

Change-Id: I0c0fa942bbd3b42839294f5653ba8fa048612624
Tested: on Linux.
2016-07-25 15:01:37 -07:00
Wouter van Oortmerssen
f98870715a Adding missing generated code from recent commits.
Also updated generated_code.sh to prevent this from happening in
the future.

Change-Id: Ib282e9b6c762a79d4b4e09bee06b14781cd2a4c1
2016-07-25 15:01:37 -07:00
TGIshib
b7a26d73ee Merge remote-tracking branch 'refs/remotes/google/master' 2016-07-26 00:07:23 +03:00
Raman
1ba4d3c4c7 Update idl_gen_general.cpp 2016-07-25 23:04:01 +02:00
Wouter van Oortmerssen
f61f0449c7 Merge pull request #3935 from kazimuth/jsns
Add @namespace annotation to namespaces in javascript
2016-07-25 10:47:46 -07:00
Raman
06c1ad5a73 Merge pull request #3 from TGIshib/key
Update idl_gen_general.cpp
2016-07-23 15:17:28 +03:00
Raman
38b3893211 Update idl_gen_general.cpp 2016-07-23 14:16:30 +02:00
Wouter van Oortmerssen
42e0b02149 Fixed missing \ in CMakeLists.txt that broke the build 2016-07-22 15:46:26 -07:00
Robert
a56c6e5195 Merge pull request #363 from danring/fix-341
Emit GetRootAs methods for all types in Go and Python
2016-07-22 15:12:35 -07:00
Wouter van Oortmerssen
5efa22447e Fixed conversion warning in generated code. 2016-07-20 18:17:33 -07:00
Wouter van Oortmerssen
bdd668df7b Fixed VS2010 build 2016-07-20 18:13:11 -07:00
Wouter van Oortmerssen
05b00c50ad Added way to test two schemas for safe evolution.
Change-Id: I1dfc867e6df5932ab61dad431eb3cb02f15d04df
Tested: on Linux.
Bug: 30202327
2016-07-20 17:56:59 -07:00
Wouter van Oortmerssen
77e9122681 Merge "This is a minimal amount of #ifdef's to make stlport work." into ub-games-master 2016-07-21 00:55:05 +00:00
Wouter van Oortmerssen
e067040375 Fixed unused parameter warning.
Change-Id: I7a2576c6f366b89ef3e1f83941f90294ca7a07fd
2016-07-20 17:52:41 -07:00
Wouter van Oortmerssen
370e101a69 Added missing Go generated files.
Change-Id: I9d738e84ab2e01ec117c825ade44cc865cf5f1c2
2016-07-20 17:43:03 -07:00
Wouter van Oortmerssen
91f5cf357c Merge branch 'master' of https://github.com/google/flatbuffers into grpc2 2016-07-20 17:41:36 -07:00
Wouter van Oortmerssen
7c7c571bbe This is a minimal amount of #ifdef's to make stlport work.
Minimal, in the sense that this will only allow flatbuffers.h +
generated code to work. Everything else (tests, parsing, reflection
etc.) may still not compile with stlport.

Functionality has been reduced, some utility functions are not
available.

Tested: on Linux (no stlport), Android (stlport).

Change-Id: I3f8b6a88258c07d78964dd455fb9f99f65266301
2016-07-20 17:29:47 -07:00
Wouter van Oortmerssen
3101e327c0 Added optional object based API for C++.
Change-Id: If927f3ea3fb3723088fa287f24bdd1ad43c8d1d1
Tested: on Linux.
2016-07-20 14:58:57 -07:00
Wouter van Oortmerssen
46bf9f5177 Merge pull request #259 from kadirahq/golang-mutators
(Go) Add setter methods for scalar values.
2016-07-20 10:51:30 -07:00
Wouter van Oortmerssen
694725beb0 Xcode fixes 2016-07-20 10:48:37 -07:00
Wouter van Oortmerssen
ce3e7fbd72 VS2010 fixes 2016-07-20 10:41:26 -07:00
Muhammed Thanish
53e9606ea2 Implement mutators for Go 2016-07-20 22:58:22 +05:30
Wouter van Oortmerssen
ffc0d6209a Merge pull request #3954 from yakiro/master
fixed ArrayOutOfBoundsException in java example
2016-07-20 10:01:32 -07:00
Wouter van Oortmerssen
9fdb6dcf1f Merge pull request #3951 from devantoine/patch-2
[PHP] Fix typo
2016-07-20 09:40:50 -07:00
Yakir Buskilla
298dd21ec8 fixed ArrayOutOfBoundsException in java example 2016-07-20 10:46:43 +03:00
Antoine Descamps
64fa8ba9a9 Fix typo
Related to https://github.com/google/flatbuffers/pull/3904#issuecomment-224724181
2016-07-19 12:22:37 +02:00
Matt Mastracci
36daedf35f Avoid unsafe when sizing types 2016-07-18 18:48:39 -06:00
Wouter van Oortmerssen
a8d2eeee34 Merge pull request #3904 from devantoine/patch-1
Fix typo
2016-07-18 17:35:43 -07:00
Wouter van Oortmerssen
e21a61d458 Merge pull request #3902 from rgilles/master
Create a maven like project structure for java development + OSGi + generation for test
2016-07-18 14:13:36 -07:00
Wouter van Oortmerssen
410fb15a07 Merge pull request #3915 from Lakedaemon/clangFormat
clang formating header and code generators for cpp, general, js, php
2016-07-18 14:12:03 -07:00
Wouter van Oortmerssen
a69b19fa8f Merge pull request #3948 from mortonfox/patch-1
Fix link to CONTRIBUTING
2016-07-18 11:12:43 -07:00
Morton Fox
58924538a3 Fix link to CONTRIBUTING 2016-07-16 00:26:50 -04:00
lakedaemon
e750268f0c clang formating cpp code generator and add missing generated classes 2016-07-15 16:08:59 +02:00
lakedaemon
0328dedab5 clangFormating base class 2016-07-15 15:21:09 +02:00
Romain Gilles
9605dc5981 Added OSGi header generation for maven project.
This allow jar generated with maven to be used in OSGi environment.
2016-07-15 14:34:56 +02:00
Romain Gilles
00694d271e Merge branch 'master' of github.com:google/flatbuffers 2016-07-15 14:27:31 +02:00
Wouter van Oortmerssen
b22db6e8eb Merge pull request #3905 from bog-dan-ro/master
Verifier computes the buffersize, useful when streaming multiple flatbuffers
2016-07-14 10:55:22 -07:00
Wouter van Oortmerssen
14e7e8260e Merge pull request #3939 from TGIshib/hex-bug
Fixed bug with negative hex constants (2).
2016-07-14 10:47:34 -07:00
BogDan Vatra
3a1f776132 Verify everything in one shot 2016-07-14 20:16:07 +03:00
BogDan Vatra
4b53762cf2 Verifier computes the buffersize, useful for streaming
Close #3898
2016-07-14 20:15:44 +03:00
Raman
0d56276102 Update test.cpp 2016-07-14 18:51:23 +02:00
Raman
98c7a0c169 Update test.cpp 2016-07-14 10:30:06 +02:00
Raman
676f0712fd Update test.cpp 2016-07-14 10:01:08 +02:00
Wouter van Oortmerssen
7a3f1cf78e Merge pull request #3943 from bog-dan-ro/crash
Don't crash if str is null
2016-07-13 11:17:12 -07:00
BogDan Vatra
49c10bc219 Don't crash if str is null
Is useful especially when we want to create a string from another message string that might be null.
2016-07-13 21:04:26 +03:00
Wouter van Oortmerssen
df9990acf5 Merge pull request #3940 from rushabhy/patch-1
Rename CONTRIBUTING to CONTRIBUTING.md
2016-07-13 10:00:56 -07:00
Rushabh Yapuram
3d7b1a32a3 Rename CONTRIBUTING to CONTRIBUTING.md 2016-07-13 07:57:36 +05:30
Raman
db99c1aa64 Update test.cpp 2016-07-12 19:55:35 +02:00
Raman
247388a20c Merge pull request #2 from TGIshib/hex-bug
Fixed bug with negative hex constants (2).
2016-07-12 20:52:16 +03:00
Raman
f6f88e567e Update idl_parser.cpp 2016-07-12 19:47:53 +02:00
Wouter van Oortmerssen
e527b992f9 Merge pull request #3923 from daksenik/master
Fixed operator++. Added CreateXXX for vector types.
2016-07-11 10:55:17 -07:00
daksenik
aade31b263 Fixed spaces. Removed redundant == nullptr. Vectors pointers made const. 2016-07-11 20:27:38 +03:00
Wouter van Oortmerssen
e733d95e66 Merge pull request #3924 from TGIshib/master
Added --escape-proto-identifiers command-line option.
2016-07-11 09:47:31 -07:00
Wouter van Oortmerssen
14bdce41fe Merge pull request #3931 from jonathantullett/java_public_access
Fix for issue #3922
2016-07-11 09:20:43 -07:00
James Gilles
4a49493e27 js:add @namespace annotation to namespaces 2016-07-11 01:40:38 -04:00
Raman
df5575de17 Update idl_gen_fbs.cpp 2016-07-09 13:33:30 +02:00
Raman
f0b2cc8f6e Update flatc.cpp 2016-07-09 13:32:45 +02:00
Raman
5f2b4e7872 Update idl_parser.cpp 2016-07-09 12:57:07 +02:00
Raman
22697722d9 Update test.cpp 2016-07-09 12:51:06 +02:00
Raman
ffbc93526e Update flatc.cpp 2016-07-09 12:47:14 +02:00
Raman
d9d47a53bd Update idl_gen_fbs.cpp 2016-07-09 12:40:50 +02:00
Raman
71d30d5c02 Update idl.h 2016-07-09 12:28:02 +02:00
daksenik
1661f3a2e8 Added function GenSimpleParam. Tests added. 2016-07-09 13:00:21 +03:00
Jonathan Tullett
d9767b8315 Fix for issue #3922
Also, clean up redundant ';' at end of java classes.
2016-07-09 09:16:26 +01:00
Wouter van Oortmerssen
193a631708 Merge pull request #3929 from Lakedaemon/fixForMake
same fix for general code generator
2016-07-08 14:24:08 -07:00
lakedaemon
a6764b9bf1 same fix for general code generator 2016-07-08 22:54:51 +02:00
Wouter van Oortmerssen
0f5dc152b8 Merge pull request #3928 from Lakedaemon/fixForMake
Fix for make
2016-07-08 13:37:05 -07:00
lakedaemon
8e1aae0fd6 fix missing space (clang format) 2016-07-08 22:02:47 +02:00
lakedaemon
084e5dbc4b fixed initialization of member var for old make (hopefully) 2016-07-08 22:00:15 +02:00
daksenik
dfbda986d7 New CreateXXX (with vectors and strings) calls old CreateXXX (with offsets). 2016-07-08 12:35:57 +03:00
Raman
248432b92d Update idl_gen_fbs.cpp 2016-07-05 23:23:17 +02:00
Raman
f738981ed5 Update idl_gen_fbs.cpp 2016-07-05 22:26:21 +02:00
Raman
4bb6ab3cd5 Update flatc.cpp 2016-07-05 22:24:21 +02:00
Raman
72e8219a65 Update idl_parser.cpp 2016-07-05 22:20:57 +02:00
Romain Gilles
7a955a09f4 Move maven pom.xml from the java folder to the root folder.
This avoid to put the pom.xml file into the source directory. Normally the pom file is in a parent (/parent) folder and it is not mixed with the java source code.
An other thing is: this will make import of the project more easy from a IDE.

The side effect is that the target folder where maven build artifacts will move from the <flatbuffers>/java/target to <flatbuffers>/target therefore the gitignore file has been updated in consequences.
2016-07-05 14:29:12 +02:00
Romain Gilles
b730a74a19 Merge branch 'master' of github.com:google/flatbuffers 2016-07-05 11:40:33 +02:00
Romain Gilles
cc2b04ce1c Revert "Create a maven like project structure for java development. Make it OSGi compliant. Generate the flatbuffers code for testing (example)."
This reverts commit 9875b0e0f8.
2016-07-05 11:38:17 +02:00
Raman
4f8abaaf10 Update flatc.cpp 2016-07-04 22:58:58 +02:00
Raman
5043764247 Update test.cpp 2016-07-04 21:55:44 +02:00
Raman
9fd4d66438 Update flatc.cpp 2016-07-04 21:51:34 +02:00
Raman
aae48e3a9d Update idl.h 2016-07-04 21:41:01 +02:00
Raman
ff57f52b72 Update flatc.cpp 2016-07-04 21:37:50 +02:00
Raman
7d84a4914f Update idl_gen_fbs.cpp 2016-07-04 21:34:42 +02:00
daksenik
c2411e9c8c Fixed operator++. Added CreateXXX for vector types. 2016-07-04 17:37:23 +03:00
daksenik
bf26a0eccc Fixed operator++. Added CreateXXX for vector types. 2016-07-04 16:34:41 +03:00
Wouter van Oortmerssen
68a83eddd4 Merge pull request #3921 from LouisCAD/master
Fixed typo
2016-07-01 10:15:54 -07:00
Wouter van Oortmerssen
b999d49945 Merge pull request #3920 from love-ginger/master
Fix mac build error
2016-07-01 09:48:09 -07:00
Louis Cognault
c94cb6dae9 Fixed typo
is => it
2016-07-01 17:22:36 +02:00
吴凡
5ea2b49f58 Fix some error 2016-07-01 11:17:03 +08:00
吴凡
70deb70b76 Sync from upstream 2016-07-01 11:03:25 +08:00
Wouter van Oortmerssen
48f37f9e0a Added GRPC code generator to flatc.
Also added simple (in-process) test.

Change-Id: I38580d554dd52f590e3396ec4846e07546dcf07d
Tested: on Linux.
2016-06-29 15:51:44 -07:00
Wouter van Oortmerssen
6dff7c68f1 Merge pull request #3916 from YuryBandarchuk16/master
Added new constants
2016-06-27 09:52:57 -07:00
Yury Bandarchuk
ec59dc026f Update Constants.java 2016-06-23 21:30:32 +03:00
Yury Bandarchuk
c97abb1eea Added new constants
Add new constants in Constants.java

All single ints int FlatBufferBuilder.java were replaced by constants
from Constants.java
2016-06-23 19:51:55 +04:00
Wouter van Oortmerssen
2fdafa9a49 Merge pull request #3908 from Lakedaemon/intoTheClass
pulling methods inside the class... so as to share wrapInNamespace later
2016-06-22 18:00:48 -07:00
lakedaemon
f794f97d88 fixing spaces 2016-06-23 00:37:55 +02:00
lakedaemon
03ad8fa4d9 sharing the WrapInNameSpace methods 2016-06-23 00:37:55 +02:00
lakedaemon
43fedfa8ba removed static from wrapInNamespace method 2016-06-23 00:36:33 +02:00
lakedaemon
2f52618c4e removed parser from the method signatures 2016-06-23 00:36:33 +02:00
lakedaemon
a9e21170bc js:pulled methods inside the class 2016-06-23 00:36:33 +02:00
lakedaemon
cb6cc3dfb6 php:removed parser from method signatures 2016-06-23 00:36:33 +02:00
lakedaemon
66f2aac26f php:pulled methods inside the generator 2016-06-23 00:36:33 +02:00
lakedaemon
4a249752ff removed lang signature method 2016-06-23 00:31:27 +02:00
lakedaemon
f0695e0edf removed parser & static from method signatures 2016-06-23 00:28:35 +02:00
lakedaemon
07d4066847 general: moved methods into the class 2016-06-23 00:27:19 +02:00
Wouter van Oortmerssen
57ba8a4d46 Merge branch 'master' of https://github.com/google/flatbuffers 2016-06-20 16:41:40 -07:00
Wouter van Oortmerssen
9e6c5f9f2c JSON Parser allows union type fields to come after unions.
This is useful because many JSON generators will sort the fields,
cause X_type to follow X.

Change-Id: I00ef3ac05418224fc05aee93e6b3b3597e73ffe3
Tested: on Linux.
Bug: 29221752
2016-06-20 16:30:14 -07:00
Wouter van Oortmerssen
3639032d1e Allow unions of table types with the same name but from different namespaces.
Also fixed most codegenerators using the wrong namespace when multiple
namespace were used in a file, with some files not being generated.

Change-Id: Ib42969221239d7244e431cbd667ef69200fc415f
Tested: on Linux.
Bug: 29338474
2016-06-20 11:47:04 -07:00
Robert
6f75ec8490 Merge pull request #3913 from rw/fix-pytest-binary-type
Fix test using compat.binary_types (from March).
2016-06-18 13:02:02 -07:00
rw
fd43d3709e Fix test using compat.binary_types (from March). 2016-06-18 01:12:56 -07:00
Wouter van Oortmerssen
6e177bf03f Merge branch 'master' of https://github.com/google/flatbuffers 2016-06-17 17:44:00 -07:00
Wouter van Oortmerssen
d3ac0bc149 Added conversion operations that can be used inline in JSON.
e.g.: { myfield: cos(rad(180)) } is equivalent to writing { myfield: -1.0 }

Bug: 29338398
Change-Id: I6fc4ef1fd10bda3ba78cba464414dd071a2f50ca
Tested: on Linux.
2016-06-15 14:54:44 -07:00
Wouter van Oortmerssen
afa276288c Added additional convenience overloads to CreateVector().
Bug: 29337887, 29336299
Change-Id: Iad8b3b2263f6cea7ee7e45994369194960df293b
Tested: on Linux.
2016-06-15 14:31:34 -07:00
Dan Ring
4832238708 Add tests for GetRootAs* in Go and Python 2016-06-14 18:41:33 -04:00
Dan Ring
1f8e3c13e6 Emit GetRootAs methods for all types in Go and Python 2016-06-14 18:41:33 -04:00
Wouter van Oortmerssen
5a401aef57 Merge pull request #3897 from Lakedaemon/namespaceWork
Namespace work
2016-06-13 15:16:28 -07:00
Wouter van Oortmerssen
78ecf45527 Merge pull request #3903 from senior7515/master
Add env var for flatc schema compiler cmake module
2016-06-13 13:07:17 -07:00
Alexander Gallego
3ae503a191 Add env var for flatc schema compiler cmake module 2016-06-10 15:39:14 -04:00
Wouter van Oortmerssen
bafd48d96c Merge branch 'master' of https://github.com/google/flatbuffers into fuzzer2 2016-06-08 11:51:49 -07:00
Antoine Descamps
cf7e4b027a Fix typo
"your platform can't handling..." => "your platform can't handle"
2016-06-08 09:32:37 +02:00
lakedaemon
15863c34a0 SetNameSpace algorithm documentation and more meaningful variable names 2016-06-07 14:46:25 +02:00
Romain Gilles
9875b0e0f8 Create a maven like project structure for java development. Make it OSGi compliant. Generate the flatbuffers code for testing (example).
Java developer are mostly comfortable with maven project structure. One one the main concept behind maven is convention. If you follow the maven project convention then your development team will get more effective as they now this project structure and can easily find the production code versus the test code.
 In this pull request I have structured the java project around 2 main parts:
  * the `flatbuffers` project. This project is the api / lib project and contains the test code structure + an example of code generation for testing. This avoid to commit generated code. Pre-configure JUnit for test driven development and make this project OSGi compliant.
  * the `jmh` project. This project aims to provide a placeholder for micro-benchmarking. JMH is a 'de facto' standard for micro benchmarking you can find more details here: http://openjdk.java.net/projects/code-tools/jmh/

For now I didn't move the JavaTest class but it could be a next step with a migration to the JUnit framework.
The only impacts are the move of the class and the project structure => no code change.
2016-06-07 09:05:56 +02:00
Wouter van Oortmerssen
2bdf44a25d Added a way to get mutable tables out of a mutable vector of tables.
Change-Id: I8f9ef1d14f86671ced929c7a159115b1d8510327
Tested: on Linux.
2016-06-06 17:38:21 -07:00
Wouter van Oortmerssen
4ffc881fb6 Fixed LoadFile crashing on directory arguments.
Change-Id: I737f6fd0bb1302ab7cfa6ab8b06108e221ebb63c
Tested: on Linux.
2016-06-06 11:34:31 -07:00
Wouter van Oortmerssen
e92ae5199d Fixed compile errors on Windows 2016-06-02 14:55:35 -07:00
lakedaemon
a3a2bf890f Better C++ namespace management 2016-06-02 23:11:51 +02:00
lakedaemon
a9194c4c68 cpp generator : pulling all methods inside the class 2016-06-02 21:56:27 +02:00
Wouter van Oortmerssen
ca32eb77f3 Merge pull request #3885 from Lakedaemon/shareWarningAndTwoMethods
Share warning and two methods
2016-06-02 11:35:41 -07:00
Wouter van Oortmerssen
886441df98 Merge pull request #3870 from martinus/master
Added helpers to access objects while creating the flatbuffer.
2016-06-02 11:26:16 -07:00
Wouter van Oortmerssen
e02ceca54b Merge pull request #3891 from bog-dan-ro/master
More bit fields patches
2016-06-02 11:24:48 -07:00
Martin Ankerl
b3c35750c2 renamed functions
More descriptive name, show that it's really just a temporary object.
2016-06-01 13:13:00 +02:00
BogDan Vatra
3e52fecd1e Don't generate MIN & MAX enum values if "--no-prefix" is used.
Close #3892
2016-06-01 10:23:44 +03:00
BogDan Vatra
cccd7003ed MIN & MAX are useless for bit_flags
Instead we need NONE (0) and ANY (all orred values), if the user didn't
already defined them
2016-06-01 10:15:41 +03:00
BogDan Vatra
038ea7c1d3 Add ! operator 2016-06-01 10:05:27 +03:00
BogDan Vatra
0b0cf58f24 We already know the underlying_type.
We just need to pass it to DEFINE_BITMASK_OPERATORS macro
2016-06-01 10:04:55 +03:00
Wouter van Oortmerssen
7d1f372ba6 Merge pull request #3888 from bog-dan-ro/master
Define bit mask operators for scoped enums bitfields
2016-05-31 11:59:51 -07:00
Wouter van Oortmerssen
25e4ad19f6 Merge pull request #3889 from PSPDFKit-labs/james/avoid-msvc-align-error
MSVC doesn't allow alignment on function params.
2016-05-31 11:33:10 -07:00
BogDan Vatra
7dfe8e726b Define bit mask operators for scoped enums bitfields
Close #3887
2016-05-30 14:04:37 +03:00
lakedaemon
61b101d442 sharing namespace_dir and the namespace string methods 2016-05-28 20:59:22 +02:00
lakedaemon
cd1493b082 sharing the Flatbuffers warning 2016-05-26 15:26:58 +02:00
Wouter van Oortmerssen
a98bff3ea1 Add simple libfuzzer based test.
This tests the verifier and the parser.

Tested: on Linux.
Bug: 27230459
Change-Id: I3417faba9385dc941199c57a08d8a50c2faec1aa
2016-05-25 17:25:40 -07:00
Wouter van Oortmerssen
06eb6e94e3 Merge pull request #3880 from Lakedaemon/IsEverythingGenerated
shared method that exits early if everything is generated
2016-05-25 10:38:56 -07:00
Lakedaemon
4a8801da34 shared method that exits early if everything is generated 2016-05-25 15:15:56 +02:00
James Swift
b1e8be27a9 MSVC doesn't allow alignment on function params. This prevents the copy and thus avoids this issue https://msdn.microsoft.com/en-us/library/373ak2y1.aspx 2016-05-24 17:16:03 +02:00
Wouter van Oortmerssen
b922a3c952 Merge "Uncomment the corpus attribute since b/28762769 is fixed, add more items to the corpus (taken from the ClusterFuzz-generated corpus)." into ub-games-master 2016-05-23 23:58:50 +00:00
Wouter van Oortmerssen
b52826e7cc Merge "Add a fuzzer for flatbuffers, derived from the one used in Chromium: https://code.google.com/p/chromium/codesearch#chromium/src/testing/libfuzzer/fuzzers/flatbuffers_verifier_fuzzer.cc" into ub-games-master 2016-05-23 23:58:27 +00:00
Wouter van Oortmerssen
0ef72db7bf Merge pull request #3865 from bhamiltoncx/surrogate-pairs
Handle \u-escaped surrogate pairs correctly in IDL parser
2016-05-23 16:51:07 -07:00
Stewart Miles
505d0f2288 Merge "Removed reference to deprecated NDK toolchain version." into ub-games-master 2016-05-23 23:49:56 +00:00
Ben Gertzfield
6704b19db6 Handle \u-escaped surrogate pairs correctly in IDL parser 2016-05-23 16:38:55 -07:00
Wouter van Oortmerssen
64b91da9cf Uncomment the corpus attribute since b/28762769 is fixed,
add more items to the corpus (taken from the ClusterFuzz-generated corpus).

(mirrored from cl 122690857)

Change-Id: I98c7672169a9a27fe18bedae8501e6fb85a0681d
2016-05-23 16:37:57 -07:00
Wouter van Oortmerssen
fe9787e58d Add a fuzzer for flatbuffers, derived from the one used in Chromium:
https://code.google.com/p/chromium/codesearch#chromium/src/testing/libfuzzer/fuzzers/flatbuffers_verifier_fuzzer.cc

(mirrored from cl 122676317)

Change-Id: I0074af435cf37f5e6368b040563c3733d9e02345
2016-05-23 16:35:20 -07:00
Stewart Miles
d06e571b31 Removed reference to deprecated NDK toolchain version.
Change-Id: I8d39a66ca5642427619c60f349fa78917aec2455
2016-05-23 16:27:35 -07:00
Wouter van Oortmerssen
208c15f29d Merge branch 'master' of https://github.com/google/flatbuffers 2016-05-23 14:56:47 -07:00
Wouter van Oortmerssen
a82dbb6e01 Fixed Google Groups link in documentation.
Change-Id: I64307ccd0a6f23a7c3860d602813e637415e7c91
2016-05-23 14:08:21 -07:00
Wouter van Oortmerssen
a42a99029f Made .sh files all have same comment formatting.
Change-Id: Ie7cc268a8823aec1d06c8b7cbef54068d832de3a
2016-05-23 14:08:21 -07:00
Wouter van Oortmerssen
0c7b700895 Merge pull request #3878 from pjulien/no_alloc_on_cb
Remove Remaining FBB#createString Allocation
2016-05-23 13:55:21 -07:00
pjulien
1aa3ee2170 Clarify documentation based on review comments 2016-05-23 16:47:41 -04:00
Wouter van Oortmerssen
8c0d56d55a Removed BOM marker from some files.
Also removed some trailing whitespace.

Change-Id: I40bf4f776ca4d467b7ee6f2c9a7500c13700f9d5
2016-05-23 12:24:44 -07:00
Wouter van Oortmerssen
c41a0453c1 Merge branch 'master' of https://github.com/google/flatbuffers 2016-05-23 10:59:47 -07:00
Wouter van Oortmerssen
1a161a8333 Added missing licenses to some sh/cs/py files.
Bug: https://github.com/google/flatbuffers/issues/3872
Change-Id: I5d551168e9bc925e867e5e4ddf5d809418fd44eb
Tested: on Linux.
2016-05-23 09:51:41 -07:00
pjulien
9d8ae1b0c3 If the user passes in a {{CharBuffer}} himser, reward him by
eliminating the last remaining allocation in string creation
2016-05-21 09:19:43 -04:00
Wouter van Oortmerssen
2de558057d Merge pull request #3867 from dreifachstein/master
Use the build output flatc to compile test schemas by default.
2016-05-20 13:19:52 -07:00
Wouter van Oortmerssen
0756caa42e Merge pull request #3866 from bhamiltoncx/fix-undefined-bit-shift
Fix undefined behavior when CheckBitsFit left-shifts 64-bit value by 64 bits
2016-05-20 13:10:52 -07:00
Wouter van Oortmerssen
99c1ddc792 Merge branch 'master' of https://github.com/google/flatbuffers 2016-05-18 18:01:17 -07:00
Wouter van Oortmerssen
69eef0a0ec Fixes verifier not catching odd vtable sizes.
Bug: 28762769
Change-Id: Iec370482f67c4585e97dd5175c1a4258ddba47fe
Tested: on Linux.
2016-05-18 18:00:25 -07:00
Wouter van Oortmerssen
42bd6447c0 Merge pull request #3877 from ozkuran/patch-1
Fixed Library Location in CppUsage.md
2016-05-18 10:33:55 -07:00
Mahmut Ali ÖZKURAN
747a8c628e Fixed Library Location in CppUsage.md
Fixed Library Location 
"https://github.com/google/flatbuffers/tree/master/include/flatbuffers"
in CppUsage.md
2016-05-18 12:02:32 +03:00
Martin Ankerl
023fec627e Added helpers to access objects while creating the flatbuffer.
GetObject and GetMutableObject are similar to GetRoot and GetMutableRoot,
and can be useful when wanting to access data that has just been created.
Unfortunately there is a danger in using these methods, as it is possible
that the buffer reallocates which will invalidate the pointers.
2016-05-03 17:20:14 +02:00
Xiaolei Yu
3a8bc309e2 Use the build output flatc to compile test schemas by default. 2016-05-01 11:15:53 +08:00
Ben Gertzfield
3400727fff Fix undefined behavior in CheckBitsFit bit-shift on size_t 2016-04-29 15:15:09 -07:00
Robert
77742a3fba Merge pull request #3806 from mediagraph/fix-create-string
Fix CreateString with already-encoded string or bytearray in Python 2.7.
2016-04-27 20:31:55 -07:00
Wouter van Oortmerssen
7cce55d8f0 Merge pull request #3854 from pjulien/3853
Fix for #3853
2016-04-27 18:12:15 -07:00
Wouter van Oortmerssen
933c195e51 Merge pull request #3843 from Lakedaemon/refactoring
Transition 1 (nice diffs) Go, C++ and General generators with class
2016-04-27 13:59:16 -07:00
Wouter van Oortmerssen
d0898fd0c8 Merge pull request #3863 from pjulien/cseq
Can now use ``CharSequence`` of ``String``.  Works with
2016-04-27 13:50:04 -07:00
Lakedaemon
6765c19d45 memory leak fix + php/js/python transition to class based generator 2016-04-26 20:36:43 +02:00
pjulien
599f5e3915 Can now use `CharSequence of String`. Works with
1. [AsciiString]
(http://netty.io/4.1/api/io/netty/util/AsciiString.html)
2. [CharBuffer]
(https://docs.oracle.com/javase/8/docs/api/java/nio/CharBuffer.html)
3. [StringBuilder]
(https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html)
2016-04-25 22:07:57 -04:00
Robert
ba7204a7b7 Merge pull request #3859 from rw/go-zero-alloc-strings
Go: Fix heap allocation when reading a string.
2016-04-23 18:38:03 -07:00
rw
e8ac0f293e Fix heap allocation when reading a string. 2016-04-23 12:32:43 -07:00
Wouter van Oortmerssen
a0d1161feb Merge pull request #3850 from pjulien/3849
Fix for #3849
2016-04-22 11:42:14 -07:00
Wouter van Oortmerssen
828b2680c0 Merge branch 'master' of https://github.com/google/flatbuffers 2016-04-22 11:35:10 -07:00
Wouter van Oortmerssen
c17cf022ea Fixed a verifier check that didn't return from its parent.
Change-Id: I1aef5fdba72de0c3bb8276c9f50fffa494f26e29
Tested: on Linux.
2016-04-22 11:31:35 -07:00
Wouter van Oortmerssen
f6330ab8f1 Fixed SkipByteOrderMark advancing cursor_ too early.
Change-Id: Ie60f01d935ca6b4aa6ce0eab7598602ac0758342
Tested: on Linux.
2016-04-22 11:27:35 -07:00
pjulien
6908826f95 Fix for #3849
This avoids the following allocations over repeated use:

- A ``CharsetEncoder``
- A byte array to contain the contents of the string
- A wrapper, via ``ByteBuffer#wrap``, for the previously mentioned byte
  array

This also removes a copy of the temporary byte array.  This extra copy
is needed because ``String#getBytes`` returns a byte array and its
length must match the exact size of the contents.

This implementation requires that the builder retain a ``ByteBuffer``
and ``CharEncoder``.  This is considered slower only for users that
will only allocate a single string in their buffers or none at all.

The improvement is especially potent if the builder is constantly reused
by its caller.  This also eliminates the penalty for users that do not
use strings at all since the cost of allocating these fields is
now amortized.

The only allocation left in this code is a ``CharBuffer`` wrapper.  It's
possible to eliminate this allocation using an additional copy but need
further profiling to see which is the bigger problem.
2016-04-21 20:20:14 -04:00
Wouter van Oortmerssen
fd542c71e3 Fixed float suffix not being added on implicit float defaults.
Change-Id: I8dcbb5e93836356511d411ef86452babd3dd3c0b
Tested: on Linux.
2016-04-20 12:06:32 -07:00
pjulien
9fb87f813b size the allocation to the required bytes 2016-04-18 21:43:28 -04:00
pjulien
b0146b3d9a fix file permission 2016-04-18 20:19:56 -04:00
pjulien
286587d151 Fix for #3853
Removes the following allocations:
- ``CharsetDecoder`` is reused between calls
- ``CharBuffer#wrap`` removed in favor of heap
  based char buffer that is reused
- Temporary ``char[]``, an intermediate copy inside ``StringCoding``
- Another ``char[]``, this is needed because ``StringCoding`` uses
  a ``CharBuffer`` internally but returns a ``char[]``.  Extra
  characters need to be trimmed so this means yet another allocation
- Yet another ``char[]`` directly from ``__string`` for non-heap
  based buffers

Removes the following copies
- No copy is performed to trim the allocation since a ``CharBuffer``
  is used directly
- For non-heap based byte buffers, removes the copy that was
  previously done in the __string function

This does need to get the TLS entry which implies at least some
contention on the thread object table and a fence.
2016-04-18 20:04:00 -04:00
Wouter van Oortmerssen
6f751d5d26 Merge pull request #3848 from pjulien/3847
Fix for 3847
2016-04-18 15:54:34 -07:00
Wouter van Oortmerssen
4d7890c2c9 Fixed whole-number float default values missing a .0 suffix.
A previous commit that added "f" for C++/Java/C# would break
on gcc of constants like 3f, which are now output as 3.0f

Tested: on Linux

Change-Id: If9cabbe3c6d6948a5050b8b123bda9c06e181f52
2016-04-18 11:50:46 -07:00
pjulien
fdfaf23361 3847 2016-04-16 20:09:28 -04:00
Lakedaemon
38597160f2 Enforcing the google C++ style guide 2016-04-15 13:20:26 +02:00
Wouter van Oortmerssen
791c83aa7e Merge branch 'master' of https://github.com/google/flatbuffers 2016-04-13 17:44:23 -07:00
Wouter van Oortmerssen
29d957ed5e Fixed missing "f" on float default values in C++/Java/C#
Bug: 28145201
Change-Id: I5a1818c40c2f4fbd00cfec3362040407976f7a39
Tested: on Linux.
2016-04-13 17:29:03 -07:00
Wouter van Oortmerssen
8d8b7c19b7 Merge pull request #3844 from Nnamdi/CreateUninitializedVector_fix
Stop CreateUninitializedVector returning a pointer to invalid memory.
2016-04-13 16:14:11 -07:00
Nnamdi
039ab48b7a Stop CreateUninitializedVector returning a pointer to invalid memory.
CreateUninitializedVector was performing the following actions:
    1. call StartVector.
    2. call make_space, and set buf to point to the reserved space.
    3. call EndVector.

The problem is that a call to EndVector can ultimately call make_space, which
if the buffer is full, will cause a reallocation, invalidating the value stored
in buf.  So setting buf needs to be delayed until after EndVector.

The following code, when run under valgrind shows a write to free'd memory before
the change, but no such error after:

int main()
{
    flatbuffers::FlatBufferBuilder fbb(128);
    char *buf = nullptr;
    fbb.CreateUninitializedVector(128, &buf);
    *buf = 0;
}
2016-04-13 23:04:27 +01:00
Lakedaemon
8a64afabfd Transition 1 (with nice diffs) Go, Cpp and General code generators with class 2016-04-13 23:21:18 +02:00
Wouter van Oortmerssen
4a04bac250 Fixed struct -> class pre-declaration error.
Change-Id: I3730a6823d603982c4250d514e827e3f93d1f81e
Tested: on Linux.
2016-04-13 12:02:22 -07:00
Wouter van Oortmerssen
72fc45aa6a Made user-defined attributes available in the reflection data.
Tested: on Linux.

Bug: 27923233
Change-Id: Ic16675650e4a8e138c163f1e2131a3aad7008ada
2016-04-11 17:36:56 -07:00
Wouter van Oortmerssen
9f2b05df1b Merge branch 'master' of https://github.com/google/flatbuffers 2016-04-11 13:48:57 -07:00
Wouter van Oortmerssen
83dc5ed4a7 Fixed JSON integers as strings not being parsed correctly.
Change-Id: If34aef46ef619e06de799cff14948b02e98da86d
Tested: on Linux.
2016-04-11 11:08:09 -07:00
Wouter van Oortmerssen
e597ad8f0f Fixed pre-declarations of included types in generated code.
This was harmless, but unnecessary.

Change-Id: I1365a725e254d4ebbda081110a50277cb5118323
Tested: on Linux.
2016-04-11 11:05:42 -07:00
Wouter van Oortmerssen
3ea5446680 Merge pull request #3789 from Chippiewill/master
Allow builds on platforms with unsigned chars by default
2016-04-08 11:32:16 -07:00
Wouter van Oortmerssen
8b18e487bd Merge pull request #3839 from klapek/net/bytebuffer-assert-optimization
Remove unnecessary condition in AssertOffsetAndLength.
2016-04-08 11:18:58 -07:00
Wojciech Jaszczak
c837d29eab Remove unnecessary condition in AssertOffsetAndLength.
Condition is already checked and covered in the following condition, the second one was excess.

Signed-off-by: Wojciech Jaszczak <jaszczakw@gmail.com>
2016-04-08 19:56:02 +02:00
Wouter van Oortmerssen
ec1daef858 Merge pull request #3832 from mikkelfj/c_docs
Documentation for C bindings
2016-04-08 10:54:27 -07:00
Mikkel Fahnøe Jørgensen
7d396bc2e7 Update C documentation with supported MSVC versions, and other minor updates. 2016-04-07 18:52:00 +02:00
Wouter van Oortmerssen
8128df7655 Added missing util.cpp to VS project 2016-04-04 17:09:07 -07:00
Wouter van Oortmerssen
cfaa7782b6 Adding missing util.cpp to Xcode project 2016-04-04 17:07:05 -07:00
Wouter van Oortmerssen
5e3f9d5175 Merge branch 'master' of https://github.com/google/flatbuffers 2016-04-04 16:55:25 -07:00
Wouter van Oortmerssen
cdc5d5b18d Merge pull request #3836 from tkelman/cygwinbuild
Fix build on Cygwin
2016-04-04 15:38:32 -07:00
Wouter van Oortmerssen
e98b1912b3 add setloadfile and setfileexists functions to flatbuffers
to allow for custom file loaders. The targeted use case is android runtime.

(from CL 116980408)

Change-Id: I8785c0acf714fab41d8f6fc9f1c52875423b8f5b
2016-04-04 13:03:22 -07:00
Wouter van Oortmerssen
c8c0082413 Fix flatbuffers conversion warnings.
(from CL 116785833)

Change-Id: I0fb0e1318fd70cba51e229a93f535c6639bbb331
2016-04-04 13:03:22 -07:00
Wouter van Oortmerssen
1c1d079113 Fix flatc build for msvc.
(from CL 117010760)

Change-Id: I0ee77cf87d0cb00b94887356745b85423b1375a6
2016-04-04 13:03:22 -07:00
Wouter van Oortmerssen
7523e4ad49 Fixed potential integer overflow in the Verifier.
This overflow could allow malformed FlatBuffers to pass the verifier.

Change-Id: Ia993299a761b00b93e53e8aff2689b631755763c
Tested: on Linux.
Bug: 27903580
2016-04-04 13:03:22 -07:00
Wouter van Oortmerssen
f4a5c9de50 Fixed VS assignment constructor warning. 2016-04-04 13:00:48 -07:00
Mikkel Fahnøe Jørgensen
1db9783bfc Remove details on FlatCC builds that would easily become outdated 2016-04-04 16:33:20 +02:00
Mikkel Fahnøe Jørgensen
5b38134431 Document FlatCC support for Windows 2016-04-03 21:37:57 +02:00
Tony Kelman
4c16038e72 Fix build on Cygwin
use -std=gnu++11 instead of c++0x on cygwin to avoid
error: realpath was not declared in this scope

ref http://www.cygwin.com/ml/cygwin/2016-03/msg00005.html
2016-04-01 21:42:23 -07:00
Wouter van Oortmerssen
2f7f50b8cb Merge pull request #3816 from armen/master
Implement __vector_as_bytes and methods to get [ubyte] efficiently
2016-03-30 14:04:36 -07:00
Wouter van Oortmerssen
a1633055f7 Merge pull request #3834 from Nnamdi/gen_name_strings
Added --gen-name-strings command line option.
2016-03-30 13:14:49 -07:00
Nnamdi
35f6bb5060 Added --gen-name-strings command line option.
To support the use case described in issue google/flatbuffers#3826, a new command line option --gen-name-strings
has been added, which will cause a static GetFullyQualifiedName function to be added
to the C++ output for tables/structs.
2016-03-29 22:25:04 +01:00
Armen Baghumian
28a3c939e7 Implement __vector_as_bytes and methods to get [ubyte] efficiently
Currently in order to get a value type of [ubyte] in PHP, iteration is
necessary which is not efficient. Helper __vector_as_bytes has been
implemented in order to return the byte arrays in PHP efficiently.

Appropriate methods also been added to use aforementioned method to return
the byte array. (e.g. get*Bytes()).

The reason the methods are named get*Bytes() and not for instance
get*ByteArray() is the fact that PHP doesn't support byte arrays and the
binary safe string implementation in PHP is used to simulate byte arrays
and since there is chance for PHP users to confuse this with PHP arrays
the name get*Bytes() has been chosen.

In the future __vector_as_bytebuffer() method can also be implemented to
return PHP implementation of ByteBuffer.
2016-03-29 14:56:09 +11:00
Mikkel Fahnøe Jørgensen
7d9779fc67 Move some C specifics out of tutorial and clarify platform support 2016-03-28 22:52:10 +02:00
Mikkel Fahnøe Jørgensen
9b8c91c90b Add C support in README, minor updates in other C doc 2016-03-26 09:22:56 +01:00
Mikkel Fahnøe Jørgensen
47d4b46950 Documentation for C bindings 2016-03-26 00:28:31 +01:00
Wouter van Oortmerssen
a649cb7db5 Merge pull request #3822 from cage433/tutorial-java-type-error
Tutorial's Java example uses incorrect types
2016-03-23 12:45:24 -07:00
Alex McGuire
68c69b3717 Tutorial's Java example uses incorrect types
`FlatBufferBuilder.createString` returns an int offset, not a string
2016-03-20 12:59:39 +00:00
Will Gardner
ce4d3316d3 Allow builds on platforms with unsigned chars by default
Certain architectures, such as ARM, use unsigned chars by default
so require the `-fsigned-char` for certain value comparisons to
make sense and in order to compile.
2016-03-14 16:19:38 +00:00
Wouter van Oortmerssen
e6b79f0002 Added stream & idempotent annotations for RPCs.
Change-Id: Ia8651c1051808fdda0dc0ba52ec991777f868e88
Tested: on Linux.
2016-03-09 15:03:05 -08:00
Wouter van Oortmerssen
1a63eb46bb Added RPC declarations to the schema parser.
This is the first step in RPC support. Actual code generation
to follow.

Change-Id: I96c40fec3db671d100dd9eb509a71c5cbe55bfb2
Tested: on Linux.
Bug: 20122696
2016-03-09 13:47:40 -08:00
Wouter van Oortmerssen
91c27148c0 Merge pull request #3805 from artiom/patch-1
Update google user group link
2016-03-09 09:58:51 -08:00
Alex Kerfoot
1e7310e6cd Fix CreateString with already-encoded string or bytearray in Python 2.7.
There was no way to pass an already-encoded string to 
`builder.CreateString` in Python 2.7:

- Passing a `bytearray` raised a TypeError because `bytearray` was not
  recognized as an instance of `compat.binary_type`.
- Passing a utf-8 encoded `str` would cause the string to be
  double-encoded, because `compat.string_types = (basestring,)` and
  `basestring` is the base class of `str` and `unicode`, so the logic
  would never reach the `elif isinstance(s, compat.binary_type)` case.
- Converting a utf-8 encoded bytearray to `bytes` like
  `builder.CreateString(bytes(encoded_string))` does not work because
  in Python 2.7, bytes is just an alias for `str` so it behaves as
  above.

This change allows either `bytes` or `bytearray` as an already-encoded
string to be passed to `CreateString` in versions of Python that support
`bytearray`, and falls back to `str` in older versions.

In Python 2, it restricts unencoded string types to `unicode`, so `str`
can be used as an encoded, binary representaiton.
2016-03-08 16:05:02 -08:00
artiom
b49a7d146d Update google user group link
Original link returns 404.
2016-03-08 23:57:12 +00:00
Wouter van Oortmerssen
fbc8af40e3 Allow JSON numeric fields to be specified by a numeric data in a string.
Change-Id: I6a3fae1e71434a7384edc39b8602bd84a0432edb
Tested: on Linux.
Bug: 24140897
2016-03-07 17:22:51 -08:00
Wouter van Oortmerssen
709e720839 Merge branch 'master' of https://github.com/google/flatbuffers 2016-03-07 15:04:18 -08:00
Wouter van Oortmerssen
3cd9181ef8 Fixed Java pom.xml file still having wrong version number.
Change-Id: I95bc50ecd3b49d91fb81477a8818e3c1f253ff77
2016-03-07 14:15:01 -08:00
Wouter van Oortmerssen
81e4d3c6c3 Moved the build dir to build_ide to not clash with BUILD files.
Change-Id: I9576e130142acc697fadbfb6aacfd5969f25866a
Tested: on Windows.
Bug: 27426239
2016-03-07 12:58:36 -08:00
Wouter van Oortmerssen
958fc6ec49 Added support for easy string pooling.
Change-Id: I790cf681c1bffff800d77afb0e2f908d1c827679
Tested: on Linux.
Bug: 26186542
2016-03-07 12:58:36 -08:00
Wouter van Oortmerssen
19afcdc704 Clarified how to test for the presence of fields.
This is FAQ on the issue tracker.

Bug: 26863353
Change-Id: I227e10a5c0134dbe7fd7f59e64cd57a0752c568e
2016-03-07 12:58:36 -08:00
Wouter van Oortmerssen
51d48bd953 Merge pull request #3793 from yurivict/master
Fixed missing -lc++abi on FreeBSD.
2016-03-02 17:46:30 -08:00
Yuri
26f15bcd77 Fixed missing -lc++abi on FreeBSD. 2016-03-02 17:15:42 -08:00
Wouter van Oortmerssen
412b8d2c80 Merge pull request #3788 from franc0is/layout-typo
Fix small typo in documentation navigation
2016-02-26 10:14:39 -08:00
Wouter van Oortmerssen
617fedf349 Merge pull request #3765 from Mischanix/js-typed-arrays
Javascript helper to get typed array views
2016-02-26 09:51:50 -08:00
Wouter van Oortmerssen
59caa536ed Merge pull request #3784 from evanw/fix-for-3773
Fix #3773: Generated JS now avoids the flatbuffers object
2016-02-26 09:37:55 -08:00
François Baldassari
3d5f7f64f8 Remove erroneous extra character 2016-02-26 09:03:22 -08:00
François Baldassari
66126cc32d Fix typo in documentation navigation 2016-02-26 09:00:46 -08:00
Evan Wallace
31b30335f6 Fix #3773: Generated JS now avoids the flatbuffers object 2016-02-25 01:06:16 -08:00
Wouter van Oortmerssen
959866b848 Merge pull request #3776 from ncpenke/fix-bug-skipping-unknown-fields
Fix bug skipping unknown fields
2016-02-22 13:38:14 -08:00
Nalinichandra Penke
cbab26673b Fix #3775: Skip unknown field names if they're quoted 2016-02-22 14:34:20 -06:00
ncpenke
1cf5e3f751 Merge pull request #4 from google/master
Catchup
2016-02-22 14:34:05 -06:00
Wouter van Oortmerssen
9a76ce8a65 Disabled broken biicode builds on Travis for the moment.
Change-Id: I834e6da091ea704a3fe599a5b99f338d29cd3bf1
2016-02-22 11:33:14 -08:00
Wouter van Oortmerssen
574404e2ee Merge branch 'master' of https://github.com/google/flatbuffers 2016-02-17 13:29:34 -08:00
Wouter van Oortmerssen
20c0082ee5 Fixed namespace code generation for C++
The code generator was assuming all declarations for the current
file sit in the same namepace. Now uses the "on demand" namespace
switching we had for the forward declarations.

Also fixed a bug related to namespace lookup.

Change-Id: Ib54a3efbc752cbb9590302fa0707c0c73448db3d
Tested: on Linux.
2016-02-17 11:26:38 -08:00
Robert Nix
9d92aeb182 Add helper for javascript typed arrays
For scalar vector fields, emit an Array helper that
returns a typed array view of the underlying bytes buffer.
2016-02-12 12:41:28 -06:00
Robert Nix
2f5d7ae645 Fix javascript unicode test
The generated buffer should be tested for semantic equivalence
to the correct buffer, instead of being tested for bytewise
equality.
2016-02-12 12:31:25 -06:00
Wouter van Oortmerssen
d2bc73bbbe Merge pull request #3761 from msb-at-yahoo/fix-gcc-4.4-build
fix gcc-4.4 build: -Werror=unused-result is not supported
2016-02-10 16:13:59 -08:00
maurice barnum
697cad7027 fix gcc-4.4 build: -Werror=unused-result is not supported 2016-02-11 00:05:04 +00:00
Wouter van Oortmerssen
472fb12273 Merge branch 'master' of https://github.com/google/flatbuffers 2016-02-10 13:51:10 -08:00
Wouter van Oortmerssen
d779308b3e Fixed enum declaration values being parsed as int.
This caused values in the uint range to be made negative values.

Change-Id: Ia4284747f48508b589c034ff3aae0d141e96eb3c
Tested: on Linux.
2016-02-10 11:25:31 -08:00
Wouter van Oortmerssen
a03f3287b3 Merge pull request #3760 from rw/python-remove-ctypes-dependency
Python: remove ctypes dependency in runtime library.
2016-02-08 14:35:45 -08:00
rw
a88cf317fd Python: remove ctypes dependency in runtime library. 2016-02-08 14:15:02 -08:00
Wouter van Oortmerssen
38662548c7 Bumped version to 1.3.0
Change-Id: I080041e533153b2bb2db53f030761852e95c88fa
2016-02-03 10:52:33 -08:00
Wouter van Oortmerssen
5973b778b1 Merge pull request #3749 from escholtz/flatc-version
Add -v --version arg support to the flatc command.
2016-02-03 10:03:40 -08:00
Eddie Scholtz
ac655b3ff0 Remove -v as option for printing version # (based on PR feedback). 2016-02-01 13:54:09 -08:00
Eddie Scholtz
0b3cd33e55 Add __DATE__ to FLATC_VERSION based on PR feedback. 2016-02-01 13:43:05 -08:00
Wouter van Oortmerssen
d7a86eb029 Merge pull request #3739 from Mandar-Shinde/master
Update readme.md for github
2016-02-01 11:33:44 -08:00
Mandar
757d830f4e Updated text in section "Supported programming languages" 2016-02-02 00:18:00 +05:30
Eddie Scholtz
e43d127eff Add -v --version arg support to the flatc command. 2016-01-29 15:01:54 -08:00
Wouter van Oortmerssen
9b8a814c3f Merge pull request #3742 from evolutional/cs-partial
Added support for C# partial class generation using attribute
2016-01-27 16:18:21 -08:00
Mandar
8b4c0b94dc Update readme.md 2016-01-22 22:27:47 +05:30
Oli Wilkinson
dbf6702371 Added support for C# partial class generation when the csharp_partial attribute is used on a table/struct. 2016-01-21 15:42:30 +00:00
Wouter van Oortmerssen
491e970943 Merge branch 'master' of https://github.com/google/flatbuffers 2016-01-20 18:11:51 -08:00
Wouter van Oortmerssen
9a54c44742 Re-Added accidentally deleted sample generated file.
Change-Id: Ie3b31719f7b133ec4aea64f00f2029566558cb18
Tested: Linux.
2016-01-20 18:09:53 -08:00
Wouter van Oortmerssen
9dfc3d61ee Merge pull request #3735 from evolutional/vs2010-buildfix
Buildfix for VS2010
2016-01-20 13:49:40 -08:00
Wouter van Oortmerssen
db0727e943 Merge pull request #3734 from evolutional/cs-forcedefaults
Implemented ForceDefaults option on C# FlatBufferBuilder.
2016-01-20 13:46:49 -08:00
Wouter van Oortmerssen
abd6a1427e Merge pull request #3729 from fichter/master
Fix build error when flatc binary is missing in path.
2016-01-20 13:35:25 -08:00
Wouter van Oortmerssen
0afac8f75a Merge branch 'master' of https://github.com/google/flatbuffers 2016-01-20 13:30:09 -08:00
Wouter van Oortmerssen
519dcdd0b2 Fixed Python unit test breakage.
Test was testing for a field to be None, even though it is populated
in one particular instance.

Change-Id: Id19848d01498d4c0a684efdb2bf49ff12c5b6758
Tested: on Linux.
2016-01-20 13:04:03 -08:00
Oli Wilkinson
112a619ec1 Disabled assignment operator of TableKeyComparator; was causing warning C4512 on VS2010 and thus causing the build to fail. 2016-01-20 18:59:51 +00:00
Oli Wilkinson
fff4590faf Implemented ForceDefaults option on C# FlatBufferBuilder.
Tested on: Windows, Unit Tests
2016-01-20 17:25:58 +00:00
Wouter van Oortmerssen
41395d981d Merge pull request #3707 from evolutional/vs-gitignore
Added Visual Studio transient files to .gitignore
2016-01-19 18:01:34 -08:00
Robert
b7d97ff3de Merge pull request #3491 from faizanrashid/master
[BUG FIX] [MINOR] Fix encoding with unicode characters.
2016-01-19 17:56:26 -08:00
Wouter van Oortmerssen
bf07c37a53 Merge branch 'master' of https://github.com/google/flatbuffers 2016-01-19 15:56:26 -08:00
Wouter van Oortmerssen
2ab7ebc82b Merge pull request #3510 from jaakristioja/patch-1
Fixed comment typo
2016-01-19 15:36:45 -08:00
Mark Klara
0ece042162 Silenced unused variable warnings.
When built for release, builds were failing with unused
variable warnings, since they were only used in `assert()`
calls.

I added explicit void casting to any potentially unused variables.

Change-Id: I9947ba46891fdda5aa925caa950642dedd4e009f
2016-01-19 15:30:41 -08:00
Mark Klara
69a31b807a Revamping the FlatBuffers docs.
Adding an API reference for the supported languages.

General docs cleanup, including a new `tutorial` section that
supports all of the supported languages.

Added samples for each supported language to mirror the new
tutorial page.

Cleaned up all the links by making them `@ref` style links,
instead of referencing the names of the generated `.html` files.

Removed all generated files that were unnecessarily committed.

Also fixed the C# tests (two were failing due to a missing file).

Bug: b/25801305

Tested: Tested all samples on Ubuntu, Mac, and Android. Docs were
generated using doxygen and viewed on Chrome.

Change-Id: I2acaba6e332a15ae2deff5f26a4a25da7bd2c954
2016-01-19 14:31:17 -08:00
Wouter van Oortmerssen
d75d29e2fe Merge branch 'master' of https://github.com/google/flatbuffers 2016-01-19 14:10:49 -08:00
Wouter van Oortmerssen
049f3f7907 Added support for parsing JSON null value.
These cause the field in question to be skipped.

Bug: 16550393
Change-Id: Id05104e89818ee773b8a91fdcc86e18061b9a82f
Tested: on Linux.
2016-01-19 14:05:27 -08:00
Wouter van Oortmerssen
e848137ded Added min/max values for enums/unions.
Bug: 21642898
Change-Id: Ifaf0b3c4274fe30ef29507ba1c1216d700efe85b
Tested: on Linux.
2016-01-19 14:05:27 -08:00
Wouter van Oortmerssen
f8c1980fdf Added schema evolution examples to the docs.
Bug: 26296711
Change-Id: I225067d82ac0f8bd71b2b97b1672517ca86cc3b9
Tested: on Linux.
2016-01-19 12:29:53 -08:00
Wouter van Oortmerssen
7d70082590 Merge pull request #3706 from evolutional/fix-3506
Check (& skip) of the utf-8 byte order mark
2016-01-19 11:10:07 -08:00
Wouter van Oortmerssen
8472b5f224 Merge pull request #3513 from evolutional/fix-3500
Java/C#: generation of typed helpers when using nested_flatbuffers
2016-01-19 10:40:02 -08:00
Wouter van Oortmerssen
6136dd490a Merge pull request #3498 from ncpenke/gcc-4.4.3-support
Gcc 4.4.3 support
2016-01-19 10:27:57 -08:00
Rene Fichter
3de82050ce Fix build error when flatc binary is missing in PATH. 2016-01-19 13:02:25 +01:00
Oli Wilkinson
f1ab30a490 Added Visual Studio transient files to .gitignore 2016-01-18 20:54:22 +00:00
Oli Wilkinson
cbe8747b59 Added check (& skipping) of the utf-8 byte order mark (0xEF BB BF) at the beginning of the file 2016-01-18 20:14:39 +00:00
Oli Wilkinson
eaa2b414b2 Added generation of typed helpers when using nested_flatbuffers in Java/C#. Fixes #3500 2016-01-18 15:23:14 +00:00
Jaak Ristioja
77a6a786b8 Fixed comment typo 2016-01-13 15:30:27 +02:00
Chandra Penke
b63ebad49d Fix #3497: Add support for compiling in g++ 4.4 and 4.5
- Removed uses of lambda expressions

- Added custom defines for constexpr and nullptr

- Removed trailing comma of last value from generated enums
2016-01-09 06:30:50 -06:00
Wouter van Oortmerssen
42c20d7a69 Make flatc check for binary files to avoid accidental parsing.
Binary file arguments to flatc have to be preceded by -- to
identify them, forgetting this however results in them being
attempted to be parsed as schema/json, with cryptic errors.
This instead gives an error if 0 bytes are contained in your
text file.

Bug: 22069056
Change-Id: I226bf651dcb016f18d7c8ffadcf23466a1fc0b87
Tested: on Linux.
2016-01-08 13:10:25 -08:00
Wouter van Oortmerssen
63b526db52 Ensured code is not generated directly from .proto files.
The parser state generated from the .proto conversion process is
not exactly the same as what you get by parsing the generated
schema, which can cause problems. This check enforces that you
first convert the .proto, then generate code from the new schema.

Change-Id: I04b53af9288d87e256d1cc109388332fefb3a09f
Tested: on Linux.
2016-01-08 11:39:56 -08:00
Wouter van Oortmerssen
514d274a45 Added android static library target for text parsing/generation etc.
Change-Id: If24e3eea90cef2a0d6a9d98fb503d2e3ec34ceed
Tested: on Linux.
2016-01-06 17:48:19 -08:00
Wouter van Oortmerssen
6beafd14e0 Updated docs to point to benchmark source code location.
Change-Id: If4c8fac6a421ac6436cab0dd7a0ae822a32e90bf
2016-01-06 16:51:00 -08:00
Robert
b4d29970f4 Merge pull request #2098 from faizanrashid/issue-1741
[BUG] [MINOR] Use buffer for specific py versions
2016-01-06 16:13:59 -08:00
Wouter van Oortmerssen
586fdee89b Merge pull request #3494 from parnic/fix-vs2012-static-analysis
Fixed MS static analysis warnings
2016-01-06 12:34:08 -08:00
Chris Pickett
178f768f7f Changed how the SA warning is suppressed to avoid pragma stuff 2016-01-06 14:21:18 -06:00
Wouter van Oortmerssen
316854c26f Merge pull request #3495 from parnic/fix-reflection-vs2012-warnings
Fixed warning building in VS2012
2016-01-06 12:03:40 -08:00
Wouter van Oortmerssen
6532bfce34 Merge pull request #3493 from parnic/support-platforms-without-realpath
Fix build for platforms not supporting realpath
2016-01-06 11:52:37 -08:00
Chris Pickett
e1e7dfa625 Fixed warning building in VS2012
src\reflection.cpp(297): warning C4267: 'argument' : conversion from 'size_t' to 'flatbuffers::uoffset_t', possible loss of data

sizeof() was promoting the type from uoffset_t to size_t.
2016-01-06 12:45:24 -06:00
Chris Pickett
a3363def52 Updated comment on endif for new name 2016-01-06 12:21:17 -06:00
Chris Pickett
b4fef31d84 Made requested revisions for naming and spacing 2016-01-06 12:20:38 -06:00
Chris Pickett
cfd6e7dea8 Documented what the suppressed warning is about 2016-01-06 12:04:46 -06:00
Wouter van Oortmerssen
56f9b2d142 Merge pull request #3492 from parnic/fix-vs2012-warnings
Fix vs2012 warnings
2016-01-06 09:39:23 -08:00
ncpenke
01025fa22b Merge pull request #3 from google/master
Catchup
2016-01-06 10:18:04 -06:00
Chris Pickett
30013b4ff8 Fixed MS static analysis warnings
Cleaned up a few warnings to allow VS2012 to compile idl_parser and idl_gen_text (for exporting binary protobuf blobs as JSON) cleanly under static analysis.
2016-01-05 13:38:59 -06:00
Chris Pickett
4731c7e502 Fix build for platforms not supporting realpath
Added a check for a preprocessor definition that can be set if the platform you're building for doesn't support any notion of absolute path resolution/realpath()/etc.
2016-01-05 11:04:16 -06:00
Chris Pickett
e0b2f81885 Fixed compile warning with VS2012
flatbuffers\src\idl_parser.cpp(1516): warning C4244: 'argument' : conversion from 'int' to 'char', possible loss of data
2016-01-05 10:58:40 -06:00
Chris Pickett
0e1601b80d Fixed compile warning with VS2012
flatbuffers\src\idl_parser.cpp(1525): warning C4127: conditional expression is constant
flatbuffers\src\idl_parser.cpp(1546): warning C4127: conditional expression is constant
2016-01-05 10:58:21 -06:00
Wouter van Oortmerssen
a6a38f6035 Merge branch 'master' of https://github.com/google/flatbuffers
Fixed conflicts and added missing generated files.

Change-Id: I4321c798543292d814c2c9e8b238c203b7526c7b
2016-01-04 13:06:19 -08:00
Wouter van Oortmerssen
4e4a5142fb Clarified binary encoding with an example.
Change-Id: I60c900a2f7cbd88fe264f7b0dc78ef86b1580655
Tested: in Chrome.
2016-01-04 09:53:21 -08:00
ncpenke
17c0b677e0 Merge pull request #2 from google/master
Catchup
2016-01-02 06:59:41 +00:00
Faizan Rashid
af23683311 [BUG FIX] [MINOR] Fix encoding with unicode characters.
When passing a unicode string to builder.CreateString, the
default encoding assumed all characters can be encoded
using ascii. Added a fix so a user can specify the
encoding and how to handle errors when creating strings.
2015-12-31 09:45:09 +05:00
Wouter van Oortmerssen
451272b618 Made error checking macros less prone to clashes.
Change-Id: Ieb252ce01446551699d935507bc95ee286fe1ddd
Tested: on Linux.
2015-12-29 16:33:00 -08:00
Wouter van Oortmerssen
8f13c828f5 Merge pull request #2776 from ncpenke/skip-unknown-json-fields
Fix #2775: Add parser option to skip unknown JSON fields
2015-12-29 10:29:11 -08:00
Wouter van Oortmerssen
e6240f4039 Merge pull request #2790 from chobie/php-table-fix
(PHP) fixes getting indirect table, also fixes getInt method on 32bit machine
2015-12-29 10:25:21 -08:00
Shuhei Tanuma
4691558ee3 (PHP) remove duplicate test 2015-12-24 15:50:03 +09:00
Shuhei Tanuma
7fbd9b8de4 (PHP) improve indirect buffer test 2015-12-24 15:35:28 +09:00
Nalinichandra Penke
f243109524 Fix #2775: Add option to flatc to skip unknown fields in JSON 2015-12-22 00:13:22 -08:00
Nalinichandra Penke
13d0594b4c Fix #2775: Add parser option to skip unknown JSON fields 2015-12-22 00:02:19 -08:00
ncpenke
6bfcb286b1 Merge pull request #1 from google/master
Catchup
2015-12-21 22:56:49 -08:00
Wouter van Oortmerssen
1891537236 Fixed reflection setting string not changing size field.
Change-Id: I3c3e88a79667d1733b6c47e43b55d8b2604ca8e2
Tested: on Linux.
2015-12-21 16:20:03 -08:00
Wouter van Oortmerssen
d7d527d154 Merge branch 'master' of https://github.com/google/flatbuffers 2015-12-21 14:43:48 -08:00
Wouter van Oortmerssen
995ee86a6e Added an IsFieldPresent helper function.
This is implemented as a template function, since Table::CheckField
is not reachable by subclasses of Table (private base class).

Change-Id: I1ed4d47ce7cb672460ccab61cf7442eb9136b0f1
Tested: on Linux.
Bug: 26273432
2015-12-21 12:17:59 -08:00
Wouter van Oortmerssen
40a33b1d06 Replaced exception handling in the parser with error checking.
This to allow the code to run on a greater range of build
configurations (that don't allow exceptions/RTTI).

If anyone ever doubts the usefulness of exception handling,
please show them this commit.

Change-Id: If7190babdde93c3f9cd97b8e1ab447bf0c81696d
Tested: on Linux.
2015-12-21 12:17:59 -08:00
Shuhei Tanuma
c9198dbbb8 (PHP) fixes getting indirect table, also fixes getInt method on 32bit machine. 2015-12-17 11:35:31 +09:00
Wouter van Oortmerssen
b974e95ce4 Merge pull request #2601 from AaronCritchley/patch-1
Improving the README by linking to the SO tag, and changing SO wording.
2015-12-16 09:59:22 -08:00
Aaron Critchley
99249ada01 Linking to SO tag and improving readability 2015-12-15 21:06:01 +00:00
Oli Wilkinson
4802e8a285 C# added BYTEBUFFER_NO_BOUNDS_CHECK #define
Removes the bounds checking on the ByteBuffer Get/Put operations. Can be dangerous when used with UNSAFE_BYTEBUFFER but results in increased performance. Use at your own risk!
2015-12-14 21:06:29 -05:00
Wouter van Oortmerssen
a9909a0c18 Made sure all namespace test files get generated.
Also included them in the C++ test.

Change-Id: Ib0c8470f0aacdf16616c27494abdda57a010195d
Tested: on Linux.
2015-12-14 16:15:43 -08:00
Wouter van Oortmerssen
2ce5d6c2b6 Merge pull request #2090 from evolutional/cs-perf-string
C# - Performance optimizations
2015-12-14 15:16:46 -08:00
Faizan Rashid
853e34087a [BUG] [MINOR] Use buffer for specific py versions
Fix for Issue 1741
Minor bug where python versions 2.7.x where x < 5 do not support
unpacking from memoryview objects. Versions 2.7.5 and above will
use memoryview while 2.7 versions below 2.7.5  will use buffer
objects.

Manual testing was performed on versions 2.7.5 and 2.7.2 to
confirm both worked correctly.
2015-12-13 02:55:16 -05:00
Oli Wilkinson
be11d2b6ef C# performance optimization to Pad/Prep methods 2015-12-12 11:39:57 -05:00
Oli Wilkinson
b8187e5b82 Performance tweak to FlatBufferBuilder.CreateString method to remove the unnecessary byte buffer allocation
(See https://github.com/google/flatbuffers/issues/55#issuecomment-164031718 for stats)
2015-12-11 14:57:59 -05:00
Wouter van Oortmerssen
4dcaec7938 Fixed root_type not accepting namespaced types.
Change-Id: I272f377742cc0a2c1bfccaa641b54eb9a8c762b6
Tested: on Linux.
2015-12-09 16:41:12 -08:00
Wouter van Oortmerssen
c44bc6a719 Merge branch 'master' of https://github.com/google/flatbuffers 2015-12-09 12:57:12 -08:00
Wouter van Oortmerssen
6fba6b6e71 Fixed compiler warnings for cast to bool in generated code.
Change-Id: I7727aeb478feb23d8ef66fd1ba9499b142b3ea7d
Tested: on Linux.
2015-12-09 12:56:24 -08:00
Wouter van Oortmerssen
96cd275603 Merge pull request #288 from mfcollins3/csharp-byte-buffer
Add Get Bytes Method Generator for C#
2015-12-07 17:35:57 -08:00
Wouter van Oortmerssen
42b48bd55f Merge pull request #776 from belldon/bytebuffer_pos_fix
Extend C# ByteBuffer Put method fix to unsafe methods
2015-12-07 16:19:05 -08:00
Wouter van Oortmerssen
8bb45dc0a6 Merge pull request #1029 from belldon/vtable_reuse
Update C# FlatBufferBuilder to reuse vtable array
2015-12-07 14:42:04 -08:00
belldon
8db90f5073 Extend C# ByteBuffer Put method fix to unsafe methods
Fixes issue #243.  Extends the initial C# ByteBuffer fix
(e4c3bf3d2c) to Put methods
used when UNSAFE_BYTEBUFFER is defined.
2015-12-07 16:43:55 -05:00
belldon
d5a113e5bf Update C# FlatBufferBuilder to reuse vtable array
This commit updates the FlatBufferBuilder class to reuse the vtable
array instead of creating a new array with every StartObject() call.
2015-12-07 16:42:21 -05:00
Wouter van Oortmerssen
8e6758d205 Merge pull request #608 from evolutional/master
Fix to #360 - Fully qualified names outside of current NS
2015-12-07 10:33:38 -08:00
Wouter van Oortmerssen
163d04a5d2 Merge pull request #778 from armen/master
Correct the max/min signed/unsigned 32-bit int
2015-12-07 10:27:27 -08:00
Wouter van Oortmerssen
b0d5bb1c4b Fixed language for generators not being set correctly.
Change-Id: I36c1f05efa836b32635e3274ac0ba976a8961bdd
Tested: on Linux.
2015-12-07 09:53:04 -08:00
Armen Baghumian
f622e5996c Optimize get* operation
It's slightly faster to convert the value to signed value in PHP as
opposed to use pack and unpack.

For 1M get operation the difference is:

    getShort in 3.3272678852081 seconds
    getInt in 3.8338589668274 seconds
    getLong in 5.6381590366364 seconds
    getLong (neg) in 5.6149101257324 seconds

vs

    getShort in 2.7564418315887 seconds
    getInt in 3.1612701416016 seconds
    getLong in 3.1369340419769 seconds
    getLong (neg) in 3.1478710174561 seconds

And since pack("P") and unpack("q") has been removed now ByteBuffer
works for PHP >= 5.4
2015-12-05 23:32:35 +00:00
Armen Baghumian
77fbdd28e2 Correct the max/min signed/unsigned 32-bit int
The test was trying to pack an unsigned int which couldn't fit as a
signed int and putInt() wasn't doing the validation in the correct range
2015-12-05 23:32:35 +00:00
Oli Wilkinson
c9ad6d5496 Fix to #360 - Updated the general generator (Java/C#) to emit fully qualified names where the referenced object isn't directly in this namespace. Added test fbs files to verify compilation. 2015-12-05 13:42:09 -05:00
Michael Collins
e083e466b8 Add Get Bytes Method Generator for C#
I updated idl_gen_general.cpp to add support for generating a Get Bytes
method for a vector to the generated C# source code. Given a byte vector
field named Foo, a method named GetFooBytes() will be generated in the
C# source code that will return an ArraySegment<byte> value referencing
the vector data in the underlying ByteBuffer.

I added a method to Table.cs named __vector_as_arraysegment that is used
by the code generated by the change to the C# generator.
__vector_as_arraysegment will take the offset of the vector and will
return the ArraySegment<byte> value corresponding to the bytes that
store the vector data.

I updated FlatBuffersExampleTests.cs to add tests to validate my
implementation of Table.__vector_as_arraysegment. I added tests to
demonstrate that the bytes for the monster's name can be extracted from
the underlying byte array. I also added tests to show that
Table.__vector_as_arraysegment returns a null value if the vector is not
present in the FlatBuffer.

I used the updated flatc.exe program to regenerate the C# source files
for the MyGame example. The new Monster class includes the GetXXXBytes
methods to return the byte arrays containing data for vectors.
2015-12-04 11:44:43 -07:00
Jason Sanmiya
fe2f8d32aa Do not create empty enums.
Mac build issued a warning for enum{}.

Change-Id: I9cab958538ac3cec61aeae289d1da0118ecac15f
Tested: Mac build no longer issues warnings.
2015-12-04 09:45:44 -08:00
Wouter van Oortmerssen
45bda6e08d Added --gen-all to generate code for a schema and all its includes.
Also refactored the way options are stored.

Change-Id: I709ac908cd2aba396c9c282725cf1d42ccce0882
Tested: on Linux.
2015-12-04 09:44:31 -08:00
Wouter van Oortmerssen
47478117d8 Fixed implicit dereference in flatc.
Change-Id: If2e62a325b47399561b4c20d2def55ede4831d19
Tested: on Linux.
2015-12-02 11:12:39 -08:00
Perry Hung
d7f2488099 Link clang builds against libc++abi on Linux
Simply running clang with -stdlib=libc++ requires a manual link against
libc++abi on Linux. This is documented in the libc++ documentation:
    http://libcxx.llvm.org/

Tested on Arch Linux, using clang 3.7.0 RELEASE.

Signed-off-by: Perry Hung <iperry@gmail.com>
2015-12-02 11:12:39 -08:00
Wouter van Oortmerssen
3881bbd651 Multiple schemas parsed by flatc are now parsed independently.
It used to be such that later schemas could depend on earlier
schemas. This was a convenience from days before include files
were implemented. Nowadays they cause subtle bugs rather than being
useful, so this functionality has been removed.

You now need to explicitly include files you depend upon.

Change-Id: Id8292c3c621fc38fbd796da2d2cbdd63efc230d1
Tested: on Linux.
2015-12-02 11:12:39 -08:00
Wouter van Oortmerssen
7b06041a7c C++ generated code now has constants for vtable offsets.
Besides making the generated code looking a lot more readable,
it also allows you to use these offsets in calls to
Table::CheckField, to see if a field is present in a table.

Change-Id: I1b4cc350c4f27c4e474c31add40c701ef4ae63b2
Tested: On Linux.
2015-12-02 11:12:39 -08:00
Wouter van Oortmerssen
3fc5387db7 Made C++ generated code use "bool" instead of uint8_t wire type.
Change-Id: I5756d15a758429ca67456264842017063d1f755e
Tested: on Linux.
2015-12-02 11:12:39 -08:00
Wouter van Oortmerssen
fc1cfd287a Allow vectors to be aligned beyond their natural type.
Change-Id: I09ade6b688a6b97d65fd832558917225d86c9118
2015-12-02 11:12:39 -08:00
Wouter van Oortmerssen
54dc4395b9 Java builder now checks if buffer was finished upon access.
Also checks for nesting of objects in vector construction.

This avoids common errors in FlatBuffer construction.

Change-Id: I5507c5d767684e20e94883a92448f05acefba4d6
Tested: on Linux.
2015-12-02 11:12:39 -08:00
Chris
1d457a0271 Fix use of std::max when Windows.h is imported. 2015-12-02 11:12:39 -08:00
Chris
671c9495d9 Return the full string when requested from a flatbuffers::String, even if it contains a NULL byte. 2015-12-02 11:12:39 -08:00
Wouter van Oortmerssen
d7b4a31e93 Added long form options for all generators (--cpp etc.)
Short-form versions are still supported, but are deprecated.

Change-Id: I15f70ca8d69ba5790368205caa9603b65e1b7fff
Tested: on Linux.
2015-12-02 11:12:39 -08:00
Wouter van Oortmerssen
b7d8c2af1a Made generated C++ code respect gcc -Werror=shadow.
Change-Id: I17de0bcc462770124227a9967e2aab620467f6eb
Tested: on Linux.
2015-12-02 11:12:39 -08:00
Wouter van Oortmerssen
1075c80e8a Fixed crash related to flatc parsing duplicate input files.
Thanks @Chaosvex for reporting.

Change-Id: I73f60ab0bf875a3e0849eaec5f42f6d036881094
Tested: on Linux.
2015-12-02 11:12:39 -08:00
Wouter van Oortmerssen
b611dc4b99 Fixed implicit dereference in flatc.
Change-Id: If2e62a325b47399561b4c20d2def55ede4831d19
Tested: on Linux.
2015-11-30 17:53:00 -08:00
Wouter van Oortmerssen
5f19ea5e45 Merge pull request #610 from iperry/master
Link clang builds against libc++abi on Linux
2015-11-30 16:56:08 -08:00
Perry Hung
e4abeef65c Link clang builds against libc++abi on Linux
Simply running clang with -stdlib=libc++ requires a manual link against
libc++abi on Linux. This is documented in the libc++ documentation:
    http://libcxx.llvm.org/

Tested on Arch Linux, using clang 3.7.0 RELEASE.

Signed-off-by: Perry Hung <iperry@gmail.com>
2015-11-30 19:48:49 -05:00
Wouter van Oortmerssen
ac49eda053 Multiple schemas parsed by flatc are now parsed independently.
It used to be such that later schemas could depend on earlier
schemas. This was a convenience from days before include files
were implemented. Nowadays they cause subtle bugs rather than being
useful, so this functionality has been removed.

You now need to explicitly include files you depend upon.

Change-Id: Id8292c3c621fc38fbd796da2d2cbdd63efc230d1
Tested: on Linux.
2015-11-30 16:48:31 -08:00
Wouter van Oortmerssen
1fa803d187 C++ generated code now has constants for vtable offsets.
Besides making the generated code looking a lot more readable,
it also allows you to use these offsets in calls to
Table::CheckField, to see if a field is present in a table.

Change-Id: I1b4cc350c4f27c4e474c31add40c701ef4ae63b2
Tested: On Linux.
2015-11-30 14:27:47 -08:00
Wouter van Oortmerssen
6d1ff8a525 Merge branch 'master' of https://github.com/google/flatbuffers 2015-11-30 13:55:34 -08:00
Wouter van Oortmerssen
59dc29a19a Made C++ generated code use "bool" instead of uint8_t wire type.
Change-Id: I5756d15a758429ca67456264842017063d1f755e
Tested: on Linux.
2015-11-30 13:54:24 -08:00
Wouter van Oortmerssen
6db667b6b1 Merge pull request #602 from chrisstaite/master
Fix flatbuffers::String to std::string and import of Windows.h
2015-11-30 12:21:41 -08:00
Wouter van Oortmerssen
07da3fc216 Allow vectors to be aligned beyond their natural type.
Change-Id: I09ade6b688a6b97d65fd832558917225d86c9118
2015-11-30 11:50:09 -08:00
Wouter van Oortmerssen
c5835b896c Java builder now checks if buffer was finished upon access.
Also checks for nesting of objects in vector construction.

This avoids common errors in FlatBuffer construction.

Change-Id: I5507c5d767684e20e94883a92448f05acefba4d6
Tested: on Linux.
2015-11-30 11:25:21 -08:00
Chris
345e8ca804 Fix use of std::max when Windows.h is imported. 2015-11-27 20:06:41 +00:00
Chris
9202f0cf09 Return the full string when requested from a flatbuffers::String, even if it contains a NULL byte. 2015-11-27 20:05:48 +00:00
Wouter van Oortmerssen
d10f9a6abc Added long form options for all generators (--cpp etc.)
Short-form versions are still supported, but are deprecated.

Change-Id: I15f70ca8d69ba5790368205caa9603b65e1b7fff
Tested: on Linux.
2015-11-25 17:26:34 -08:00
Wouter van Oortmerssen
ec0c0b14ca Made generated C++ code respect gcc -Werror=shadow.
Change-Id: I17de0bcc462770124227a9967e2aab620467f6eb
Tested: on Linux.
2015-11-25 16:48:28 -08:00
Wouter van Oortmerssen
6267f8c6c0 Fixed crash related to flatc parsing duplicate input files.
Thanks @Chaosvex for reporting.

Change-Id: I73f60ab0bf875a3e0849eaec5f42f6d036881094
Tested: on Linux.
2015-11-25 15:50:30 -08:00
Wouter van Oortmerssen
947a5b4ea3 Merge pull request #353 from takaken1994/master
C++: Fixed generated header file cannot be compiled when the type of key is enum class
2015-11-25 13:40:00 -08:00
Wouter van Oortmerssen
e10b8d6f2a Merge pull request #349 from belldon/enum-fix
Fixes issue #348: C# vector of enums doesn't compile
2015-11-25 13:14:28 -08:00
Donnell
644bcbde91 Fix C# vector of enum code generation
Fixes a bug where the logic to determine when to use a C# enum flags
both enums and vectors of enums.  This causes the C# generator to
generate code that doesn't compile for tables that contain vectors of
enums.

The fix also consolidates type generation functions a bit and adds
some additional casting functions for clarity.
2015-11-23 09:19:43 -05:00
Wouter van Oortmerssen
6775a0a941 Merge pull request #362 from chobie/fix-projectfile
Fix projectfile (VisualStudio, XCode) for development
2015-11-20 13:43:57 -08:00
Shuhei Tanuma
20c712f31b also, fix xcode project 2015-11-21 05:38:57 +09:00
Shuhei Tanuma
e6d51b54b6 Add missing idl_gen_php.cpp to VisualStudio project 2015-11-21 05:33:30 +09:00
Stewart Miles
c7482832b8 Merge remote-tracking branch internal into fb_upstream 2015-11-19 03:07:49 -08:00
Stewart Miles
6fe6532673 Fixed typo in cmake build rule for Linux.
Tested:
Verified it's possible to build generated headers on Linux for Android.

Change-Id: I82249a252cb851b978a177f4a4b92b527cc2bfd9
2015-11-19 03:02:58 -08:00
Stewart Miles
8212da5d5d Workaround broken gnumake realpath on Windows.
Also, added missing build scripts for flatc on Windows and fixed
numerous issues in the flatbuffers/android/jni/include.mk makefile.

Tested:
Verified dependent project (motive) can generate flatbuffers headers
with these changes on Android.

Bug: 25780616

Change-Id: I73f0dec8f7a6a7eb4e71951a8f1cd3e0d343a9ff
2015-11-19 02:44:56 -08:00
Wouter van Oortmerssen
a7b5f92f51 Merge pull request #359 from proppy/move-build-fb
flatbuffers/cmake: move build_flatbuffers to a standalone file
2015-11-18 10:10:07 -08:00
Wouter van Oortmerssen
6266b4f122 Merge pull request #308 from chobie/php
Add support for PHP code.
2015-11-18 09:31:17 -08:00
Wouter van Oortmerssen
e4eb286483 Merge pull request #312 from chobie/unity-fix
C# Unity (.NET 3.5) can't cast enum default value.
2015-11-18 09:28:00 -08:00
Johan Euphrosine
331d2d835c flatbuffers/cmake: move build_flatbuffers to a standalone file
So that it could be included from both flatbuffers CMakeLists.txt and
FindFlatBuffers.cmake.

Change-Id: Ie16a879beef9367cd6fd9b2d2157044841a7cdbc
2015-11-17 13:52:41 -08:00
Shuhei Taunma
5ce8682671 (PHP) add experimental support for PHP language.
* codegen for all basic features: WIP (probably implemented all basic feature)
* JSON parsing: NO
* Simple mutation: NO
* Reflection: NO
* Buffer verifier: NO (will be add later)
* Testing: basic: Yes
* Testing: fuzz: Yes
* Performance: Not bad
* Platform: Supported Linux, OS X, Windows (has 32bit integer limitation)
* Engine Unity: No

flatc --php monster_test.fbs

  <?php
  //include neccessary files.
  $fbb = new Google\FlatBuffers\FlatBufferBuilder(1);
  $str = $fbb->createString("monster");
  \MyGame\Example\Monster::startMonster($fbb);
  \MyGame\Example\Monster::addHp($fbb, 80);
  \MyGame\Example\Monster::addName($fbb, $str);
  $mon = \MyGame\Example\Monster::endMonster($fbb);
  $fbb->finish($mon);
  echo $fbb->sizedByteArray();

PHP 5.4 higher

Currently, we do not register this library to packagist as still experimental and versioning problem.
If you intended to use flatbuffers with composer. add repostiories section to composer.json like below.

  "repositories": [{
    "type": "vcs",
    "url": "https://github.com/google/flatbuffers"
  }],

 and just put google/flatbuffers.

  "require": {
    "google/flatbuffers": "*"
  }

* PHP's integer is platform dependant. we strongly recommend use 64bit machine
  and don't use uint, ulong types as prevent overflow issue.
  ref: http://php.net/manual/en/language.types.integer.php

* php don't support float type. floating point numbers are always parsed as double precision internally.
  ref: http://php.net/manual/en/language.types.float.php

* ByteBuffer is little bit slow implemnentation due to many chr/ord function calls. Especially encoding objects.
  This is expected performance as PHP5 has parsing arguments overhead. probably we'll add C-extension.

Basically, PHP implementation respects Java and C# implementation.

Note: ByteBuffer and FlatBuffersBuilder class are not intended to use other purposes.
      we may change internal API foreseeable future.

PSR-2, PSR-4 standards.

Implemented simple assertion class (respect JavaScript testcase implementation) as we prefer small code base.
this also keeps CI iteration speed.

we'll choose phpunit or something when the test cases grown.
2015-11-18 00:26:39 +09:00
Shuhei Tanuma
37e28d98ea C# Unity can't cast integer represented enum value.
```
namespace MyGame;

enum CommandType : byte {
	None = 0,
}

table Command {
	id:int;
	type:CommandType;
}
```

then generate c# files. it'll output compile error like these.

```
Assets/MyGame/Command.cs(18,39): error CS1041: Identifier expected
Assets/MyGame/Command.cs(18,39): error CS1737: Optional parameter cannot precede required parameters

16:   public static Offset<Command> CreateCommand(FlatBufferBuilder builder,
17:   int id = 0,
18:   CommandType type = (CommandType)0) {
```
2015-11-17 18:02:59 +09:00
Wouter van Oortmerssen
097797bf9f Merge branch 'master' of https://github.com/google/flatbuffers 2015-11-16 14:10:16 -08:00
Robert
4725be015d Merge pull request #343 from rw/go-builder-ergonomics
Go: Improve Builder user interface.
2015-11-16 12:18:30 -08:00
Wouter van Oortmerssen
f7d465f990 Merge pull request #344 from rw/py-builder-ergonomics
Python: Improve Builder user interface.
2015-11-16 09:07:31 -08:00
takaken1994
c4966370e2 C++: Fixed generated header file cannot be compiled when the type of key is enum class 2015-11-15 21:24:08 +09:00
Jon Simantov
65c9b355c1 Store the dirs you pass into build_flatbuffers as properties.
This allows you to query the generated target for those properties
later, so dependent modules can refer to the directories to, for example,
add them to the include_directories.

Change-Id: I7a6bd34c5c1d08e2ea69b5ad845223297cad1159
2015-11-13 18:04:41 -08:00
Jon Simantov
f2949c3fb1 Added build_flatbuffers function to CMake.
This function is designed to be called by projects that use FlatBuffers.
It takes a list of FlatBuffers schemas and a list of schema include
directories, and generates build rules to create generated headers
and/or binary schemas for those files, as well as optionally copying
all of the text schemas into a directory for your use (for example if
you need to parse text schemas within your app).

See function comments for more details.

Change-Id: I181684b916e91d965e14849d8f83ec2c83e9a4a4
2015-11-13 16:24:20 -08:00
Stewart Miles
ef53aebf9e Expand local file path to allow users to fix ndk-build
local-source-file-path does not expand to correct file paths in
some circumstances so some users override it.  Therefore
flatbuffers_header_build_rules has been modified to generate rules
that expand LOCAL_SRC_FILES values with flatbuffers_header_build_rules.

Also, this overrides local-source-file-path to allow nest projects
to build when NDK_OUT is set.

Tested:
Verified a dependent project continues to build.

Bug: 25673744
Change-Id: Ic90186fe96d6e4533f9f3b7ca9ef78084de08a7e
2015-11-13 08:49:00 -08:00
Stewart Miles
4f96603e12 Pass job server arguments (-jX) to make.
When $(MAKE) is expanded via a macro "make" doesn't know whether
$(MAKE) refers to an instance of the make app and therefore doesn't
pass job server arguments down.  This change adds the + prefix to the
command in the receipe in order to indicate $(MAKE) is another instance of
make.

Tested:
Verified flatc builds in parallel from Android builds.

Change-Id: I9f2f4f9680b818fdda7420a75a8bfa995b4644db
2015-11-12 18:25:24 -08:00
rw
3232727ace Python: Improve Builder user interface.
+ Add state to the Builder object to track if we are inside a table,
  and if we are finished building the buffer.
+ Use this data to check that a buffer is being built correctly.
+ Raise an exception if a buffer is not being built correctly.
+ Test that the exceptions happen as expected.

Based on d236dea.
2015-11-11 19:43:53 -08:00
rw
2dfff15a9d Improve Builder user interface.
+ Add state to the Builder object to track if we are inside a table,
  and if we are finished building the buffer.
+ Use this data to check that a buffer is being built correctly.
+ Panic if a buffer is not being built correctly.
+ Test that the panics happen as expected.

Based on d236dea13d.
2015-11-11 17:08:16 -08:00
Wouter van Oortmerssen
3f1c4b41f6 Merge pull request #339 from chobie/net-add-bytebuffer-property-to-table
(C#) Add ByteBuffer property to Table
2015-11-11 10:07:51 -08:00
Shuhei Taunma
b98f526b8a (C#) Add ByteBuffer property to Table 2015-11-10 14:32:31 +09:00
Wouter van Oortmerssen
9dc5d378b1 Updated supported languages in the docs.
Change-Id: I607f5f33b609c47fe32342f5e9d066f61f5546cd
2015-11-09 17:25:17 -08:00
Wouter van Oortmerssen
b0b39543de Merge pull request #311 from chobie/dont-hide-function-parameter-vs2015
Don't hide function parameter
2015-11-09 09:22:30 -08:00
Shuhei Tanuma
721d21923e Don't hide function parameter 2015-11-07 11:36:32 +09:00
Wouter van Oortmerssen
3f79e05585 Added new documentation links.
Change-Id: Ib5234a97a863be08c3bb0f9329204bc3a7effccb
2015-11-06 09:51:19 -08:00
Wouter van Oortmerssen
4d7810424c Allow structs to be parsed in JSON with out of order fields.
Also simplified the code and made it faster.

Change-Id: I1d83b1165a4a9a4380d1bfb5538769c012d2d367
Tested: on Linux.
2015-10-28 17:54:11 -07:00
Wouter van Oortmerssen
2107a7d514 Fixed assert in flatc converting to text.
Change-Id: Idac375b22aa9beaba162084cc3396f5536a4e721
Tested: on Linux.
2015-10-28 17:50:06 -07:00
Wouter van Oortmerssen
40b03519c1 Updated Xcode project for v7 2015-10-28 12:07:28 -07:00
Wouter van Oortmerssen
d236dea13d Improved C++ asserts for nesting and not finishing buffers.
Change-Id: I82a392bd262b13e978df748bc54b7ac43aec1e15
Tested: on Linux.
2015-10-28 11:57:16 -07:00
Stewart Miles
ed88f7de96 Improved build rule generation for Android flatbuffer headers.
* Added the ability to create a build target for generated headers.
* Made it possible for generated header targets to depend upon each
  other or arbitrary build targets.

Tested:
Verified some pretty complex libraries with numerous flatbuffer schema
dependencies build using this macro on Linux with the NDK.
Bug: 25188384

Change-Id: I846855a50808e58c34cdf7086e93e7ea0df69e0d
2015-10-22 13:16:45 -07:00
Robert
07478a6700 Merge pull request #204 from layzerar/fix_struct_comment
fix comment generation of struct
2015-10-20 13:25:53 -07:00
Wouter van Oortmerssen
48ff729477 Added assert for referring to 0 offsets.
Change-Id: I7c04d934bfacd4aeaa2ba476b934dd3a62d4fc0e
Tested: on Linux.
2015-10-20 09:36:35 -07:00
Wouter van Oortmerssen
7c60937806 Added -M flatc flag to the documentation.
Change-Id: Ie19af91ec5bf0b65297cba58c124bceaa58fd73e
2015-10-19 17:05:42 -07:00
Wouter van Oortmerssen
ace304513f Fixes for JS generator in Xcode 2015-10-19 16:05:39 -07:00
Wouter van Oortmerssen
1917e577a2 Fixes for JS generator in VS 2015-10-19 15:55:28 -07:00
Wouter van Oortmerssen
9c9fce96c7 Vector of structs were not being verified correctly.
Because they are represented as `const T *` in the Vector template,
the sizeof(const T *) was accidentally used instead of sizeof(T).

Change-Id: Ib4dc73e1d21396ba2e30c84e5e229c4147204bb1
Tested: on Linux.
2015-10-19 14:11:13 -07:00
Wouter van Oortmerssen
525130765a Merge pull request #257 from evanw/javascript
Add support for JavaScript code generation with Google Closure Compiler type annotations
2015-10-19 12:49:16 -07:00
Wouter van Oortmerssen
d890ef9e20 Merge pull request #298 from evolutional/master
Ported some of the python fuzz tests to C#
2015-10-19 11:11:05 -07:00
Wouter van Oortmerssen
9f69d79430 Merge pull request #296 from prideout/master
Fix minor typos in the Python documentation.
2015-10-19 10:40:16 -07:00
evolutional
9d66af6efc Ported some of the python fuzz tests to C#
* Refactored the test runner to use attribute based test discovery
* Ported value and vtable/object fuzzing tests from python to C#
2015-10-18 17:08:39 -04:00
Philip Rideout
8f1729f7df Fix minor typos in the Python documentation. 2015-10-17 17:48:06 -07:00
Evan Wallace
4bef5e89c4 Add UTF-8 support to the JavaScript API
This adds an optional argument to generated getters for string fields to
specify the encoding type and overloads the createString() function. It's
now possible to use either JavaScript UTF-16 string objects or C-style
UTF-8 byte arrays (Uint8Array) for string data.
2015-10-14 23:07:40 -07:00
Evan Wallace
79222bf100 Update monster_test_generated.js baseline after rebase 2015-10-14 23:06:58 -07:00
Evan Wallace
c3bfefca57 change DataView to bit twiddling for JavaScript 2015-10-14 21:15:57 -07:00
Evan Wallace
00fd394d23 remove unnecessary return 2015-10-14 21:15:57 -07:00
Evan Wallace
e1e8d53df6 Add low-level fuzzer, fix 64-bit issue it found 2015-10-14 21:15:57 -07:00
Evan Wallace
57a6dd472f Add a test for JavaScript UTF-8 <=> UTF-16 conversion
JavaScript uses UTF-16 but FlatBuffers uses UTF-8. This commit tests the code
that does the conversion between the two encodings. The last entry in the array
is tricky because each code point actually requires two UTF-16 code units,
unlike the other examples. The current JSON output of flatc actually handles
this case incorrectly (it generates invalid JSON with UTF-8 code units). The
generated JavaScript code passes these tests fine, however.
2015-10-14 21:15:57 -07:00
Evan Wallace
224e33ed09 Add support for JavaScript code generation
This adds a JavaScript language target. The generated JavaScript uses Google
Closure Compiler type annotations and can be compiled using the advanced
compilation mode, which performs type checking and optimizations such as
inlining and dead code elimination. The generated JavaScript also exports all
generated symbols for use with Node.js and RequireJS. This export behavior
can be turned off with the --no-js-exports flag for use with Google Closure
Compiler.
2015-10-14 21:15:57 -07:00
Wouter van Oortmerssen
94680f5483 Added support for imports and many other .proto features.
Change-Id: I6600021b7ec8c486794349511232c3e604421c5b
Tested: on Linux.
2015-10-13 14:01:55 -07:00
Robert
b4db88808f Merge pull request #286 from tguo-aa/fix-278
Add self.assertNotNested() in CreateString
2015-10-08 00:23:26 -07:00
tguo-aa
d9db48257b Add self.assertNotNested() in CreateString
And also add a test case.
If you try to nest CreateString you will get a clear exception.
2015-09-29 08:34:10 +08:00
Wouter van Oortmerssen
e1e1bced08 Fixed LoadFile on Windows 2015-09-28 16:24:34 -07:00
Wouter van Oortmerssen
b56add9520 Improved documentation with links to videos, articles and who uses it.
Change-Id: I62de6b7008e397a5043d47f014a7acd83ee64740
2015-09-28 10:49:01 -07:00
Wouter van Oortmerssen
2abe24b9dd Made .proto parsing understand nested declarations.
Bug: 24401812
Change-Id: I196a03b8c5ef0bcd3c26178239c764e40ca1950d
Tested: on Linux.
2015-09-28 09:48:41 -07:00
Wouter van Oortmerssen
a35c32e30f Merge pull request #282 from google/fix-277
Fix 32bit-system integer overflow (test only)
2015-09-25 14:54:50 -07:00
Robert
781c39c708 Fix 32bit-system integer overflow (test only)
For #277
2015-09-25 13:57:17 -07:00
Wouter van Oortmerssen
ff9e539cc5 Merge pull request #280 from alexames/master
Removed call to pop_back on std::string.
2015-09-25 10:38:50 -07:00
Wouter van Oortmerssen
feb4816610 Fixed .proto translation making scalars into required fields.
Change-Id: If414d156b4e9bc7fead5f131823b2c419cdc4e2c
Tested: on Linux.
2015-09-25 09:21:31 -07:00
Alex Ames
703b790939 Removed call to pop_back on std::string.
The pop_back function was added to strings in C++11 and it appears not
all compilers we target support it. The call to pop_back has been
replaced with a call to erase.

Tested on Linux. All unit tests pass.
2015-09-24 14:19:32 -07:00
Wouter van Oortmerssen
811a5c3389 Merge pull request #274 from cogumbreiro/master
Fix an out-of bounds read when the element is bigger than the buffer.
2015-09-23 12:37:45 -07:00
Robert
2736711d67 Merge pull request #275 from brunoqc/patch-1
Remove duplicate Go test
2015-09-21 15:13:24 -07:00
Bruno Bigras
edb3b9c307 Remove duplicate Go test 2015-09-21 17:51:16 -04:00
Tiago Cogumbreiro
477fedccd4 Fix an out-of bounds read when the element is bigger than the buffer.
Ensure the size of the buffer being checked is bigger than the element
of the buffer being checked. The buffer can be triggered when, for
example, the buffer is of length zero and we are checking for:

    Verify<uoffset_t>(buf_)

The condition above should fail.
2015-09-18 20:38:47 -05:00
Björn Reimer
5de28c74f9 serialize boolean in JSON to "true/false" instead of "0/1"
Change-Id: I90cf519c00eaf9ccd9fcab8035a91b9205587c3b
2015-09-16 10:31:38 -07:00
Wouter van Oortmerssen
44261ccdf1 Merge pull request #271 from vijairaj/scoped-enums
Implemented option --scoped-enum for C++ generator
2015-09-16 10:14:49 -07:00
vijairaj
c02b16e195 Implemented option --scoped-enum for C++ generator
This generates C++11 style scoped and strongly typed enums.
Enabling this option also implies --no-prefix.
2015-09-15 16:13:52 +05:30
Wouter van Oortmerssen
169df65df4 Merge pull request #266 from kadirahq/fix-travis-osx
Fix before_install step on .travis.yml file for osx
2015-09-14 17:50:29 -07:00
Wouter van Oortmerssen
af1487bcfb Clarified use of unions in C++.
Change-Id: I9654e0c6a45457c8e150f07dd5f7b39539266f9e
2015-09-14 11:00:12 -07:00
Jason Sanmiya
5db12e9907 Fix Visual Studio 2012 build warning.
Also, remove execute permissions on several source files.

Tested: Builds on Visual Studio 2012, and Linux.

Change-Id: Idaacb2ae8eba98ce2974218c2ab840e97a1d67e9
2015-09-11 14:35:34 -07:00
Wouter van Oortmerssen
dff07b6f31 Merge pull request #269 from teemuandersen/master
Add @SuppressWarnings("all") to generated Java classes
2015-09-11 14:23:53 -07:00
Teemu Andersén
5dd8795a10 Add @SuppressWarnings("unused") to generated Java classes
Usually generators add @SuppressWarnings("all") to generated Java
classes to prevent IDEs from complaining about unused imports, etc.
Solving used imports seems pretty hard with current generator logic so
IMO this is the next best thing.

Yes, it’s appended to import block but that is the block that gives
these warnings in the first place.
2015-09-11 23:33:55 +03:00
Muhammed Thanish
be503cb0f2 Fix OSX related errors on travis
- Install g++ and cmake only on Linux.
 - Use biicode only on Linux machines.
2015-09-11 22:15:27 +05:30
Wouter van Oortmerssen
01e06b69a5 Improved the speed of LoadFile() in debug mode.
Apparently, istreambuf_iterator has a lot of overhead.

Change-Id: I804f4e8f2b380b05e939edefe0e1e88cd10e920c
Tested: on Linux.
2015-09-09 12:56:23 -07:00
Wouter van Oortmerssen
782e05de55 Fixed Android builds on Windows (generated schema rules).
include.mk causes absolute paths to be generated, which doesn't
work on Windows (make doesn't like : in paths).

Change-Id: Ib06c9581620bde1e8452e0dd887d3986d517c4f5
Tested: on Windows, Linux.
2015-08-28 14:42:13 -07:00
Melvi Ts
82a71b18f1 Python: Fix potential code generation issue of documentation comment. 2015-08-28 23:48:28 +08:00
Wouter van Oortmerssen
aeff09d724 Fixed a clang warning about signed shifts.
Change-Id: I7c2bf87972ee0ba6811d6ed42e13300bff90e36f
2015-08-26 16:47:59 -07:00
Björn Reimer
a5c511576f Fix conversion of floats when generating json
Change-Id: I01def42eda9b70308046c048099d85db8f889ede
2015-08-26 14:06:29 -07:00
Maxim Zaks
ac10873e26 fixed code generator for array of bools
Change-Id: I3cdd801b641bf180222203a37634598350d340e3
2015-08-19 14:39:06 -07:00
Robert
9689d38bef Merge pull request #235 from FrankStain/master
2Gb buffer size checks fixed for Python Builder
2015-08-19 23:22:20 +02:00
Wouter van Oortmerssen
d06b2736aa Merge pull request #248 from aeneid/master
Added Java and C# mutators
2015-08-19 11:43:22 -07:00
Maor Itzkovitch
a0f3fb44e7 rebase 2015-08-19 21:32:08 +03:00
Wouter van Oortmerssen
d97f628703 Clarified choice of types in Java/C# codegen.
Change-Id: I1f094f350145d13b12cbe367bae7c623cfbbd8d3
2015-08-19 11:08:53 -07:00
Maor Itzkovitch
fb7f27a7c9 Merge remote-tracking branch 'upstream/master' 2015-08-15 14:48:59 +03:00
Maor Itzkovitch
7bfed4b29a added vector mutators 2015-08-15 14:48:47 +03:00
Wouter van Oortmerssen
a170b69d5d Added authors to support.md
Change-Id: I8f12e60d29a1c587d991bf64011bdf4a4b0d7e5b
2015-08-14 14:07:54 -07:00
Frank Stein
33e4ab65e9 Incorrect buffer size check fixed. 2015-08-14 00:50:39 +03:00
Wouter van Oortmerssen
201699288b Added a platform / language / feature support matrix to docs.
This is just a start, will need to be extended.

Change-Id: I5a9ad671911942dcb83fdd2bae537deed751cbfd
2015-08-12 12:07:43 -07:00
Wouter van Oortmerssen
e9202d85bd Add missing Python files from type cast commit.
Change-Id: I800119d8fe19f4c3e95772aba629ef8b2deb9e4b
2015-08-12 10:17:10 -07:00
Wouter van Oortmerssen
9a1ab5006f Merge pull request #253 from mormegil-cz/issue-252
[Issue 252] Add type cast for default enum values in C#
2015-08-12 09:21:21 -07:00
Mormegil
25c99273d3 [Issue 252] Add type cast for default enum values in C#
When creating a “CreateXxx(...)” method for a “simple table” type,
enum-type fields with a non-zero default must have an explicit
cast for the respective argument default value, because in C#,
there is an implicit cast from int to an enum only for 0.

Also, added an example of such type into the example monster_test
type, so that we test this feature.
2015-08-11 18:07:38 +02:00
Frank Stein
7bcbb19569 MaxBufferSize() changed to MAX_BUFFER_SIZE. Also buffer will never grow more MAX_BUFFER_SIZE. 2015-08-07 21:19:02 +03:00
Maor Itzkovitch
b062af4c8c rebased fork 2015-08-07 18:59:59 +03:00
Maor Itzkovitch
0956719726 added comments 2015-08-07 18:35:28 +03:00
Maor Itzkovitch
766eaad4e7 added a successful test run console print 2015-08-07 18:12:19 +03:00
Maor Itzkovitch
3a74c33ba5 removed console print from code 2015-08-07 10:57:37 +03:00
Maor Itzkovitch
e4c3bf3d2c fixed C# bytebuffer put methods 2015-08-07 10:51:15 +03:00
Maor Itzkovitch
7196c36842 begin to correct C# bytebuffer behavior 2015-08-07 09:05:08 +03:00
Wouter van Oortmerssen
e151160560 Added a link to other FPL libraries to the main page.
Change-Id: I45362806df6d4eff0b0b7521b7caf42c2ec0515c
2015-08-05 17:32:14 -07:00
Jon Simantov
dac63a227e Fix missing break statement in SetAnyValueS case.
Causing SetAnyValueS to treat all scalars as integers.

Change-Id: Ib467b255e7f32a1478180a91e65def31676399eb
2015-08-05 16:06:47 -07:00
Wouter van Oortmerssen
986b52d849 Merge pull request #247 from stewartmiles/master
Clarified the use of the deprecated flatc --gen-includes flag.
2015-08-05 13:58:17 -07:00
Wouter van Oortmerssen
45cc503bbd Changed maximum force_align to match the C++ code generator.
Change-Id: I7df2b0172f5de6f7bdbd8778361794004cd06062
Tested: on Linux.
2015-08-05 13:56:31 -07:00
Stewart Miles
6aeb09b297 Clarified the use of the deprecated flatc --gen-includes flag.
Also, removed the flag from the Android makefile.

Tested:
Verified flatc builds successfully on Linux and regenerated the docs.

Change-Id: I7140daa10b7cb9a29b5ffd63c6b20489e72a5899
2015-08-05 13:26:13 -07:00
Wouter van Oortmerssen
210c0ece54 Fixed VS project file.
Tested: on Windows.
2015-08-03 17:56:09 -07:00
Wouter van Oortmerssen
ad84b5b8fa Fixed AddFlatBuffer using wrong buffer length.
Also made the Xcode project link.

Tested: on OS X.
2015-08-03 17:39:47 -07:00
Wouter van Oortmerssen
7101224d86 Reworked reflection.h to be more general.
e.g. support generic reading/writing from structs/vectors etc.

Change-Id: I2eb6e24db088a72da444d5c8df7e506e53d5bc2d
Tested: on Linux.
Bug: 22660837
2015-08-03 16:42:05 -07:00
Maor Itzkovitch
6be146d67f small refactor to GenSetter method 2015-08-01 19:28:22 +03:00
Maor Itzkovitch
f706a42951 extend java tests 2015-08-01 19:14:12 +03:00
Maor Itzkovitch
e24afd838a extended scalar mutator support 2015-08-01 19:08:22 +03:00
Maor Itzkovitch
81c2b185ef support for scalar mutators 2015-08-01 12:38:47 +03:00
Wouter van Oortmerssen
0e064e415b Fixed small inaccurracies in the schema grammar.
Change-Id: I6e9e66c3d7d67c54617bc892f612b7341bebd7e0
2015-07-31 12:26:23 -07:00
Wouter van Oortmerssen
4998ad7365 Added support for adding new tables/strings to an existing FlatBuffer.
As part of the reflection support.

Change-Id: Ie0a8e233bca7dffa4cff7e564660035d97ff8902
Tested: on Linux.
Bug:22637258
2015-07-31 09:44:25 -07:00
Wouter van Oortmerssen
9a30d3d0df Merge pull request #241 from RevenantX/master
[BREAKING CHANGE] Base type safety in C#. Clear FlatBufferBuilder in C#.
2015-07-29 11:36:03 -07:00
RevenantX
0b761ece4d default in switch. 2015-07-29 00:45:26 +03:00
RevenantX
01249c1d48 remove unused funciton. 2015-07-29 00:40:48 +03:00
RevenantX
588564d74f Base type safety in C#. Clear FlatBufferBuilder in C#. 2015-07-29 00:33:45 +03:00
Wouter van Oortmerssen
6e192fa408 Updated documentation to use new css style.
Change-Id: I05e2f8fd06026645a8e5da1703d757ad9de10b4f
Tested: on Linux.
2015-07-22 13:10:37 -07:00
Wouter van Oortmerssen
12ca3e054e Fixed compile error in older gcc's for trailing comma in enum.
Change-Id: I60f6da32fb2a30557fcf842624f68ca184f65e1f
Tested: on Linux.
2015-07-22 12:35:40 -07:00
Wouter van Oortmerssen
62af533820 Merge pull request #237 from jonsimantov/master
Add optional root table to SetString and ResizeVector, when your Flatbuffer isn't the schema's root type.
2015-07-22 12:03:39 -07:00
Jon Simantov
b56020ad3b Updated pointer syntax to be consistent in SetString, etc. 2015-07-22 11:46:14 -07:00
Jon Simantov
6e160f4c59 Use Object* for optional root_table in SetString/ResizeVector.
Was previously using table name, but no reason not to just let the
calling code worry about getting the object.
2015-07-22 10:56:41 -07:00
Wouter van Oortmerssen
07e77ad0ff Merge pull request #238 from martell/master
Add a libflatbuffers for other projects to use
2015-07-22 10:02:11 -07:00
Wouter van Oortmerssen
b6380aceac Fixed reflection resizing code not checking strings in vectors.
Change-Id: I4081160a8281939ab282d7914ae396276c767882
Tested: on Linux.
2015-07-22 09:57:35 -07:00
Martell Malone
79d3cb6a6c Add a libflatbuffers for other projects to use 2015-07-22 17:53:19 +01:00
Jon Simantov
a4de6de700 Add optional root table name to SetString and ResizeVector.
This allows you to use these functions with a flatbuffer whose root
table type does't correspond with the root table type of the schema.

If you don't specify the table name, it will use the root table from
the schema by default (mimicing the current behavior).
2015-07-22 02:01:56 -07:00
Frank Stein
a1d801c375 2Gb buffer size checks fixed for Python Builder 2015-07-14 00:10:11 +03:00
Wouter van Oortmerssen
f66e93cd8d Merge pull request #233 from aeneid/master
fix for parameter name clash in generated structs
2015-07-13 13:27:54 -07:00
aeneid
59a09cb1d0 comment update 2015-07-13 22:58:54 +03:00
Maor Itzkovitch
c23c620d26 applied struct parameter fix to Go and Python generated classes 2015-07-13 22:53:59 +03:00
Wouter van Oortmerssen
4798456df6 Fixed type specifiers in the grammar document.
Change-Id: Ia6b976f0eb6a99d710bcd09cb56339580ff69f5b
2015-07-13 10:31:10 -07:00
Maor Itzkovitch
147fbb4285 builder.put statements now use correct argument names 2015-07-13 20:00:48 +03:00
aeneid
a9ae9bdcab comment update 2015-07-12 22:12:58 +03:00
aeneid
f7d8102b35 Passed field name as prefix for nested structs
This pull request should fix #232.
Pass field name instead of struct name as nameprefix for nested structures. Continuously concatenate nameprefix arguments to support deeper nested structures.
2015-07-12 22:10:57 +03:00
Wouter van Oortmerssen
d0e9bc6a75 A few schema documentation fixes.
Change-Id: I140e1322fc1bfb3ab8012e00d8f3006ee2e7ce95
2015-07-08 17:49:49 -07:00
Wouter van Oortmerssen
d863df8683 Merge pull request #230 from aeneid/master
included stdio.h in include/flatbuffers/hash.h
2015-07-08 09:01:17 -07:00
aeneid
4834634766 Update flathash.cpp 2015-07-07 08:14:00 +03:00
aeneid
a4c893dbe2 Update hash.h 2015-07-07 08:13:08 +03:00
Wouter van Oortmerssen
8833255ed3 Merge pull request #227 from evanw/master
Round up allocation size to avoid misalignment (issue #226)
2015-07-06 13:32:44 -07:00
aeneid
fb5f9456e9 Merge pull request #1 from aeneid/aeneid-patch-1
added #include <stdio.h>
2015-07-05 20:27:20 +03:00
aeneid
0dacfbbfca added #include <stdio.h> 2015-07-05 19:50:50 +03:00
Evan Wallace
47aab78233 Round up allocation size to avoid misalignment (issue #226)
Before this change, requesting a large initial allocation could cause the
backing store to grow to an unaligned size. Since memory inside vector_downward
is relative to the end of the buffer, this then caused all memory in the buffer
to be misaligned and also misaligns any further loads and stores. Misaligned
loads and stores are undefined behavior and don't work in environments such as
emscripten (a JavaScript to C++ compiler).
2015-07-02 14:05:45 -07:00
Jon Simantov
185b9f9792 Allow customization of flatc cmdline arguments on Android.
On Android builds, set FLATBUFFERS_FLATC_ARGS to change the arguments
passed to the flatc cmdline. Do this in your Android makefile where
you include the flatbuffers include.mk (before or after).

For example FLATBUFFERS_FLATC_ARGS=--gen-mutable

The default value is --gen-includes although since that is deprecated
we could just make the default value blank.

Change-Id: I79fb35f50c3e21bbef18ad40ad3559cb026ffe8e
2015-07-01 11:46:19 -07:00
Wouter van Oortmerssen
21765bea2e Made warning settings in Xcode more aggressive.
Tested: on OS X.
2015-06-29 15:49:13 -07:00
Wouter van Oortmerssen
36c7e9a962 Fixed null root_table access in binary schema generation.
Change-Id: Ia2b7abc10bee52814e815befcad6a89697295d8f
Tested: on Linux.
2015-06-29 15:21:48 -07:00
Wouter van Oortmerssen
cb2b2be54e Reflection: generically copy (parts of) FlatBuffers.
Change-Id: Ief3f1507c003079eac90c2bb6c2abd64a80a0a34
Tested: on Linux.
2015-06-29 15:18:51 -07:00
Robert
1c152cc72a Merge pull request #222 from rw/go-update-panics
Panic when nesting strings. Test panic scenarios.
2015-06-29 18:10:44 -04:00
gwvo
d67661eb39 Merge pull request #224 from rubber-duck/master
Fixed argument value to correct type
2015-06-29 10:44:11 -07:00
gwvo
ea97e1b5e2 Merge pull request #223 from belm0/csharp_docs
Java/C-sharp docs: fix typo, clarify parser availability.
2015-06-29 09:55:38 -07:00
Rafael Munitić
dca3ccf5fd Fixed argument value to correct type 2015-06-26 21:28:39 +02:00
John Belmonte
ef7b3ed8f5 Java/C-sharp docs: fix typo, clarify parser availability. 2015-06-25 14:42:41 -07:00
rw
4d305f5922 Panic when nesting strings. Test panic scenarios.
Also add a new `insideObject` boolean to the Builder to track whether an
object is currently being constructed. This fixes a bug with objects
that have zero fields.
2015-06-24 11:53:44 -04:00
Wouter van Oortmerssen
1e6f8f5b8c Fixed possible crash from reference to non-static variable.
Change-Id: I1842098a7ef461e2e92dd35d79d8ca303e814867
Tested: on Linux.
2015-06-22 10:23:42 -07:00
Wouter van Oortmerssen
c967515da5 Small improvements to the C++ API.
Change-Id: Ib30ffbbd140a8b82fe664129fa4e8c55836267f8
Tested: on Linux.
2015-06-17 17:17:01 -07:00
Wouter van Oortmerssen
576022c64b Changed VS flatc test settings to match Linux. 2015-06-17 10:27:05 -07:00
gwvo
eab9cfbec9 Merge pull request #217 from amoldeshpande/master
option to generate one file for C#
2015-06-17 10:10:50 -07:00
Amol Deshpande
ab4801a82e Merge branch 'master' of https://github.com/amoldeshpande/flatbuffers 2015-06-16 07:23:29 -07:00
Amol Deshpande
8df4b318bc Merge branch 'master' of https://github.com/google/flatbuffers
Conflicts:
	src/flatc.cpp
	src/idl_gen_general.cpp
2015-06-16 07:16:59 -07:00
amoldeshpande
8a98e9ad98 Merge pull request #3 from amoldeshpande/google-master
Merge pull request #2 from amoldeshpande/master
2015-06-15 21:00:40 -07:00
amoldeshpande
eee5628569 Merge pull request #2 from amoldeshpande/master
merge
2015-06-15 20:58:48 -07:00
Amol Deshpande
ad3fd6ecbf merge 2015-06-15 20:26:10 -07:00
Wouter van Oortmerssen
622b8d05cf Fixed warnings on Windows 2015-06-15 17:35:07 -07:00
Wouter van Oortmerssen
5faa0ab1be Removed unused variable.
Tested: on OS X.
2015-06-15 15:57:48 -07:00
Wouter van Oortmerssen
81312c2128 Initial reflection and resizing functionality.
Tested: on Linux.

Change-Id: I8f7bccf9b1ad87fea788f85e23fa69435758feca
2015-06-15 15:53:10 -07:00
Wouter van Oortmerssen
1808337adc Make generating dependent include files for C++ the default.
--gen-includes is now deprecate but still accepted.
--no-includes can be used instead when needed.

Change-Id: I2cd46d193032b9b7c31c76c6f655e9333d3a393a
Tested: on Linux.
2015-06-15 13:09:22 -07:00
Wouter van Oortmerssen
5f091c46ce Allowing _ as first character of identifiers in .fbs/.json.
Change-Id: Ie2cb42632f6a907a38e10b2c9be1536cf330b2fa
Tested: on Linux.
2015-06-15 13:09:22 -07:00
gwvo
a96bfdb369 Merge pull request #219 from jesta88/master
Fix for #218 - Check empty namespace in general generator
2015-06-15 12:04:58 -07:00
Jeremie St-Amand
ad3ebb110b Follow Google code standards 2015-06-14 13:04:04 -04:00
Jeremie St-Amand
929105432c Namespace now optional for general generator
If you have a schema with no namespace, the resulting C#/Java won't have
an erroneous empty namespace keyword.
2015-06-14 12:56:48 -04:00
Amol Deshpande
40fffc8fff fix code formatting and bug with losing enums when using --gen-onefile 2015-06-13 08:55:24 -07:00
Amol Deshpande
2f76141813 option to generate one file for C# 2015-06-06 19:35:12 -07:00
Wouter van Oortmerssen
932b22f043 Added clang & OS X to .travis 2015-05-27 18:32:49 -07:00
Wouter van Oortmerssen
ecf5a6a580 Added --defaults-json to output fields at default value.
Normal behavior is to not output fields that happen to have
the default value, since those will be reproduced anyway
when turned into a FlatBuffer binary. This however can be problematic
when using JSON to interop with other system since they might not
know this default value. This flatc option (and also flag
to GenerateText) will force those fields to be output anyway.

Tested: on Linux.
2015-05-27 16:42:15 -07:00
Wouter van Oortmerssen
788acb08d4 Added GitHub link to start of documentation page. 2015-05-27 15:21:10 -07:00
Wouter van Oortmerssen
ddb1d5ffe4 Added a #define for running tests without file access.
Change-Id: Ib2b7aa8a5641cf73fa0d6f2000db7fdd1aabab66
Tested: on Linux.
2015-05-27 14:00:08 -07:00
Wouter van Oortmerssen
7ba29dbe41 Small readability improvements to recent commits.
Change-Id: I290c33c475f7b019ab0d3c571245d27351d22fa1
Tested: on Linux.
2015-05-20 16:21:22 -07:00
Wouter van Oortmerssen
3b070310f0 Fixed -Wunused-result warning.
Change-Id: Iea5fab66047ac0a5057a743dbb1fdb27c063188c
Tested: on Linux.
2015-05-20 16:21:22 -07:00
Wouter van Oortmerssen
fbe085601b Java: Allow access to the underlying ByteBuffer from a table.
Change-Id: Id268e35de207c25c809a09071b81eea873c9123e
Tested: on Linux.
2015-05-20 16:21:22 -07:00
gwvo
36f9b1ec91 Merge pull request #207 from zachreizner/header
Add include for cstdlib for std::bsearch definition
2015-05-20 15:01:53 -07:00
Zach Reizner
7bcd99451f Add include for cstdlib for std::bsearch definition 2015-05-20 14:54:20 -07:00
Robert
2535a3aa3a Merge pull request #206 from rw/go-faster-string-writing
Go: CreateString now needs zero allocs.
2015-05-20 14:37:53 -07:00
rw
0894c25f2c Improve comment for unicode check. 2015-05-20 14:19:49 -07:00
rw
7810fb9ce4 use escape codes here for non-unicode editors 2015-05-20 13:42:51 -07:00
rw
c127cf78c2 Go: CreateString now needs zero allocs.
Big speed boost for the typical use case of building with strings.
2015-05-20 12:00:44 -07:00
gwvo
6fffa2a14d Merge pull request #198 from zulli73/master
Fixed endianness Vector's begin() and end()
2015-05-20 09:30:10 -07:00
gwvo
2b02d330fd Merge pull request #205 from zachreizner/fb_bsearch
Use std::bsearch in LookupByKey for binary search
2015-05-18 17:36:51 -07:00
Zach Reizner
c8f1682e07 Use std::bsearch in LookupByKey for binary search 2015-05-18 17:29:51 -07:00
gwvo
f64e040896 Merge pull request #201 from rw/python-docs-and-packaging
Update Python docs and package description
2015-05-18 09:33:30 -07:00
rw
339376ba67 Regenerate Doxygen docs to add Python usage page. 2015-05-15 12:23:10 -07:00
rw
7a1b77322b Update Python package description: license, descriptions. 2015-05-15 12:20:20 -07:00
Wouter van Oortmerssen
60b6ca5850 fixed xcode build files 2015-05-13 17:45:20 -07:00
Wouter van Oortmerssen
b8681d8031 fixed the windows build files 2015-05-13 17:26:20 -07:00
Robert
f8139b05cb Merge pull request #112 from rw/python23-read-write-gen-port
Port FlatBuffers to Python.
2015-05-13 11:20:09 -07:00
rw
776c4eb965 use EnsureDirExists from util.h instead of mkdir 2015-05-13 10:54:02 -07:00
rw
2746aabcf1 fix string catenation 2015-05-13 10:50:47 -07:00
Raphael Zulliger
04a06781f5 Fixed endianness Vector's begin() and end() 2015-05-13 16:25:56 +02:00
rw
48dfc69ee6 Port FlatBuffers to Python.
Implement code generation and self-contained runtime library for Python.

The test suite verifies:
  - Correctness of generated Python code by comparing output to that of
    the other language ports.
  - The exact bytes in the Builder buffer during many scenarios.
  - Vtable deduplication correctness.
  - Edge cases for table construction, via a fuzzer derived from the Go
    implementation.
  - All code is simultaneously valid in Python 2.6, 2.7, and 3.4.

The test suite includes benchmarks for:
  - Building 'gold' data.
  - Parsing 'gold' data.
  - Deduplicating vtables.

All tests pass on this author's system for the following Python
implementations:
  - CPython 2.6.7
  - CPython 2.7.8
  - CPython 3.4.2
  - PyPy 2.5.0 (CPython 2.7.8 compatible)
2015-05-12 15:40:29 -07:00
Robert
4d213c2d06 Merge pull request #165 from rw/go-faster
Go speed improvements
2015-05-12 14:53:31 -07:00
gwvo
361bfb6764 Merge pull request #189 from pjulien/188
Issue #188
2015-05-11 14:07:40 -07:00
gwvo
3f96eead4c Merge pull request #192 from Jiboo/fix190
Added a default constructor for Java's FlatBufferBuilder.
2015-05-11 13:59:22 -07:00
Wouter van Oortmerssen
8896587faf Fixed schemas inheriting namespace from included schemas.
Change-Id: Ib561430b235eddf4bfe20f68409e1dfdb359ef2b
Tested: on Linux.
2015-05-11 10:55:22 -07:00
Jean-Baptiste "Jiboo" Lepesme
9fa3e2f387 Added a default costructor for Java's FlatBufferBuilder.
Default's size of 1024b like in cpp. Fixes #190.
2015-05-11 19:17:01 +02:00
rw
e5c21ec666 invoke many fewer growth events 2015-05-09 16:32:26 -07:00
rw
e11da87a24 gofmt 2015-05-09 16:10:03 -07:00
rw
3dd54424c0 remove remaining allocs during build 2015-05-09 16:07:11 -07:00
rw
5d68493df4 update CheckClash for string accesses 2015-05-09 15:37:13 -07:00
pjulien
d322eec3c3 Issue #188
When accessing the array directly of a byte buffer, need to offset
by ``arrayOffset``
2015-05-09 14:08:28 -04:00
Mormegil
221193eaa2 Union accessors in C# should use generic type for the table
When accessing a union field, we should return the same object type
as was given to the method, i.e. the parameter should have a generic
type for any Table-derived type. This way, we do not need to make
superfluous casts (which also reduce type safety) like

var myUnionType = (MyUnionType)buff.GetUnionField(new MyUnionType());

when we can do just
var myUnionType = buff.GetUnionField(new MyUnionType());

Change-Id: Idac1b638e46cc50b1f2dc19f10741481202b1515
2015-05-08 16:21:54 -07:00
pjulien
f7d24f60a2 set version for next dev cycle
Change-Id: I17a7896e257c0ab7e4cd1b22c928d4cee21fbf11
2015-05-08 16:21:54 -07:00
pjulien
e5a1a3129d Initially discussed in #178.
Allows adding an already encoded UTF-8 string directly without
having to convert to a ``String`` first.

Change-Id: I23f9c738eec18fd35f4c14f58dbd0f6cf0970dc7
2015-05-08 16:21:54 -07:00
Wouter van Oortmerssen
39833d7cf0 Added namespaced way to refer to types in schemas.
Also made proper namespacing work for enums.

You can now say namespace.MyTable as the type when declaring
a field that refers to a type in a different namespace.

Previously, it would work just referring to MyTable, however
with the recent commit fixing namespaced types this now
is ambiguous.

Change-Id: Ieaa3f4ac1662b8c4dc1f16e1898ea3cdb02e10fd
Tested: on Linux.
2015-05-08 16:21:53 -07:00
Brett Cooley
ecb27817ca Merge "Initial support for propagating namespaces from schema files to generated code" into ub-games-master 2015-05-08 19:52:54 +00:00
Jason Sanmiya
f59bfdd084 Add missing newline in help text for flatc.
Tested: Help text displays correctly now.
Change-Id: Ibbdc810ae41e24321860879064bdc64f78a67cb9
2015-05-07 10:30:34 -07:00
Mormegil
0ee1b99c5d [BREAKING CHANGE] Field accessors should use property getters in C#
In C#, plain field accessors should not be nonparametric methods
but should be standard property getters.

The accessor methods with parameters were renamed to `GetXxx`
because a method cannot be named identically to a property.

Also, `ByteBuffer.Position`, `FlatBufferBuilder.Offset` and
`FlatBufferBuilder.DataBuffer` are now properties instead
of nonparametric accessor methods, for more idiomatic C# style.

This is a breaking change, all client C# code accessing these
fields needs to be changed (i.e. remove those `()` or add the
`Get` prefix).

Issue: #77
Change-Id: Iaabe9ada076e5ea2c69911cf6170fdda2df3487e
2015-05-06 11:55:07 -07:00
yinlei
a50711ad13 Fix u_int8_t to uint8_t
Change-Id: I475ef9454f51f1b7ec2a7f9086d711359456677a
2015-05-06 11:29:07 -07:00
Brett Cooley
249f71a12b Initial support for propagating namespaces from schema files to generated code
Change-Id: Ifc10c54845ea7553586d1896d509314d68e9ab0f
2015-05-05 17:10:53 -07:00
Wouter van Oortmerssen
1d138fbe07 Merge "Added extra checks for reading binaries in flatc" into ub-games-master 2015-05-04 21:02:00 +00:00
Wouter van Oortmerssen
a0bf238b09 Merge changes I2de7d14d,I56392340 into ub-games-master
* changes:
  Added accessor for file_extension in generated code.
  Added missing --gen-mutable to CMakeLists.txt
2015-05-04 21:00:43 +00:00
Wouter van Oortmerssen
c49c6da803 Added extra checks for reading binaries in flatc
By default, disallow reading binaries that do not correspond to
the schema file_identifier. Override with --raw-binary

Change-Id: I24822c0e4c80dab4e5a238ae2b6e601a09025c27
Tested: on Linux.
2015-05-04 13:38:20 -07:00
Wouter van Oortmerssen
37e6efe1f9 Added accessor for file_extension in generated code.
Change-Id: I2de7d14dbb1f7b8f81022dd2c9da65060ae49300
Tested: on Linux.
2015-05-04 13:38:20 -07:00
Wouter van Oortmerssen
d4d7a84e11 Added missing --gen-mutable to CMakeLists.txt
Change-Id: I56392340de4439d05fa8f06a7336ff72c6f9346d
Tested: on Linux
2015-05-04 13:38:19 -07:00
Jason Sanmiya
fc7e8af55e Merge "Fix bug on flathash compilation option." into ub-games-master 2015-04-29 21:12:07 +00:00
Wouter van Oortmerssen
3ec5dddb00 Mutable FlatBuffers: in-place updates.
This commit contains the first step in providing mutable FlatBuffers,
non-const accessors and mutation functions for existing fields generated
from --gen-mutable.

Change-Id: Iebee3975f05c1001f8e22824725edeaa6d85fbee
Tested: on Linux.
Bug: 15777024
2015-04-29 10:58:45 -07:00
Jason Sanmiya
f47660f510 Fix bug on flathash compilation option.
Change-Id: Ib9d31d08daba7ce54b864417ae93bf479702861b
2015-04-28 15:44:10 -07:00
Mormegil
a8d6962ac2 Tolerate DOS-style EOL in IDL line comments
If an IDL file uses DOS-style EOLs (CR+LF), line comments need to
ignore the second linebreak character, otherwise, as is currently
the case, the parsed documentation comment includes a trailing `\r`
character, which is then output verbatim into the output source
code by flatc.

Change-Id: I39591631995a980622d20a4a32315178b33f18f6
2015-04-15 13:44:54 -07:00
franchuti688
23f75f598e added .travis.yml file (build with original and biicode building);
added bii-travis.sh and readme.md files; added build status section with travis and biicode build
systems

Change-Id: I93acd1ca9497416ade6293d63b5311c4c31b880f
2015-04-15 13:43:25 -07:00
Mormegil
e3b432cba8 Enums use native enums in C#
Enums should not be (badly) emulated with classes in C# but should
use native C# enums instead. Java implementation made an explicit
choice not to use the (more complex) Java enums, but C# enums are
just light-weight syntactic coating over integral types.

Fixes issue #171.

Change-Id: I9f4d6ba5324400a1e52982e49b58603cb7d7cca7
2015-04-13 10:40:30 -07:00
Advay Mengle
557c57eb9d Seal all classes in Java/C#
Makes enums/structs/tables unsubclassable (final or sealed) and
prevents instantiation of enum classes (which are solely static
constants).

Tested (Mac OS 10.10.2):
1. run flattests
2. cd tests && ../flatc -c monster_test.fbs && ../flatc -j
monster_test.fbs && ../flatc -g monster_test.fbs && ../flatc -n
monster_test.fbs  # Note deltas for C# and Java.
3. ./JavaTest.sh

**Breaking api change**

Change-Id: Ie008c941c36d212690da58ddc72c9b228eb7a093
2015-04-10 11:20:19 -07:00
Joël Lamotte
9d368deb05 Fixed: Readme version is not up to date
Change-Id: Ie44419026eca94bce0a2857abef95a82e78cfc3e
2015-04-06 11:44:22 -07:00
Ben Harper
8b99bf614c Add byte slice accessor to Go code
Change-Id: I15cc8924d6607bd93068c762fd67e6088cfd9789
2015-04-06 11:44:22 -07:00
Kyle Jones
c4a3e2f6bd Always add additional space if no more is available
Change-Id: If08b2d839489d40e977de794b13584fa66ff32c1
2015-04-06 11:44:22 -07:00
INADA Naoki
803f9bba27 Fix typo in Benchmarks.md
Change-Id: I1c5fbd019cc233e1d551887ff5fb740420c18c2b
2015-04-06 11:44:21 -07:00
rw
d756efbf76 Reduce allocations when reusing a Builder.
Add the function `Reset` to the Builder, which facilitates reuse of the
underlying byte slice.
2015-04-02 19:33:00 -07:00
rw
ace7fa8094 Reduce allocations when building strings.
Builder has a new CreateByteString function that writes a
null-terimnated byte slice to the buffer. This results in zero
allocations for writing strings.
2015-04-02 18:22:13 -07:00
rw
f02646e357 Remove all string allocations during parsing.
Change the signature for 'string' getters and settings to use byte
slices instead of strings.
2015-04-02 11:56:55 -07:00
rw
0a3a09aaf3 Merge branch 'go-bytevector-getter' of github.com:benharper123/flatbuffers into go-faster 2015-04-02 11:47:17 -07:00
rw
796be3282c Benchmarks for building and parsing 'gold' data.
Identifies alloc-heavy codepaths.
2015-04-02 11:26:00 -07:00
rw
468124fb9b chmod GoTest.sh +x 2015-04-02 11:25:48 -07:00
Advay Mengle
3ad853630c Generate appropriate schema doc comments from .proto files
- Add parse handling of .proto struct and field doc comments (enums and
their values were already handled)
- Add FBS generation handling of doc comments for structs, their
fields, enums, and their values (requires linking idl_gen_general in
the test binary build)
- Tested using test.proto|golden with doc comments added.  Xcode run of
flattest passes.

Change-Id: Idff64dd8064afba227174ab77d2c7be22d006628
2015-04-01 17:17:39 -07:00
Advay Mengle
b8708beeec Generate Java doc comments in JavaDoc style
Tested by regenerating all tests/ generated sources; note that only
Monster.java changes.  Ran flattests as well.

Change-Id: I65b6ea7d208b0ccd6a0b34761162fed6ba391fc5
2015-04-01 17:10:52 -07:00
Ben Harper
8fb6c4f764 Add byte slice accessor to Go code 2015-04-01 16:47:10 +02:00
Wouter van Oortmerssen
75740c1374 Clarified Verifier options.
Change-Id: I04775dedc61f1c448eedb1883182af7b07239797
Tested: on Linux.
2015-03-30 15:38:36 -07:00
Jason Sanmiya
e8598950fc Fix Mac ndk-build error on motive, pie_noon, pindrop.
We were looking for 'flatc' in motive/bin/Debug/flatc,
on Mac. It's actually built to flatbuffers/Debug/flatc.

Tested: OS X Yosemite, ndk-r10d. Also tested on Linux.
Change-Id: I9f1ecfe00c5f42fd9b6808b5a5da1c920487a4c2
2015-03-27 09:27:18 -07:00
Wouter van Oortmerssen
ca5c9e7496 Unsigned types in Java now return bigger size signed types.
(Java doesn't support unsigned types).

ubyte/ushort return as int
uint returns as long
(all with correct masking)

ulong still returns as long, as before.

Tested: on Linux & Windows.
Bug 17521464

Change-Id: Id6bc8f38fc8c1a2f4e6733c6980dc6b6e322b452
2015-03-23 17:01:33 -07:00
Wouter van Oortmerssen
f7818d83d7 Changed C# ByteBuffer to use bit shifts instead of BitConverter
BitConverter was excessively slow since it allocates a byte array
at each access.

Bug: 18702381
Change-Id: I47be9c38e1d04287ba4c10bc369848f3e13a2a2f
Tested: on Windows.
2015-03-13 16:59:29 -07:00
Wouter van Oortmerssen
7ef2fc2517 Regenerated test code + fixed typo in C# FlatBufferBuilder
Change-Id: Ifa6d9459c53ae60b9bf936d9468ec971ee282f14
Tested: on Linux and Windows.
2015-03-13 13:05:28 -07:00
reynolma2
6df9e1c537 Update idl_gen_general.cpp
There is a bug in creating a C# table when it includes a field of type 'BOOL'. The problem is that the generate C# code is as follows:
  "bool SampleValue = 0;"
This will fail to compile, because in C# this fails, it needs to be generated as:
 "bool SampleValue = false;"

The error is in line ~510

Change-Id: I77f6eea0f269b0540dbeb462602fc447cb69237d
2015-03-13 13:05:03 -07:00
Ben Harper
6a0126340a Add CreateByteVector function to Go's builder
This function gets around the inefficiency of populating a [ubyte] vector
byte by byte. Since ubyte vectors are probably the most commonly used type
of generic byte buffer, this seems like a worthwhile thing to create a
fast path for.

Benchmarks show a 6x improvement in throughput on x64.

There is a new test verifying the functionality of the function.

Change-Id: I82e0228ae0f815dd7ea89bf168b8c1925f3ce0d7
2015-03-11 17:27:39 -07:00
Max Galkin
4464405250 Make FuzzTest2 fuzzier.
1. Random table fields are now marked deprecated. The deprecation rate is adjustable, default is ~10% of fields.
2. Vector type previously produced a dummy field, now a trivial ubyte vector is generated instead.
3. The fuzzed "instances" were previously generated with identical data, now they are randomized: I suppose such was the intent from the beginning, just wasn't implemented.

I ran the new test with a few different settings and random seeds (but only on Windows + VS2015), and it always passed.

Change-Id: I2014686b6680aec24049ccda3f6deffe5205a83e
2015-03-11 17:27:39 -07:00
Max Galkin
c3807fa39d Fix for VS 2015 stricter warnings about "shadowed" names.
This change renames a few variables to fix the build in VS 2015.

VS 2015 new warnings:
http://blogs.msdn.com/b/vcblog/archive/2014/11/12/improvements-to-warnings-in-the-c-compiler.aspx

Change-Id: Ic9c3f75ee717f0125960c813df442ed4fbcceb4a
2015-03-11 17:27:39 -07:00
gregoire-astruc
a360958be3 Implementation of a buffer release strategy.
* Tests for Release feature.
* Check vector_downward.buf_ before passing to deallocator.
* Assertions.
* Shared test between unique_ptr and GetBufferPointer()
* Unnecessary using directives.
* Reallocate vector if released on clear operation.
* Use allocator attribute.
* Renamed `Release()` to `ReleaseBufferPointer()`
* For consistency with `GetBufferPointer()`
* Updated documentation for ReleaseBuffer.

Change-Id: I108527778e56ae5127abf9e5b1be6b445ad75cb7
2015-03-11 17:27:38 -07:00
loverszhaokai
432f3f26a4 Added Copyright headers
Change-Id: I106de8985cea572590d49c896b72c54f33e73bd2
2015-03-11 17:27:38 -07:00
Wouter van Oortmerssen
6ccdfff0af Android build script works with pre-releases present.
build_apk.sh assumed pre-releases would be sorted towards the end,
but instead they end up at the front (sort -n) causing the api
selection loop to halt early.

bug: 19213196
Change-Id: I210a18c16e81880229f154c4613f8b97d90ac9bd
tested: on Linux.
2015-03-09 14:04:30 -07:00
Grégoire Astruc
71e97b7123 Fixed C# Table.cs to work with Mono.
Cast to short for mono compatibility.

Change-Id: I568059a21369b895fa52002fa231f7594f0f736c
2015-02-23 15:57:35 -08:00
Alex Ames
c243aa4e15 Merge "Added the hash attribute to ints and longs." into ub-games-master 2015-02-17 22:58:04 +00:00
Alex Ames
d575321eba Added the hash attribute to ints and longs.
FlatBuffer schema files can now optionally specify a hash attribute that
will allow someone writing json files to enter a string to be hashed
rather than a specific value. The hashing algorithm to use is specified
by the schema.

Currently the only algorithms are fnv1 and fnv1a. There are 32 bit and
64 variatns for each. Additionally, a hashing command line tool was
added so that you can see what a string will hash to without needing to
inspect the flatbuffer binary blob.

Change-Id: I0cb359d0e2dc7d2dc1874b446dc19a17cc77109d
2015-02-17 14:10:18 -08:00
Stefan Eilemann
f353fd8864 Fix pointer underrun when allocating large vectors
Change-Id: Ia69fc3098468eb64420215dc1068342ccbbb1ede
2015-02-13 10:35:08 -08:00
Hyungjin Kim
c9a840e935 Change nested_root accessor to be const function.
The `<field>_nested_root()` is not viable from const object. (We usually get `const Monster *`.)

Change-Id: I0d0adcb38dd974318608417ee3094c34fb9c480d
2015-02-11 10:54:03 -08:00
Alex Ames
620fe1c5cf Merge "Call $(strip) on parameters so newlines work." into ub-games-master 2015-02-10 00:56:55 +00:00
Alex Ames
69dae32776 Call $(strip) on parameters so newlines work.
Added a call to $(strip) to the parameters of
`flatbuffers_header_build_rules` so that newlines can be used when
passing arguments to it.

Change-Id: Ie2149acebcef91d28ce2cb4bfd204a209b4c4e2f
2015-02-09 15:18:38 -08:00
franramirez688
da0f096ba2 Added biicode support via biicode.conf and CMake/biicode.cmake
Change-Id: Id9750cceaa57aad3c969cf12299aa60f21c29074
2015-02-09 14:57:17 -08:00
Wouter van Oortmerssen
36fe9d539f Merge "Clarified how to create a good pull request." into ub-games-master 2015-02-09 21:56:56 +00:00
Wouter van Oortmerssen
6180b5ac7a Merge "Reset minimum alignment when reusing FlatBufferBuilder" into ub-games-master 2015-02-09 17:16:38 +00:00
Wouter van Oortmerssen
42bfe240e0 Merge "added reuse option for root objects" into ub-games-master 2015-02-09 17:16:19 +00:00
Wouter van Oortmerssen
1fb0f1ef71 Clarified how to create a good pull request.
Updated CONTRIBUTING.md with some tips.

Change-Id: Id377621a98804293837fda25ef0758cf988eea37
2015-02-04 15:50:02 -08:00
Alex Ames
1c8c9438a2 Merge "Added new Android build target and makefile utils." into ub-games-master 2015-02-04 23:49:58 +00:00
Wouter van Oortmerssen
85f64786da Reset minimum alignment when reusing FlatBufferBuilder
Previously, if you were re-using instances of FlatBufferBuilder
and an earlier buffer would use a 64bit item where later ones
do not, you could be wasting space.

Change-Id: Ic8090a38f97ce73194e991ba72bcfae74a7ace9f
Tested: on Linux.
2015-02-04 15:30:47 -08:00
Florian Enner
b0910e75e0 added reuse option for root objects
getRootAs..() function now has a second implementation that
accepts an existing object to allow object reuse, much like
all other methods that refer to objects.

Change-Id: Iffef567c903a130761ef7de98867e5465d29a04d
2015-02-04 15:30:07 -08:00
Alex Ames
ff1ac8ab5a Added new Android build target and makefile utils.
Previously Android.mk only had a rule for the Flatbuffers test. There
is now an empty module definition so that flatbuffers can be included
as an Android module in other projects.

Additionally, android/jni/include.mk has been added which contains
some utility functions that can be used by projects using Flatbuffers
to generate header build rules and set up dependencies.

A sample project has been added to the samples directory to
demonstrate how to use flatbuffers with Android.

Tested by compiling Android project on Linux.

Change-Id: I25d6da40f6531777b22f7371187e0a2f4e903ad4
2015-02-04 14:39:53 -08:00
pjulien
4d3db99283 Issue #136
The satellite data of the ``ByteBuffer`` cannot be modified in
any way and stay thread safe in the presence of concurrent readers.

This implementation is simple and does introduce an allocation, however
without it multiple readers will quickly and continuously encounter
``IndexOutOfBoundsException`` exceptions.

An alternative, but possibly more controversial, implementation would
be to use ``Unsafe``.  Using ``Unsafe``, it's possible to do an
array copy with a provided buffer index.

Change-Id: I851d4034e753b3be2931ee2249ec2c82dde43135
2015-02-04 13:53:02 -08:00
Florian Enner
72b9501e69 Added force-defaults to Java bindings
Change-Id: I62d10b639112788be3b0f670280bd50ef9fcf094
2015-02-02 14:04:22 -08:00
Florian Enner
9c169083ad Added FlatBufferBuilder reuse
init resets internal variables, but keeps memory that has been allocated
for temporary storage

Change-Id: If2aa7d27de3c2717cf4c82b1e4e4b6732e495cea
2015-02-02 14:02:22 -08:00
Wouter van Oortmerssen
7bebaab69e Added "raw struct" results to benchmark.
Change-Id: I95c550df7019645b02417259522c7049865997cc
Tested: on Windows.
2015-02-02 14:02:21 -08:00
Gabriel Martinez
d8117bb8a3 Merge "Add options to print build rule dependencies" into ub-games-master 2015-02-02 17:01:39 +00:00
Gabriel Martinez
df4909e5f6 Add options to print build rule dependencies
Tested: on Linux

Bug: 16465909
Change-Id: I2f1a6def13e47716110426b00990c2c625c03251
2015-01-28 11:27:05 -08:00
Wouter van Oortmerssen
79c2d80ed4 Fix for previous Java commit.
optimization would cause vtable fields from previous tables to be written.

Bug: 19046968
Change-Id: I781f7bcbceeaec0b499d4f1e4e5e8a1e750e0707
Tested: on Linux.
2015-01-26 14:12:20 -08:00
Wouter van Oortmerssen
3e1b789d21 Applied Java namespace filename fix to Go.
Bug: 19067493
Change-Id: Ib32fef963306e27834c15e3bbabc60570924c1a9
Tested: on Linux.
2015-01-26 13:45:33 -08:00
Wouter van Oortmerssen
cf7135ff58 Reducing garbage produced by Java serializer.
startObject() now only allocates a new vtable array when it needs to grow.

Tested: on Linux.

Change-Id: Idd041605afcb9487a34d63bda067172d797f437a
2015-01-26 13:35:20 -08:00
Wouter van Oortmerssen
f60276f54b Fixed flatc not writing Java files without namespace.
If the schema didn't contain a namespace, paths would contain a
leading /, causing files not to be written.

Change-Id: I508772cbf6d18d464ef7d9f8842d0dbff14358a3
Tested: on Linux.
Bug: 19067493
2015-01-26 13:08:44 -08:00
pjulien
2b01247b30 PR for issue #130. Improves the javadoc of `FlatBufferBuilder`
and marks ``dataStart`` deprecated.

Change-Id: I48409e20948117c5cf17a1bfabecf64b033eab27
2015-01-26 13:08:44 -08:00
Hiroshi Matsunaga
7cf74cb864 cursor_ is not directly represent the hexadecimal
Change-Id: Ibdbd0e2f85284c1443403ed8c43acbd6e9de635f
2015-01-26 13:08:44 -08:00
Wouter van Oortmerssen
4fb5a764df Support for booleans in the Java/C# API
Change-Id: I72e92183a7b5f4145ea51fcec29257dc9553a461
2015-01-26 13:08:44 -08:00
Wouter van Oortmerssen
6c2dc41e0d Parser will allow a table or vector to have a trailing comma.
Unless in --strict-json mode.
Also added strict_json option to the parser, which in
addition controls if field names without quotes are allowed.

Change-Id: Id56fe5c780bdb9170958050ffa8fa23cf2babe95
Tested: on Linux.
2015-01-21 11:18:01 -08:00
Wouter van Oortmerssen
e568f17096 Fixed C# SizedByteArray copying leading bytes of ByteBuffer.
Tested: on Windows.

Change-Id: I946dacf799eae835ec041ea759622f74b0384937
2015-01-16 15:36:25 -08:00
Patrick Julien
1263e9788e Add a simple Maven file modeled after
https://github.com/google/protobuf/blob/master/java/pom.xml

This isn't good enough to publish to Maven Central but will at
least allow users to publish to their local maven repository
using 'mvn install'

Change-Id: I91ea146cf7c5263fcf5d9823f70bb1ef0158f9a6
Tested: 'mvn install' runs succesfully and produces a .jar
2015-01-16 11:39:23 -08:00
Patrick Julien
f5132b9ee1 Ignore intellij files
Change-Id: I34ea778fc791ecce3a8948de51dea6fe4389a3c6
2015-01-16 11:09:06 -08:00
Patrick Julien
c95ad9cc55 Reuse the same charset instance
Change-Id: I58b411a2c0f1ee6b856d5b1eaa42787036da1384
2015-01-16 11:05:58 -08:00
Wouter van Oortmerssen
3550899987 Sorted Vector & binary search functionality.
Bug: 16659276
Tested: on Linux & Windows.

Change-Id: Ie7a73810345fad4cf0a3ad03dfaa5464e3ed5ac8
2015-01-16 10:59:52 -08:00
Wouter van Oortmerssen
73582b145c Fixed C# showing up as C in the documentation
Change-Id: Id1cc75cee07fa2d3de3e7d346f6e2641e4692968
2015-01-07 16:30:10 -08:00
Wouter van Oortmerssen
b929c62c71 Added clarification about unions in JSON to the docs.
Change-Id: I1f310636f8b74366b5b0fc73c7e106424583fc93
2015-01-07 15:42:43 -08:00
Leander Bessa Beernaert
3ec8d7f598 Added option FLATBUFFERS_BUILD_FLATC
When FLATBUFFERS_BUILD_FLATC is set to OFF, the flatbuffer compiler
and tests will not be build.

Change-Id: I42b87b71daab4cb9c06605c813e7e4b62d6bf67a
2015-01-07 15:41:59 -08:00
Wouter van Oortmerssen
352b743c71 Union verification functions were not correctly namespaced.
Bug: 18908613
Change-Id: Ifed8a33b6b976b64eed9d190d930b08de1d5f41e
Tested: on Linux.
2015-01-07 13:37:25 -08:00
Wouter van Oortmerssen
b7cb91c34e Made CreateUninitializedVector return the buffer.
Previously, obtaining the buffer was unclear and required multiple
casts.

Change-Id: I18e01c9e669886ac250e83aad10623cbddd629b6
Tested: on Linux.
2015-01-07 13:37:25 -08:00
Wouter van Oortmerssen
f79cc460f8 Merge changes Id7618e53,Ieddc3c5c into ub-games-master
* changes:
  non-generic version of CreateUninitializedVector for c ffi
  cast literal to csize to fix error
2015-01-07 19:25:59 +00:00
Jon Simantov
757854a6cd Merge "C#: Allow ByteBuffer to use faster unsafe mode" into ub-games-master 2015-01-07 19:07:03 +00:00
dyu
6f4b4c80a7 non-generic version of CreateUninitializedVector for c ffi
Change-Id: Id7618e53797a158b82e7e480a6507887db3528bc
2015-01-07 10:47:26 -08:00
dyu
ae1763e226 cast literal to csize to fix error
Change-Id: Ieddc3c5cd4f7c97a9739ae3046b8a1b328180ae1
2015-01-07 10:47:19 -08:00
dyu
aa46f0e4c2 update generated sources
Change-Id: I531c26572fca7fca9805178971d7e110d44627d8
2015-01-07 10:34:17 -08:00
Wouter van Oortmerssen
89d2b0861b Documentation clarifications.
Change-Id: I7dc4bb3bbe32c6fe83a013790391fba0df8f4888
2015-01-07 10:34:17 -08:00
Jon Simantov
4390254e6a C#: Allow ByteBuffer to use faster unsafe mode
If your C# runtime environment supports unsafe mode, you can use
the #define UNSAFE_BYTEBUFFER setting and build the FlatBuffers assembly
in unsafe mode for greatly increased performance.

Tested: Tested FlatBuffersTest on Windows using VS2010 with both safe
and unsafe versions. Added ByteBufferTest to test the byte reversing
functions.

Change-Id: I21334468b339334f9abf4317e6291b648b97f57b
2015-01-06 12:39:17 -08:00
Wouter van Oortmerssen
3a27013732 Merge "Added CONTRIBUTING.md file." into ub-games-master 2014-12-09 02:03:07 +00:00
Wouter van Oortmerssen
d72c478128 Merge "Added VectorLength helper function that works on nullptr." into ub-games-master 2014-12-09 02:01:31 +00:00
Wouter van Oortmerssen
10f4ecac26 Merge "Fixed missing virtual destructor in allocator." into ub-games-master 2014-12-09 02:01:21 +00:00
Wouter van Oortmerssen
27823d5552 Merge "Fixed Java ByteBuffer accessors generated for non-scalar vectors." into ub-games-master 2014-12-09 02:01:12 +00:00
Wouter van Oortmerssen
19361a58ec Merge "Generate C++ function returning the file_identifier of a flatbuffer" into ub-games-master 2014-12-09 02:00:58 +00:00
Wouter van Oortmerssen
c6c8a9ba29 Merge "Various documentation clarifications." into ub-games-master 2014-12-09 02:00:47 +00:00
Wouter van Oortmerssen
14eaddfdcc Added CONTRIBUTING.md file.
Change-Id: Ie187065698dfb6ba9d989e9d2c48bdd7cb870e89
2014-12-08 17:48:06 -08:00
Wouter van Oortmerssen
8833cff911 Added VectorLength helper function that works on nullptr.
Change-Id: Ie62096f7337a476bee7a6d46d652e594fb3124d2
Tested: on Linux.
Bug: 18201051
2014-12-08 17:32:26 -08:00
Wouter van Oortmerssen
318668aed6 Fixed missing virtual destructor in allocator.
Change-Id: I458249d95e6d65ac039e84d947d2fdf4fd1c3809
Tested: on Linux.
2014-12-08 17:19:29 -08:00
Wouter van Oortmerssen
9566669245 Fixed Java ByteBuffer accessors generated for non-scalar vectors.
Change-Id: I9787ab88e5bd4846d92995e2bb05d0c2121113ca
Tested: on Linux.
2014-12-08 17:14:38 -08:00
Lars Magnusson
354fd906a5 Generate C++ function returning the file_identifier of a flatbuffer
Change-Id: I6ee09cf1e86a41b73bb3aa79b68871afb1a4e34f
2014-12-08 17:00:56 -08:00
Wouter van Oortmerssen
2d9b3ade18 Various documentation clarifications.
Change-Id: Ibc2bd88a636f3b4abf82a7c2722fc1e354dab848
Tested: on Linux.
2014-12-08 16:47:00 -08:00
Robert Segal
ced2cb6ce9 [fix] removed some source files included multiple times causing duplicate symbol compilation errors
Change-Id: I72aa590a0dc13771ca2f17857824f8b6fd76c78f
2014-12-08 16:29:15 -08:00
Wouter van Oortmerssen
285501f7be Added "final" to generated types to block inheritance.
People sometimes accidentally inherit from these types.

Bug: 18224703
Change-Id: Ia09489a834ac4941f9b4a46f240cbdcf456f03a1
Tested: on Windows and Linux.
2014-11-19 13:41:15 -08:00
Wouter van Oortmerssen
0952143971 Added user defined attribute declarations.
This is such that if you mis-spell an attribute, it doesn't get
silently ignored.

Bug: 18294628
Change-Id: I10013f5b2a21048b7daba2e9410678f528e09761
Tested: on Linux.
2014-11-19 11:06:17 -08:00
Wouter van Oortmerssen
0ce53c96c3 Clarified note on multi-threading in the docs.
Change-Id: Ib36ec71aab02fc66d2a6d0c916ebfa4dd1d0d02f
2014-11-19 11:06:17 -08:00
Jon Simantov
d6f70cdd7d Fix FlatBuffersTest build on Android by adding missing file.
Change-Id: I5333d45ac43cbba61473bd8ba5b44aedb696a25c
Tested: FlatBuffersTest now builds on Android under Windows.
2014-11-19 10:57:34 -08:00
Zbigniew Mandziejewicz
07d5965c81 Fixes #90 - flatc chokes on IDL files starting with a comment
Change-Id: I5ab692ceb6809493720c1bff69a2e3210efd4618
2014-11-07 16:21:20 -08:00
Wouter van Oortmerssen
6ca102e413 Made the memcmp address sanitizer clean.
Added extra check to ensure memcmp gets called with a size that is
guaranteed within range of the buffer. This wasn't a real problem,
but stops address sanitizer from complaining.

See:
https://github.com/google/flatbuffers/issues/88
517506b4e1 (commitcomment-8265231)

Change-Id: I7de24da2d36d973e154f92eeb3e093070886037f
Tested: on Linux
2014-11-07 15:24:22 -08:00
Wouter van Oortmerssen
8ef6ee2a3e Fixed required field checking incorrectly using unsigned offsets.
Reported by: https://github.com/google/flatbuffers/issues/99

Change-Id: Ia26da95bbac189836c257fa85f3bec1b153b6207
Tested: on Linux.
2014-11-07 14:36:49 -08:00
Luna
118abc2871 Fix a build error on 32 bit go
Change-Id: Iac5894fd8f56da7e420714558a94d63d4fea2d72
2014-10-29 10:42:10 -07:00
Wouter van Oortmerssen
fbcf063401 Fixed boilerplate copyright message in LICENSE.txt
Change-Id: I85e8a6bf2fd1ce04271e8afc5083fd47502e5075
2014-10-27 17:48:29 -07:00
Wouter van Oortmerssen
e97f38e53c Added support for custom allocators and uninitialized vectors.
This is helpful working with zero-copy use cases.

Bug: 15779698
Change-Id: I7097651ca9a432b5021b4e024da86398d1413ec7
Tested: on Linux and Windows.
2014-10-24 16:21:36 -07:00
Wouter van Oortmerssen
4cdf3eb19b Made CMakeLists.txt compatible with older versions of CMake.
By replacing DIRECTORY by PATH:
http://www.cmake.org/cmake/help/v3.0/command/get_filename_component.html

Change-Id: I6f5802deeda53dea443b255294235e43e7bb5389
Tested: on Linux.
2014-10-24 14:58:32 -07:00
Wouter van Oortmerssen
ea592296b8 Various documentation improvements.
Change-Id: Iacea45ae0f602f49e46de472286a7a77ee20c301
2014-10-24 14:58:32 -07:00
Wouter van Oortmerssen
d426890b92 Fixed big-endian issue.
Noticed a memory read that isn't big-endian safe. Was somewhat
benign in that it would have simply caused vtable duplication
when constructing a FlatBuffer on a big-endian machine.

Change-Id: I5de3a2bb3ce6912fdd845ed40668719794920cac
2014-10-22 13:35:24 -07:00
Wouter van Oortmerssen
1e4d28bf14 Fixed missing files in Xcode project.
Change-Id: I3480de9157fd6d0eeb123e77e448bd57c75c74ad
Tested: on OS X
2014-10-22 11:58:54 -07:00
Wouter van Oortmerssen
0eac15c784 Added fenced code blocks to the C++/Java/Go docs for syntax highlighting.
Change-Id: I504915c6b5367e8c05dc056463158b8420ad8c5e
Tested: on Linux.
2014-10-15 17:42:31 -07:00
Wouter van Oortmerssen
d38b9af243 Added .proto parsing and convertion to .fbs.
Bug: 15777858
Change-Id: Iabef9b8c8044e593bb89510feebdee00d2f1840b
Tested: on Linux and Windows.
2014-10-15 17:42:31 -07:00
Wouter van Oortmerssen
18cf19f876 Fixed bug in convenient constructors for Java/C#
Also fixed Go unit tests not being up to date with recent schema
changes.

Change-Id: I42e619f9c5ea05f6f937c68a5c8a92462c46bce3
Tested: on Linux and Windows.
2014-09-25 15:53:56 -07:00
Gabriel Martinez
730c0cadde Output multiline doc comments over multiple lines
Tested: on Linux

Bug: 15779934
Change-Id: I6f822f1705e443d8721ea208dcb021aad3c8715c
2014-09-25 11:17:53 -07:00
rw
ef03cf46e4 Fix vector of strings for Go
Mirrors Java patch 39d4b7e2bf

Change-Id: If8d0ab29f6eb508a156d468aeb0a9d5410149e53
2014-09-23 17:25:50 -07:00
Wouter van Oortmerssen
7b8053570e Enums in C++ are now strongly typed.
Accessors and constructors now take enum types rather than ints.

Bug: 16570507
Change-Id: I4b50fd64ad2e662ea2481bc0ccea784326fb31c0
Tested: on Linux and Windows.
2014-09-23 17:25:50 -07:00
Wouter van Oortmerssen
85c9c83844 Made flatc error messages look like what other compilers output.
Looks like MSVC on Windows and like gcc everywhere else.
For enhanced IDE clickability.

Bug: 17208371
Change-Id: Ie3e02658fccd3edfd464b4bacf4bc68c613a8570
Tested: on Linux and Windows.
2014-09-23 17:19:01 -07:00
Wouter van Oortmerssen
30642c5a6f Added option to flatc to generate dependent header statements.
Bug: 17322776
Change-Id: I3a4d3cb4ccd40bc3200a87653aa0ab8ecb90ce60
Tested: on Linux.
2014-09-23 14:13:35 -07:00
Wouter van Oortmerssen
517c964fe2 Support for required fields.
Change-Id: I560c7ca11b3d665eecafb528f3737b7e139ca9b0
Tested: on Linux and Windows.
2014-09-22 15:53:19 -07:00
Zbigniew Mandziejewicz
3f8700b296 Generate headers from spec, add option for installing targets
Change-Id: I16ddb06e887e618fa871e842054115909fbf235c
2014-09-22 15:53:19 -07:00
Gabriel Martinez
048638a971 Add enum name lookup method to Java/C# enums
Tested: on Linux for Java and C#

Bug: 15781151
Change-Id: I7cb97bcc01d986cac2b24aaf7cb29521ddaa2f6b
2014-09-22 15:10:48 -07:00
Wouter van Oortmerssen
d6ed127cf4 Added convenient create functions for Java/C#.
Bug: 15777857
Tested: on Linux and Windows.

Change-Id: I25db724349e2c801bb0e41137540507acd57cd03
2014-09-19 13:51:33 -07:00
Wouter van Oortmerssen
bdaedebef9 Added general codegen to Xcode project.
Change-Id: I5e21a08fe4b93382e5fbc3b911de5634b7aa88b9
Tested: on OS X.
2014-09-18 15:26:49 -07:00
Wouter van Oortmerssen
557c88c039 Refactored the Java and C# code generators into one.
Also made the C# implementation support unsigned types, and
made it more like the Java version.

Bug: 17359988
Change-Id: If5305c08cd5c97f35426639516ce05e53bbec36c
Tested: on Linux and Windows.
2014-09-18 12:29:31 -07:00
Wouter van Oortmerssen
d01b30cdd6 Added C# generator to Xcode project.
Change-Id: I54ce51f16043664d706a79d1b31f2569f3311b70
Tested: on OS X
2014-09-16 16:40:30 -07:00
Wouter van Oortmerssen
c01c77a7f2 Prepended com.google to the Java namespace.
Bug: 16507831
Change-Id: I5beee18f63f174e425dc1ab395807b578d5f9477
Tested: on Linux.
2014-09-15 17:45:15 -07:00
Wouter van Oortmerssen
0a549e3875 Added missing assert.h to util.h.
This was only causing compiler errors on certain compiler configurations.

Change-Id: I110fb8c896f74aae7ef739e9a29c636393dbbde2
Tested: on Linux and Windows.
2014-09-15 16:27:21 -07:00
Wouter van Oortmerssen
e57b86bb9f The parser and flatc now allow include directories to be specified.
Bug: 17139854
Change-Id: I0eac65d054951e00a8811ad1d80ba8c37012dbf0
Tested: on Linux.
2014-09-15 16:19:27 -07:00
Wouter van Oortmerssen
cb58fc6fa1 Added convenient vector from array construction for Java.
Change-Id: Ib3fd576cf9fa4b4058a9fd1bbe24a0859bc3917a
Tested: on Linux.
2014-09-15 16:19:27 -07:00
Wouter van Oortmerssen
858e9961e2 Added accessor in Java to get vectors as ByteBuffers.
Also cleaned up ByteBuffer usage in general: ByteBuffer.position
now universally indicates the start of a ByteBuffer.

Change-Id: Ic4bfb98f9df9501b8fc82de2c45db7d7311135ac
Tested: on Linux.
2014-09-15 16:19:26 -07:00
Wouter van Oortmerssen
32f2c1c3b9 Fixed test that was incompatible with 64bit offsets.
Change-Id: I35984d0ab3e849bec6cdaa364a39f66f2c37b4d0
Tested: on Linux.
2014-09-15 16:13:49 -07:00
bml13
e14bc1d9ac Removed the use of b.array() to support DirectBuffers.
Also removed Table extend Constants.

Change-Id: I1770b613c58094fa572a3b26a31f01bd5fb8fdbf
2014-09-15 16:13:49 -07:00
evolutional
9a1f7be6fd Initial commit of .NET port of FlatBuffers
Include C# codegen in flatc and .NET FlatBuffer access via the
FlatBufferBuilder class

Tested: on Windows.

Change-Id: If5228a8df60a10e0751b245c6c64530264ea2d8a
2014-09-15 16:13:27 -07:00
Stewart Miles
3f85183c88 Added option to disable build of tests and samples.
Added FLATBUFFERS_BUILD_TESTS option which can be used to disable
the build of flatbuffers tests and samples.

Tested:
Verified tests and samples are no longer built on Linux when
FLATBUFFERS_BUILD_TESTS=OFF.

Change-Id: Ic23ab827849ba2c4481de9ca86adc1ab8e6b828c
2014-09-10 16:01:13 -07:00
Wouter van Oortmerssen
354aad4bc5 Made FlatBufferBuilder.java require ByteBuffers that have an array.
Readonly ByteBuffers and Direct ByteBuffers don't have a backing
array, and thus can't be used for writing FlatBuffers (though
they are fine for reading).

Change-Id: I4d7b9cc222b96161d0f8e92f34588bd3e0e38034
Tested: on Linux.
2014-09-05 13:48:02 -07:00
Wouter van Oortmerssen
f57d012a21 Non-alpha-numeric characters are filtered out of include guards
Since part of it is based on the filename, which may contain
characters that are not legal identifiers.

Change-Id: I62b8fe228a434a2040fd4ce47d220fc4d3398b41
Tested: on Linux.
2014-09-05 11:27:03 -07:00
Wouter van Oortmerssen
f5e343efba A generated C++ function was missing "inline".
This would cause double definition linker errors when included in
multiple compilation units.

Change-Id: Ie6fd4af018055a099343182a92a7776f2fea4725
Tested: on Linux.
2014-09-05 10:56:16 -07:00
Wouter van Oortmerssen
b5edc2dea5 Fixed JSON text output not finding symbolic names for enum value 1.
Change-Id: If3a062926dd86b95fa68ed64fc7ee2de7bc0d930
Tested: on Linux
2014-09-05 10:54:52 -07:00
Wouter van Oortmerssen
09a2999c66 Implemented the file identifier functionality for Java.
Also fixed flatc not outputting these identifiers for files
compiled on the command-line.

Bug: 16983987
Change-Id: I8b714cfea3a8e144fa52133f62b2f7eda6eb044a
Tested: on Linux
2014-09-05 10:54:52 -07:00
Wouter van Oortmerssen
96592d5dbb Made Vector have a size() function, to make it more STL-alike.
Bug: 17316346
Change-Id: I52377b7fa51adccadc4e867d45666e683bc2c1ae
Tested: on Linux.
2014-09-04 17:35:24 -07:00
Wouter van Oortmerssen
84f86be700 Changed hard-coded constant in JavaTest to enum value.
Change-Id: I7d2eac7fed6c36c966670a3e58f4dae7dff25029
Tested: on Linux.
2014-09-04 17:35:24 -07:00
rw
417cb878c3 Fixed possible alignment issue in Go
Java patch with same purpose:
cdb0dca39d

Change-Id: I57d268cc0064843779eb7812a9e69326d9ab2498
Tested: on Darwin
2014-09-04 17:35:08 -07:00
Wouter van Oortmerssen
11f2538610 Made "field set more than once" check in JSON parser faster.
Change-Id: I3ecc1aa610526c270faa56cc5266f14cd81db247
Tested: on Linux.
2014-09-04 16:36:41 -07:00
617 changed files with 107758 additions and 11316 deletions

View File

@@ -0,0 +1,40 @@
:: Copyright 2018 Google Inc. All rights reserved.
::
:: Licensed under the Apache License, Version 2.0 (the "License");
:: you may not use this file except in compliance with the License.
:: You may obtain a copy of the License at
::
:: http://www.apache.org/licenses/LICENSE-2.0
::
:: Unless required by applicable law or agreed to in writing, software
:: distributed under the License is distributed on an "AS IS" BASIS,
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
:: See the License for the specific language governing permissions and
:: limitations under the License.
set buildtype=Release
if "%1"=="-b" set buildtype=%2
cd tests
call generate_code.bat -b %buildtype% || goto FAIL
:: TODO: Release and Debug builds produce differences here for some reason.
git checkout HEAD -- monster_test.bfbs
git -c core.autocrlf=true diff --exit-code --quiet || goto :DIFFFOUND
goto SUCCESS
:DIFFFOUND
@echo "" >&2
@echo "ERROR: ********************************************************" >&2
@echo "ERROR: The following differences were found after running the" >&2
@echo "ERROR: tests/generate_code.sh script. Maybe you forgot to run" >&2
@echo "ERROR: it after making changes in a generator or schema?" >&2
@echo "ERROR: ********************************************************" >&2
@echo "" >&2
@git -c core.autocrlf=true --no-pager diff --binary
:FAIL
set EXITCODE=1
:SUCCESS
cd ..
EXIT /B %EXITCODE%

18
.bazelci/presubmit.yml Normal file
View File

@@ -0,0 +1,18 @@
---
buildifier: latest
platforms:
ubuntu1604:
build_targets:
- "..."
test_targets:
- "..."
ubuntu1804:
build_targets:
- "..."
test_targets:
- "..."
macos:
build_targets:
- "..."
test_targets:
- "..."

13
.clang-format Normal file
View File

@@ -0,0 +1,13 @@
---
Language: Cpp
BasedOnStyle: Google
DerivePointerAlignment: false
PointerAlignment: Right
IndentPPDirectives: AfterHash
Cpp11BracedListStyle: false
AlwaysBreakTemplateDeclarations: false
AllowShortCaseLabelsOnASingleLine: true
SpaceAfterTemplateKeyword: false
AllowShortBlocksOnASingleLine: true
...

7
.editorconfig Normal file
View File

@@ -0,0 +1,7 @@
root = true
# Don't set line endings to avoid conflict with core.autocrlf flag.
# Line endings on checkout/checkin are controlled by .gitattributes file.
[*]
indent_style = space
indent_size = 2
insert_final_newline = true

1
.gitattributes vendored Executable file → Normal file
View File

@@ -1 +1,2 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

12
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,12 @@
Thank you for submitting an issue!
Please make sure you include the names of the affected language(s), compiler version(s), operating system version(s), and FlatBuffers version(s) in your issue title.
This helps us get the correct maintainers to look at your issue. Here are examples of good titles:
- Crash when accessing FlatBuffer [C++, gcc 4.8, OS X, master]
- Flatc converts a protobuf 'bytes' field to 'string' in fbs schema file [all languages, FlatBuffers 1.4]
Include other details as appropriate.
Thanks!

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,16 @@
Thank you for submitting a PR!
Please make sure you include the names of the affected language(s) in your PR title.
This helps us get the correct maintainers to look at your issue.
If you make changes to any of the code generators, be sure to run
`cd tests && sh generate_code.sh` (or equivalent .bat) and include the generated
code changes in the PR. This allows us to better see the effect of the PR.
If your PR includes C++ code, please adhere to the Google C++ Style Guide,
and don't forget we try to support older compilers (e.g. VS2010, GCC 4.6.3),
so only some C++11 support is available.
Include other details as appropriate.
Thanks!

79
.gitignore vendored Executable file → Normal file
View File

@@ -5,23 +5,34 @@
*.o.d
*.class
*.a
*.swp
*~
*.vcxproj
*.vcxproj.filters
*.vcxproj.user
*.sln
*.suo
*.opendb
*.keystore
**/.vs/**
**/bin/**
!tests/rust_usage_test/bin/**
**/gen/**
**/libs/**
**/obj/**
**/*.dir/**
**/CMakeFiles/**
**/cmake_install.cmake
**/install_manifest.txt
**/CMakeCache.txt
**/CMakeTestfile.cmake
**/CPackConfig.cmake
**/CPackSourceConfig.cmake
**/compile_commands.json
**/Debug/**
**/Release/**
**/RelWithDebInfo/**
**/x64/ #build artifacts from VS
build.xml
local.properties
project.properties
@@ -29,13 +40,79 @@ proguard-project.txt
linklint_results
Makefile
flatc
flatc.exe
flathash
flathash.exe
flattests
flattests.exe
flatsamplebinary
flatsamplebinary.exe
flatsampletext
flatsampletext.exe
flatsamplebfbs
flatsamplebfbs.exe
grpctest
grpctest.exe
snapshot.sh
tags
tests/dart_gen
tests/go_gen
tests/monsterdata_java_wire.mon
tests/monsterdata_java_wire_sp.mon
tests/monsterdata_go_wire.mon
tests/monsterdata_javascript_wire.mon
tests/monsterdata_lobster_wire.mon
tests/monsterdata_rust_wire.mon
tests/unicode_test.mon
tests/ts/
tests/php/
CMakeLists.txt.user
CMakeScripts/**
CTestTestfile.cmake
FlatbuffersConfigVersion.cmake
FlatBuffers.cbp
build/Xcode/FlatBuffers.xcodeproj/project.xcworkspace/**
build/Xcode/FlatBuffers.xcodeproj/xcuserdata/**
FlatBuffers.xcodeproj/
java/.idea
java/*.iml
.idea
*.iml
target
**/*.pyc
build/VS2010/FlatBuffers.sdf
build/VS2010/FlatBuffers.opensdf
build/VS2010/ipch/**/*.ipch
*.so
Testing/Temporary
.cproject
.settings/
.project
net/**/obj
node_modules/
android/.externalNativeBuild/
android/.gradle/
android/build/
samples/android/.externalNativeBuild/
samples/android/.gradle/
samples/android/build/
js/flatbuffers.mjs
/bazel-bin
/bazel-flatbuffers
/bazel-genfiles
/bazel-out
/bazel-testlogs
.ninja_deps
.ninja_log
build.ninja
rules.ninja
.vscode
dart/.pub/
dart/.packages
dart/pubspec.lock
dart/.dart_tool/
dart/build/
dart/doc/api/
Cargo.lock
.corpus**
.seed**

186
.travis.yml Normal file
View File

@@ -0,0 +1,186 @@
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-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 CONAN=true
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:
- 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 . -- -j${JOBS}
- LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/google/grpc/install/lib ctest --extra-verbose --output-on-failure
- bash .travis/check-generate-code.sh
- if [ "$CONAN" == "true" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo pip install conan && conan create . flatbuffers/${TRAVIS_BRANCH}@google/testing -s build_type=$BUILD_TYPE -tf conan/test_package; fi
- language: cpp
os: osx
osx_image: xcode9.3
env:
matrix:
- BUILD_TYPE=Debug
- BUILD_TYPE=Release
script:
- 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
- bash .travis/check-generate-code.sh
- <<: *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_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-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
env: CONAN_APPLE_CLANG_VERSIONS=10.0
- language: android
sudo: true
android:
components:
- tools
- platform-tools
- build-tools-25.0.2
- android-25
- extra-android-m2repository
compiler:
- gcc
before_install:
# Output something every 10 minutes or Travis kills the job
- while sleep 540; do echo "=====[ $SECONDS seconds still running ]====="; done &
- git clone https://github.com/urho3d/android-ndk.git $HOME/android-ndk-root
- export ANDROID_NDK_HOME=$HOME/android-ndk-root
# Setup environment for Linux build which is required to build the sample.
- 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:
- failed=0; for build_gradle in $(git ls-files | grep build.gradle); do ( cd "$(dirname "${build_gradle}")" && ./gradlew build ) || failed=1; done; exit $((failed))
# Kill the sleep loop
- kill %1

View File

@@ -0,0 +1,40 @@
#!/bin/bash
#
# Copyright 2018 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
# build flatc on debian once to speed up the test loop below
docker build -t build_flatc_debian_stretch -f tests/docker/Dockerfile.testing.build_flatc_debian_stretch .
BUILD_CONTAINER_ID=$(docker create --read-only build_flatc_debian_stretch)
docker cp ${BUILD_CONTAINER_ID}:/code/flatc flatc_debian_stretch
for f in $(ls tests/docker/languages | sort)
do
# docker pull sometimes fails for unknown reasons, probably travisci-related. this retries the pull we need a few times.
REQUIRED_BASE_IMAGE=$(cat tests/docker/languages/${f} | head -n 1 | awk ' { print $2 } ')
set +e
n=0
until [ $n -ge 5 ]
do
docker pull $REQUIRED_BASE_IMAGE && break
n=$[$n+1]
sleep 1
done
set -e
docker build -t $(echo ${f} | cut -f 3- -d .) -f tests/docker/languages/${f} .
echo "TEST OK: ${f}"
done

34
.travis/check-generate-code.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
#
# Copyright 2018 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
cd tests
./generate_code.sh
cd ..
# TODO: Linux and macos builds produce differences here for some reason.
git checkout HEAD -- tests/monster_test.bfbs
if ! git diff --quiet; then
echo >&2
echo "ERROR: ********************************************************" >&2
echo "ERROR: The following differences were found after running the" >&2
echo "ERROR: tests/generate_code.sh script. Maybe you forgot to run" >&2
echo "ERROR: it after making changes in a generator or schema?" >&2
echo "ERROR: ********************************************************" >&2
echo >&2
git diff --binary --exit-code
fi

33
.travis/check-sources.sh Normal file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
#
# Copyright 2018 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
if [ -n "$1" ]; then
scan_dir="$1"
else
scan_dir="$( pwd )"
fi
py_checker="$0.py"
echo "scan root directory = '$scan_dir'"
python3 --version
# Scan recursively and search all *.cpp and *.h files using regex patterns.
# Assume that script running from a root of Flatbuffers working dir.
python3 $py_checker "ascii" "$scan_dir/include" "\.h$"
python3 $py_checker "ascii" "$scan_dir/src" "\.cpp$"
python3 $py_checker "ascii" "$scan_dir/tests" "\.h$"
python3 $py_checker "utf-8" "$scan_dir/tests" "\.cpp$"

View File

@@ -0,0 +1,35 @@
import os
import re
import sys
def check_encoding(encoding, scan_dir, regex_pattern):
fname = None
try:
assert encoding in ['ascii', 'utf-8'], "unexpected encoding"
cmp = re.compile(regex_pattern)
for root, dirs, files in os.walk(scan_dir):
fname = root
cmp_list = [f for f in files if cmp.search(f) is not None]
for f in cmp_list:
fname = os.path.join(root, f)
with open(fname, mode='rb') as test_file:
btext = test_file.read()
# check encoding
btext.decode(encoding=encoding, errors="strict")
if encoding == "utf-8" and btext.startswith(b'\xEF\xBB\xBF'):
raise ValueError("unexpected BOM in file")
# check LF line endings
LF = btext.count(b'\n')
CR = btext.count(b'\r')
if CR!=0:
raise ValueError("invalid line endings: LF({})/CR({})".format(LF, CR))
except Exception as err:
print("ERROR with [{}]: {}".format(fname, err))
return -1
else:
return 0
if __name__ == "__main__":
# python check-sources.sh.py 'ascii' '.' '.*\.(cpp|h)$'
res = check_encoding(sys.argv[1], sys.argv[2], sys.argv[3])
sys.exit(0 if res == 0 else -1)

12
.travis/deploy-python.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PROD_REPOSITORY="https://upload.pypi.org/legacy/"
TEST_REPOSITORY="https://test.pypi.org/legacy/"
twine upload \
--username "$PYPI_USERNAME" \
--password "$PYPI_PASSWORD" \
--repository-url "$PROD_REPOSITORY" \
"$DIR/../python/dist/"*

186
BUILD Normal file
View File

@@ -0,0 +1,186 @@
licenses(["notice"])
package(
default_visibility = ["//visibility:public"],
features = [
"-layering_check",
"-parse_headers",
],
)
exports_files([
"LICENSE",
])
load(":build_defs.bzl", "flatbuffer_cc_library")
# Public flatc library to compile flatbuffer files at runtime.
cc_library(
name = "flatbuffers",
srcs = [
"src/code_generators.cpp",
"src/idl_gen_fbs.cpp",
"src/idl_gen_general.cpp",
"src/idl_gen_text.cpp",
"src/idl_parser.cpp",
"src/reflection.cpp",
"src/util.cpp",
],
hdrs = [":public_headers"],
includes = ["include/"],
linkstatic = 1,
)
# Public C++ headers for the Flatbuffers library.
filegroup(
name = "public_headers",
srcs = [
"include/flatbuffers/base.h",
"include/flatbuffers/code_generators.h",
"include/flatbuffers/flatbuffers.h",
"include/flatbuffers/flexbuffers.h",
"include/flatbuffers/hash.h",
"include/flatbuffers/idl.h",
"include/flatbuffers/minireflect.h",
"include/flatbuffers/reflection.h",
"include/flatbuffers/reflection_generated.h",
"include/flatbuffers/stl_emulation.h",
"include/flatbuffers/util.h",
],
)
# Public flatc compiler library.
cc_library(
name = "flatc_library",
srcs = [
"src/code_generators.cpp",
"src/flatc.cpp",
"src/idl_gen_fbs.cpp",
"src/idl_parser.cpp",
"src/reflection.cpp",
"src/util.cpp",
],
hdrs = [
"include/flatbuffers/flatc.h",
":public_headers",
],
includes = [
"grpc/",
"include/",
],
)
# Public flatc compiler.
cc_binary(
name = "flatc",
srcs = [
"grpc/src/compiler/config.h",
"grpc/src/compiler/cpp_generator.cc",
"grpc/src/compiler/cpp_generator.h",
"grpc/src/compiler/go_generator.cc",
"grpc/src/compiler/go_generator.h",
"grpc/src/compiler/java_generator.cc",
"grpc/src/compiler/java_generator.h",
"grpc/src/compiler/schema_interface.h",
"src/flatc_main.cpp",
"src/idl_gen_cpp.cpp",
"src/idl_gen_dart.cpp",
"src/idl_gen_general.cpp",
"src/idl_gen_go.cpp",
"src/idl_gen_grpc.cpp",
"src/idl_gen_js_ts.cpp",
"src/idl_gen_json_schema.cpp",
"src/idl_gen_lobster.cpp",
"src/idl_gen_lua.cpp",
"src/idl_gen_php.cpp",
"src/idl_gen_python.cpp",
"src/idl_gen_rust.cpp",
"src/idl_gen_text.cpp",
],
includes = [
"grpc/",
"include/",
],
deps = [
":flatc_library",
],
)
cc_library(
name = "runtime_cc",
hdrs = [
"include/flatbuffers/base.h",
"include/flatbuffers/flatbuffers.h",
"include/flatbuffers/flexbuffers.h",
"include/flatbuffers/stl_emulation.h",
"include/flatbuffers/util.h",
],
includes = ["include/"],
linkstatic = 1,
)
# Test binary.
cc_test(
name = "flatbuffers_test",
testonly = 1,
srcs = [
"include/flatbuffers/minireflect.h",
"include/flatbuffers/registry.h",
"src/code_generators.cpp",
"src/idl_gen_fbs.cpp",
"src/idl_gen_general.cpp",
"src/idl_gen_text.cpp",
"src/idl_parser.cpp",
"src/reflection.cpp",
"src/util.cpp",
"tests/namespace_test/namespace_test1_generated.h",
"tests/namespace_test/namespace_test2_generated.h",
"tests/test.cpp",
"tests/test_assert.cpp",
"tests/test_assert.h",
"tests/test_builder.cpp",
"tests/test_builder.h",
"tests/union_vector/union_vector_generated.h",
":public_headers",
],
copts = [
"-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
"-DBAZEL_TEST_DATA_PATH",
],
data = [
":tests/include_test/include_test1.fbs",
":tests/include_test/sub/include_test2.fbs",
":tests/monster_test.bfbs",
":tests/monster_test.fbs",
":tests/monsterdata_test.golden",
":tests/prototest/imported.proto",
":tests/prototest/test.golden",
":tests/prototest/test.proto",
":tests/prototest/test_union.golden",
":tests/unicode_test.json",
":tests/union_vector/union_vector.fbs",
":tests/union_vector/union_vector.json",
],
includes = ["include/"],
deps = [
":monster_extra_cc_fbs",
":monster_test_cc_fbs",
],
)
# Test bzl rules
flatbuffer_cc_library(
name = "monster_test_cc_fbs",
srcs = ["tests/monster_test.fbs"],
include_paths = ["tests/include_test"],
includes = [
"tests/include_test/include_test1.fbs",
"tests/include_test/sub/include_test2.fbs",
],
)
flatbuffer_cc_library(
name = "monster_extra_cc_fbs",
srcs = ["tests/monster_extra.fbs"],
)

View File

@@ -0,0 +1,152 @@
# Copyright 2015 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.
# General function to create FlatBuffer build rules for the given list of
# schemas.
#
# flatbuffers_schemas: A list of flatbuffer schema files to process.
#
# schema_include_dirs: A list of schema file include directories, which will be
# passed to flatc via the -I parameter.
#
# custom_target_name: The generated files will be added as dependencies for a
# new custom target with this name. You should add that target as a dependency
# for your main target to ensure these files are built. You can also retrieve
# various properties from this target, such as GENERATED_INCLUDES_DIR,
# BINARY_SCHEMAS_DIR, and COPY_TEXT_SCHEMAS_DIR.
#
# additional_dependencies: A list of additional dependencies that you'd like
# all generated files to depend on. Pass in a blank string if you have none.
#
# generated_includes_dir: Where to generate the C++ header files for these
# schemas. The generated includes directory will automatically be added to
# CMake's include directories, and will be where generated header files are
# placed. This parameter is optional; pass in empty string if you don't want to
# generate include files for these schemas.
#
# binary_schemas_dir: If you specify an optional binary schema directory, binary
# schemas will be generated for these schemas as well, and placed into the given
# directory.
#
# copy_text_schemas_dir: If you want all text schemas (including schemas from
# all schema include directories) copied into a directory (for example, if you
# need them within your project to build JSON files), you can specify that
# folder here. All text schemas will be copied to that folder.
#
# IMPORTANT: Make sure you quote all list arguments you pass to this function!
# Otherwise CMake will only pass in the first element.
# Example: build_flatbuffers("${fb_files}" "${include_dirs}" target_name ...)
function(build_flatbuffers flatbuffers_schemas
schema_include_dirs
custom_target_name
additional_dependencies
generated_includes_dir
binary_schemas_dir
copy_text_schemas_dir)
# Test if including from FindFlatBuffers
if(FLATBUFFERS_FLATC_EXECUTABLE)
set(FLATC_TARGET "")
set(FLATC ${FLATBUFFERS_FLATC_EXECUTABLE})
else()
set(FLATC_TARGET flatc)
set(FLATC flatc)
endif()
set(FLATC_SCHEMA_ARGS --gen-mutable)
if(FLATBUFFERS_FLATC_SCHEMA_EXTRA_ARGS)
set(FLATC_SCHEMA_ARGS
${FLATBUFFERS_FLATC_SCHEMA_EXTRA_ARGS}
${FLATC_SCHEMA_ARGS}
)
endif()
set(working_dir "${CMAKE_CURRENT_SOURCE_DIR}")
set(schema_glob "*.fbs")
# Generate the include files parameters.
set(include_params "")
set(all_generated_files "")
foreach (include_dir ${schema_include_dirs})
set(include_params -I ${include_dir} ${include_params})
if (NOT ${copy_text_schemas_dir} STREQUAL "")
# Copy text schemas from dependent folders.
file(GLOB_RECURSE dependent_schemas ${include_dir}/${schema_glob})
foreach (dependent_schema ${dependent_schemas})
file(COPY ${dependent_schema} DESTINATION ${copy_text_schemas_dir})
endforeach()
endif()
endforeach()
foreach(schema ${flatbuffers_schemas})
get_filename_component(filename ${schema} NAME_WE)
# For each schema, do the things we requested.
if (NOT ${generated_includes_dir} STREQUAL "")
set(generated_include ${generated_includes_dir}/${filename}_generated.h)
add_custom_command(
OUTPUT ${generated_include}
COMMAND ${FLATC} ${FLATC_SCHEMA_ARGS}
-o ${generated_includes_dir}
${include_params}
-c ${schema}
DEPENDS ${FLATC_TARGET} ${schema} ${additional_dependencies}
WORKING_DIRECTORY "${working_dir}")
list(APPEND all_generated_files ${generated_include})
endif()
if (NOT ${binary_schemas_dir} STREQUAL "")
set(binary_schema ${binary_schemas_dir}/${filename}.bfbs)
add_custom_command(
OUTPUT ${binary_schema}
COMMAND ${FLATC} -b --schema
-o ${binary_schemas_dir}
${include_params}
${schema}
DEPENDS ${FLATC_TARGET} ${schema} ${additional_dependencies}
WORKING_DIRECTORY "${working_dir}")
list(APPEND all_generated_files ${binary_schema})
endif()
if (NOT ${copy_text_schemas_dir} STREQUAL "")
file(COPY ${schema} DESTINATION ${copy_text_schemas_dir})
endif()
endforeach()
# Create a custom target that depends on all the generated files.
# This is the target that you can depend on to trigger all these
# to be built.
add_custom_target(${custom_target_name}
DEPENDS ${all_generated_files} ${additional_dependencies})
# Register the include directory we are using.
if (NOT ${generated_includes_dir} STREQUAL "")
include_directories(${generated_includes_dir})
set_property(TARGET ${custom_target_name}
PROPERTY GENERATED_INCLUDES_DIR
${generated_includes_dir})
endif()
# Register the binary schemas dir we are using.
if (NOT ${binary_schemas_dir} STREQUAL "")
set_property(TARGET ${custom_target_name}
PROPERTY BINARY_SCHEMAS_DIR
${binary_schemas_dir})
endif()
# Register the text schema copy dir we are using.
if (NOT ${copy_text_schemas_dir} STREQUAL "")
set_property(TARGET ${custom_target_name}
PROPERTY COPY_TEXT_SCHEMAS_DIR
${copy_text_schemas_dir})
endif()
endfunction()

4
CMake/DESCRIPTION.txt Normal file
View File

@@ -0,0 +1,4 @@
FlatBuffers is a cross platform serialization library architected for
maximum memory efficiency. It allows you to directly access serialized
data without parsing/unpacking it first, while still having great
forwards/backwards compatibility.

View File

@@ -24,6 +24,8 @@
# for the given flatbuffer schema files.
# Returns the header files in ${Name}_OUTPUTS
set(FLATBUFFERS_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR})
find_program(FLATBUFFERS_FLATC_EXECUTABLE NAMES flatc)
find_path(FLATBUFFERS_INCLUDE_DIR NAMES flatbuffers/flatbuffers.h)
@@ -43,6 +45,7 @@ if(FLATBUFFERS_FOUND)
add_custom_command(OUTPUT ${FLATC_OUTPUT}
COMMAND ${FLATBUFFERS_FLATC_EXECUTABLE}
ARGS -c -o "${CMAKE_CURRENT_BINARY_DIR}/" ${FILE}
DEPENDS ${FILE}
COMMENT "Building C++ header for ${FILE}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endforeach()
@@ -54,3 +57,5 @@ if(FLATBUFFERS_FOUND)
else()
set(FLATBUFFERS_INCLUDE_DIR)
endif()
include("${FLATBUFFERS_CMAKE_DIR}/BuildFlatBuffers.cmake")

View File

@@ -0,0 +1,4 @@
include("${CMAKE_CURRENT_LIST_DIR}/FlatbuffersTargets.cmake" OPTIONAL)
include("${CMAKE_CURRENT_LIST_DIR}/FlatcTargets.cmake" OPTIONAL)
include("${CMAKE_CURRENT_LIST_DIR}/FlatbuffersSharedTargets.cmake" OPTIONAL)

View File

@@ -0,0 +1,11 @@
set(PACKAGE_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@")
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()

39
CMake/PackageDebian.cmake Normal file
View File

@@ -0,0 +1,39 @@
# ------------------- Debianization ---------------------
if (UNIX)
# Set build environment
SET(CPACK_GENERATOR "TGZ;DEB")
SET(CPACK_SOURCE_TGZ "ON")
# Common package information
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"FlatBuffers is an efficient cross platform serialization library for C++, with support for Java, C# and Go. It was created at Google specifically for game development and other performance-critical applications.")
SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/google/flatbuffers")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Vitaly Isaev <vitalyisaev2@gmail.com>")
SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
SET(CPACK_PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_COMMIT}")
SET(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
# Derive architecture
IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
FIND_PROGRAM(DPKG_CMD dpkg)
IF(NOT DPKG_CMD)
MESSAGE(STATUS "Can not find dpkg in your path, default to i386.")
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
ENDIF(NOT DPKG_CMD)
EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
# Package name
SET(CPACK_DEBIAN_PACKAGE_NAME "flatbuffers")
SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt)
SET(CPACK_PACKAGE_FILE_NAME
"${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
endif(UNIX)

34
CMake/PackageRedhat.cmake Normal file
View File

@@ -0,0 +1,34 @@
if (UNIX)
set(CPACK_GENERATOR "RPM")
set(CPACK_SOURCE_TGZ "ON")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "FlatBuffers serialization library and schema compiler.")
set(CPACK_RPM_PACKAGE_HOMEPAGE "https://github.com/google/flatbuffers")
set(CPACK_RPM_PACKAGE_MAINTAINER "Marc Butler <mockbutler@gmail.com>")
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
set(CPACK_PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_COMMIT}")
set(CPACK_RPM_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
set(CPACK_RPM_PACKAGE_NAME "flatbuffers")
# Assume this is not a cross complation build.
if(NOT CPACK_RPM_PACKAGE_ARCHITECTURE)
set(CPACK_RPM_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
endif(NOT CPACK_RPM_PACKAGE_ARCHITECTURE)
set(CPACK_RPM_PACKAGE_VENDOR "Google, Inc.")
set(CPACK_RPM_PACKAGE_LICENSE "Apache 2.0")
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt)
set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/CMake/DESCRIPTION.txt)
# This may reduce rpm compatiblity with very old systems.
set(CPACK_RPM_COMPRESSION_TYPE lzma)
set(CPACK_RPM_PACKAGE_NAME "flatbuffers")
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_RPM_PACKAGE_NAME}_${CPACK_RPM_PACKAGE_VERSION}_${CPACK_RPM_PACKAGE_ARCHITECTURE}")
endif(UNIX)

11
CMake/Version.cmake Normal file
View File

@@ -0,0 +1,11 @@
find_program(GIT git)
execute_process(
COMMAND ${GIT} describe
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_DESCRIBE_DIRTY
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GIT_DESCRIBE_DIRTY}")
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${GIT_DESCRIBE_DIRTY}")
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GIT_DESCRIBE_DIRTY}")
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.[0-9]+\\-([0-9]+).*" "\\1" VERSION_COMMIT "${GIT_DESCRIBE_DIRTY}")

View File

@@ -1,62 +1,222 @@
cmake_minimum_required(VERSION 2.8)
# generate compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(CheckCXXSymbolExists)
project(FlatBuffers)
# NOTE: Code coverage only works on Linux & OSX.
option(FLATBUFFERS_CODE_COVERAGE "Enable the code coverage build option." OFF)
option(FLATBUFFERS_BUILD_TESTS "Enable the build of tests and samples." ON)
option(FLATBUFFERS_INSTALL "Enable the installation of targets." ON)
option(FLATBUFFERS_BUILD_FLATLIB "Enable the build of the flatbuffers library"
ON)
option(FLATBUFFERS_BUILD_FLATC "Enable the build of the flatbuffers compiler"
ON)
option(FLATBUFFERS_BUILD_FLATHASH "Enable the build of flathash" ON)
option(FLATBUFFERS_BUILD_GRPCTEST "Enable the build of grpctest" OFF)
option(FLATBUFFERS_BUILD_SHAREDLIB
"Enable the build of the flatbuffers shared library"
OFF)
option(FLATBUFFERS_LIBCXX_WITH_CLANG "Force libc++ when using Clang" ON)
# NOTE: Sanitizer check only works on Linux & OSX (gcc & llvm).
option(FLATBUFFERS_CODE_SANITIZE
"Add '-fsanitize' flags to 'flattests' and 'flatc' targets."
OFF)
option(FLATBUFFERS_PACKAGE_REDHAT
"Build an rpm using the 'package' target."
OFF)
option(FLATBUFFERS_PACKAGE_DEBIAN
"Build an deb using the 'package' target."
OFF)
set(FlatBuffers_Compiler_SRCS
if(NOT FLATBUFFERS_BUILD_FLATC AND FLATBUFFERS_BUILD_TESTS)
message(WARNING
"Cannot build tests without building the compiler. Tests will be disabled.")
set(FLATBUFFERS_BUILD_TESTS OFF)
endif()
if(DEFINED FLATBUFFERS_MAX_PARSING_DEPTH)
# Override the default recursion depth limit.
add_definitions(-DFLATBUFFERS_MAX_PARSING_DEPTH=${FLATBUFFERS_MAX_PARSING_DEPTH})
message(STATUS "FLATBUFFERS_MAX_PARSING_DEPTH: ${FLATBUFFERS_MAX_PARSING_DEPTH}")
endif()
# Auto-detect locale-narrow 'strtod_l' function.
if(NOT DEFINED FLATBUFFERS_LOCALE_INDEPENDENT)
if(MSVC)
check_cxx_symbol_exists(_strtof_l stdlib.h FLATBUFFERS_LOCALE_INDEPENDENT)
else()
check_cxx_symbol_exists(strtof_l stdlib.h FLATBUFFERS_LOCALE_INDEPENDENT)
endif()
endif()
add_definitions(-DFLATBUFFERS_LOCALE_INDEPENDENT=$<BOOL:${FLATBUFFERS_LOCALE_INDEPENDENT}>)
set(FlatBuffers_Library_SRCS
include/flatbuffers/code_generators.h
include/flatbuffers/base.h
include/flatbuffers/flatbuffers.h
include/flatbuffers/hash.h
include/flatbuffers/idl.h
include/flatbuffers/util.h
include/flatbuffers/reflection.h
include/flatbuffers/reflection_generated.h
include/flatbuffers/stl_emulation.h
include/flatbuffers/flexbuffers.h
include/flatbuffers/registry.h
include/flatbuffers/minireflect.h
src/code_generators.cpp
src/idl_parser.cpp
src/idl_gen_cpp.cpp
src/idl_gen_java.cpp
src/idl_gen_go.cpp
src/idl_gen_text.cpp
src/reflection.cpp
src/util.cpp
)
set(FlatBuffers_Compiler_SRCS
${FlatBuffers_Library_SRCS}
src/idl_gen_cpp.cpp
src/idl_gen_dart.cpp
src/idl_gen_general.cpp
src/idl_gen_go.cpp
src/idl_gen_js_ts.cpp
src/idl_gen_php.cpp
src/idl_gen_python.cpp
src/idl_gen_lobster.cpp
src/idl_gen_lua.cpp
src/idl_gen_rust.cpp
src/idl_gen_fbs.cpp
src/idl_gen_grpc.cpp
src/idl_gen_json_schema.cpp
src/flatc.cpp
src/flatc_main.cpp
grpc/src/compiler/schema_interface.h
grpc/src/compiler/cpp_generator.h
grpc/src/compiler/cpp_generator.cc
grpc/src/compiler/go_generator.h
grpc/src/compiler/go_generator.cc
grpc/src/compiler/java_generator.h
grpc/src/compiler/java_generator.cc
)
set(FlatHash_SRCS
include/flatbuffers/hash.h
src/flathash.cpp
)
set(FlatBuffers_Tests_SRCS
include/flatbuffers/flatbuffers.h
include/flatbuffers/idl.h
include/flatbuffers/util.h
src/idl_parser.cpp
src/idl_gen_text.cpp
${FlatBuffers_Library_SRCS}
src/idl_gen_fbs.cpp
tests/test.cpp
tests/test_assert.h
tests/test_assert.cpp
tests/test_builder.h
tests/test_builder.cpp
# file generate by running compiler on tests/monster_test.fbs
tests/monster_test_generated.h
${CMAKE_CURRENT_BINARY_DIR}/tests/monster_test_generated.h
)
set(FlatBuffers_Sample_Binary_SRCS
include/flatbuffers/flatbuffers.h
samples/sample_binary.cpp
# file generate by running compiler on samples/monster.fbs
samples/monster_generated.h
# file generated by running compiler on samples/monster.fbs
${CMAKE_CURRENT_BINARY_DIR}/samples/monster_generated.h
)
set(FlatBuffers_Sample_Text_SRCS
include/flatbuffers/flatbuffers.h
include/flatbuffers/idl.h
include/flatbuffers/util.h
src/idl_parser.cpp
src/idl_gen_text.cpp
${FlatBuffers_Library_SRCS}
samples/sample_text.cpp
# file generate by running compiler on samples/monster.fbs
samples/monster_generated.h
# file generated by running compiler on samples/monster.fbs
${CMAKE_CURRENT_BINARY_DIR}/samples/monster_generated.h
)
set(CMAKE_BUILD_TYPE Debug)
set(FlatBuffers_Sample_BFBS_SRCS
${FlatBuffers_Library_SRCS}
src/idl_gen_general.cpp
samples/sample_bfbs.cpp
# file generated by running compiler on samples/monster.fbs
${CMAKE_CURRENT_BINARY_DIR}/samples/monster_generated.h
)
set(FlatBuffers_GRPCTest_SRCS
include/flatbuffers/flatbuffers.h
include/flatbuffers/grpc.h
tests/monster_test.grpc.fb.h
tests/test_assert.h
tests/test_builder.h
tests/monster_test.grpc.fb.cc
tests/test_assert.cpp
tests/test_builder.cpp
grpc/tests/grpctest.cpp
grpc/tests/message_builder_test.cpp
# file generated by running compiler on samples/monster.fbs
${CMAKE_CURRENT_BINARY_DIR}/samples/monster_generated.h
)
# source_group(Compiler FILES ${FlatBuffers_Compiler_SRCS})
# source_group(Tests FILES ${FlatBuffers_Tests_SRCS})
if(APPLE)
if(EXISTS "${CMAKE_TOOLCHAIN_FILE}")
# do not apply any global settings if the toolchain
# is being configured externally
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")
elseif(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra -Wno-unused-parameter")
set(FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wold-style-cast")
elseif(CMAKE_COMPILER_IS_GNUCXX)
if(CYGWIN)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -std=gnu++11")
else(CYGWIN)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -std=c++0x")
endif(CYGWIN)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++ -Wall -pedantic -Werror -Wextra")
elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
"${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra -Werror=shadow")
set(FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wold-style-cast")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.4)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -faligned-new -Werror=implicit-fallthrough=2")
endif()
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wunused-result -Werror=unused-result -Wunused-parameter -Werror=unused-parameter")
endif()
# Certain platforms such as ARM do not use signed chars by default
# which causes issues with certain bounds checks.
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -std=c++0x -Wall -pedantic -Werror -Wextra")
"${CMAKE_CXX_FLAGS} -fsigned-char")
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -std=c++0x -Wall -pedantic -Werror -Wextra -Wno-unused-parameter")
set(FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wold-style-cast")
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.8)
list(APPEND FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wimplicit-fallthrough" "-Wextra-semi" "-Werror=unused-private-field") # enable warning
endif()
if(FLATBUFFERS_LIBCXX_WITH_CLANG)
if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
if(NOT ("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD" OR
"${CMAKE_SYSTEM_NAME}" MATCHES "Linux"))
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -lc++abi")
endif()
endif()
# Certain platforms such as ARM do not use signed chars by default
# which causes issues with certain bounds checks.
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -fsigned-char")
elseif(MSVC)
# Visual Studio pedantic build settings
# warning C4512: assignment operator could not be generated
# warning C4316: object allocated on the heap may not be aligned
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX /wd4512 /wd4316")
endif()
if(FLATBUFFERS_CODE_COVERAGE)
@@ -65,17 +225,237 @@ if(FLATBUFFERS_CODE_COVERAGE)
"${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
endif()
function(add_fsanitize_to_target _target _sanitizer)
# FLATBUFFERS_CODE_SANITIZE: boolean {ON,OFF,YES,NO} or string with list of sanitizer.
# List of sanitizer is string starts with '=': "=address,undefined,thread,memory".
if((${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") OR
((${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9"))
)
set(_sanitizer_flags "=address,undefined")
if(_sanitizer MATCHES "=.*")
# override default by user-defined sanitizer list
set(_sanitizer_flags ${_sanitizer})
endif()
target_compile_options(${_target} PRIVATE
-g -fsigned-char -fno-omit-frame-pointer
"-fsanitize${_sanitizer_flags}")
target_link_libraries(${_target} PRIVATE
"-fsanitize${_sanitizer_flags}")
set_property(TARGET ${_target} PROPERTY POSITION_INDEPENDENT_CODE ON)
message(STATUS "Sanitizer ${_sanitizer_flags} added to ${_target}")
endif()
endfunction()
if(BIICODE)
include(biicode/cmake/biicode.cmake)
return()
endif()
include_directories(include)
include_directories(grpc)
add_executable(flatc ${FlatBuffers_Compiler_SRCS})
add_executable(flattests ${FlatBuffers_Tests_SRCS})
add_executable(flatsamplebinary ${FlatBuffers_Sample_Binary_SRCS})
add_executable(flatsampletext ${FlatBuffers_Sample_Text_SRCS})
if(FLATBUFFERS_BUILD_FLATLIB)
add_library(flatbuffers STATIC ${FlatBuffers_Library_SRCS})
# CMake > 2.8.11: Attach header directory for when build via add_subdirectory().
target_include_directories(flatbuffers INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
target_compile_options(flatbuffers PRIVATE "${FLATBUFFERS_PRIVATE_CXX_FLAGS}")
endif()
install(DIRECTORY include/flatbuffers DESTINATION include)
install(TARGETS flatc DESTINATION bin)
if(FLATBUFFERS_BUILD_FLATC)
add_executable(flatc ${FlatBuffers_Compiler_SRCS})
target_compile_options(flatc PRIVATE "${FLATBUFFERS_PRIVATE_CXX_FLAGS}")
if(FLATBUFFERS_CODE_SANITIZE AND NOT WIN32)
add_fsanitize_to_target(flatc ${FLATBUFFERS_CODE_SANITIZE})
endif()
if(NOT FLATBUFFERS_FLATC_EXECUTABLE)
set(FLATBUFFERS_FLATC_EXECUTABLE $<TARGET_FILE:flatc>)
endif()
if(MSVC)
# Make flatc.exe not depend on runtime dlls for easy distribution.
target_compile_options(flatc PUBLIC $<$<CONFIG:Release>:/MT>)
endif()
endif()
add_test(NAME flattest
CONFIGURATIONS Debug
WORKING_DIRECTORY tests
COMMAND flattests)
if(FLATBUFFERS_BUILD_FLATHASH)
add_executable(flathash ${FlatHash_SRCS})
endif()
if(FLATBUFFERS_BUILD_SHAREDLIB)
add_library(flatbuffers_shared SHARED ${FlatBuffers_Library_SRCS})
# Shared object version: "major.minor.micro"
# - micro updated every release when there is no API/ABI changes
# - minor updated when there are additions in API/ABI
# - major (ABI number) updated when there are changes in ABI (or removals)
set(FlatBuffers_Library_SONAME_MAJOR "1")
set(FlatBuffers_Library_SONAME_FULL "${FlatBuffers_Library_SONAME_MAJOR}.11.0")
set_target_properties(flatbuffers_shared PROPERTIES OUTPUT_NAME flatbuffers
SOVERSION "${FlatBuffers_Library_SONAME_MAJOR}"
VERSION "${FlatBuffers_Library_SONAME_FULL}")
endif()
function(compile_flatbuffers_schema_to_cpp SRC_FBS)
get_filename_component(SRC_FBS_DIR ${SRC_FBS} PATH)
string(REGEX REPLACE "\\.fbs$" "_generated.h" GEN_HEADER ${SRC_FBS})
add_custom_command(
OUTPUT ${GEN_HEADER}
COMMAND "${FLATBUFFERS_FLATC_EXECUTABLE}" -c --no-includes --gen-mutable
--gen-object-api --gen-compare -o "${SRC_FBS_DIR}"
--cpp-ptr-type flatbuffers::unique_ptr # Used to test with C++98 STLs
--reflect-names
-I "${CMAKE_CURRENT_SOURCE_DIR}/tests/include_test"
"${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FBS}"
DEPENDS flatc)
endfunction()
function(compile_flatbuffers_schema_to_binary SRC_FBS)
get_filename_component(SRC_FBS_DIR ${SRC_FBS} PATH)
string(REGEX REPLACE "\\.fbs$" ".bfbs" GEN_BINARY_SCHEMA ${SRC_FBS})
add_custom_command(
OUTPUT ${GEN_BINARY_SCHEMA}
COMMAND "${FLATBUFFERS_FLATC_EXECUTABLE}" -b --schema -o "${SRC_FBS_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FBS}"
DEPENDS flatc)
endfunction()
if(FLATBUFFERS_BUILD_TESTS)
compile_flatbuffers_schema_to_cpp(tests/monster_test.fbs)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/tests)
add_executable(flattests ${FlatBuffers_Tests_SRCS})
set_property(TARGET flattests
PROPERTY COMPILE_DEFINITIONS FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE
FLATBUFFERS_DEBUG_VERIFICATION_FAILURE=1)
if(FLATBUFFERS_CODE_SANITIZE)
if(WIN32)
target_compile_definitions(flattests PRIVATE FLATBUFFERS_MEMORY_LEAK_TRACKING)
message(STATUS "Sanitizer MSVC::_CrtDumpMemoryLeaks added to flattests")
else()
add_fsanitize_to_target(flattests ${FLATBUFFERS_CODE_SANITIZE})
endif()
endif()
compile_flatbuffers_schema_to_cpp(samples/monster.fbs)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/samples)
add_executable(flatsamplebinary ${FlatBuffers_Sample_Binary_SRCS})
add_executable(flatsampletext ${FlatBuffers_Sample_Text_SRCS})
add_executable(flatsamplebfbs ${FlatBuffers_Sample_BFBS_SRCS})
endif()
if(FLATBUFFERS_BUILD_GRPCTEST)
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-shadow")
endif()
if(NOT GRPC_INSTALL_PATH)
message(SEND_ERROR "GRPC_INSTALL_PATH variable is not defined. See grpc/README.md")
endif()
if(NOT PROTOBUF_DOWNLOAD_PATH)
message(SEND_ERROR "PROTOBUF_DOWNLOAD_PATH variable is not defined. See grpc/README.md")
endif()
INCLUDE_DIRECTORIES(${GRPC_INSTALL_PATH}/include)
INCLUDE_DIRECTORIES(${PROTOBUF_DOWNLOAD_PATH}/src)
LINK_DIRECTORIES(${GRPC_INSTALL_PATH}/lib)
add_executable(grpctest ${FlatBuffers_GRPCTest_SRCS})
target_link_libraries(grpctest grpc++_unsecure grpc_unsecure gpr pthread dl)
endif()
include(CMake/Version.cmake)
if(FLATBUFFERS_INSTALL)
include(GNUInstallDirs)
install(DIRECTORY include/flatbuffers DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
set(FB_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/flatbuffers")
configure_file(CMake/FlatbuffersConfigVersion.cmake.in FlatbuffersConfigVersion.cmake @ONLY)
install(
FILES "CMake/FlatbuffersConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/FlatbuffersConfigVersion.cmake"
DESTINATION ${FB_CMAKE_DIR}
)
if(FLATBUFFERS_BUILD_FLATLIB)
if(CMAKE_VERSION VERSION_LESS 3.0)
install(
TARGETS flatbuffers EXPORT FlatbuffersTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
else()
install(
TARGETS flatbuffers EXPORT FlatbuffersTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
endif()
install(EXPORT FlatbuffersTargets
FILE FlatbuffersTargets.cmake
NAMESPACE flatbuffers::
DESTINATION ${FB_CMAKE_DIR}
)
endif()
if(FLATBUFFERS_BUILD_FLATC)
install(
TARGETS flatc EXPORT FlatcTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(
EXPORT FlatcTargets
FILE FlatcTargets.cmake
NAMESPACE flatbuffers::
DESTINATION ${FB_CMAKE_DIR}
)
endif()
if(FLATBUFFERS_BUILD_SHAREDLIB)
if(CMAKE_VERSION VERSION_LESS 3.0)
install(
TARGETS flatbuffers_shared EXPORT FlatbuffersSharedTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
else()
install(
TARGETS flatbuffers_shared EXPORT FlatbuffersSharedTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
endif()
install(
EXPORT FlatbuffersSharedTargets
FILE FlatbuffersSharedTargets.cmake
NAMESPACE flatbuffers::
DESTINATION ${FB_CMAKE_DIR}
)
endif()
endif()
if(FLATBUFFERS_BUILD_TESTS)
enable_testing()
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/tests" DESTINATION
"${CMAKE_CURRENT_BINARY_DIR}")
add_test(NAME flattests COMMAND flattests)
if(FLATBUFFERS_BUILD_GRPCTEST)
add_test(NAME grpctest COMMAND grpctest)
endif()
endif()
include(CMake/BuildFlatBuffers.cmake)
if(UNIX)
# Use of CPack only supported on Linux systems.
if(FLATBUFFERS_PACKAGE_DEBIAN)
include(CMake/PackageDebian.cmake)
endif()
if (FLATBUFFERS_PACKAGE_REDHAT)
include(CMake/PackageRedhat.cmake)
endif()
include(CPack)
endif()

42
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,42 @@
Contributing {#contributing}
============
Want to contribute? Great! First, read this page (including the small print at
the end).
# Before you contribute
Before we can use your code, you must sign the
[Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1)
(CLA), which you can do online. The CLA is necessary mainly because you own the
copyright to your changes, even after your contribution becomes part of our
codebase, so we need your permission to use and distribute your code. We also
need to be sure of various other things—for instance that you'll tell us if you
know that your code infringes on other people's patents. You don't have to sign
the CLA until after you've submitted your code for review and a member has
approved it, but you must do it before we can put your code into our codebase.
Before you start working on a larger contribution, you should get in touch with
us first through the issue tracker with your idea so that we can help out and
possibly guide you. Coordinating up front makes it much easier to avoid
frustration later on.
# Code reviews
All submissions, including submissions by project members, require review. We
use Github pull requests for this purpose.
Some tips for good pull requests:
* Use our code
[style guide](https://google.github.io/styleguide/cppguide.html).
When in doubt, try to stay true to the existing code of the project.
* Write a descriptive commit message. What problem are you solving and what
are the consequences? Where and what did you test? Some good tips:
[here](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message)
and [here](https://www.kernel.org/doc/Documentation/SubmittingPatches).
* If your PR consists of multiple commits which are successive improvements /
fixes to your first commit, consider squashing them into a single commit
(`git rebase -i`) such that your PR is a single commit on top of the current
HEAD. This make reviewing the code so much easier, and our history more
readable.
# The small print
Contributions made by corporations are covered by a different agreement than
the one above, the Software Grant and Corporate Contributor License Agreement.

2
LICENSE.txt Executable file → Normal file
View File

@@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Copyright 2014 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

15
WORKSPACE Normal file
View File

@@ -0,0 +1,15 @@
workspace(name = "com_github_google_flatbuffers")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "492c3ac68ed9dcf527a07e6a1b2dcbf199c6bf8b35517951467ac32e421c06c1",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.17.0/rules_go-0.17.0.tar.gz"],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains()

0
android/.project Executable file → Normal file
View File

11
android/AndroidManifest.xml Executable file → Normal file
View File

@@ -17,17 +17,14 @@
-->
<!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.FlatBufferTest"
android:versionCode="1"
android:versionName="1.0">
package="com.example.FlatBufferTest">
<uses-feature android:glEsVersion="0x00020000"></uses-feature>
<!-- This is the platform API where NativeActivity was introduced. -->
<uses-sdk android:minSdkVersion="9" />
<!-- This .apk has no Java code itself, so set hasCode to false. -->
<application android:label="@string/app_name" android:hasCode="false">
<application android:label="@string/app_name"
android:hasCode="false"
android:allowBackup="false">
<!-- Our activity is the built-in NativeActivity framework class.
This will take care of integrating with our NDK code. -->
<activity android:name="android.app.NativeActivity"

108
android/build.gradle Normal file
View File

@@ -0,0 +1,108 @@
// Copyright (c) 2017 Google, Inc.
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
res.srcDirs = ['res']
}
}
externalNativeBuild {
ndkBuild {
path "jni/Android.mk"
}
}
defaultConfig {
applicationId 'com.example.FlatBufferTest'
// This is the platform API where NativeActivity was introduced.
minSdkVersion 9
targetSdkVersion 25
versionCode 1
versionName "1.0"
buildTypes {
release {
minifyEnabled false
}
}
externalNativeBuild {
ndkBuild {
targets "FlatBufferTest"
arguments "-j" + Runtime.getRuntime().availableProcessors()
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
}
}
lintOptions {
abortOnError false
}
// Build with each STL variant.
productFlavors {
stlport {
applicationIdSuffix ".stlport"
versionNameSuffix "-stlport"
externalNativeBuild {
ndkBuild {
arguments "APP_STL=stlport_static"
}
}
}
gnustl {
applicationIdSuffix ".gnustl"
versionNameSuffix "-gnustl"
externalNativeBuild {
ndkBuild {
arguments "APP_STL=gnustl_static"
}
}
}
libcpp {
applicationIdSuffix ".libcpp"
versionNameSuffix "-libcpp"
externalNativeBuild {
ndkBuild {
arguments "APP_STL=c++_static"
}
}
}
}
}

View File

@@ -1,500 +0,0 @@
#!/bin/bash -eu
# Copyright (c) 2013 Google, Inc.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution.
#
# Build, deploy, debug / execute a native Android package based upon
# NativeActivity.
declare -r script_directory=$(dirname $0)
declare -r android_root=${script_directory}/../../../../../../
declare -r script_name=$(basename $0)
declare -r android_manifest=AndroidManifest.xml
declare -r os_name=$(uname -s)
# Minimum Android target version supported by this project.
: ${BUILDAPK_ANDROID_TARGET_MINVERSION:=10}
# Directory containing the Android SDK
# (http://developer.android.com/sdk/index.html).
: ${ANDROID_SDK_HOME:=}
# Directory containing the Android NDK
# (http://developer.android.com/tools/sdk/ndk/index.html).
: ${NDK_HOME:=}
# Display script help and exit.
usage() {
echo "
Build the Android package in the current directory and deploy it to a
connected device.
Usage: ${script_name} \\
[ADB_DEVICE=serial_number] [BUILD=0] [DEPLOY=0] [RUN_DEBUGGER=1] \
[LAUNCH=0] [SWIG_BIN=swig_binary_directory] [SWIG_LIB=swig_include_directory] [ndk-build arguments ...]
ADB_DEVICE=serial_number:
serial_number specifies the device to deploy the built apk to if multiple
Android devices are connected to the host.
BUILD=0:
Disables the build of the package.
DEPLOY=0:
Disables the deployment of the built apk to the Android device.
RUN_DEBUGGER=1:
Launches the application in gdb after it has been deployed. To debug in
gdb, NDK_DEBUG=1 must also be specified on the command line to build a
debug apk.
LAUNCH=0:
Disable the launch of the apk on the Android device.
SWIG_BIN=swig_binary_directory:
The directory where the SWIG binary lives. No need to set this if SWIG is
installed and point to from your PATH variable.
SWIG_LIB=swig_include_directory:
The directory where SWIG shared include files are, usually obtainable from
commandline with \"swig -swiglib\". No need to set this if SWIG is installed
and point to from your PATH variable.
ndk-build arguments...:
Additional arguments for ndk-build. See ndk-build -h for more information.
" >&2
exit 1
}
# Get the number of CPU cores present on the host.
get_number_of_cores() {
case ${os_name} in
Darwin)
sysctl hw.ncpu | awk '{ print $2 }'
;;
CYGWIN*|Linux)
awk '/^processor/ { n=$3 } END { print n + 1 }' /proc/cpuinfo
;;
*)
echo 1
;;
esac
}
# Get the package name from an AndroidManifest.xml file.
get_package_name_from_manifest() {
xmllint --xpath 'string(/manifest/@package)' "${1}"
}
# Get the library name from an AndroidManifest.xml file.
get_library_name_from_manifest() {
echo "\
setns android=http://schemas.android.com/apk/res/android
xpath string(/manifest/application/activity\
[@android:name=\"android.app.NativeActivity\"]/meta-data\
[@android:name=\"android.app.lib_name\"]/@android:value)" |
xmllint --shell "${1}" | awk '/Object is a string/ { print $NF }'
}
# Get the number of Android devices connected to the system.
get_number_of_devices_connected() {
adb devices -l | \
awk '/^..*$/ { if (p) { print $0 } }
/List of devices attached/ { p = 1 }' | \
wc -l
return ${PIPESTATUS[0]}
}
# Kill a process and its' children. This is provided for cygwin which
# doesn't ship with pkill.
kill_process_group() {
local parent_pid="${1}"
local child_pid=
for child_pid in $(ps -f | \
awk '{ if ($3 == '"${parent_pid}"') { print $2 } }'); do
kill_process_group "${child_pid}"
done
kill "${parent_pid}" 2>/dev/null
}
# Find and run "adb".
adb() {
local adb_path=
for path in "$(which adb 2>/dev/null)" \
"${ANDROID_SDK_HOME}/sdk/platform-tools/adb" \
"${android_root}/prebuilts/sdk/platform-tools/adb"; do
if [[ -e "${path}" ]]; then
adb_path="${path}"
break
fi
done
if [[ "${adb_path}" == "" ]]; then
echo -e "Unable to find adb." \
"\nAdd the Android ADT sdk/platform-tools directory to the" \
"PATH." >&2
exit 1
fi
"${adb_path}" "$@"
}
# Find and run "android".
android() {
local android_executable=android
if echo "${os_name}" | grep -q CYGWIN; then
android_executable=android.bat
fi
local android_path=
for path in "$(which ${android_executable})" \
"${ANDROID_SDK_HOME}/sdk/tools/${android_executable}" \
"${android_root}/prebuilts/sdk/tools/${android_executable}"; do
if [[ -e "${path}" ]]; then
android_path="${path}"
break
fi
done
if [[ "${android_path}" == "" ]]; then
echo -e "Unable to find android tool." \
"\nAdd the Android ADT sdk/tools directory to the PATH." >&2
exit 1
fi
# Make sure ant is installed.
if [[ "$(which ant)" == "" ]]; then
echo -e "Unable to find ant." \
"\nPlease install ant and add to the PATH." >&2
exit 1
fi
"${android_path}" "$@"
}
# Find and run "ndk-build"
ndkbuild() {
local ndkbuild_path=
for path in "$(which ndk-build 2>/dev/null)" \
"${NDK_HOME}/ndk-build" \
"${android_root}/prebuilts/ndk/current/ndk-build"; do
if [[ -e "${path}" ]]; then
ndkbuild_path="${path}"
break
fi
done
if [[ "${ndkbuild_path}" == "" ]]; then
echo -e "Unable to find ndk-build." \
"\nAdd the Android NDK directory to the PATH." >&2
exit 1
fi
"${ndkbuild_path}" "$@"
}
# Get file modification time of $1 in seconds since the epoch.
stat_mtime() {
local filename="${1}"
case ${os_name} in
Darwin) stat -f%m "${filename}" 2>/dev/null || echo 0 ;;
*) stat -c%Y "${filename}" 2>/dev/null || echo 0 ;;
esac
}
# Build the native (C/C++) build targets in the current directory.
build_native_targets() {
# Save the list of output modules in the install directory so that it's
# possible to restore their timestamps after the build is complete. This
# works around a bug in ndk/build/core/setup-app.mk which results in the
# unconditional execution of the clean-installed-binaries rule.
restore_libraries="$(find libs -type f 2>/dev/null | \
sed -E 's@^libs/(.*)@\1@')"
# Build native code.
ndkbuild -j$(get_number_of_cores) "$@"
# Restore installed libraries.
# Obviously this is a nasty hack (along with ${restore_libraries} above) as
# it assumes it knows where the NDK will be placing output files.
(
IFS=$'\n'
for libpath in ${restore_libraries}; do
source_library="obj/local/${libpath}"
target_library="libs/${libpath}"
if [[ -e "${source_library}" ]]; then
cp -a "${source_library}" "${target_library}"
fi
done
)
}
# Select the oldest installed android build target that is at least as new as
# BUILDAPK_ANDROID_TARGET_MINVERSION. If a suitable build target isn't found,
# this function prints an error message and exits with an error.
select_android_build_target() {
local -r android_targets_installed=$( \
android list targets | \
awk -F'"' '/^id:.*android/ { print $2 }')
local android_build_target=
for android_target in $(echo "${android_targets_installed}" | \
awk -F- '{ print $2 }' | sort -n); do
if [[ $((android_target)) -ge \
$((BUILDAPK_ANDROID_TARGET_MINVERSION)) ]]; then
android_build_target="android-${android_target}"
break
fi
done
if [[ "${android_build_target}" == "" ]]; then
echo -e \
"Found installed Android targets:" \
"$(echo ${android_targets_installed} | sed 's/ /\n /g;s/^/\n /;')" \
"\nAndroid SDK platform" \
"android-$((BUILDAPK_ANDROID_TARGET_MINVERSION))" \
"must be installed to build this project." \
"\nUse the \"android\" application to install API" \
"$((BUILDAPK_ANDROID_TARGET_MINVERSION)) or newer." >&2
exit 1
fi
echo "${android_build_target}"
}
# Sign unsigned apk $1 and write the result to $2 with key store file $3 and
# password $4.
# If a key store file $3 and password $4 aren't specified, a temporary
# (60 day) key is generated and used to sign the package.
sign_apk() {
local unsigned_apk="${1}"
local signed_apk="${2}"
if [[ $(stat_mtime "${unsigned_apk}") -gt \
$(stat_mtime "${signed_apk}") ]]; then
local -r key_alias=$(basename ${signed_apk} .apk)
local keystore="${3}"
local key_password="${4}"
[[ "${keystore}" == "" ]] && keystore="${unsigned_apk}.keystore"
[[ "${key_password}" == "" ]] && \
key_password="${key_alias}123456"
if [[ ! -e ${keystore} ]]; then
keytool -genkey -v -dname "cn=, ou=${key_alias}, o=fpl" \
-storepass ${key_password} \
-keypass ${key_password} -keystore ${keystore} \
-alias ${key_alias} -keyalg RSA -keysize 2048 -validity 60
fi
cp "${unsigned_apk}" "${signed_apk}"
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 \
-keystore ${keystore} -storepass ${key_password} \
-keypass ${key_password} "${signed_apk}" ${key_alias}
fi
}
# Build the apk $1 for package filename $2 in the current directory using the
# ant build target $3.
build_apk() {
local -r output_apk="${1}"
local -r package_filename="${2}"
local -r ant_target="${3}"
# Get the list of installed android targets and select the oldest target
# that is at least as new as BUILDAPK_ANDROID_TARGET_MINVERSION.
local -r android_build_target=$(select_android_build_target)
[[ "${android_build_target}" == "" ]] && exit 1
echo "Building ${output_apk} for target ${android_build_target}" >&2
# Create / update build.xml and local.properties files.
if [[ $(stat_mtime "${android_manifest}") -gt \
$(stat_mtime build.xml) ]]; then
android update project --target "${android_build_target}" \
-n ${package_filename} --path .
fi
# Use ant to build the apk.
ant -quiet ${ant_target}
# Sign release apks with a temporary key as these packages will not be
# redistributed.
local unsigned_apk="bin/${package_filename}-${ant_target}-unsigned.apk"
if [[ "${ant_target}" == "release" ]]; then
sign_apk "${unsigned_apk}" "${output_apk}" "" ""
fi
}
# Uninstall package $1 and install apk $2 on device $3 where $3 is "-s device"
# or an empty string. If $3 is an empty string adb will fail when multiple
# devices are connected to the host system.
install_apk() {
local -r uninstall_package_name="${1}"
local -r install_apk="${2}"
local -r adb_device="${3}"
# Uninstall the package if it's already installed.
adb ${adb_device} uninstall "${uninstall_package_name}" 1>&2 > /dev/null || \
true # no error check
# Install the apk.
# NOTE: The following works around adb not returning an error code when
# it fails to install an apk.
echo "Install ${install_apk}" >&2
local -r adb_install_result=$(adb ${adb_device} install "${install_apk}")
echo "${adb_install_result}"
if echo "${adb_install_result}" | grep -qF 'Failure ['; then
exit 1
fi
}
# Launch previously installed package $1 on device $2.
# If $2 is an empty string adb will fail when multiple devices are connected
# to the host system.
launch_package() {
(
# Determine the SDK version of Android on the device.
local -r android_sdk_version=$(
adb ${adb_device} shell cat system/build.prop | \
awk -F= '/ro.build.version.sdk/ {
v=$2; sub(/[ \r\n]/, "", v); print v
}')
# Clear logs from previous runs.
# Note that logcat does not just 'tail' the logs, it dumps the entire log
# history.
adb ${adb_device} logcat -c
local finished_msg='Displayed '"${package_name}"
local timeout_msg='Activity destroy timeout.*'"${package_name}"
# Maximum time to wait before stopping log monitoring. 0 = infinity.
local launch_timeout=0
# If this is a Gingerbread device, kill log monitoring after 10 seconds.
if [[ $((android_sdk_version)) -le 10 ]]; then
launch_timeout=10
fi
# Display logcat in the background.
# Stop displaying the log when the app launch / execution completes or the
# logcat
(
adb ${adb_device} logcat | \
awk "
{
print \$0
}
/ActivityManager.*: ${finished_msg}/ {
exit 0
}
/ActivityManager.*: ${timeout_msg}/ {
exit 0
}" &
adb_logcat_pid=$!;
if [[ $((launch_timeout)) -gt 0 ]]; then
sleep $((launch_timeout));
kill ${adb_logcat_pid};
else
wait ${adb_logcat_pid};
fi
) &
logcat_pid=$!
# Kill adb logcat if this shell exits.
trap "kill_process_group ${logcat_pid}" SIGINT SIGTERM EXIT
# If the SDK is newer than 10, "am" supports stopping an activity.
adb_stop_activity=
if [[ $((android_sdk_version)) -gt 10 ]]; then
adb_stop_activity=-S
fi
# Launch the activity and wait for it to complete.
adb ${adb_device} shell am start ${adb_stop_activity} -n \
${package_name}/android.app.NativeActivity
wait "${logcat_pid}"
)
}
# See usage().
main() {
# Parse arguments for this script.
local adb_device=
local ant_target=release
local disable_deploy=0
local disable_build=0
local run_debugger=0
local launch=1
local build_package=1
for opt; do
case ${opt} in
NDK_DEBUG=1) ant_target=debug ;;
ADB_DEVICE*) adb_device="$(\
echo "${opt}" | sed -E 's/^ADB_DEVICE=([^ ]+)$/-s \1/;t;s/.*//')" ;;
BUILD=0) disable_build=1 ;;
DEPLOY=0) disable_deploy=1 ;;
RUN_DEBUGGER=1) run_debugger=1 ;;
LAUNCH=0) launch=0 ;;
clean) build_package=0 ;;
-h|--help|help) usage ;;
esac
done
# If a target device hasn't been specified and multiple devices are connected
# to the host machine, display an error.
local -r devices_connected=$(get_number_of_devices_connected)
if [[ "${adb_device}" == "" && $((devices_connected)) -gt 1 && \
($((disable_deploy)) -eq 0 || $((launch)) -ne 0 || \
$((run_debugger)) -ne 0) ]]; then
if [[ $((disable_deploy)) -ne 0 ]]; then
echo "Deployment enabled, disable using DEPLOY=0" >&2
fi
if [[ $((launch)) -ne 0 ]]; then
echo "Launch enabled." >&2
fi
if [[ $((disable_deploy)) -eq 0 ]]; then
echo "Deployment enabled." >&2
fi
if [[ $((run_debugger)) -ne 0 ]]; then
echo "Debugger launch enabled." >&2
fi
echo "
Multiple Android devices are connected to this host. Either disable deployment
and execution of the built .apk using:
\"${script_name} DEPLOY=0 LAUNCH=0\"
or specify a device to deploy to using:
\"${script_name} ADB_DEVICE=\${device_serial}\".
The Android devices connected to this machine are:
$(adb devices -l)
" >&2
exit 1
fi
if [[ $((disable_build)) -eq 0 ]]; then
# Build the native target.
build_native_targets "$@"
fi
# Get the package name from the manifest.
local -r package_name=$(get_package_name_from_manifest "${android_manifest}")
if [[ "${package_name}" == "" ]]; then
echo -e "No package name specified in ${android_manifest},"\
"skipping apk build, deploy"
"\nand launch steps." >&2
exit 0
fi
local -r package_basename=${package_name/*./}
local package_filename=$(get_library_name_from_manifest ${android_manifest})
[[ "${package_filename}" == "" ]] && package_filename="${package_basename}"
# Output apk name.
local -r output_apk="bin/${package_filename}-${ant_target}.apk"
if [[ $((disable_build)) -eq 0 && $((build_package)) -eq 1 ]]; then
# Build the apk.
build_apk "${output_apk}" "${package_filename}" "${ant_target}"
fi
# Deploy to the device.
if [[ $((disable_deploy)) -eq 0 ]]; then
install_apk "${package_name}" "${output_apk}" "${adb_device}"
fi
if [[ "${ant_target}" == "debug" && $((run_debugger)) -eq 1 ]]; then
# Start debugging.
ndk-gdb ${adb_device} --start
elif [[ $((launch)) -eq 1 ]]; then
launch_package "${package_name}" "${adb_device}"
fi
}
main "$@"

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#Mon Jun 19 11:54:59 PDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip

172
android/gradlew vendored Executable file
View File

@@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
android/gradlew.bat vendored Normal file
View File

@@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

48
android/jni/Android.mk Executable file → Normal file
View File

@@ -14,20 +14,50 @@
# misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution.
LOCAL_PATH := $(call my-dir)
LOCAL_PATH := $(call my-dir)/../..
include $(LOCAL_PATH)/android/jni/include.mk
LOCAL_PATH := $(call realpath-portable,$(LOCAL_PATH))
# Empty static library so that other projects can include just the basic
# FlatBuffers headers as a module.
include $(CLEAR_VARS)
LOCAL_MODULE := flatbuffers
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_EXPORT_CPPFLAGS := -std=c++11 -fexceptions -Wall \
-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE
LOCAL_MODULE := FlatBufferTest
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../include
LOCAL_SRC_FILES := main.cpp ../../tests/test.cpp ../../src/idl_parser.cpp ../../src/idl_gen_text.cpp
LOCAL_LDLIBS := -llog -landroid
LOCAL_STATIC_LIBRARIES := android_native_app_glue
LOCAL_ARM_MODE:=arm
LOCAL_CPPFLAGS += -std=c++11 -fexceptions -Wall -Wno-literal-suffix
include $(BUILD_STATIC_LIBRARY)
# static library that additionally includes text parsing/generation/reflection
# for projects that want richer functionality.
include $(CLEAR_VARS)
LOCAL_MODULE := flatbuffers_extra
LOCAL_SRC_FILES := src/idl_parser.cpp \
src/idl_gen_text.cpp \
src/reflection.cpp \
src/util.cpp \
src/code_generators.cpp
LOCAL_STATIC_LIBRARIES := flatbuffers
LOCAL_ARM_MODE := arm
include $(BUILD_STATIC_LIBRARY)
# FlatBuffers test
include $(CLEAR_VARS)
LOCAL_MODULE := FlatBufferTest
LOCAL_SRC_FILES := android/jni/main.cpp \
tests/test.cpp \
tests/test_assert.h \
tests/test_builder.h \
tests/test_assert.cpp \
tests/test_builder.cpp \
src/idl_gen_fbs.cpp \
src/idl_gen_general.cpp
LOCAL_LDLIBS := -llog -landroid -latomic
LOCAL_STATIC_LIBRARIES := android_native_app_glue flatbuffers_extra
LOCAL_ARM_MODE := arm
include $(BUILD_SHARED_LIBRARY)
$(call import-module,android/native_app_glue)
$(call import-add-path,../..)
$(call import-add-path,$(LOCAL_PATH)/../..)

6
android/jni/Application.mk Executable file → Normal file
View File

@@ -13,10 +13,8 @@
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution.
APP_PLATFORM := android-10
APP_PLATFORM := android-9
APP_PROJECT_PATH := $(call my-dir)/..
APP_STL := gnustl_static
APP_STL ?= stlport_static
APP_ABI := armeabi-v7a
NDK_TOOLCHAIN_VERSION := 4.8
APP_CPPFLAGS += -std=c++11

View File

@@ -0,0 +1,68 @@
@rem Copyright (c) 2013 Google, Inc.
@rem
@rem This software is provided 'as-is', without any express or implied
@rem warranty. In no event will the authors be held liable for any damages
@rem arising from the use of this software.
@rem Permission is granted to anyone to use this software for any purpose,
@rem including commercial applications, and to alter it and redistribute it
@rem freely, subject to the following restrictions:
@rem 1. The origin of this software must not be misrepresented; you must not
@rem claim that you wrote the original software. If you use this software
@rem in a product, an acknowledgment in the product documentation would be
@rem appreciated but is not required.
@rem 2. Altered source versions must be plainly marked as such, and must not be
@rem misrepresented as being the original software.
@rem 3. This notice may not be removed or altered from any source distribution.
@echo off
setlocal enabledelayedexpansion
set thispath=%~dp0
rem Path to cmake passed in by caller.
set cmake=%1
rem Path to cmake project to build.
set cmake_project_path=%2
rem Newest and oldest version of Visual Studio that it's possible to select.
set visual_studio_version_max=20
set visual_studio_version_min=8
rem Determine the newest version of Visual Studio installed on this machine.
set visual_studio_version=
for /L %%a in (%visual_studio_version_max%,-1,%visual_studio_version_min%) do (
echo Searching for Visual Studio %%a >&2
reg query HKLM\SOFTWARE\Microsoft\VisualStudio\%%a.0 /ve 1>NUL 2>NUL
if !ERRORLEVEL! EQU 0 (
set visual_studio_version=%%a
goto found_vs
)
)
echo Unable to determine whether Visual Studio is installed. >&2
exit /B 1
:found_vs
rem Map Visual Studio version to cmake generator name.
if "%visual_studio_version%"=="8" (
set cmake_generator=Visual Studio 8 2005
)
if "%visual_studio_version%"=="9" (
set cmake_generator=Visual Studio 9 2008
)
if %visual_studio_version% GEQ 10 (
set cmake_generator=Visual Studio %visual_studio_version%
)
rem Set visual studio version variable for msbuild.
set VisualStudioVersion=%visual_studio_version%.0
rem Generate Visual Studio solution.
echo Generating solution for %cmake_generator%. >&2
cd "%cmake_project_path%"
%cmake% -G"%cmake_generator%"
if %ERRORLEVEL% NEQ 0 (
exit /B %ERRORLEVEL%
)
rem Build flatc
python %thispath%\msbuild.py flatc.vcxproj
if ERRORLEVEL 1 exit /B 1

237
android/jni/include.mk Normal file
View File

@@ -0,0 +1,237 @@
# 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.
# This file contains utility functions for Android projects using Flatbuffers.
# To use this file, include it in your project's Android.mk by calling near the
# top of your android makefile like so:
#
# include $(FLATBUFFERS_DIR)/android/jni/include.mk
#
# You will also need to import the flatbuffers module using the standard
# import-module function.
#
# The main functionality this file provides are the following functions:
# flatbuffers_fbs_to_h: Converts flatbuffer schema paths to header paths.
# flatbuffers_header_build_rule:
# Creates a build rule for a schema's generated header. This build rule
# has a dependency on the flatc compiler which will be built if necessary.
# flatbuffers_header_build_rules:
# Creates build rules for generated headers for each schema listed and sets
# up depenedendies.
#
# More information and example usage can be found in the comments preceeding
# each function.
# Targets to build the Flatbuffers compiler as well as some utility definitions
ifeq (,$(FLATBUFFERS_INCLUDE_MK_))
FLATBUFFERS_INCLUDE_MK_ := 1
# Portable version of $(realpath) that omits drive letters on Windows.
realpath-portable = $(join $(filter %:,$(subst :,: ,$1)),\
$(realpath $(filter-out %:,$(subst :,: ,$1))))
PROJECT_OS := $(OS)
ifeq (,$(OS))
PROJECT_OS := $(shell uname -s)
else
ifneq ($(findstring Windows,$(PROJECT_OS)),)
PROJECT_OS := Windows
endif
endif
# The following block generates build rules which result in headers being
# rebuilt from flatbuffers schemas.
FLATBUFFERS_CMAKELISTS_DIR := \
$(call realpath-portable,$(dir $(lastword $(MAKEFILE_LIST)))/../..)
# Directory that contains the FlatBuffers compiler.
ifeq (Windows,$(PROJECT_OS))
FLATBUFFERS_FLATC_PATH?=$(FLATBUFFERS_CMAKELISTS_DIR)
FLATBUFFERS_FLATC := $(lastword \
$(wildcard $(FLATBUFFERS_FLATC_PATH)/*/flatc.exe) \
$(wildcard $(FLATBUFFERS_FLATC_PATH)/flatc.exe))
endif
ifeq (Linux,$(PROJECT_OS))
FLATBUFFERS_FLATC_PATH?=$(FLATBUFFERS_CMAKELISTS_DIR)
FLATBUFFERS_FLATC := $(FLATBUFFERS_FLATC_PATH)/flatc
endif
ifeq (Darwin,$(PROJECT_OS))
FLATBUFFERS_FLATC_PATH?=$(FLATBUFFERS_CMAKELISTS_DIR)
FLATBUFFERS_FLATC := $(lastword \
$(wildcard $(FLATBUFFERS_FLATC_PATH)/*/flatc) \
$(wildcard $(FLATBUFFERS_FLATC_PATH)/flatc))
endif
FLATBUFFERS_FLATC_ARGS?=
# Search for cmake.
CMAKE_ROOT := \
$(call realpath-portable,$(LOCAL_PATH)/../../../../../../prebuilts/cmake)
ifeq (,$(CMAKE))
ifeq (Linux,$(PROJECT_OS))
CMAKE := $(wildcard $(CMAKE_ROOT)/linux-x86/current/bin/cmake*)
endif
ifeq (Darwin,$(PROJECT_OS))
CMAKE := \
$(wildcard $(CMAKE_ROOT)/darwin-x86_64/current/*.app/Contents/bin/cmake)
endif
ifeq (Windows,$(PROJECT_OS))
CMAKE := $(wildcard $(CMAKE_ROOT)/windows/current/bin/cmake*)
endif
endif
ifeq (,$(CMAKE))
CMAKE := cmake
endif
# Windows friendly portable local path.
# GNU-make doesn't like : in paths, must use relative paths on Windows.
ifeq (Windows,$(PROJECT_OS))
PORTABLE_LOCAL_PATH =
else
PORTABLE_LOCAL_PATH = $(LOCAL_PATH)/
endif
# Generate a host build rule for the flatbuffers compiler.
ifeq (Windows,$(PROJECT_OS))
define build_flatc_recipe
$(FLATBUFFERS_CMAKELISTS_DIR)\android\jni\build_flatc.bat \
$(CMAKE) $(FLATBUFFERS_CMAKELISTS_DIR)
endef
endif
ifeq (Linux,$(PROJECT_OS))
define build_flatc_recipe
+cd $(FLATBUFFERS_CMAKELISTS_DIR) && \
$(CMAKE) . && \
$(MAKE) flatc
endef
endif
ifeq (Darwin,$(PROJECT_OS))
define build_flatc_recipe
cd $(FLATBUFFERS_CMAKELISTS_DIR) && "$(CMAKE)" -GXcode . && \
xcodebuild -target flatc
endef
endif
ifeq (,$(build_flatc_recipe))
ifeq (,$(FLATBUFFERS_FLATC))
$(error flatc binary not found!)
endif
endif
# Generate a build rule for flatc.
ifeq ($(strip $(FLATBUFFERS_FLATC)),)
flatc_target := build_flatc
.PHONY: $(flatc_target)
FLATBUFFERS_FLATC := \
python $(FLATBUFFERS_CMAKELISTS_DIR)/android/jni/run_flatc.py \
$(FLATBUFFERS_CMAKELISTS_DIR)
else
flatc_target := $(FLATBUFFERS_FLATC)
endif
$(flatc_target):
$(call build_flatc_recipe)
# $(flatbuffers_fbs_to_h schema_dir,output_dir,path)
#
# Convert the specified schema path to a Flatbuffers generated header path.
# For example:
#
# $(call flatbuffers_fbs_to_h,$(MY_PROJ_DIR)/schemas,\
# $(MY_PROJ_DIR)/gen/include,$(MY_PROJ_DIR)/schemas/example.fbs)
#
# This will convert the file path `$(MY_PROJ_DIR)/schemas/example.fbs)` to
# `$(MY_PROJ_DIR)/gen/include/example_generated.h`
define flatbuffers_fbs_to_h
$(subst $(1),$(2),$(patsubst %.fbs,%_generated.h,$(3)))
endef
# $(flatbuffers_header_build_rule schema_file,schema_dir,output_dir,\
# schema_include_dirs)
#
# Generate a build rule that will convert a Flatbuffers schema to a generated
# header derived from the schema filename using flatbuffers_fbs_to_h. For
# example:
#
# $(call flatbuffers_header_build_rule,$(MY_PROJ_DIR)/schemas/example.fbs,\
# $(MY_PROJ_DIR)/schemas,$(MY_PROJ_DIR)/gen/include)
#
# The final argument, schema_include_dirs, is optional and is only needed when
# the schema files depend on other schema files outside their own directory.
define flatbuffers_header_build_rule
$(eval \
$(call flatbuffers_fbs_to_h,$(2),$(3),$(1)): $(1) $(flatc_target)
$(call host-echo-build-step,generic,Generate) \
$(subst $(LOCAL_PATH)/,,$(call flatbuffers_fbs_to_h,$(2),$(3),$(1)))
$(hide) $$(FLATBUFFERS_FLATC) $(FLATBUFFERS_FLATC_ARGS) \
$(foreach include,$(4),-I $(include)) -o $$(dir $$@) -c $$<)
endef
# TODO: Remove when the LOCAL_PATH expansion bug in the NDK is fixed.
# Override the default behavior of local-source-file-path to workaround
# a bug which prevents the build of deeply nested projects when NDK_OUT is
# set.
local-source-file-path=\
$(if $(call host-path-is-absolute,$1),$1,$(call \
realpath-portable,$(LOCAL_PATH)/$1))
# $(flatbuffers_header_build_rules schema_files,schema_dir,output_dir,\
# schema_include_dirs,src_files,[build_target],[dependencies]))
#
# $(1) schema_files: Space separated list of flatbuffer schema files.
# $(2) schema_dir: Directory containing the flatbuffer schemas.
# $(3) output_dir: Where to place the generated files.
# $(4) schema_include_dirs: Directories to include when generating schemas.
# $(5) src_files: Files that should depend upon the headers generated from the
# flatbuffer schemas.
# $(6) build_target: Name of a build target that depends upon all generated
# headers.
# $(7) dependencies: Space seperated list of additional build targets src_files
# should depend upon.
#
# Use this in your own Android.mk file to generate build rules that will
# generate header files for your flatbuffer schemas as well as automatically
# set your source files to be dependent on the generated headers. For example:
#
# $(call flatbuffers_header_build_rules,$(MY_PROJ_SCHEMA_FILES),\
# $(MY_PROJ_SCHEMA_DIR),$(MY_PROJ_GENERATED_OUTPUT_DIR),
# $(MY_PROJ_SCHEMA_INCLUDE_DIRS),$(LOCAL_SRC_FILES))
#
# NOTE: Due problesm with path processing in ndk-build when presented with
# deeply nested projects must redefine LOCAL_PATH after include this makefile
# using:
#
# LOCAL_PATH := $(call realpath-portable,$(LOCAL_PATH))
#
define flatbuffers_header_build_rules
$(foreach schema,$(1),\
$(call flatbuffers_header_build_rule,\
$(schema),$(strip $(2)),$(strip $(3)),$(strip $(4))))\
$(foreach src,$(strip $(5)),\
$(eval $(call local-source-file-path,$(src)): \
$(foreach schema,$(strip $(1)),\
$(call flatbuffers_fbs_to_h,$(strip $(2)),$(strip $(3)),$(schema)))))\
$(if $(6),\
$(foreach schema,$(strip $(1)),\
$(eval $(6): \
$(call flatbuffers_fbs_to_h,$(strip $(2)),$(strip $(3)),$(schema)))),)\
$(if $(7),\
$(foreach src,$(strip $(5)),\
$(eval $(call local-source-file-path,$(src)): $(strip $(7)))),)\
$(if $(7),\
$(foreach dependency,$(strip $(7)),\
$(eval $(6): $(dependency))),)
endef
endif # FLATBUFFERS_INCLUDE_MK_

0
android/jni/main.cpp Executable file → Normal file
View File

77
android/jni/msbuild.py Normal file
View File

@@ -0,0 +1,77 @@
#!/usr/bin/python
# 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.
"""Simple script that locates the newest MSBuild in one of several locations.
This script will find the highest version number of MSBuild and run it,
passing its arguments through to MSBuild.
"""
import glob
import os
import re
import string
import subprocess
import sys
SYSTEMROOT = os.getenv("SYSTEMROOT", "c:\\windows")
PROGRAM_FILES = os.getenv("ProgramFiles", "c:\\Program Files")
PROGRAM_FILES_X86 = os.getenv("ProgramFiles(x86)", "c:\\Program Files (x86)")
SEARCH_FOLDERS = [ PROGRAM_FILES + "\\MSBuild\\*\\Bin\\MSBuild.exe",
PROGRAM_FILES_X86 + "\\MSBuild\\*\\Bin\\MSBuild.exe",
SYSTEMROOT + "\\Microsoft.NET\Framework\\*\\MSBuild.exe" ]
def compare_version(a, b):
"""Compare two version number strings of the form W.X.Y.Z.
The numbers are compared most-significant to least-significant.
For example, 12.345.67.89 > 2.987.88.99.
Args:
a: First version number string to compare
b: Second version number string to compare
Returns:
0 if the numbers are identical, a positive number if 'a' is larger, and
a negative number if 'b' is larger.
"""
aa = string.split(a, ".")
bb = string.split(b, ".")
for i in range(0, 4):
if aa[i] != bb[i]:
return cmp(int(aa[i]), int(bb[i]))
return 0
def main():
msbuilds = []
for folder in SEARCH_FOLDERS:
for file in glob.glob(folder):
p = subprocess.Popen([file, "/version"], stdout=subprocess.PIPE)
out, err = p.communicate()
match = re.search("^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$", out, re.M)
if match:
msbuilds.append({ 'ver':match.group(), 'exe':file })
msbuilds.sort(lambda x, y: compare_version(x['ver'], y['ver']), reverse=True)
if len(msbuilds) == 0:
print "Unable to find MSBuild.\n"
return -1;
cmd = [msbuilds[0]['exe']]
cmd.extend(sys.argv[1:])
return subprocess.call(cmd)
if __name__ == '__main__':
sys.exit(main())

46
android/jni/run_flatc.py Executable file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/python
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import platform
import subprocess
import sys
EXECUTABLE_EXTENSION = '.exe' if platform.system() == 'Windows' else ''
# Paths to search for flatc relative to the current working directory.
FLATC_SEARCH_PATHS = [os.path.curdir, 'Release', 'Debug']
def main():
"""Script that finds and runs flatc built from source."""
if len(sys.argv) < 2:
sys.stderr.write('Usage: run_flatc.py flatbuffers_dir [flatc_args]\n')
return 1
cwd = os.getcwd()
flatc = ''
flatbuffers_dir = sys.argv[1]
for path in FLATC_SEARCH_PATHS:
current = os.path.join(flatbuffers_dir, path,
'flatc' + EXECUTABLE_EXTENSION)
if os.path.exists(current):
flatc = current
break
if not flatc:
sys.stderr.write('flatc not found\n')
return 1
command = [flatc] + sys.argv[2:]
return subprocess.call(command)
if __name__ == '__main__':
sys.exit(main())

0
android/res/values/strings.xml Executable file → Normal file
View File

105
appveyor.yml Normal file
View File

@@ -0,0 +1,105 @@
branches:
only:
- master
os: Visual Studio 2015
environment:
global:
# Workaround for https://github.com/conda/conda-build/issues/636
PYTHONIOENCODING: UTF-8
CONDA_INSTALL_LOCN: "C:\\Miniconda35-x64"
matrix:
- CMAKE_VS_VERSION: "10 2010"
MONSTER_EXTRA: "skip"
- CMAKE_VS_VERSION: "12 2013"
MONSTER_EXTRA: "skip"
- CMAKE_VS_VERSION: "14 2015"
MONSTER_EXTRA: ""
platform:
- x86
- x64
configuration:
- Debug
- Release
before_build:
- set MONSTER_EXTRA=%MONSTER_EXTRA%
- cmake -G"Visual Studio %CMAKE_VS_VERSION%" -DFLATBUFFERS_CODE_SANITIZE=1 .
# This cuts down on a lot of noise generated by xamarin warnings.
- del "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"
build:
project: ALL_BUILD.vcxproj
verbosity: minimal
after_build:
- python conan/appveyor/install.py
- python conan/appveyor/build.py
install:
- set PATH=%CONDA_INSTALL_LOCN%;%CONDA_INSTALL_LOCN%\scripts;%PATH%;
- curl -sSf -o rustup-init.exe https://win.rustup.rs/
- rustup-init.exe -y
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
- rustc -V
- cargo -V
test_script:
- call .appveyor\check-generate-code.bat -b %CONFIGURATION%
- "cd tests"
- rem "Building all code"
- generate_code.bat -b %CONFIGURATION%
- 7z a GeneratedMyGameCode.zip MyGame\
- rem "---------------- C++ -----------------"
- "cd .."
- "%CONFIGURATION%\\flattests.exe"
- "cd tests"
- rem "---------------- Java -----------------"
- "java -version"
- "JavaTest.bat"
- rem "---------------- Rust ----------------"
- "RustTest.bat"
- rem "---------------- JS -----------------"
- "node --version"
- "..\\%CONFIGURATION%\\flatc -b -I include_test monster_test.fbs unicode_test.json"
- "node JavaScriptTest ./monster_test_generated"
- rem "-------------- Python ---------------"
- where python
- python --version
- where pip
- pip --version
- where conda
- conda --version
- rem "installing flatbuffers python library"
- pip install ../python
- rem "testing without installing Numpy"
- python py_test.py 0 0 0
- rem "testing after installing Numpy - disabled"
# FIXME: This has a LOT of unnecessary dependencies and makes the tests fail
# with timeouts.
# - conda install --yes numpy
# - python py_test.py 0 0 0
- rem "---------------- C# -----------------"
# Have to compile this here rather than in "build" above because AppVeyor only
# supports building one project??
- "cd FlatBuffers.Test"
- "msbuild.exe /property:Configuration=Release;OutputPath=tempcs /verbosity:minimal FlatBuffers.Test.csproj"
- "tempcs\\FlatBuffers.Test.exe"
# Run tests with UNSAFE_BYTEBUFFER
- "msbuild.exe /property:Configuration=Release;UnsafeByteBuffer=true;OutputPath=tempcsUnsafe /verbosity:minimal FlatBuffers.Test.csproj"
- "tempcsUnsafe\\FlatBuffers.Test.exe"
# TODO: add more languages.
- "cd ..\\.."
artifacts:
- path: $(CONFIGURATION)\flatc.exe
name: flatc.exe
- path: tests\GeneratedMyGameCode.zip
name: GeneratedMyGameCode.zip

View File

@@ -1,55 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flatc", "flatc.vcxproj", "{5B5857E1-64E2-4CED-A12E-45E1B3880496}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flatsamplebinary", "flatsamplebinary.vcxproj", "{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flatsampletext", "flatsampletext.vcxproj", "{F0A15675-1017-4217-BB5B-3372F2C636AB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flattests", "flattests.vcxproj", "{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5B5857E1-64E2-4CED-A12E-45E1B3880496}.Debug|Win32.ActiveCfg = Debug|Win32
{5B5857E1-64E2-4CED-A12E-45E1B3880496}.Debug|Win32.Build.0 = Debug|Win32
{5B5857E1-64E2-4CED-A12E-45E1B3880496}.Debug|x64.ActiveCfg = Debug|x64
{5B5857E1-64E2-4CED-A12E-45E1B3880496}.Debug|x64.Build.0 = Debug|x64
{5B5857E1-64E2-4CED-A12E-45E1B3880496}.Release|Win32.ActiveCfg = Release|Win32
{5B5857E1-64E2-4CED-A12E-45E1B3880496}.Release|Win32.Build.0 = Release|Win32
{5B5857E1-64E2-4CED-A12E-45E1B3880496}.Release|x64.ActiveCfg = Release|x64
{5B5857E1-64E2-4CED-A12E-45E1B3880496}.Release|x64.Build.0 = Release|x64
{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}.Debug|Win32.ActiveCfg = Debug|Win32
{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}.Debug|Win32.Build.0 = Debug|Win32
{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}.Debug|x64.ActiveCfg = Debug|x64
{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}.Debug|x64.Build.0 = Debug|x64
{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}.Release|Win32.ActiveCfg = Release|Win32
{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}.Release|Win32.Build.0 = Release|Win32
{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}.Release|x64.ActiveCfg = Release|x64
{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}.Release|x64.Build.0 = Release|x64
{F0A15675-1017-4217-BB5B-3372F2C636AB}.Debug|Win32.ActiveCfg = Debug|Win32
{F0A15675-1017-4217-BB5B-3372F2C636AB}.Debug|Win32.Build.0 = Debug|Win32
{F0A15675-1017-4217-BB5B-3372F2C636AB}.Debug|x64.ActiveCfg = Debug|x64
{F0A15675-1017-4217-BB5B-3372F2C636AB}.Debug|x64.Build.0 = Debug|x64
{F0A15675-1017-4217-BB5B-3372F2C636AB}.Release|Win32.ActiveCfg = Release|Win32
{F0A15675-1017-4217-BB5B-3372F2C636AB}.Release|Win32.Build.0 = Release|Win32
{F0A15675-1017-4217-BB5B-3372F2C636AB}.Release|x64.ActiveCfg = Release|x64
{F0A15675-1017-4217-BB5B-3372F2C636AB}.Release|x64.Build.0 = Release|x64
{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}.Debug|Win32.ActiveCfg = Debug|Win32
{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}.Debug|Win32.Build.0 = Debug|Win32
{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}.Debug|x64.ActiveCfg = Debug|x64
{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}.Debug|x64.Build.0 = Debug|x64
{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}.Release|Win32.ActiveCfg = Release|Win32
{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}.Release|Win32.Build.0 = Release|Win32
{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}.Release|x64.ActiveCfg = Release|x64
{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -1,281 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGUID>{5B5857E1-64E2-4CED-A12E-45E1B3880496}</ProjectGUID>
<Keyword>Win32Proj</Keyword>
<Platform>Win32</Platform>
<ProjectName>flatc</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">flatc.dir\Debug\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">flatc.dir\Debug\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">flatc</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">flatc</TargetName>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.exe</TargetExt>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.exe</TargetExt>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</GenerateManifest>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</GenerateManifest>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">flatc.dir\Release\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">flatc.dir\Release\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">flatc</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">flatc</TargetName>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.exe</TargetExt>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.exe</TargetExt>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</GenerateManifest>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<CompileAs>CompileAsCpp</CompileAs>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<Optimization>Disabled</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>Debug</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>../../Debug/flatc.pdb</ProgramDataBaseFileName>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalOptions> /machine:X86 /debug %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>../../Debug/flatc.lib</ImportLibrary>
<ProgramDataBaseFile>../../Debug/flatc.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<Version>
</Version>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<CompileAs>CompileAsCpp</CompileAs>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<Optimization>Disabled</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>Debug</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>../../Debug/flatc.pdb</ProgramDataBaseFileName>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalOptions>/debug %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>../../Debug/flatc.lib</ImportLibrary>
<ProgramDataBaseFile>../../Debug/flatc.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<Version>
</Version>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<Optimization>MaxSpeed</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>Release</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>../../Release/flatc.pdb</ProgramDataBaseFileName>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalOptions> /machine:X86 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>../../Release/flatc.lib</ImportLibrary>
<ProgramDataBaseFile>../../Release/flatc.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<Version>
</Version>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<Optimization>MaxSpeed</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>Release</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>../../Release/flatc.pdb</ProgramDataBaseFileName>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>../../Release/flatc.lib</ImportLibrary>
<ProgramDataBaseFile>../../Release/flatc.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<Version>
</Version>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\include\flatbuffers\flatbuffers.h" />
<ClInclude Include="..\..\include\flatbuffers\idl.h" />
<ClInclude Include="..\..\include\flatbuffers\util.h" />
<ClCompile Include="..\..\src\idl_gen_go.cpp">
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Level4</WarningLevel>
</ClCompile>
<ClCompile Include="..\..\src\idl_parser.cpp" />
<ClCompile Include="..\..\src\idl_gen_cpp.cpp" />
<ClCompile Include="..\..\src\idl_gen_java.cpp" />
<ClCompile Include="..\..\src\idl_gen_text.cpp" />
<ClCompile Include="..\..\src\flatc.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>..\..\tests</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>-j -c -g -b -t monster_test.fbs monsterdata_test.golden</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>-j -c -g -b -t monster_test.fbs monsterdata_test.golden</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommandArguments>-j -c -g -b -t monster_test.fbs monsterdata_test.golden</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>..\..\tests</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerCommandArguments>-j -c -g -b -t monster_test.fbs monsterdata_test.json</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerWorkingDirectory>..\..\tests</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

View File

@@ -1,273 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGUID>{16FA5518-3DE1-4B15-A1E0-F4734C276FB4}</ProjectGUID>
<Keyword>Win32Proj</Keyword>
<Platform>Win32</Platform>
<ProjectName>flatsamplebinary</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">flatsamplebinary.dir\Debug\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">flatsamplebinary.dir\Debug\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">flatsamplebinary</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">flatsamplebinary</TargetName>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.exe</TargetExt>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.exe</TargetExt>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</GenerateManifest>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</GenerateManifest>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">flatsamplebinary.dir\Release\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">flatsamplebinary.dir\Release\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">flatsamplebinary</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">flatsamplebinary</TargetName>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.exe</TargetExt>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.exe</TargetExt>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</GenerateManifest>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<CompileAs>CompileAsCpp</CompileAs>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<Optimization>Disabled</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>Debug</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>../../Debug/flatsamplebinary.pdb</ProgramDataBaseFileName>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalOptions> /machine:X86 /debug %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>../../Debug/flatsamplebinary.lib</ImportLibrary>
<ProgramDataBaseFile>../../Debug/flatsamplebinary.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<Version>
</Version>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<CompileAs>CompileAsCpp</CompileAs>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<Optimization>Disabled</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>Debug</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>../../Debug/flatsamplebinary.pdb</ProgramDataBaseFileName>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalOptions>/debug %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>../../Debug/flatsamplebinary.lib</ImportLibrary>
<ProgramDataBaseFile>../../Debug/flatsamplebinary.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<Version>
</Version>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<Optimization>MaxSpeed</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>Release</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>../../Release/flatsamplebinary.pdb</ProgramDataBaseFileName>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalOptions> /machine:X86 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>../../Release/flatsamplebinary.lib</ImportLibrary>
<ProgramDataBaseFile>../../Release/flatsamplebinary.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<Version>
</Version>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<Optimization>MaxSpeed</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>Release</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>../../Release/flatsamplebinary.pdb</ProgramDataBaseFileName>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>../../Release/flatsamplebinary.lib</ImportLibrary>
<ProgramDataBaseFile>../../Release/flatsamplebinary.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<Version>
</Version>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\include\flatbuffers\flatbuffers.h" />
<ClInclude Include="..\..\samples\monster_generated.h" />
<ClCompile Include="..\..\samples\sample_binary.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

View File

@@ -1,277 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGUID>{F0A15675-1017-4217-BB5B-3372F2C636AB}</ProjectGUID>
<Keyword>Win32Proj</Keyword>
<Platform>Win32</Platform>
<ProjectName>flatsampletext</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">flatsampletext.dir\Debug\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">flatsampletext.dir\Debug\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">flatsampletext</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">flatsampletext</TargetName>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.exe</TargetExt>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.exe</TargetExt>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</GenerateManifest>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</GenerateManifest>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">flatsampletext.dir\Release\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">flatsampletext.dir\Release\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">flatsampletext</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">flatsampletext</TargetName>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.exe</TargetExt>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.exe</TargetExt>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</GenerateManifest>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<CompileAs>CompileAsCpp</CompileAs>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<Optimization>Disabled</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>Debug</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>../../Debug/flatsampletext.pdb</ProgramDataBaseFileName>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalOptions> /machine:X86 /debug %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>../../Debug/flatsampletext.lib</ImportLibrary>
<ProgramDataBaseFile>../../Debug/flatsampletext.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<Version>
</Version>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<CompileAs>CompileAsCpp</CompileAs>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<Optimization>Disabled</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>Debug</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>../../Debug/flatsampletext.pdb</ProgramDataBaseFileName>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalOptions>/debug %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>../../Debug/flatsampletext.lib</ImportLibrary>
<ProgramDataBaseFile>../../Debug/flatsampletext.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<Version>
</Version>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<Optimization>MaxSpeed</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>Release</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>../../Release/flatsampletext.pdb</ProgramDataBaseFileName>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalOptions> /machine:X86 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>../../Release/flatsampletext.lib</ImportLibrary>
<ProgramDataBaseFile>../../Release/flatsampletext.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<Version>
</Version>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<Optimization>MaxSpeed</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>Release</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>../../Release/flatsampletext.pdb</ProgramDataBaseFileName>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>../../Release/flatsampletext.lib</ImportLibrary>
<ProgramDataBaseFile>../../Release/flatsampletext.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<Version>
</Version>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\include\flatbuffers\flatbuffers.h" />
<ClInclude Include="..\..\include\flatbuffers\idl.h" />
<ClInclude Include="..\..\include\flatbuffers\util.h" />
<ClInclude Include="..\..\samples\monster_generated.h" />
<ClCompile Include="..\..\src\idl_parser.cpp" />
<ClCompile Include="..\..\src\idl_gen_text.cpp" />
<ClCompile Include="..\..\samples\sample_text.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

View File

@@ -1,277 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGUID>{DC7BBA00-9FC6-48AF-B7E9-12CA91AC02AA}</ProjectGUID>
<Keyword>Win32Proj</Keyword>
<Platform>Win32</Platform>
<ProjectName>flattests</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">flattests.dir\Debug\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">flattests.dir\Debug\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">flattests</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">flattests</TargetName>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.exe</TargetExt>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.exe</TargetExt>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</GenerateManifest>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</GenerateManifest>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)</OutDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">flattests.dir\Release\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">flattests.dir\Release\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">flattests</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">flattests</TargetName>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.exe</TargetExt>
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.exe</TargetExt>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</GenerateManifest>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</GenerateManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<CompileAs>CompileAsCpp</CompileAs>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<Optimization>Disabled</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>Debug</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>../../Debug/flattests.pdb</ProgramDataBaseFileName>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalOptions> /machine:X86 /debug %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>../../Debug/flattests.lib</ImportLibrary>
<ProgramDataBaseFile>../../Debug/flattests.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<Version>
</Version>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<CompileAs>CompileAsCpp</CompileAs>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
<Optimization>Disabled</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>Debug</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>../../Debug/flattests.pdb</ProgramDataBaseFileName>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalOptions>/debug %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>../../Debug/flattests.lib</ImportLibrary>
<ProgramDataBaseFile>../../Debug/flattests.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<Version>
</Version>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<Optimization>MaxSpeed</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>Release</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>../../Release/flattests.pdb</ProgramDataBaseFileName>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalOptions> /machine:X86 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>../../Release/flattests.lib</ImportLibrary>
<ProgramDataBaseFile>../../Release/flattests.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<Version>
</Version>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>
<ExceptionHandling>Sync</ExceptionHandling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<Optimization>MaxSpeed</Optimization>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>Release</AssemblerListingLocation>
<ObjectFileName>$(IntDir)</ObjectFileName>
<ProgramDataBaseFileName>../../Release/flattests.pdb</ProgramDataBaseFileName>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Midl>
<AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>%(Filename).tlb</TypeLibraryName>
<InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
<ProxyFileName>%(Filename)_p.c</ProxyFileName>
</Midl>
<Link>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ImportLibrary>../../Release/flattests.lib</ImportLibrary>
<ProgramDataBaseFile>../../Release/flattests.pdb</ProgramDataBaseFile>
<SubSystem>Console</SubSystem>
<Version>
</Version>
</Link>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\include\flatbuffers\flatbuffers.h" />
<ClInclude Include="..\..\include\flatbuffers\idl.h" />
<ClInclude Include="..\..\include\flatbuffers\util.h" />
<ClInclude Include="..\..\tests\monster_test_generated.h" />
<ClCompile Include="..\..\src\idl_parser.cpp" />
<ClCompile Include="..\..\src\idl_gen_text.cpp" />
<ClCompile Include="..\..\tests\test.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

File diff suppressed because it is too large Load Diff

237
build_defs.bzl Normal file
View File

@@ -0,0 +1,237 @@
# Description:
# BUILD rules for generating flatbuffer files in various languages.
"""
Rules for building C++ flatbuffers with Bazel.
"""
flatc_path = "@com_github_google_flatbuffers//:flatc"
DEFAULT_INCLUDE_PATHS = [
"./",
"$(GENDIR)",
"$(BINDIR)",
]
DEFAULT_FLATC_ARGS = [
"--gen-object-api",
"--gen-compare",
"--no-includes",
"--gen-mutable",
"--reflect-names",
"--cpp-ptr-type flatbuffers::unique_ptr",
]
def flatbuffer_library_public(
name,
srcs,
outs,
language_flag,
out_prefix = "",
includes = [],
include_paths = DEFAULT_INCLUDE_PATHS,
flatc_args = DEFAULT_FLATC_ARGS,
reflection_name = "",
reflection_visiblity = None,
output_to_bindir = False):
"""Generates code files for reading/writing the given flatbuffers in the requested language using the public compiler.
Args:
name: Rule name.
srcs: Source .fbs files. Sent in order to the compiler.
outs: Output files from flatc.
language_flag: Target language flag. One of [-c, -j, -js].
out_prefix: Prepend this path to the front of all generated files except on
single source targets. Usually is a directory name.
includes: Optional, list of filegroups of schemas that the srcs depend on.
include_paths: Optional, list of paths the includes files can be found in.
flatc_args: Optional, list of additional arguments to pass to flatc.
reflection_name: Optional, if set this will generate the flatbuffer
reflection binaries for the schemas.
reflection_visiblity: The visibility of the generated reflection Fileset.
output_to_bindir: Passed to genrule for output to bin directory.
This rule creates a filegroup(name) with all generated source files, and
optionally a Fileset([reflection_name]) with all generated reflection
binaries.
"""
include_paths_cmd = ["-I %s" % (s) for s in include_paths]
# '$(@D)' when given a single source target will give the appropriate
# directory. Appending 'out_prefix' is only necessary when given a build
# target with multiple sources.
output_directory = (
("-o $(@D)/%s" % (out_prefix)) if len(srcs) > 1 else ("-o $(@D)")
)
genrule_cmd = " ".join([
"SRCS=($(SRCS));",
"for f in $${SRCS[@]:0:%s}; do" % len(srcs),
"$(location %s)" % (flatc_path),
" ".join(include_paths_cmd),
" ".join(flatc_args),
language_flag,
output_directory,
"$$f;",
"done",
])
native.genrule(
name = name,
srcs = srcs + includes,
outs = outs,
output_to_bindir = output_to_bindir,
tools = [flatc_path],
cmd = genrule_cmd,
message = "Generating flatbuffer files for %s:" % (name),
)
if reflection_name:
reflection_genrule_cmd = " ".join([
"SRCS=($(SRCS));",
"for f in $${SRCS[@]:0:%s}; do" % len(srcs),
"$(location %s)" % (flatc_path),
"-b --schema",
" ".join(flatc_args),
" ".join(include_paths_cmd),
language_flag,
output_directory,
"$$f;",
"done",
])
reflection_outs = [
(out_prefix + "%s.bfbs") % (s.replace(".fbs", "").split("/")[-1])
for s in srcs
]
native.genrule(
name = "%s_srcs" % reflection_name,
srcs = srcs + includes,
outs = reflection_outs,
output_to_bindir = output_to_bindir,
tools = [flatc_path],
cmd = reflection_genrule_cmd,
message = "Generating flatbuffer reflection binary for %s:" % (name),
)
native.Fileset(
name = reflection_name,
out = "%s_out" % reflection_name,
entries = [
native.FilesetEntry(files = reflection_outs),
],
visibility = reflection_visiblity,
)
def flatbuffer_cc_library(
name,
srcs,
srcs_filegroup_name = "",
out_prefix = "",
includes = [],
include_paths = DEFAULT_INCLUDE_PATHS,
flatc_args = DEFAULT_FLATC_ARGS,
visibility = None,
srcs_filegroup_visibility = None,
gen_reflections = False):
'''A cc_library with the generated reader/writers for the given flatbuffer definitions.
Args:
name: Rule name.
srcs: Source .fbs files. Sent in order to the compiler.
srcs_filegroup_name: Name of the output filegroup that holds srcs. Pass this
filegroup into the `includes` parameter of any other
flatbuffer_cc_library that depends on this one's schemas.
out_prefix: Prepend this path to the front of all generated files. Usually
is a directory name.
includes: Optional, list of filegroups of schemas that the srcs depend on.
** SEE REMARKS BELOW **
include_paths: Optional, list of paths the includes files can be found in.
flatc_args: Optional list of additional arguments to pass to flatc
(e.g. --gen-mutable).
visibility: The visibility of the generated cc_library. By default, use the
default visibility of the project.
srcs_filegroup_visibility: The visibility of the generated srcs filegroup.
By default, use the value of the visibility parameter above.
gen_reflections: Optional, if true this will generate the flatbuffer
reflection binaries for the schemas.
This produces:
filegroup([name]_srcs): all generated .h files.
filegroup(srcs_filegroup_name if specified, or [name]_includes if not):
Other flatbuffer_cc_library's can pass this in for their `includes`
parameter, if they depend on the schemas in this library.
Fileset([name]_reflection): (Optional) all generated reflection binaries.
cc_library([name]): library with sources and flatbuffers deps.
Remarks:
** Because the genrule used to call flatc does not have any trivial way of
computing the output list of files transitively generated by includes and
--gen-includes (the default) being defined for flatc, the --gen-includes
flag will not work as expected. The way around this is to add a dependency
to the flatbuffer_cc_library defined alongside the flatc included Fileset.
For example you might define:
flatbuffer_cc_library(
name = "my_fbs",
srcs = [ "schemas/foo.fbs" ],
includes = [ "//third_party/bazz:bazz_fbs_includes" ],
)
In which foo.fbs includes a few files from the Fileset defined at
//third_party/bazz:bazz_fbs_includes. When compiling the library that
includes foo_generated.h, and therefore has my_fbs as a dependency, it
will fail to find any of the bazz *_generated.h files unless you also
add bazz's flatbuffer_cc_library to your own dependency list, e.g.:
cc_library(
name = "my_lib",
deps = [
":my_fbs",
"//third_party/bazz:bazz_fbs"
],
)
Happy dependent Flatbuffering!
'''
output_headers = [
(out_prefix + "%s_generated.h") % (s.replace(".fbs", "").split("/")[-1])
for s in srcs
]
reflection_name = "%s_reflection" % name if gen_reflections else ""
srcs_lib = "%s_srcs" % (name)
flatbuffer_library_public(
name = srcs_lib,
srcs = srcs,
outs = output_headers,
language_flag = "-c",
out_prefix = out_prefix,
includes = includes,
include_paths = include_paths,
flatc_args = flatc_args,
reflection_name = reflection_name,
reflection_visiblity = visibility,
)
native.cc_library(
name = name,
hdrs = [
":" + srcs_lib,
],
srcs = [
":" + srcs_lib,
],
features = [
"-parse_headers",
],
deps = [
"@com_github_google_flatbuffers//:runtime_cc",
],
includes = [],
linkstatic = 1,
visibility = visibility,
)
# A filegroup for the `srcs`. That is, all the schema files for this
# Flatbuffer set.
native.filegroup(
name = srcs_filegroup_name if srcs_filegroup_name else "%s_includes" % (name),
srcs = srcs,
visibility = srcs_filegroup_visibility if srcs_filegroup_visibility != None else visibility,
)

18
composer.json Normal file
View File

@@ -0,0 +1,18 @@
{
"name": "google/flatbuffers",
"type": "library",
"description": "FlatBuffers for PHP",
"keywords": ["google", "flatbuffers", "serialization"],
"homepage": "https://github.com/google/flatbuffers",
"license": "Apache-2.0",
"require": {
"php": ">=5.4"
},
"require-dev": {
},
"autoload": {
"psr-4": {
"Google\\FlatBuffers\\": "php"
}
}
}

12
conan/CMakeLists.txt Normal file
View File

@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 2.8)
message(STATUS "Conan FlatBuffers Wrapper")
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
if (WIN32 AND MSVC AND FLATBUFFERS_BUILD_SHAREDLIB)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif(WIN32 AND MSVC AND FLATBUFFERS_BUILD_SHAREDLIB)
include(${CMAKE_SOURCE_DIR}/CMakeListsOriginal.txt)

8
conan/appveyor/build.py Normal file
View File

@@ -0,0 +1,8 @@
#!/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")

View File

@@ -0,0 +1,8 @@
#!/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")

69
conan/build.py Normal file
View File

@@ -0,0 +1,69 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import subprocess
from cpt.packager import ConanMultiPackager
def set_appveyor_environment():
if os.getenv("APPVEYOR") is not None:
compiler_version = os.getenv("CMAKE_VS_VERSION").split(" ")[0].replace('"', '')
os.environ["CONAN_VISUAL_VERSIONS"] = compiler_version
os.environ["CONAN_STABLE_BRANCH_PATTERN"] = "master"
ci_platform = os.getenv("Platform").replace('"', '')
ci_platform = "x86" if ci_platform == "x86" else "x86_64"
os.environ["CONAN_ARCHS"] = ci_platform
os.environ["CONAN_BUILD_TYPES"] = os.getenv("Configuration").replace('"', '')
def get_branch():
try:
for line in subprocess.check_output("git branch", shell=True).decode().splitlines():
line = line.strip()
if line.startswith("*") and " (HEAD detached" not in line:
return line.replace("*", "", 1).strip()
return ""
except Exception:
pass
return ""
def get_version():
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)
if match:
return match.group(1)
return version
def get_reference(username):
return "flatbuffers/{}@google/stable".format(get_version())
if __name__ == "__main__":
login_username = os.getenv("CONAN_LOGIN_USERNAME", "aardappel")
username = os.getenv("CONAN_USERNAME", "google")
upload = os.getenv("CONAN_UPLOAD", "https://api.bintray.com/conan/aardappel/flatbuffers")
stable_branch_pattern = os.getenv("CONAN_STABLE_BRANCH_PATTERN", r"v\d+\.\d+\.\d+.*")
test_folder = os.getenv("CPT_TEST_FOLDER", os.path.join("conan", "test_package"))
upload_only_when_stable = os.getenv("CONAN_UPLOAD_ONLY_WHEN_STABLE", True)
set_appveyor_environment()
builder = ConanMultiPackager(reference=get_reference(username),
username=username,
login_username=login_username,
upload=upload,
stable_branch_pattern=stable_branch_pattern,
upload_only_when_stable=upload_only_when_stable,
test_folder=test_folder)
builder.add_common_builds(pure_c=False)
builder.run()

View File

@@ -0,0 +1,9 @@
project(test_package CXX)
cmake_minimum_required(VERSION 2.8.11)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)

View File

@@ -0,0 +1,21 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, CMake
import os
class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
self.run("flatc --version", run_environment=True)
self.run("flathash fnv1_16 conan", run_environment=True)

View File

@@ -0,0 +1,35 @@
/*
* Copyright 2018 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.
*/
#include <cstdlib>
#include <iostream>
#include "flatbuffers/util.h"
// Test to validate Conan package generated
int main(int /*argc*/, const char * /*argv*/ []) {
const std::string filename("conanbuildinfo.cmake");
if (flatbuffers::FileExists(filename.c_str())) {
std::cout << "File " << filename << " exists.\n";
} else {
std::cout << "File " << filename << " does not exist.\n";
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}

14
conan/travis/build.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/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

22
conan/travis/install.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/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

75
conanfile.py Normal file
View File

@@ -0,0 +1,75 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Conan recipe package for Google FlatBuffers
"""
import os
import shutil
from conans import ConanFile, CMake, tools
class FlatbuffersConan(ConanFile):
name = "flatbuffers"
license = "Apache-2.0"
url = "https://github.com/google/flatbuffers"
homepage = "http://google.github.io/flatbuffers/"
author = "Wouter van Oortmerssen"
topics = ("conan", "flatbuffers", "serialization", "rpc", "json-parser")
description = "Memory Efficient Serialization Library"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}
generators = "cmake"
exports = "LICENSE.txt"
exports_sources = ["CMake/*", "include/*", "src/*", "grpc/*", "CMakeLists.txt", "conan/CMakeLists.txt"]
def source(self):
"""Wrap the original CMake file to call conan_basic_setup
"""
shutil.move("CMakeLists.txt", "CMakeListsOriginal.txt")
shutil.move(os.path.join("conan", "CMakeLists.txt"), "CMakeLists.txt")
def config_options(self):
"""Remove fPIC option on Windows platform
"""
if self.settings.os == "Windows":
self.options.remove("fPIC")
def configure_cmake(self):
"""Create CMake instance and execute configure step
"""
cmake = CMake(self)
cmake.definitions["FLATBUFFERS_BUILD_TESTS"] = False
cmake.definitions["FLATBUFFERS_BUILD_SHAREDLIB"] = self.options.shared
cmake.definitions["FLATBUFFERS_BUILD_FLATLIB"] = not self.options.shared
cmake.configure()
return cmake
def build(self):
"""Configure, build and install FlatBuffers using CMake.
"""
cmake = self.configure_cmake()
cmake.build()
def package(self):
"""Copy Flatbuffers' artifacts to package folder
"""
cmake = self.configure_cmake()
cmake.install()
self.copy(pattern="LICENSE.txt", dst="licenses")
self.copy(pattern="FindFlatBuffers.cmake", dst=os.path.join("lib", "cmake", "flatbuffers"), src="CMake")
self.copy(pattern="flathash*", dst="bin", src="bin")
self.copy(pattern="flatc*", dst="bin", src="bin")
if self.settings.os == "Windows" and self.options.shared:
if self.settings.compiler == "Visual Studio":
shutil.move(os.path.join(self.package_folder, "lib", "%s.dll" % self.name),
os.path.join(self.package_folder, "bin", "%s.dll" % self.name))
elif self.settings.compiler == "gcc":
shutil.move(os.path.join(self.package_folder, "lib", "lib%s.dll" % self.name),
os.path.join(self.package_folder, "bin", "lib%s.dll" % self.name))
def package_info(self):
"""Collect built libraries names and solve flatc path.
"""
self.cpp_info.libs = tools.collect_libs(self)
self.user_info.flatc = os.path.join(self.package_folder, "bin", "flatc")

14
dart/CHANGELOG.md Normal file
View File

@@ -0,0 +1,14 @@
# CHANGELOG
## 1.9.2
- Ensure `_writeString` adds enough padding to null terminate strings.
## 1.9.1
- Changed constant identifiers to be compatible with Dart 2.x
- No longer supports Dart 1.x
## 1.9.0
- Initial release, supports Dart 1.x and many dev versions of Dart 2.x

233
dart/LICENSE Normal file
View File

@@ -0,0 +1,233 @@
The code in lib/flat_buffers.dart is based on code that was releases under the
following license:
Copyright 2012, the Dart project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
To the extent permissible, the changes to that code and the other assets in
this package are licensed under the Apache2 license:
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2014 Google Inc.
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.

13
dart/README.md Normal file
View File

@@ -0,0 +1,13 @@
# FlatBuffers for Dart
This package is used to read and write FlatBuffer files in Dart.
Most consumers will want to use the [`flatc`](https://github.com/google/flatbuffers)
compiler to generate Dart code from a FlatBuffers IDL schema. For example, the
`monster_my_game.sample_generated.dart` was generated with `flatc` from
`monster.fbs` in the example folder. The generated classes can be used to read
or write binary files that are interoperable with other languages and platforms
supported by FlatBuffers, as illustrated in the `example.dart` in the
examples folder.
Additional documentation and examples are available [at the FlatBuffers site](https://google.github.io/flatbuffers/index.html)

155
dart/example/example.dart Normal file
View File

@@ -0,0 +1,155 @@
/*
* Copyright 2018 Dan Field. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import 'package:flat_buffers/flat_buffers.dart' as fb;
import './monster_my_game.sample_generated.dart' as myGame;
// Example how to use FlatBuffers to create and read binary buffers.
void main() {
builderTest();
objectBuilderTest();
}
void builderTest() {
final builder = new fb.Builder(initialSize: 1024);
final int weaponOneName = builder.writeString("Sword");
final int weaponOneDamage = 3;
final int weaponTwoName = builder.writeString("Axe");
final int weaponTwoDamage = 5;
final swordBuilder = new myGame.WeaponBuilder(builder)
..begin()
..addNameOffset(weaponOneName)
..addDamage(weaponOneDamage);
final int sword = swordBuilder.finish();
final axeBuilder = new myGame.WeaponBuilder(builder)
..begin()
..addNameOffset(weaponTwoName)
..addDamage(weaponTwoDamage);
final int axe = axeBuilder.finish();
// Serialize a name for our monster, called "Orc".
final int name = builder.writeString('Orc');
// Create a list representing the inventory of the Orc. Each number
// could correspond to an item that can be claimed after he is slain.
final List<int> treasure = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
final inventory = builder.writeListUint8(treasure);
final weapons = builder.writeList([sword, axe]);
// Struct builders are very easy to reuse.
final vec3Builder = new myGame.Vec3Builder(builder);
vec3Builder.finish(4.0, 5.0, 6.0);
vec3Builder.finish(1.0, 2.0, 3.0);
// Set his hit points to 300 and his mana to 150.
final int hp = 300;
final int mana = 150;
final monster = new myGame.MonsterBuilder(builder)
..begin()
..addNameOffset(name)
..addInventoryOffset(inventory)
..addWeaponsOffset(weapons)
..addEquippedType(myGame.EquipmentTypeId.Weapon)
..addEquippedOffset(axe)
..addHp(hp)
..addMana(mana)
..addPos(vec3Builder.finish(1.0, 2.0, 3.0))
..addColor(myGame.Color.Red);
final int monsteroff = monster.finish();
final buffer = builder.finish(monsteroff);
if (verify(buffer)) {
print(
"The FlatBuffer was successfully created with a builder and verified!");
}
}
void objectBuilderTest() {
// Create the builder here so we can use it for both weapons and equipped
// the actual data will only be written to the buffer once.
var axe = new myGame.WeaponObjectBuilder(name: 'Axe', damage: 5);
var monsterBuilder = new myGame.MonsterObjectBuilder(
pos: new myGame.Vec3ObjectBuilder(x: 1.0, y: 2.0, z: 3.0),
mana: 150,
hp: 300,
name: 'Orc',
inventory: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
color: myGame.Color.Red,
weapons: [new myGame.WeaponObjectBuilder(name: 'Sword', damage: 3), axe],
equippedType: myGame.EquipmentTypeId.Weapon,
equipped: axe,
);
var buffer = monsterBuilder.toBytes();
// We now have a FlatBuffer we can store on disk or send over a network.
// ** file/network code goes here :) **
// Instead, we're going to access it right away (as if we just received it).
if (verify(buffer)) {
print(
"The FlatBuffer was successfully created with an object builder and verified!");
}
}
bool verify(List<int> buffer) {
// Get access to the root:
var monster = new myGame.Monster(buffer);
// Get and test some scalar types from the FlatBuffer.
assert(monster.hp == 80);
assert(monster.mana == 150); // default
assert(monster.name == "MyMonster");
// Get and test a field of the FlatBuffer's `struct`.
var pos = monster.pos;
assert(pos != null);
assert(pos.z == 3.0);
// Get a test an element from the `inventory` FlatBuffer's `vector`.
var inv = monster.inventory;
assert(inv != null);
assert(inv.length == 10);
assert(inv[9] == 9);
// Get and test the `weapons` FlatBuffers's `vector`.
var expected_weapon_names = ["Sword", "Axe"];
var expected_weapon_damages = [3, 5];
var weps = monster.weapons;
for (int i = 0; i < weps.length; i++) {
assert(weps[i].name == expected_weapon_names[i]);
assert(weps[i].damage == expected_weapon_damages[i]);
}
// Get and test the `Equipment` union (`equipped` field).
assert(monster.equippedType.value == myGame.EquipmentTypeId.Weapon.value);
assert(monster.equippedType == myGame.EquipmentTypeId.Weapon);
assert(monster.equipped is myGame.Weapon);
var equipped = monster.equipped as myGame.Weapon;
assert(equipped.name == "Axe");
assert(equipped.damage == 5);
print(monster);
return true;
}

View File

@@ -0,0 +1,440 @@
// automatically generated by the FlatBuffers compiler, do not modify
// ignore_for_file: unused_import, non_constant_identifier_names
library my_game.sample;
import 'dart:typed_data' show Uint8List;
import 'package:flat_buffers/flat_buffers.dart' as fb;
class Color {
final int value;
const Color._(this.value);
factory Color.fromValue(int value) {
if (value == null) return null;
if (!values.containsKey(value)) {
throw new StateError('Invalid value $value for bit flag enum Color');
}
return values[value];
}
static const int minValue = 0;
static const int maxValue = 2;
static bool containsValue(int value) => values.containsKey(value);
static const Color Red = const Color._(0);
static const Color Green = const Color._(1);
static const Color Blue = const Color._(2);
static get values => {0: Red,1: Green,2: Blue,};
static const fb.Reader<Color> reader = const _ColorReader();
@override
String toString() {
return 'Color{value: $value}';
}
}
class _ColorReader extends fb.Reader<Color> {
const _ColorReader();
@override
int get size => 1;
@override
Color read(fb.BufferContext bc, int offset) =>
new Color.fromValue(const fb.Int8Reader().read(bc, offset));
}
class EquipmentTypeId {
final int value;
const EquipmentTypeId._(this.value);
factory EquipmentTypeId.fromValue(int value) {
if (value == null) return null;
if (!values.containsKey(value)) {
throw new StateError('Invalid value $value for bit flag enum EquipmentTypeId');
}
return values[value];
}
static const int minValue = 0;
static const int maxValue = 1;
static bool containsValue(int value) => values.containsKey(value);
static const EquipmentTypeId NONE = const EquipmentTypeId._(0);
static const EquipmentTypeId Weapon = const EquipmentTypeId._(1);
static get values => {0: NONE,1: Weapon,};
static const fb.Reader<EquipmentTypeId> reader = const _EquipmentTypeIdReader();
@override
String toString() {
return 'EquipmentTypeId{value: $value}';
}
}
class _EquipmentTypeIdReader extends fb.Reader<EquipmentTypeId> {
const _EquipmentTypeIdReader();
@override
int get size => 1;
@override
EquipmentTypeId read(fb.BufferContext bc, int offset) =>
new EquipmentTypeId.fromValue(const fb.Uint8Reader().read(bc, offset));
}
class Vec3 {
Vec3._(this._bc, this._bcOffset);
static const fb.Reader<Vec3> reader = const _Vec3Reader();
final fb.BufferContext _bc;
final int _bcOffset;
double get x => const fb.Float32Reader().read(_bc, _bcOffset + 0);
double get y => const fb.Float32Reader().read(_bc, _bcOffset + 4);
double get z => const fb.Float32Reader().read(_bc, _bcOffset + 8);
@override
String toString() {
return 'Vec3{x: $x, y: $y, z: $z}';
}
}
class _Vec3Reader extends fb.StructReader<Vec3> {
const _Vec3Reader();
@override
int get size => 12;
@override
Vec3 createObject(fb.BufferContext bc, int offset) =>
new Vec3._(bc, offset);
}
class Vec3Builder {
Vec3Builder(this.fbBuilder) {
assert(fbBuilder != null);
}
final fb.Builder fbBuilder;
int finish(double x, double y, double z) {
fbBuilder.putFloat32(z);
fbBuilder.putFloat32(y);
fbBuilder.putFloat32(x);
return fbBuilder.offset;
}
}
class Vec3ObjectBuilder extends fb.ObjectBuilder {
final double _x;
final double _y;
final double _z;
Vec3ObjectBuilder({
double x,
double y,
double z,
})
: _x = x,
_y = y,
_z = z;
/// Finish building, and store into the [fbBuilder].
@override
int finish(
fb.Builder fbBuilder) {
assert(fbBuilder != null);
fbBuilder.putFloat32(_z);
fbBuilder.putFloat32(_y);
fbBuilder.putFloat32(_x);
return fbBuilder.offset;
}
/// Convenience method to serialize to byte list.
@override
Uint8List toBytes([String fileIdentifier]) {
fb.Builder fbBuilder = new fb.Builder();
int offset = finish(fbBuilder);
return fbBuilder.finish(offset, fileIdentifier);
}
}
class Monster {
Monster._(this._bc, this._bcOffset);
factory Monster(List<int> bytes) {
fb.BufferContext rootRef = new fb.BufferContext.fromBytes(bytes);
return reader.read(rootRef, 0);
}
static const fb.Reader<Monster> reader = const _MonsterReader();
final fb.BufferContext _bc;
final int _bcOffset;
Vec3 get pos => Vec3.reader.vTableGet(_bc, _bcOffset, 4, null);
int get mana => const fb.Int16Reader().vTableGet(_bc, _bcOffset, 6, 150);
int get hp => const fb.Int16Reader().vTableGet(_bc, _bcOffset, 8, 100);
String get name => const fb.StringReader().vTableGet(_bc, _bcOffset, 10, null);
List<int> get inventory => const fb.ListReader<int>(const fb.Uint8Reader()).vTableGet(_bc, _bcOffset, 14, null);
Color get color => new Color.fromValue(const fb.Int8Reader().vTableGet(_bc, _bcOffset, 16, 2));
List<Weapon> get weapons => const fb.ListReader<Weapon>(Weapon.reader).vTableGet(_bc, _bcOffset, 18, null);
EquipmentTypeId get equippedType => new EquipmentTypeId.fromValue(const fb.Uint8Reader().vTableGet(_bc, _bcOffset, 20, null));
dynamic get equipped {
switch (equippedType?.value) {
case 1: return Weapon.reader.vTableGet(_bc, _bcOffset, 22, null);
default: return null;
}
}
List<Vec3> get path => const fb.ListReader<Vec3>(Vec3.reader).vTableGet(_bc, _bcOffset, 24, null);
@override
String toString() {
return 'Monster{pos: $pos, mana: $mana, hp: $hp, name: $name, inventory: $inventory, color: $color, weapons: $weapons, equippedType: $equippedType, equipped: $equipped, path: $path}';
}
}
class _MonsterReader extends fb.TableReader<Monster> {
const _MonsterReader();
@override
Monster createObject(fb.BufferContext bc, int offset) =>
new Monster._(bc, offset);
}
class MonsterBuilder {
MonsterBuilder(this.fbBuilder) {
assert(fbBuilder != null);
}
final fb.Builder fbBuilder;
void begin() {
fbBuilder.startTable();
}
int addPos(int offset) {
fbBuilder.addStruct(0, offset);
return fbBuilder.offset;
}
int addMana(int mana) {
fbBuilder.addInt16(1, mana);
return fbBuilder.offset;
}
int addHp(int hp) {
fbBuilder.addInt16(2, hp);
return fbBuilder.offset;
}
int addNameOffset(int offset) {
fbBuilder.addOffset(3, offset);
return fbBuilder.offset;
}
int addInventoryOffset(int offset) {
fbBuilder.addOffset(5, offset);
return fbBuilder.offset;
}
int addColor(Color color) {
fbBuilder.addInt8(6, color?.value);
return fbBuilder.offset;
}
int addWeaponsOffset(int offset) {
fbBuilder.addOffset(7, offset);
return fbBuilder.offset;
}
int addEquippedType(EquipmentTypeId equippedType) {
fbBuilder.addUint8(8, equippedType?.value);
return fbBuilder.offset;
}
int addEquippedOffset(int offset) {
fbBuilder.addOffset(9, offset);
return fbBuilder.offset;
}
int addPathOffset(int offset) {
fbBuilder.addOffset(10, offset);
return fbBuilder.offset;
}
int finish() {
return fbBuilder.endTable();
}
}
class MonsterObjectBuilder extends fb.ObjectBuilder {
final Vec3ObjectBuilder _pos;
final int _mana;
final int _hp;
final String _name;
final List<int> _inventory;
final Color _color;
final List<WeaponObjectBuilder> _weapons;
final EquipmentTypeId _equippedType;
final dynamic _equipped;
final List<Vec3ObjectBuilder> _path;
MonsterObjectBuilder({
Vec3ObjectBuilder pos,
int mana,
int hp,
String name,
List<int> inventory,
Color color,
List<WeaponObjectBuilder> weapons,
EquipmentTypeId equippedType,
dynamic equipped,
List<Vec3ObjectBuilder> path,
})
: _pos = pos,
_mana = mana,
_hp = hp,
_name = name,
_inventory = inventory,
_color = color,
_weapons = weapons,
_equippedType = equippedType,
_equipped = equipped,
_path = path;
/// Finish building, and store into the [fbBuilder].
@override
int finish(
fb.Builder fbBuilder) {
assert(fbBuilder != null);
final int nameOffset = fbBuilder.writeString(_name);
final int inventoryOffset = _inventory?.isNotEmpty == true
? fbBuilder.writeListUint8(_inventory)
: null;
final int weaponsOffset = _weapons?.isNotEmpty == true
? fbBuilder.writeList(_weapons.map((b) => b.getOrCreateOffset(fbBuilder)).toList())
: null;
final int equippedOffset = _equipped?.getOrCreateOffset(fbBuilder);
final int pathOffset = _path?.isNotEmpty == true
? fbBuilder.writeListOfStructs(_path)
: null;
fbBuilder.startTable();
if (_pos != null) {
fbBuilder.addStruct(0, _pos.finish(fbBuilder));
}
fbBuilder.addInt16(1, _mana);
fbBuilder.addInt16(2, _hp);
if (nameOffset != null) {
fbBuilder.addOffset(3, nameOffset);
}
if (inventoryOffset != null) {
fbBuilder.addOffset(5, inventoryOffset);
}
fbBuilder.addInt8(6, _color?.value);
if (weaponsOffset != null) {
fbBuilder.addOffset(7, weaponsOffset);
}
fbBuilder.addUint8(8, _equippedType?.value);
if (equippedOffset != null) {
fbBuilder.addOffset(9, equippedOffset);
}
if (pathOffset != null) {
fbBuilder.addOffset(10, pathOffset);
}
return fbBuilder.endTable();
}
/// Convenience method to serialize to byte list.
@override
Uint8List toBytes([String fileIdentifier]) {
fb.Builder fbBuilder = new fb.Builder();
int offset = finish(fbBuilder);
return fbBuilder.finish(offset, fileIdentifier);
}
}
class Weapon {
Weapon._(this._bc, this._bcOffset);
factory Weapon(List<int> bytes) {
fb.BufferContext rootRef = new fb.BufferContext.fromBytes(bytes);
return reader.read(rootRef, 0);
}
static const fb.Reader<Weapon> reader = const _WeaponReader();
final fb.BufferContext _bc;
final int _bcOffset;
String get name => const fb.StringReader().vTableGet(_bc, _bcOffset, 4, null);
int get damage => const fb.Int16Reader().vTableGet(_bc, _bcOffset, 6, null);
@override
String toString() {
return 'Weapon{name: $name, damage: $damage}';
}
}
class _WeaponReader extends fb.TableReader<Weapon> {
const _WeaponReader();
@override
Weapon createObject(fb.BufferContext bc, int offset) =>
new Weapon._(bc, offset);
}
class WeaponBuilder {
WeaponBuilder(this.fbBuilder) {
assert(fbBuilder != null);
}
final fb.Builder fbBuilder;
void begin() {
fbBuilder.startTable();
}
int addNameOffset(int offset) {
fbBuilder.addOffset(0, offset);
return fbBuilder.offset;
}
int addDamage(int damage) {
fbBuilder.addInt16(1, damage);
return fbBuilder.offset;
}
int finish() {
return fbBuilder.endTable();
}
}
class WeaponObjectBuilder extends fb.ObjectBuilder {
final String _name;
final int _damage;
WeaponObjectBuilder({
String name,
int damage,
})
: _name = name,
_damage = damage;
/// Finish building, and store into the [fbBuilder].
@override
int finish(
fb.Builder fbBuilder) {
assert(fbBuilder != null);
final int nameOffset = fbBuilder.writeString(_name);
fbBuilder.startTable();
if (nameOffset != null) {
fbBuilder.addOffset(0, nameOffset);
}
fbBuilder.addInt16(1, _damage);
return fbBuilder.endTable();
}
/// Convenience method to serialize to byte list.
@override
Uint8List toBytes([String fileIdentifier]) {
fb.Builder fbBuilder = new fb.Builder();
int offset = finish(fbBuilder);
return fbBuilder.finish(offset, fileIdentifier);
}
}

1241
dart/lib/flat_buffers.dart Normal file

File diff suppressed because it is too large Load Diff

28
dart/publish.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/sh
#
# Copyright 2018 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.
#
# Note to pub consumers: this file is used to assist with publishing the
# pub package from the flatbuffers repository and is not meant for general use.
# As pub does not currently provide a way to exclude files, it is included here.
command -v pub >/dev/null 2>&1 || { echo >&2 "Require `pub` but it's not installed. Aborting."; exit 1; }
cp ../samples/monster.fbs example/
cp ../tests/monster_test.fbs test/
pub publish
rm example/monster.fbs
rm test/monster_test.fbs

20
dart/pubspec.yaml Normal file
View File

@@ -0,0 +1,20 @@
name: flat_buffers
version: 1.11.0
description: >
FlatBuffers reading and writing library for Dart. Use the flatc compiler to
generate Dart classes for a FlatBuffers schema, and this library to assist with
reading and writing the binary format.
Based on original work by Konstantin Scheglov and Paul Berry of the Dart SDK team.
authors:
- Dan Field <dfield@gmail.com>
- Konstantin Scheglov
- Paul Berry
homepage: https://github.com/google/flatbuffers
documentation: https://google.github.io/flatbuffers/index.html
dev_dependencies:
test: ^1.3.0
test_reflective_loader: ^0.1.4
path: ^1.5.1
environment:
sdk: '>=2.0.0-dev.28.0 <3.0.0'

View File

@@ -0,0 +1,573 @@
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:typed_data';
import 'dart:io' as io;
import 'package:path/path.dart' as path;
import 'package:flat_buffers/flat_buffers.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import './monster_test_my_game.example_generated.dart' as example;
main() {
defineReflectiveSuite(() {
defineReflectiveTests(BuilderTest);
defineReflectiveTests(CheckOtherLangaugesData);
});
}
int indexToField(int index) {
return (1 + 1 + index) * 2;
}
@reflectiveTest
class CheckOtherLangaugesData {
test_cppData() async {
List<int> data = await new io.File(path.join(
path.dirname(io.Platform.script.path),
'monsterdata_test.mon',
))
.readAsBytes();
example.Monster mon = new example.Monster(data);
expect(mon.hp, 80);
expect(mon.mana, 150);
expect(mon.name, 'MyMonster');
expect(mon.pos.x, 1.0);
expect(mon.pos.y, 2.0);
expect(mon.pos.z, 3.0);
expect(mon.pos.test1, 3.0);
expect(mon.pos.test2.value, 2.0);
expect(mon.pos.test3.a, 5);
expect(mon.pos.test3.b, 6);
expect(mon.testType.value, example.AnyTypeId.Monster.value);
expect(mon.test is example.Monster, true);
final monster2 = mon.test as example.Monster;
expect(monster2.name, "Fred");
expect(mon.inventory.length, 5);
expect(mon.inventory.reduce((cur, next) => cur + next), 10);
expect(mon.test4.length, 2);
expect(
mon.test4[0].a + mon.test4[0].b + mon.test4[1].a + mon.test4[1].b, 100);
expect(mon.testarrayofstring.length, 2);
expect(mon.testarrayofstring[0], "test1");
expect(mon.testarrayofstring[1], "test2");
// this will fail if accessing any field fails.
expect(mon.toString(),
'Monster{pos: Vec3{x: 1.0, y: 2.0, z: 3.0, test1: 3.0, test2: Color{value: 2}, test3: Test{a: 5, b: 6}}, mana: 150, hp: 80, name: MyMonster, inventory: [0, 1, 2, 3, 4], color: Color{value: 8}, testType: AnyTypeId{value: 1}, test: Monster{pos: null, mana: 150, hp: 100, name: Fred, inventory: null, color: Color{value: 8}, testType: AnyTypeId{value: 0}, test: null, test4: null, testarrayofstring: null, testarrayoftables: null, enemy: null, testnestedflatbuffer: null, testempty: null, testbool: false, testhashs32Fnv1: 0, testhashu32Fnv1: 0, testhashs64Fnv1: 0, testhashu64Fnv1: 0, testhashs32Fnv1a: 0, testhashu32Fnv1a: 0, testhashs64Fnv1a: 0, testhashu64Fnv1a: 0, testarrayofbools: null, testf: 3.14159, testf2: 3.0, testf3: 0.0, testarrayofstring2: null, testarrayofsortedstruct: null, flex: null, test5: null, vectorOfLongs: null, vectorOfDoubles: null, parentNamespaceTest: null, vectorOfReferrables: null, singleWeakReference: 0, vectorOfWeakReferences: null, vectorOfStrongReferrables: null, coOwningReference: 0, vectorOfCoOwningReferences: null, nonOwningReference: 0, vectorOfNonOwningReferences: null}, test4: [Test{a: 10, b: 20}, Test{a: 30, b: 40}], testarrayofstring: [test1, test2], testarrayoftables: null, enemy: Monster{pos: null, mana: 150, hp: 100, name: Fred, inventory: null, color: Color{value: 8}, testType: AnyTypeId{value: 0}, test: null, test4: null, testarrayofstring: null, testarrayoftables: null, enemy: null, testnestedflatbuffer: null, testempty: null, testbool: false, testhashs32Fnv1: 0, testhashu32Fnv1: 0, testhashs64Fnv1: 0, testhashu64Fnv1: 0, testhashs32Fnv1a: 0, testhashu32Fnv1a: 0, testhashs64Fnv1a: 0, testhashu64Fnv1a: 0, testarrayofbools: null, testf: 3.14159, testf2: 3.0, testf3: 0.0, testarrayofstring2: null, testarrayofsortedstruct: null, flex: null, test5: null, vectorOfLongs: null, vectorOfDoubles: null, parentNamespaceTest: null, vectorOfReferrables: null, singleWeakReference: 0, vectorOfWeakReferences: null, vectorOfStrongReferrables: null, coOwningReference: 0, vectorOfCoOwningReferences: null, nonOwningReference: 0, vectorOfNonOwningReferences: null}, testnestedflatbuffer: null, testempty: null, testbool: false, testhashs32Fnv1: -579221183, testhashu32Fnv1: 3715746113, testhashs64Fnv1: 7930699090847568257, testhashu64Fnv1: 7930699090847568257, testhashs32Fnv1a: -1904106383, testhashu32Fnv1a: 2390860913, testhashs64Fnv1a: 4898026182817603057, testhashu64Fnv1a: 4898026182817603057, testarrayofbools: [true, false, true], testf: 3.14159, testf2: 3.0, testf3: 0.0, testarrayofstring2: null, testarrayofsortedstruct: null, flex: null, test5: [Test{a: 10, b: 20}, Test{a: 30, b: 40}], vectorOfLongs: [1, 100, 10000, 1000000, 100000000], vectorOfDoubles: [-1.7976931348623157e+308, 0.0, 1.7976931348623157e+308], parentNamespaceTest: null, vectorOfReferrables: null, singleWeakReference: 0, vectorOfWeakReferences: null, vectorOfStrongReferrables: null, coOwningReference: 0, vectorOfCoOwningReferences: null, nonOwningReference: 0, vectorOfNonOwningReferences: null}');
}
}
@reflectiveTest
class BuilderTest {
void test_monsterBuilder() {
final fbBuilder = new Builder();
final str = fbBuilder.writeString('MyMonster');
fbBuilder.writeString('test1');
fbBuilder.writeString('test2');
final testArrayOfString = fbBuilder.endStructVector(2);
final fred = fbBuilder.writeString('Fred');
final List<int> treasure = [0, 1, 2, 3, 4];
final inventory = fbBuilder.writeListUint8(treasure);
final monBuilder = new example.MonsterBuilder(fbBuilder)
..begin()
..addNameOffset(fred);
final mon2 = monBuilder.finish();
final testBuilder = new example.TestBuilder(fbBuilder);
testBuilder.finish(10, 20);
testBuilder.finish(30, 40);
final test4 = fbBuilder.endStructVector(2);
monBuilder
..begin()
..addPos(
new example.Vec3Builder(fbBuilder).finish(
1.0,
2.0,
3.0,
3.0,
example.Color.Green,
() => testBuilder.finish(5, 6),
),
)
..addHp(80)
..addNameOffset(str)
..addInventoryOffset(inventory)
..addTestType(example.AnyTypeId.Monster)
..addTestOffset(mon2)
..addTest4Offset(test4)
..addTestarrayofstringOffset(testArrayOfString);
final mon = monBuilder.finish();
fbBuilder.finish(mon);
}
void test_error_addInt32_withoutStartTable() {
Builder builder = new Builder();
expect(() {
builder.addInt32(0, 0);
}, throwsStateError);
}
void test_error_addOffset_withoutStartTable() {
Builder builder = new Builder();
expect(() {
builder.addOffset(0, 0);
}, throwsStateError);
}
void test_error_endTable_withoutStartTable() {
Builder builder = new Builder();
expect(() {
builder.endTable();
}, throwsStateError);
}
void test_error_startTable_duringTable() {
Builder builder = new Builder();
builder.startTable();
expect(() {
builder.startTable();
}, throwsStateError);
}
void test_error_writeString_duringTable() {
Builder builder = new Builder();
builder.startTable();
expect(() {
builder.writeString('12345');
}, throwsStateError);
}
void test_file_identifier() {
Uint8List byteList;
{
Builder builder = new Builder(initialSize: 0);
builder.startTable();
int offset = builder.endTable();
byteList = builder.finish(offset, 'Az~ÿ');
}
// Convert byteList to a ByteData so that we can read data from it.
ByteData byteData = byteList.buffer.asByteData(byteList.offsetInBytes);
// First 4 bytes are an offset to the table data.
int tableDataLoc = byteData.getUint32(0, Endian.little);
// Next 4 bytes are the file identifier.
expect(byteData.getUint8(4), 65); // 'a'
expect(byteData.getUint8(5), 122); // 'z'
expect(byteData.getUint8(6), 126); // '~'
expect(byteData.getUint8(7), 255); // 'ÿ'
// First 4 bytes of the table data are a backwards offset to the vtable.
int vTableLoc = tableDataLoc -
byteData.getInt32(tableDataLoc, Endian.little);
// First 2 bytes of the vtable are the size of the vtable in bytes, which
// should be 4.
expect(byteData.getUint16(vTableLoc, Endian.little), 4);
// Next 2 bytes are the size of the object in bytes (including the vtable
// pointer), which should be 4.
expect(byteData.getUint16(vTableLoc + 2, Endian.little), 4);
}
void test_low() {
Builder builder = new Builder(initialSize: 0);
expect((builder..putUint8(1)).lowFinish(), [1]);
expect((builder..putUint32(2)).lowFinish(), [2, 0, 0, 0, 0, 0, 0, 1]);
expect((builder..putUint8(3)).lowFinish(),
[0, 0, 0, 3, 2, 0, 0, 0, 0, 0, 0, 1]);
expect((builder..putUint8(4)).lowFinish(),
[0, 0, 4, 3, 2, 0, 0, 0, 0, 0, 0, 1]);
expect((builder..putUint8(5)).lowFinish(),
[0, 5, 4, 3, 2, 0, 0, 0, 0, 0, 0, 1]);
expect((builder..putUint32(6)).lowFinish(),
[6, 0, 0, 0, 0, 5, 4, 3, 2, 0, 0, 0, 0, 0, 0, 1]);
}
void test_table_default() {
List<int> byteList;
{
Builder builder = new Builder(initialSize: 0);
builder.startTable();
builder.addInt32(0, 10, 10);
builder.addInt32(1, 20, 10);
int offset = builder.endTable();
byteList = builder.finish(offset);
}
// read and verify
BufferContext buffer = new BufferContext.fromBytes(byteList);
int objectOffset = buffer.derefObject(0);
// was not written, so uses the new default value
expect(
const Int32Reader()
.vTableGet(buffer, objectOffset, indexToField(0), 15),
15);
// has the written value
expect(
const Int32Reader()
.vTableGet(buffer, objectOffset, indexToField(1), 15),
20);
}
void test_table_format() {
Uint8List byteList;
{
Builder builder = new Builder(initialSize: 0);
builder.startTable();
builder.addInt32(0, 10);
builder.addInt32(1, 20);
builder.addInt32(2, 30);
byteList = builder.finish(builder.endTable());
}
// Convert byteList to a ByteData so that we can read data from it.
ByteData byteData = byteList.buffer.asByteData(byteList.offsetInBytes);
// First 4 bytes are an offset to the table data.
int tableDataLoc = byteData.getUint32(0, Endian.little);
// First 4 bytes of the table data are a backwards offset to the vtable.
int vTableLoc = tableDataLoc -
byteData.getInt32(tableDataLoc, Endian.little);
// First 2 bytes of the vtable are the size of the vtable in bytes, which
// should be 10.
expect(byteData.getUint16(vTableLoc, Endian.little), 10);
// Next 2 bytes are the size of the object in bytes (including the vtable
// pointer), which should be 16.
expect(byteData.getUint16(vTableLoc + 2, Endian.little), 16);
// Remaining 6 bytes are the offsets within the object where the ints are
// located.
for (int i = 0; i < 3; i++) {
int offset =
byteData.getUint16(vTableLoc + 4 + 2 * i, Endian.little);
expect(byteData.getInt32(tableDataLoc + offset, Endian.little),
10 + 10 * i);
}
}
void test_table_string() {
String latinString = 'test';
String unicodeString = 'Проба пера';
List<int> byteList;
{
Builder builder = new Builder(initialSize: 0);
int latinStringOffset = builder.writeString(latinString);
int unicodeStringOffset = builder.writeString(unicodeString);
builder.startTable();
builder.addOffset(0, latinStringOffset);
builder.addOffset(1, unicodeStringOffset);
int offset = builder.endTable();
byteList = builder.finish(offset);
}
// read and verify
BufferContext buf = new BufferContext.fromBytes(byteList);
int objectOffset = buf.derefObject(0);
expect(const StringReader().vTableGet(buf, objectOffset, indexToField(0)),
latinString);
expect(const StringReader().vTableGet(buf, objectOffset, indexToField(1)),
unicodeString);
}
void test_table_types() {
List<int> byteList;
{
Builder builder = new Builder(initialSize: 0);
int stringOffset = builder.writeString('12345');
builder.startTable();
builder.addBool(0, true);
builder.addInt8(1, 10);
builder.addInt32(2, 20);
builder.addOffset(3, stringOffset);
builder.addInt32(4, 40);
builder.addUint32(5, 0x9ABCDEF0);
builder.addUint8(6, 0x9A);
int offset = builder.endTable();
byteList = builder.finish(offset);
}
// read and verify
BufferContext buf = new BufferContext.fromBytes(byteList);
int objectOffset = buf.derefObject(0);
expect(
const BoolReader().vTableGet(buf, objectOffset, indexToField(0)), true);
expect(
const Int8Reader().vTableGet(buf, objectOffset, indexToField(1)), 10);
expect(
const Int32Reader().vTableGet(buf, objectOffset, indexToField(2)), 20);
expect(const StringReader().vTableGet(buf, objectOffset, indexToField(3)),
'12345');
expect(
const Int32Reader().vTableGet(buf, objectOffset, indexToField(4)), 40);
expect(const Uint32Reader().vTableGet(buf, objectOffset, indexToField(5)),
0x9ABCDEF0);
expect(const Uint8Reader().vTableGet(buf, objectOffset, indexToField(6)),
0x9A);
}
void test_writeList_of_Uint32() {
List<int> values = <int>[10, 100, 12345, 0x9abcdef0];
// write
List<int> byteList;
{
Builder builder = new Builder(initialSize: 0);
int offset = builder.writeListUint32(values);
byteList = builder.finish(offset);
}
// read and verify
BufferContext buf = new BufferContext.fromBytes(byteList);
List<int> items = const Uint32ListReader().read(buf, 0);
expect(items, hasLength(4));
expect(items, orderedEquals(values));
}
void test_writeList_ofBool() {
void verifyListBooleans(int len, List<int> trueBits) {
// write
List<int> byteList;
{
Builder builder = new Builder(initialSize: 0);
List<bool> values = new List<bool>.filled(len, false);
for (int bit in trueBits) {
values[bit] = true;
}
int offset = builder.writeListBool(values);
byteList = builder.finish(offset);
}
// read and verify
BufferContext buf = new BufferContext.fromBytes(byteList);
List<bool> items = const BoolListReader().read(buf, 0);
expect(items, hasLength(len));
for (int i = 0; i < items.length; i++) {
expect(items[i], trueBits.contains(i), reason: 'bit $i of $len');
}
}
verifyListBooleans(0, <int>[]);
verifyListBooleans(1, <int>[]);
verifyListBooleans(1, <int>[0]);
verifyListBooleans(31, <int>[0, 1]);
verifyListBooleans(31, <int>[1, 2, 24, 25, 30]);
verifyListBooleans(31, <int>[0, 30]);
verifyListBooleans(32, <int>[1, 2, 24, 25, 31]);
verifyListBooleans(33, <int>[1, 2, 24, 25, 32]);
verifyListBooleans(33, <int>[1, 2, 24, 25, 31, 32]);
verifyListBooleans(63, <int>[]);
verifyListBooleans(63, <int>[0, 1, 2, 61, 62]);
verifyListBooleans(63, new List<int>.generate(63, (i) => i));
verifyListBooleans(64, <int>[]);
verifyListBooleans(64, <int>[0, 1, 2, 61, 62, 63]);
verifyListBooleans(64, <int>[1, 2, 62]);
verifyListBooleans(64, <int>[0, 1, 2, 63]);
verifyListBooleans(64, new List<int>.generate(64, (i) => i));
verifyListBooleans(100, <int>[0, 3, 30, 60, 90, 99]);
}
void test_writeList_ofInt32() {
List<int> byteList;
{
Builder builder = new Builder(initialSize: 0);
int offset = builder.writeListInt32(<int>[1, 2, 3, 4, 5]);
byteList = builder.finish(offset);
}
// read and verify
BufferContext buf = new BufferContext.fromBytes(byteList);
List<int> items = const ListReader<int>(const Int32Reader()).read(buf, 0);
expect(items, hasLength(5));
expect(items, orderedEquals(<int>[1, 2, 3, 4, 5]));
}
void test_writeList_ofFloat64() {
List<double> values = <double>[-1.234567, 3.4E+9, -5.6E-13, 7.8, 12.13];
// write
List<int> byteList;
{
Builder builder = new Builder(initialSize: 0);
int offset = builder.writeListFloat64(values);
byteList = builder.finish(offset);
}
// read and verify
BufferContext buf = new BufferContext.fromBytes(byteList);
List<double> items = const Float64ListReader().read(buf, 0);
expect(items, hasLength(values.length));
for (int i = 0; i < values.length; i++) {
expect(values[i], closeTo(items[i], .001));
}
}
void test_writeList_ofFloat32() {
List<double> values = [1.0, 2.23, -3.213, 7.8, 12.13];
// write
List<int> byteList;
{
Builder builder = new Builder(initialSize: 0);
int offset = builder.writeListFloat32(values);
byteList = builder.finish(offset);
}
// read and verify
BufferContext buf = new BufferContext.fromBytes(byteList);
List<double> items = const Float32ListReader().read(buf, 0);
expect(items, hasLength(5));
for (int i = 0; i < values.length; i++) {
expect(values[i], closeTo(items[i], .001));
}
}
void test_writeList_ofObjects() {
List<int> byteList;
{
Builder builder = new Builder(initialSize: 0);
// write the object #1
int object1;
{
builder.startTable();
builder.addInt32(0, 10);
builder.addInt32(1, 20);
object1 = builder.endTable();
}
// write the object #1
int object2;
{
builder.startTable();
builder.addInt32(0, 100);
builder.addInt32(1, 200);
object2 = builder.endTable();
}
// write the list
int offset = builder.writeList([object1, object2]);
byteList = builder.finish(offset);
}
// read and verify
BufferContext buf = new BufferContext.fromBytes(byteList);
List<TestPointImpl> items =
const ListReader<TestPointImpl>(const TestPointReader()).read(buf, 0);
expect(items, hasLength(2));
expect(items[0].x, 10);
expect(items[0].y, 20);
expect(items[1].x, 100);
expect(items[1].y, 200);
}
void test_writeList_ofStrings_asRoot() {
List<int> byteList;
{
Builder builder = new Builder(initialSize: 0);
int str1 = builder.writeString('12345');
int str2 = builder.writeString('ABC');
int offset = builder.writeList([str1, str2]);
byteList = builder.finish(offset);
}
// read and verify
BufferContext buf = new BufferContext.fromBytes(byteList);
List<String> items =
const ListReader<String>(const StringReader()).read(buf, 0);
expect(items, hasLength(2));
expect(items, contains('12345'));
expect(items, contains('ABC'));
}
void test_writeList_ofStrings_inObject() {
List<int> byteList;
{
Builder builder = new Builder(initialSize: 0);
int listOffset = builder.writeList(
[builder.writeString('12345'), builder.writeString('ABC')]);
builder.startTable();
builder.addOffset(0, listOffset);
int offset = builder.endTable();
byteList = builder.finish(offset);
}
// read and verify
BufferContext buf = new BufferContext.fromBytes(byteList);
StringListWrapperImpl reader = new StringListWrapperReader().read(buf, 0);
List<String> items = reader.items;
expect(items, hasLength(2));
expect(items, contains('12345'));
expect(items, contains('ABC'));
}
void test_writeList_ofUint32() {
List<int> byteList;
{
Builder builder = new Builder(initialSize: 0);
int offset = builder.writeListUint32(<int>[1, 2, 0x9ABCDEF0]);
byteList = builder.finish(offset);
}
// read and verify
BufferContext buf = new BufferContext.fromBytes(byteList);
List<int> items = const Uint32ListReader().read(buf, 0);
expect(items, hasLength(3));
expect(items, orderedEquals(<int>[1, 2, 0x9ABCDEF0]));
}
void test_writeList_ofUint16() {
List<int> byteList;
{
Builder builder = new Builder(initialSize: 0);
int offset = builder.writeListUint16(<int>[1, 2, 60000]);
byteList = builder.finish(offset);
}
// read and verify
BufferContext buf = new BufferContext.fromBytes(byteList);
List<int> items = const Uint16ListReader().read(buf, 0);
expect(items, hasLength(3));
expect(items, orderedEquals(<int>[1, 2, 60000]));
}
void test_writeList_ofUint8() {
List<int> byteList;
{
Builder builder = new Builder(initialSize: 0);
int offset = builder.writeListUint8(<int>[1, 2, 3, 4, 0x9A]);
byteList = builder.finish(offset);
}
// read and verify
BufferContext buf = new BufferContext.fromBytes(byteList);
List<int> items = const Uint8ListReader().read(buf, 0);
expect(items, hasLength(5));
expect(items, orderedEquals(<int>[1, 2, 3, 4, 0x9A]));
}
}
class StringListWrapperImpl {
final BufferContext bp;
final int offset;
StringListWrapperImpl(this.bp, this.offset);
List<String> get items => const ListReader<String>(const StringReader())
.vTableGet(bp, offset, indexToField(0));
}
class StringListWrapperReader extends TableReader<StringListWrapperImpl> {
const StringListWrapperReader();
@override
StringListWrapperImpl createObject(BufferContext object, int offset) {
return new StringListWrapperImpl(object, offset);
}
}
class TestPointImpl {
final BufferContext bp;
final int offset;
TestPointImpl(this.bp, this.offset);
int get x => const Int32Reader().vTableGet(bp, offset, indexToField(0), 0);
int get y => const Int32Reader().vTableGet(bp, offset, indexToField(1), 0);
}
class TestPointReader extends TableReader<TestPointImpl> {
const TestPointReader();
@override
TestPointImpl createObject(BufferContext object, int offset) {
return new TestPointImpl(object, offset);
}
}

View File

@@ -0,0 +1,62 @@
// automatically generated by the FlatBuffers compiler, do not modify
// ignore_for_file: unused_import, unused_field, unused_local_variable
library my_game.example2;
import 'dart:typed_data' show Uint8List;
import 'package:flat_buffers/flat_buffers.dart' as fb;
import 'include_test1_my_game.example2_generated.dart';
import 'include_test2_my_game.example2_generated.dart';
import './monster_test_my_game_generated.dart' as my_game;
import './monster_test_my_game.example_generated.dart' as my_game_example;
class Monster {
Monster._(this._bc, this._bcOffset);
factory Monster(List<int> bytes) {
fb.BufferContext rootRef = new fb.BufferContext.fromBytes(bytes);
return reader.read(rootRef, 0);
}
static const fb.Reader<Monster> reader = const _MonsterReader();
final fb.BufferContext _bc;
final int _bcOffset;
@override
String toString() {
return 'Monster{}';
}
}
class _MonsterReader extends fb.TableReader<Monster> {
const _MonsterReader();
@override
Monster createObject(fb.BufferContext bc, int offset) =>
new Monster._(bc, offset);
}
class MonsterObjectBuilder extends fb.ObjectBuilder {
MonsterObjectBuilder();
/// Finish building, and store into the [fbBuilder].
@override
int finish(
fb.Builder fbBuilder) {
assert(fbBuilder != null);
fbBuilder.startTable();
return fbBuilder.endTable();
}
/// Convenience method to serialize to byte list.
@override
Uint8List toBytes([String fileIdentifier]) {
fb.Builder fbBuilder = new fb.Builder();
int offset = finish(fbBuilder);
return fbBuilder.finish(offset, fileIdentifier);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,62 @@
// automatically generated by the FlatBuffers compiler, do not modify
// ignore_for_file: unused_import, unused_field, unused_local_variable
library my_game;
import 'dart:typed_data' show Uint8List;
import 'package:flat_buffers/flat_buffers.dart' as fb;
import 'include_test1_my_game_generated.dart';
import 'include_test2_my_game_generated.dart';
import './monster_test_my_game.example_generated.dart' as my_game_example;
import './monster_test_my_game.example2_generated.dart' as my_game_example2;
class InParentNamespace {
InParentNamespace._(this._bc, this._bcOffset);
factory InParentNamespace(List<int> bytes) {
fb.BufferContext rootRef = new fb.BufferContext.fromBytes(bytes);
return reader.read(rootRef, 0);
}
static const fb.Reader<InParentNamespace> reader = const _InParentNamespaceReader();
final fb.BufferContext _bc;
final int _bcOffset;
@override
String toString() {
return 'InParentNamespace{}';
}
}
class _InParentNamespaceReader extends fb.TableReader<InParentNamespace> {
const _InParentNamespaceReader();
@override
InParentNamespace createObject(fb.BufferContext bc, int offset) =>
new InParentNamespace._(bc, offset);
}
class InParentNamespaceObjectBuilder extends fb.ObjectBuilder {
InParentNamespaceObjectBuilder();
/// Finish building, and store into the [fbBuilder].
@override
int finish(
fb.Builder fbBuilder) {
assert(fbBuilder != null);
fbBuilder.startTable();
return fbBuilder.endTable();
}
/// Convenience method to serialize to byte list.
@override
Uint8List toBytes([String fileIdentifier]) {
fb.Builder fbBuilder = new fb.Builder();
int offset = finish(fbBuilder);
return fbBuilder.finish(offset, fileIdentifier);
}
}

View File

@@ -1,8 +0,0 @@
<html>
<head>
<meta http-equiv="refresh" content="0;url=html/index.html">
</head>
<body>
<a href="html/index.html">Click here if you are not redirected.</a>
</body>
</html>

0
docs/footer.html Executable file → Normal file
View File

62
docs/header.html Normal file
View File

@@ -0,0 +1,62 @@
<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen $doxygenversion"/>
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="$relpath^jquery.js"></script>
<script type="text/javascript" src="$relpath^dynsections.js"></script>
$treeview
$search
$mathjax
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,400italic,500,500italic,700,700italic|Roboto+Mono:400,700" rel="stylesheet">
$extrastylesheet
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!--BEGIN TITLEAREA-->
<div id="titlearea" style="height: 110px;">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<!--BEGIN PROJECT_LOGO-->
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td>
<!--END PROJECT_LOGO-->
<td id="commonprojectlogo">
<img alt="Logo" src="$relpath^fpl_logo_small.png"/>
</td>
<!--BEGIN PROJECT_NAME-->
<td style="padding-left: 0.5em;">
<div id="projectname">$projectname
<!--BEGIN PROJECT_NUMBER-->&#160;<span id="projectnumber">$projectnumber</span><!--END PROJECT_NUMBER-->
</div>
<div style="font-size:12px;">
An open source project by <a href="https://developers.google.com/games/#Tools">FPL</a>.
</div>
<!--BEGIN PROJECT_BRIEF--><div id="projectbrief">$projectbrief</div><!--END PROJECT_BRIEF-->
</td>
<!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME-->
<!--BEGIN PROJECT_BRIEF-->
<td style="padding-left: 0.5em;">
<div id="projectbrief">$projectbrief</div>
</td>
<!--END PROJECT_BRIEF-->
<!--END !PROJECT_NAME-->
<!--BEGIN DISABLE_INDEX-->
<!--BEGIN SEARCHENGINE-->
<td>$searchbox</td>
<!--END SEARCHENGINE-->
<!--END DISABLE_INDEX-->
</tr>
</tbody>
</table>
</div>
<!--END TITLEAREA-->
<!-- end header part -->

Binary file not shown.

Before

Width:  |  Height:  |  Size: 676 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -1,97 +0,0 @@
function toggleVisibility(linkObj)
{
var base = $(linkObj).attr('id');
var summary = $('#'+base+'-summary');
var content = $('#'+base+'-content');
var trigger = $('#'+base+'-trigger');
var src=$(trigger).attr('src');
if (content.is(':visible')===true) {
content.hide();
summary.show();
$(linkObj).addClass('closed').removeClass('opened');
$(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
} else {
content.show();
summary.hide();
$(linkObj).removeClass('closed').addClass('opened');
$(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
}
return false;
}
function updateStripes()
{
$('table.directory tr').
removeClass('even').filter(':visible:even').addClass('even');
}
function toggleLevel(level)
{
$('table.directory tr').each(function() {
var l = this.id.split('_').length-1;
var i = $('#img'+this.id.substring(3));
var a = $('#arr'+this.id.substring(3));
if (l<level+1) {
i.removeClass('iconfopen iconfclosed').addClass('iconfopen');
a.html('&#9660;');
$(this).show();
} else if (l==level+1) {
i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');
a.html('&#9658;');
$(this).show();
} else {
$(this).hide();
}
});
updateStripes();
}
function toggleFolder(id)
{
// the clicked row
var currentRow = $('#row_'+id);
// all rows after the clicked row
var rows = currentRow.nextAll("tr");
var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub
// only match elements AFTER this one (can't hide elements before)
var childRows = rows.filter(function() { return this.id.match(re); });
// first row is visible we are HIDING
if (childRows.filter(':first').is(':visible')===true) {
// replace down arrow by right arrow for current row
var currentRowSpans = currentRow.find("span");
currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
currentRowSpans.filter(".arrow").html('&#9658;');
rows.filter("[id^=row_"+id+"]").hide(); // hide all children
} else { // we are SHOWING
// replace right arrow by down arrow for current row
var currentRowSpans = currentRow.find("span");
currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");
currentRowSpans.filter(".arrow").html('&#9660;');
// replace down arrows by right arrows for child rows
var childRowsSpans = childRows.find("span");
childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
childRowsSpans.filter(".arrow").html('&#9658;');
childRows.show(); //show all children
}
updateStripes();
}
function toggleInherit(id)
{
var rows = $('tr.inherit.'+id);
var img = $('tr.inherit_header.'+id+' img');
var src = $(img).attr('src');
if (rows.filter(':first').is(':visible')===true) {
rows.css('display','none');
$(img).attr('src',src.substring(0,src.length-8)+'closed.png');
} else {
rows.css('display','table-row'); // using show() causes jump in firefox
$(img).attr('src',src.substring(0,src.length-10)+'open.png');
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 616 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 B

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