mugisoba [Thu, 21 May 2020 16:14:20 +0000 (01:14 +0900)]
[C#] Add file identifier to ObjectAPI Serialization Utility. (#5920)
* use Finish***Buffer instead.
* add file_identifier test.
Kamil Rojewski [Mon, 18 May 2020 16:39:19 +0000 (18:39 +0200)]
not creating creation methods when using structs (#5919)
* not creating creation methods when using structs
* vs2015 build fix
Co-authored-by: Kamil Rojewski <kamil.rojewski@gmail.com>
Maxim Zaks [Mon, 18 May 2020 14:50:39 +0000 (16:50 +0200)]
[Dart] Adding FlexBuffers support (#5853)
* Adding FlexBuffers support for Dart language
Derek Bailey [Sat, 16 May 2020 01:13:29 +0000 (18:13 -0700)]
[Dart] Getting tests/DartTest.sh to work on (#5915)
* Fixed refractoring issue in reflection/generate_code.sh. Also, mv deletes the original file, so I don't need to clean it up manually in that case.
* Fixed Dart Tests by removing code-gen for included files.
Vladimir Glavnyy [Thu, 14 May 2020 18:39:58 +0000 (01:39 +0700)]
Schema parser: prohibit declaration of an array of pointers inside structs (#5907)
* Fix issue #5906, Prohibit declaration of an array of pointers inside structs
- idl_parser.cpp: Prohibit declaration of an array of pointers inside structs
- idl_gen_cpp.cpp: Extract GenStructConstructor() method from GenStruct() to simplify future modification
- idl_gen_cpp.cpp: Add assert for checking of Array fields in structs on code-generation stage
* Fix the error 'unused local variable' in release build
* Fix: format the PR code according to coding rules
* Add test-case and fix review notes
Casper [Wed, 13 May 2020 18:24:32 +0000 (11:24 -0700)]
Fix Cargo.toml dependencies (#5911)
* Fix Cargo.toml dependencies
* less specific serde dependency
Co-authored-by: Casper Neo <cneo@google.com>
Dan Field [Wed, 13 May 2020 17:26:32 +0000 (10:26 -0700)]
fix union type names (#5902)
* fix union type names
* fix up generation and test
* format
* update codegen
Casper [Tue, 12 May 2020 02:46:37 +0000 (19:46 -0700)]
Update Rust Flexbuffers metadata before publishing (#5905)
Co-authored-by: Casper Neo <cneo@google.com>
Khoi Dinh Trinh [Mon, 11 May 2020 21:55:57 +0000 (14:55 -0700)]
[TS] Make Obj-API work with --short-names (#5898)
* changed function used for getting struct name
* re-generated code
Kamil Rojewski [Thu, 7 May 2020 23:21:30 +0000 (01:21 +0200)]
fixed invalid imports with --gen-all (#5895)
* fixed invalid imports with --gen-all
* only excluding crate imports
Co-authored-by: Kamil Rojewski <kamil.rojewski@gmail.com>
Derek Bailey [Thu, 7 May 2020 21:33:29 +0000 (14:33 -0700)]
[C#] Thread safe reads of Double and Float values from a ByteBuffer (#5900)
* Fixed refractoring issue in reflection/generate_code.sh. Also, mv deletes the original file, so I don't need to clean it up manually in that case.
* Thread safe reads of Double and Floats from ByteBuffer
Dmitriy Kovalev [Thu, 7 May 2020 21:26:33 +0000 (14:26 -0700)]
Implement flexbuffers in python (#5880)
Casper [Thu, 7 May 2020 21:11:26 +0000 (14:11 -0700)]
Rust Flexbuffers (#5669)
* Cargo clippy lints
* more lints
* more lints
* Restored a doc comment
* Comment on float eps-eq and adjusted casting
* Rust Flexbuffers
* more serde tests, removed some unsafe
* Redid serde to be map-like and Reader is Display
* Moved iter from Reader to VectorReader
* Serious quickcheck + bugs
* wvo api
* Made types smaller for a reasonable speedup
* redid reading in a way that's a bit faster.
Profiling shows the rust slowdown as building +10%, reading +20%
* src/bin are developer binaries in rust
* Root and Map width are not packed
* key null check is debug only + doc changes
* BuilderOptions
* Documentation
* Documentation
* Moved tests to rust_usage_test
* Moved rust flexbuffers samples to Flatbuffers/samples
* Fixed RustTest
* Fixed for Rust 1.37.0
* Upgraded to rust 1_40_0
* fixed a little-endian-only feature in a test
* 1.40.0
* fixed some benchmarks for bigendian
* Updated .bat file
* misspelling
* Gold Flexbuffer test.
* Serialize,Deserialize, std::error::Error for Errors.
* Undo rustfmt in integration_test.rs
* from_slice instead of from_vec
* Added comments to unsafe blocks
* expanded on comment
* bump
Co-authored-by: CasperN <cneo@google.com>
mustiikhalil [Thu, 7 May 2020 19:28:42 +0000 (22:28 +0300)]
[swift] Moves code to use VTablesStorage (#5888)
* Moves the code to use _vtablestorage
Rebuilt the test to confirm to the new API
Adds documentation + generates code for grpc
Reverts indentation
v0.4.0
Updated swift/readme.md
Updates VtableStorage to ensure space instead of reallocating each time
Fixes str count not being correct
* Fixes issue with boolean constant not being set + removes unused function
Markus Junginger [Thu, 7 May 2020 19:26:55 +0000 (21:26 +0200)]
[Java][FlexBuffers] Make FlexBuffersBuilder reusable by adding clear() (#5889) (#5890)
Adam Oleksy [Thu, 7 May 2020 19:22:12 +0000 (21:22 +0200)]
Align package name to FindFlatBuffers.cmake (#5899)
This change is for fix warning:
```
CMake Warning (dev) at /home/aoleksy/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
The package name passed to `find_package_handle_standard_args`
(flatbuffers) does not match the name of the calling package (FlatBuffers).
This can lead to problems in calling code that expects `find_package`
result variables (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
FindFlatBuffers.cmake:33 (find_package_handle_standard_args)
CMakeLists.txt:6 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
```
Carol (Nichols || Goulding) [Thu, 7 May 2020 19:15:11 +0000 (15:15 -0400)]
Small tutorial improvements - documentation only (#5894)
* Use code formatting for a code snippet
* Minor grammar, spelling, and Markdown fixes
Wouter van Oortmerssen [Tue, 5 May 2020 17:47:29 +0000 (10:47 -0700)]
Attempt at adding Github Actions CI
Dmitry Volosnykh [Mon, 4 May 2020 20:23:41 +0000 (23:23 +0300)]
Handle git program or .git folder absence (#5878)
Assume version is 0.0.0.0 in such cases.
Thomas [Mon, 4 May 2020 19:27:50 +0000 (21:27 +0200)]
only add native_include_files if object based api is enabled (#5886)
The native include files tag is intended to be used together with the object based api. A client which does not use the object based api should have no need to know about the additional include files needed for the object based api. The generated flatbuffers code without object api enabled should compile without the additional header files.
Mika Raento [Mon, 4 May 2020 17:33:11 +0000 (20:33 +0300)]
Respect shared attribute in Parser (#5885)
Respects the 'shared' field attribute when reading data with Parser.
Even Rouault [Mon, 4 May 2020 17:21:57 +0000 (19:21 +0200)]
include/flatbuffers: typo fixes in comments (#5884)
mustiikhalil [Mon, 4 May 2020 17:18:38 +0000 (20:18 +0300)]
Updates swift docs for package management (#5883)
Small fix for the clear function
jrop [Mon, 4 May 2020 07:16:57 +0000 (01:16 -0600)]
[Rust] idl_gen_rust.cpp: (Option/required-aware codegen for unions) (#5850)
* idl_gen_rust.cpp: Fix google/flatbuffers#5849 (Option/required-aware
codegen for unions)
The generated code was assuming that an Option is always returned by the
union-getter method: however, this is only true if the field is not
marked as `(required)`.
* idl_gen_rust.cpp: flip conditional
* idl_gen_rust.cpp: Add comment, as requested in review
The code added is not covered by the integration test
Mika Raento [Thu, 30 Apr 2020 15:58:43 +0000 (18:58 +0300)]
Propagate use_string_pooling in CopyTable (#5879)
This allows using CopyTable for deduplicating strings.
Kamil Rojewski [Mon, 27 Apr 2020 19:35:42 +0000 (21:35 +0200)]
Not using reexports with --gen-all (#5873)
Co-authored-by: Kamil Rojewski <kamil.rojewski@gmail.com>
Alex Ames [Thu, 23 Apr 2020 17:09:19 +0000 (10:09 -0700)]
Added INCLUDE_PREFIX option for flatbuffers_generate_headers (#5866)
This option was in an earlier revision of flatbuffers_generate_headers
but was lost while refactoring by mistake. We have it as a function
argument rather than one of the optional flags so that we can use it to
inform the rule where to place the generated headers, so that the file
location matches the prefix that will be added to the filenames in the
generated files.
Also fixed some of the documentation in the file.
Wouter van Oortmerssen [Thu, 23 Apr 2020 16:28:22 +0000 (09:28 -0700)]
Fixed text in internals doc that implied structs can be root
mustiikhalil [Mon, 13 Apr 2020 16:28:56 +0000 (19:28 +0300)]
[Swift] Object API support (#5826)
* Adds Object-api support to swift
* Fixed indentation issues
* Removed indentation within namespaces
Khoi Dinh Trinh [Thu, 9 Apr 2020 16:53:16 +0000 (09:53 -0700)]
[TS] Add Obj API (#5788)
* added basic code
* backup work
* got class property to work
* backup progress
* implementented fmt for creating code
* added docs for genFieldUtils
* back up work
* added base helper js func
* added union js code
* added unpackTo and base for pack
* added pack code
* added null check for packing struct list
* passes compile test
* fixed some spacing of generated functions
* added annotations for constructors
* added obj api unpack test
* tested pack to work
* merge branch
* separated js and ts test
* fixed union signature to include string
* fixed generator to support string union
* hardcoded fb builder name
* refactored struct vector creation
* work around createLong
* handle default value in constructor
* update typescript docs
* added notes about import flag
* fixed formatting stuffs
* undo TypescriptTest change
* refactored fmt
* updated generated code
* remove ignoring union_vector for js
* revert changes for .project
* revert changes for package.json
* don't generate js in ts test
* fixed android project file
* removed unused js function
* removed package-lock.json
* adjust createObjList to new signature
* changed regex to callback style
* fixed package.json
* used existing func for generating annotation
* changed ternary to !!
* added return type for lambda
* removed callback style for obj api generator
* fixed js file indentation
* removed unused header
* added tests for string only union
* handle string only union and refactor union conv func
* updated generated ts files
* renamed union conv func
* made js test create files like other languages
* removed union string only handling
* don't allow null in createObjectOffsetList
* updated generated ts code
* changed the line that triggers Windows build errors
* hopefully fix CI error
Meng Yang [Thu, 9 Apr 2020 16:38:58 +0000 (00:38 +0800)]
fix cpp usage markdown error (#5845)
mustiikhalil [Mon, 6 Apr 2020 17:05:56 +0000 (20:05 +0300)]
Upgraded swift implementation for grpc (#5843)
Updated version number
Anass Al [Mon, 6 Apr 2020 16:27:13 +0000 (09:27 -0700)]
[C#] Fix nested structs and arrays in Object API (#5765)
* [C#] Fix nested structs and arrays in Object API
The adds support for nested structs and fixed size arrays in the C#
Object API codegen which previously generated invalid code that wouldn't
compile.
- Nested structs would originally generate syntax errors due to adding an
additional `.` to separate fields.
- Fixed size arrays of nested structs would originally generate code for
the first field in the top most struct, and would lead to a compiler
error due to referencing undefined variables.
* [C#] fix nested structs and arrays of structs.
* fix nested structs + arrays
* add table support
* Cleanup code
Co-authored-by: mugisoba <mugisoba+github@icloud.com>
Max Burke [Mon, 6 Apr 2020 16:09:15 +0000 (09:09 -0700)]
[ts] Fix empty source/dest namespaces when reexporting. (#5841)
When either source or destination or both namespaces were empty, flatc
was generating incorrect TS code.
For example:
```
export namespace {
export import ObjectId = NS10770172024577249292..ObjectId;}
```
In this case the target namespace is empty, and so is the namespace
between the NSxxx placeholder and the target type.
mustiikhalil [Thu, 2 Apr 2020 19:55:30 +0000 (22:55 +0300)]
Improves performance for the swift library by using structs + a storage class (#5835)
Paulo Pinheiro [Mon, 30 Mar 2020 20:46:42 +0000 (22:46 +0200)]
[Java][FlexBuffers] Optimize Map access (#5735)
The original implementation of map access is very naive:
- Encode String to UTF8 byte[]
- Creates a new KeyVector
- Performs a binary search to find the key
- return value
So every access to the Map there was useless allocations of Keys and KeyVector
and complete encoding of the search key, which for most comparisons would be wasteful.
This changes completely removes the use of KeyVector and compute the key
positions on the spot. Besides that, it compares keys codepoint-by-codepoint,
avoiding unnecessary allocations and reducing encoding for most cases.
Some benchmarks result in a 2.75x speedup.
Olivier Le Doeuff [Fri, 27 Mar 2020 15:35:44 +0000 (16:35 +0100)]
[CMake] : Add precompiled header support with FLATBUFFERS_ENABLE_PCH (#5827)
* [CMake] : Add precompiled header support with FLATBUFFERS_ENABLE_PCH
FLATBUFFERS_ENABLE_PCH enable precompile headers support for 'flatbuffers' and 'flatc'. Default if OFF.
You need to set it to ON to make it work. 'cmake -DFLATBUFFERS_ENABLE_PCH=ON ..'
This will only work if CMake version is >= 3.16, because target_precompile_headers is used.
If CMake doesn't have target_precompile_headers, then nothing will happen.
This can speed up compilation time.
Precompiled header file for 'flatbuffers' is 'pch.h'
Precompiled header file for 'flatc' is 'flatc_pch.h'
* Enable FLATBUFFERS_ENABLE_PCH for VC 2017 and VS2019 builds
* [CMake]: Fix error in FLATBUFFERS_ENABLE_PCH description
* Add a function add_pch_to_target to avoid copy and pasting the same code like add_fsanitize_to_target
Move pch.h and flatc_pch.h from include/flatbuffers to include/flatbuffers/pch
Make flatc_pch.h depends on pch.h since it extend it
Alex Ames [Fri, 27 Mar 2020 15:33:12 +0000 (08:33 -0700)]
Added flatbuffers_generate_headers and flatbuffers_generate_binary_files cmake functions. (#5830)
flatbuffers_generate_headers is a function that can be used to generate Flatbuffers headers and binary headers. It uses named argument flags to wrap all the flags relevant to C++ header generation that flatc uses. It generates an interface library that can be added as a dependency of other targets.
flatbuffers_generate_binary_files is a function that can be used to generate Flatbuffers binaries. It uses named argument flags to wrap all the flags relevant to C++ binary generation from JSON file that flatc uses. It generates an interface library that can be added as a dependency of other targets.
Dmitriy Kovalev [Thu, 26 Mar 2020 15:54:52 +0000 (08:54 -0700)]
Correct calculation of vector element size (#5831)
Number of elements on the stack shouldn't affect the calculation
of ElemWidth(). Variable 'start' needs to be subtracted from the
loop variable 'i' to make indexing zero-based.
There is an additional unit test to pack nested vectors. Size of
the packed buffer *without* this fix is 798 and only 664 bytes
*with* the fix.
Arthur O'Dwyer [Mon, 23 Mar 2020 17:01:11 +0000 (13:01 -0400)]
Fix Clang-trunk warnings about special members deprecated in C++20. (#5829)
For example:
include/flatbuffers/reflection.h:365:8: error: definition of implicit copy
constructor for 'pointer_inside_vector<flatbuffers::Table, unsigned char>'
is deprecated because it has a user-declared copy assignment operator
[-Werror,-Wdeprecated-copy]
void operator=(const pointer_inside_vector &piv);
^
It's unclear why the old code wanted to declare a public `operator=`
without defining it; that just seems like a misunderstanding of the C++03 idiom
for deleting a member function. And anyway, we don't *want* to delete the
assignment operator; these are polymorphic types that do not follow value
semantics and nobody should ever be trying to copy them. So the simplest fix
is just to go back to the Rule of Zero: remove the declaration of `operator=`
and let the compiler do what it wanted to do originally anyway.
"The best code is no code."
Also, update the generated .h files.
Fixes #5649.
Vladimir Glavnyy [Mon, 23 Mar 2020 16:51:57 +0000 (23:51 +0700)]
Fix `float_constant` definition in './doc/Grammar.md` (#5828)
stefan301 [Mon, 23 Mar 2020 16:39:26 +0000 (17:39 +0100)]
[csharp] flatc should generate a 'Create…' method for tables with struct field… (#5818)
* flatc should generate a 'Create…' method for tables with struct fields when also generating the object based api (C#)
https://stackoverflow.com/questions/
60724317/flatc-should-generate-a-create-method-for-tables-with-struct-fields-when-al
* missing namespace fixed: C:\projects\flatbuffers\tests\namespace_test\NamespaceA\TableInFirstNS.cs(30,7): error CS0246: The type or namespace name 'StructInNestedNST' could not be found (are you missing a using directive or an assembly reference?) [C:\projects\flatbuffers\tests\FlatBuffers.Test\FlatBuffers.Test.csproj]
Co-authored-by: stefan301 <Stefan.Felkel@de.Zuken.com>
Yurii Nakonechnyi [Fri, 20 Mar 2020 17:13:47 +0000 (19:13 +0200)]
Updated doxyfile - added missing files (#5824)
Added missing Java/C#/Switft files - that fixes references to them. Removed non-existent "JavaCsharpUsage.md".
Ekene Madu [Fri, 20 Mar 2020 17:12:23 +0000 (10:12 -0700)]
Update Grammar.md (#5820)
* Update Grammar.md
Some consistency fixes to the grammar file
* Some more minor fixes to Grammar.md
* Update Grammar.md
a-maurice [Tue, 17 Mar 2020 20:38:29 +0000 (13:38 -0700)]
Include CPack only when explictly packaging (#5817)
Including CPack without the additional packaging information creates unused project files, and can potentially cause issues for projects including Flatbuffers that also use CPack.
stefan301 [Mon, 16 Mar 2020 19:19:11 +0000 (20:19 +0100)]
[C++] Add max_depth and max_tables parameters to reflection::Verify (#5815)
* Added missing EndTable() call to VerifyObject()
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
* Added Check to VerifyAlignment
https://stackoverflow.com/questions/
59376308/flatbuffers-verifier-returns-false-without-any-assertion-flatbuffers-debug-veri
* [C++] Add max_depth and max_tables parameters to reflection::Verify
Co-authored-by: Felkel <stefan@eas.local>
Co-authored-by: stefan301 <Stefan.Felkel@de.Zuken.com>
Vladimir Glavnyy [Mon, 16 Mar 2020 18:59:34 +0000 (01:59 +0700)]
Fix interpretation of 'nan(number)' by the idl_parser (#5810)
* Parser reject "nan(n)" string as it does with nan(n)
* Adjust scalar fuzzer to ignore '$schema' substrings
- Scalar fuzzer ignores '$schema' substrings at the input
- Added 'scalar_debug' target to simplify research of fuzzed cases
* Improve formatting of './tests/fuzzer/CMakeLists.txt'
mustiikhalil [Mon, 16 Mar 2020 18:55:59 +0000 (21:55 +0300)]
[Scripts] Adds swift to generated code (#5806)
* Moved swifttest.sh code generator to generate_code + fix issue in ghpages
* Fixes small issue with cocoapods documentation
Wouter van Oortmerssen [Mon, 16 Mar 2020 18:33:42 +0000 (11:33 -0700)]
updated maven build files
Change-Id: I33c69978fe7a22485a7fd5ceb7a480e84e8bcdb3
Wouter van Oortmerssen [Thu, 12 Mar 2020 21:41:06 +0000 (14:41 -0700)]
pre-tag version bump for 1.12
Change-Id: I84a9365e9d8a1afe333b1df85058401ffe0a6b7c
mustiikhalil [Thu, 12 Mar 2020 19:13:03 +0000 (22:13 +0300)]
Removes the inner loop in the endtable check written tables (#5803)
Marc Butler [Thu, 12 Mar 2020 19:10:30 +0000 (06:10 +1100)]
Escape characters in jsonschema descriptions (#5644)
* Escape JSON Schema comments
* Add quotes to monster comment
Thus exercising the JSON Schema comment escape support.
Vladimir Glavnyy [Thu, 12 Mar 2020 19:07:27 +0000 (02:07 +0700)]
Remove `noexcept` qualifier copy-ctor of `union` type (#5800) (#5802)
- Remove `noexcept` qualifier from generated 'union' copy-constructor
- Remove `noexcept` qualifier from generated 'union' assign-operator
Vladimir Glavnyy [Thu, 12 Mar 2020 18:18:10 +0000 (01:18 +0700)]
Replace 'assert' by 'FLATBUFFERS_ASSERT' inside idl_parser.cpp (#5799)
Jakub Vrána [Thu, 12 Mar 2020 16:02:29 +0000 (17:02 +0100)]
Add non-nullable modifier to return type of functions never returning null (#5797)
Myrice [Thu, 12 Mar 2020 15:32:29 +0000 (08:32 -0700)]
[C++] Generate code for vector force_align attribute. (#5796)
* [Flatbuffer] Generate code for force_align with CreateXDirect and Pack functions.
* Fixed Visual Studio 10.0 compile error for std::to_string.
* Fixed Visual Studio 10.0 compile error for std::to_string.
jean-airoldie [Tue, 10 Mar 2020 00:25:03 +0000 (20:25 -0400)]
rust: pub export the VectorIter type (#5736)
Wouter van Oortmerssen [Mon, 9 Mar 2020 23:43:43 +0000 (16:43 -0700)]
Fix Python min alignment
This was accidentally deleted in:
https://github.com/google/flatbuffers/commit/
9fa8245e81a2fd8ad19f9ae8f3da3a00e796e462
Change-Id: I8cad721e075279f6a67aca81259f73fb75aba482
Lee Mracek [Mon, 9 Mar 2020 02:05:20 +0000 (22:05 -0400)]
[Rust] Add gen-name-strings for Rust (#5757)
* Add gen-name-strings for Rust
* Clang format
* Add tests and generate with gen-name-strings
* Clang-format
* Stop doing gen-name-strings with C++ code
* Bring generate_code.bat up with generate_code.sh
Wouter van Oortmerssen [Fri, 6 Mar 2020 01:20:51 +0000 (17:20 -0800)]
Removed assert that wasn't backwards compatible.
Change-Id: I8e74d6fddf91fe955fffc572af9d671160325731
Wouter van Oortmerssen [Thu, 5 Mar 2020 17:33:22 +0000 (09:33 -0800)]
[C#] add ObjectAPI Serialization Utility (#5785)
* [C#] add ObjectAPI Serialization Utility
* set InitialBufferSize to 64k
* rename SerializeToFlatBuffers to SerializeToBinary
Wouter van Oortmerssen [Mon, 2 Mar 2020 20:15:35 +0000 (12:15 -0800)]
Fixed docs on how to obtain parser error.
Change-Id: Ib3ffbdf51ef6af1f5c8267b84b84dceed9d4a838
Derek Bailey [Mon, 2 Mar 2020 18:15:23 +0000 (10:15 -0800)]
Added --filename-suffix and --filename-ext to flatc (#5778)
* Fixed refractoring issue in reflection/generate_code.sh. Also, mv deletes the original file, so I don't need to clean it up manually in that case.
* Added --filename-suffix and --filename-ext to flatc
* Fixed typo and added example generation of suffix and extension for C++
* Removed extra ;
* Removed clang-format block from a region that didn't need it. Fixed an auto format of another clang-format block
* Added docs, fixed pointer alignment, removed suffix test file
Derek Bailey [Thu, 27 Feb 2020 20:59:44 +0000 (12:59 -0800)]
Fixed refractoring issue in reflection/generate_code.sh. Also, mv deletes the original file, so I don't need to clean it up manually in that case. (#5777)
Derek Bailey [Mon, 24 Feb 2020 22:46:24 +0000 (14:46 -0800)]
Skip writing reflection_generated.h if not changed (#5776)
mustiikhalil [Mon, 24 Feb 2020 17:27:41 +0000 (20:27 +0300)]
[Swift] Adds GRPC to Swift (#5758)
* Adds the basic structure for required to add grpc support
Added the message implementation
Updated the code to confirm to the protocol flatbuffersobject
Adds an example for Swift flatbuffers GRPC
Started implementing the swift GRPC code Gen
Generator generates protocols now
Fixing ci issues
Migrated the logic to use grpc_generator::File instead of string
Refactored swift project
Implemented GRPC in swift
Finished implementing GRPC in swift
Fixes issues
Adds contiguousBytes initializer to swift
Adds documentation + fixes buffer nameing in tables + structs
Adds documentation + fixes buffer nameing in tables + structs
Updated tests
* Updated version
Paulo Pinheiro [Fri, 21 Feb 2020 19:46:40 +0000 (20:46 +0100)]
[Java][FlexBuffers] Abstract buffer access from ByteBuffer (#5743)
To read and build flexbuffers on Java, one needs to wrap the data
using ByteBuffer. But for the common case of having ByteBuffers
backed by arrays, accessing from a ByteBuffer might be inefficient.
So this change introduces two interfaces: ReadBuf and ReadWriteBuf.
It allows one to read and writes data directly on an array. It also allow
other buffer implementations to be used with flexbuffers.
Another change is that FlexBuffersBuilder backed by array allows
the buffer to grow with the increase of the message size. Something
that could not be done with ByteBuffer.
mustiikhalil [Fri, 21 Feb 2020 19:42:07 +0000 (22:42 +0300)]
Adds cocoapods and a readme of how to get the package (#5771)
Omer Akram [Thu, 13 Feb 2020 16:05:21 +0000 (21:05 +0500)]
[snap] Fix versioning (#5727)
* fix snap versioning
* no need to install git as build packages
Joseph Pyott [Wed, 12 Feb 2020 21:53:09 +0000 (16:53 -0500)]
[Python] Fixed potential allignment issue (#5768)
xtrm0 [Wed, 12 Feb 2020 20:12:45 +0000 (20:12 +0000)]
Fix memory leak on cpp object api (#5761)
Previously UnPack would allocate data with new and assign it to a
raw pointer. This behavior makes it possible for the pointer to be
leaked in case of OOM. This commit defaults to use the user specified
pointer (which needs to implement a move constructor, a .get() and a
.release() operators), thus preventing these leaks.
Joseph Pyott [Tue, 11 Feb 2020 23:02:21 +0000 (18:02 -0500)]
[Python] Fixed issue #5499 (#5764)
David P. Sicilia [Tue, 11 Feb 2020 01:45:32 +0000 (20:45 -0500)]
[C++] Use strong enum type for vectors when scoped-enums is on. (#5750)
* [C++] Use strong enum type for vectors when scoped-enums is on.
These changes only apply when scoped-enums is on, and thus only
the C++17 tests show diffs.
This may break users who use 1) use scoped-enums and 2) use
vectors of enums. However, it seems that this change should
have been made originally when scoped-enums were added.
Fixes #5285
* [C++] Put strong enum change also behind C++17 flag.
It actually only needs C++11 technically, but this is being done
to avoid breaking any existing users.
Tests were rerun, but produced no additional diffs, as expected.
* [C++] Forgot one location in which C++17 guard needs to go.
This commit produces no additional diffs in generated code.
* Use g_only_fixed_enums instead of scoped_enums.
mugisoba [Tue, 11 Feb 2020 01:43:36 +0000 (10:43 +0900)]
[C#] support Json Serialization (#5752)
* support json serialization
* fix invalid json format.
* string must be written with double quotes.
* remove commma after the last object member.
* fix indent
* Revert "fix invalid json format."
This reverts commit
d6820ed50c8e3d3cda3aa1849b3079f853608619.
* quated string value.
* add cs-gen-json-serializer flag.
* fix preprocessor indent
* ENABLE_JSON_SERIALIZATION -> ENABLE_JSON_SERIALIZATION_TEST
* share TestBuffer method
* remove ENABLE_JSON_SERIALIZATION
* remove duplicated test data
* [windows] add nuget restore and copy test data.
* [docker mono] share msbuild settings with windows. add nuget restore and copy test data.
* add some note for json api.
Wouter van Oortmerssen [Thu, 6 Feb 2020 19:49:39 +0000 (11:49 -0800)]
FlexBuffers: C++: scalar-only typed vectors were not aligned.
This means data written with older versions of this code has
potentially misaligned data, which we'll need to support.
This isn't a problem on most architectures, but could be on
older ARM chips. To support them properly may require swapping
out uses of `flatbuffers::ReadScalar` with a version that does a
memcpy internally.
Change-Id: Ib352aab4a586f3a8c6602fb25488dcfff61e06e0
Robert Winslow [Thu, 30 Jan 2020 21:55:44 +0000 (13:55 -0800)]
Bump Rust port to 0.6.1 (#5747)
mugisoba [Thu, 30 Jan 2020 18:18:28 +0000 (03:18 +0900)]
[C#] support Object API (#5710)
* [C#] support Object API
* fix sign-compare
* fix indent
* add new line before for loop.
* using auto whenever possible
* reduce the amout of blank lines.
* wip: support vectors of union
* done: support unions of vectors
* set C# version to 4.0
* remove null propagation operator
* remove auto property initializer
* remove expression-bodied method
* remove pattern matching
* add Example2 to NetTest.sh
* separate JavaUsage.md and CsharpUsage.md from JavaCsharpUsage.md
* add C# Object based API notes.
* support vs2010.
* remove range based for loop.
* remove System.Linq
* fix indent
* CreateSharedString to CreateString
* check shared attribute
* snake case
mustiikhalil [Mon, 27 Jan 2020 18:05:41 +0000 (21:05 +0300)]
Adds min and max, comments, and all of swift's keywords + fix docs (#5737)
Dan Field [Mon, 27 Jan 2020 18:03:00 +0000 (10:03 -0800)]
Use VS 2017 and 2019 on CI, fix cast issue in dart_idl (#5740)
* vs2019
* another attempt
* syntax
* fewer
* fix dart
mustiikhalil [Fri, 24 Jan 2020 22:55:57 +0000 (01:55 +0300)]
Creates a flatbuffers validation function + small fix (#5725)
sjoblom65 [Fri, 24 Jan 2020 22:55:34 +0000 (17:55 -0500)]
Added the code to embed the binary schema to the source (--bfbs-gen-embed). (#5701)
* Added the code to embed the binary schema to the source.
This is pulled forward from a old PR #5162 that will be closed.
* Update idl_gen_cpp.cpp
Added a small comment to trigger a new build. The build was failing in a strange location and doesn't look like it has anything to do with the code.
* Moved the EscapeAndWrapBuffer to util.cpp and did some formating.
* One more camelCases removed and renamed some variables.
* wrapped_line_xxx should have been passed as a const reference in the first place.
* Moved the bfbs embed sample to it's own file.
* Missed moving the namespace back.
* Moved the embedded bfbs to test.cpp instead of using a sample.
* Missed adding the generation of embedded bfbs to the build.
* See if this makes the build happier.
* Fixed a in-compatable cpp output of the generated header.
* Did some changes to reflect the code review comments.
1. Update the EscapeAndWrapBuffer to BufferToHexText and fixed a variable name.
2. Moved the include of the embedded binary schema to all the other includes.
* Moved some code to inline the instead of using a local variable.
* Moved the BufferToHexText back to be a inline function in util.h
Paulo Pinheiro [Fri, 24 Jan 2020 17:58:15 +0000 (18:58 +0100)]
[Java][FlexBuffers] Deprecate typed vector strings due to design flaw (#5722)
* [Java][FlexBuffers] Deprecate typed vector strings due to design flaw
It will still be possible to read buffers with this type, but the
elements will be treated as FBT_KEY and will be read as null-terminated
string.
Trying to build a vector of strings as typed will throw an exception.
More information on https://github.com/google/flatbuffers/issues/5627
Also, fix another bug on strings, where long strings were not properly
aligned.
* [Java][FlexBuffers] Make FBT_VECTOR_STRING_DEPRECATED considered typed.
The logic for FlexBuffers.isVectorType() was changed
to not consider FBT_VECTOR_STRING_DEPRECATED a typed
vector, but that can lead to missinterpretation for
existing serialized data. So we are reverting.
mustiikhalil [Fri, 24 Jan 2020 17:57:34 +0000 (20:57 +0300)]
[Go] Implements a SharedStrings function (#5733)
* Adds the sharedstring implementation for go
* Reimplemented testcase according to request
vkill [Fri, 24 Jan 2020 17:45:19 +0000 (01:45 +0800)]
[Swift] Fix padding function overflow when bufSize is 0 (#5721)
* [Swift] Fix padding function overflow when bufSize is 0
[Swift] Generate linuxmain
* [Swift] Using the overflow addition operator to resolve integer overflow
Phoebe [Thu, 23 Jan 2020 23:46:25 +0000 (07:46 +0800)]
Add vcpkg installation instructions (#5732)
* Add vcpkg installation instructions
* Update comments
Dan Field [Thu, 23 Jan 2020 22:53:59 +0000 (14:53 -0800)]
[Dart] Fix deprecated field support, inf/nan (#5724)
* Fix deprecated field support, inf/nan
* unused params
* rerun tests
Max Burke [Tue, 21 Jan 2020 05:20:52 +0000 (21:20 -0800)]
[typescript] Size-prefixed root accessors not taking into account size prefix (#5717)
* [typescript/javascript] Size-prefixed root accessor needs to account for the size prefix.
* [typescript] Add parentheses after "new" expression.
* Update generated test files
Max Burke [Sun, 19 Jan 2020 22:47:28 +0000 (14:47 -0800)]
[rust] Add use declarations to Rust-generated bindings for imported FB definitions (#5645)
* Bugfix for Rust generation of union fields named with language keywords
Looking at ParseField, it appears that in the case of unions, an extra field with a `UnionTypeFieldSuffix` is added to the type definition, however, if the name of this field is a keyword in the target language, it isn't escaped.
For example, if generating code for rust for a union field named `type`, flatc will generate a (non-keyword escaped) field named `type_type` for this hidden union field, and one (keyword escaped) called `type_` for the actual union contents.
When the union accessors are generated, they refer to this `type_type` field, but they will escape it mistakenly, generating code like this:
```
#[inline]
#[allow(non_snake_case)]
pub fn type__as_int(&self) -> Option<Int<'a>> {
if self.type__type() == Type::Int {
self.type_().map(|u| Int::init_from_table(u))
} else {
None
}
}
```
Which will fail to build because the field is called `self.type_type()`, not `self.type__type()`.
* [Rust] Add crate-relative use statements for FBS includes.
At present if a flatbuffer description includes a reference to a type in
another file, the generated Rust code needs to be hand-modified to add
the appropriate `use` statements.
This assumes that the dependencies are built into the same crate, which
I think is a reasonable assumption?
* Revert "[Rust] Add crate-relative use statements for FBS includes."
This reverts commit
d554d79fecf5afd6da6fb993b30b4cd523a5889a.
* Add updated generated test files.
* Fixing Rust test harness to handle new includes.
Test binaries need to add references to generated code that's
transitively included.
This also has the knock-on in that this code (which is referenced by
include directives directly in the flatbuffer schema files) also needs
to be generated, hence the changes to generate_code.sh.
* Test harnesses expect test data to be checked in.
Put include_test2 files into the same directory as the include_test2
schema definition.
Update all code generation scripts (forgot the batch file from last
time).
Path updates in Rust test.
* Include updated generated code
* Address comments raised in PR
* Fix failing Rust tests.
* Previous merge clobbered this branch change.
* Add updated imports to benchmarks.
* Clarifying comment per PR request
* Update documentation comments per feedback
* Remove non-Rust generated files for include tests, per feedback from @rw/@aardappel
* Broken code generation batch file
* Fix typo
* Add TODO for tidying up use declaration traversal sometime in the future
* Update test files.
Somo [Fri, 17 Jan 2020 00:19:00 +0000 (19:19 -0500)]
[Go] Replace references to hardcoded ”Monster" etc with idiomatic go wherever possible (#5716)
* go: replace objAPI-generated Pack func with method
See discussion at https://github.com/google/flatbuffers/issues/5668
* go: replace generated union type UnPack func with method
Similar to discussion https://github.com/google/flatbuffers/issues/5668
But signature:
```
func AnyUnPack(t Any, table flatbuffers.Table) *AnyT
```
Becomes,
```
func (rcv Any) UnPack(table flatbuffers.Table) *AnyT
```
Vladimir Glavnyy [Thu, 16 Jan 2020 22:12:25 +0000 (05:12 +0700)]
[C++] Fix for printing of enum in case output_enum_identifiers=1. (#5706)
* Add test-case for testing of the future Color in json (output_enum_identifiers = true)
* Refactoring of idl_gen_text.cpp. Fix for printing of bit-enum with active output_enum_identifiers=1.
* Move GenerateText implementation into class
* Remove unnecessary code from flatbuffers.h
vkill [Thu, 16 Jan 2020 20:08:59 +0000 (04:08 +0800)]
[Swift] Support create long string (#5709)
* [Swift] Support create long string
* [Swift] Move the test case to correct dir
mustiikhalil [Mon, 13 Jan 2020 20:34:06 +0000 (23:34 +0300)]
Added create function for swift (#5707)
Fixed the create functions and updated the test cases in swift
Removes unneeded code
Updated documentation
mustiikhalil [Thu, 9 Jan 2020 20:12:10 +0000 (23:12 +0300)]
[Swift] Swift implementation 🎉🎉 (#5603)
* Implemented the swift version of Flatbuffers
Implemented serailzing, reading, and mutating data from object monster
Fixes mis-aligned pointer issue
Fixes issue when shared strings are removed from table
Adds swift enum, structs code gen
Fixed namespace issues + started implementing the table gen
Added Mutate function to the code generator
Generated linux test cases
Fixed an issue with bools, and structs readers in table writer
Swift docker image added
Updated the test cases, and removed a method parameters in swift
Fixed createVector api when called with scalars
Fixed issues with scalar arrays, and fixed the code gen namespaces, added sample_binary.swift
Cleaned up project
Added enum vectors, and their readers
Refactored code
Added swift into the support document
Added documentation in docs, and fixed a small issue with Data() not being returned correctly
Fixes Lowercase issue, and prevents generating lookups for deprecated keys
* Made all the required funcs to have const + removed unneeded code + fix lowercase func
* Removed transform from lowercased and moved it to function
* Fixes an issue with iOS allocation from read
* Refactored cpp code to be more readable
* casts position into int for position
* Fix enums issue, moves scalar writer code to use memcpy
* Removed c_str from struct function
* Fixed script to generate new objects when ran on travis ci: fix
* Handles deallocating space allocated for structs
* Updated the test cases to adhere to the fileprivate lookup, no mutation for unions, and updated the names of the vector functions
Wouter van Oortmerssen [Thu, 9 Jan 2020 19:47:02 +0000 (11:47 -0800)]
Changed direct calls to strtod to use StringToNumber
StringToNumber will correctly use locale-insensitive functions
when available.
Change-Id: I6bde11039a541634186f8f791012af2eb0d86b8d
emkornfield [Thu, 9 Jan 2020 18:56:35 +0000 (10:56 -0800)]
Document JSON compatibility guarantees. (#5704)
https://github.com/google/flatbuffers/issues/5688
Vladimir Glavnyy [Mon, 6 Jan 2020 23:26:41 +0000 (06:26 +0700)]
Add CMake 'generated_code' target to simplify resolution of build dependencies (#5697)
Michael Beardsworth [Mon, 6 Jan 2020 18:00:59 +0000 (10:00 -0800)]
(Optionally) add an additional suffix namespace to generated fbs files. (#5698)
This change allows for the generation of fbs files (from proto) that
don't contain name collisions with the protobuf generated C++ code,
allowing both the proto and fbs message types to be linked into the same binary.
dreifachstein [Mon, 6 Jan 2020 17:28:19 +0000 (01:28 +0800)]
[Java] Replace Table.UTF8_CHARSET with StandardCharsets.UTF_8 (#5696)
StandardCharsets.UTF_8 is already used in FlexBuffersBuilder.
Robert Winslow [Thu, 2 Jan 2020 21:34:47 +0000 (13:34 -0800)]
Rust: Temporarily disable 2 endianness unit tests (#5695)
Rare failures occur on AppVeyor in these functions; the failures appear
spurious.
David P. Sicilia [Thu, 2 Jan 2020 18:12:14 +0000 (13:12 -0500)]
[C++17] Add Traits class for Tables and Factory function within it. (#5678)
* Include flattests_cpp17 in unit tests when C++17 build is enabled.
* [C++17] Generate generic table factory function.
1. For each table, generate a convenient free-standing factory
function that allows creating the table in a generic way by
specifying only the type. This is the first change in a series
of changes to make Flatbuffers generated C++ code more friendly
to code bases that make use of C++ template metaprogramming
techniques to manage the serialization process. Example:
Before :(
// The name of the Flatbuffers type (and namespace) must
// be hard-coded when writing the factory function.
auto monster = MyGame::Example::CreateMonster(fbb, ...);
After :)
using type_to_create = MyGame::Example::Monster;
// No namespace needed on CreateByTagType.
auto monster = CreateByTagType((type_to_create*)nullptr,
fbb, ...);
This feature requires building with C++14 or greater, and thus
it is guarded behind --cpp-std >= c++17 in the flatbuffers C++
generator.
2. Fix a CMake bug to include C++17 unit tests in test suite.
* [C++17] Replace standalone variadic factory function with type_traits.
Add a `type_traits` to each table class. This `type_traits` can be
populated with various compile-time info about the table. Initially,
we have the Create* function and type, but is extensible in the future.
* Remove empty line and fix stale comments.
* Rename type_traits to Traits and move fwd declaration.
* Fix parameter evaluation order issue and use lambda for scope.