* RFC: Add ExternalStorage for ByteBuffer in Swift implementation
This PR proposed one more API for ByteBuffer such that no copy is
required to parse FlatBuffers content. This API has limited use, but for
cases that you need to read part of the flatbuffers' data to decide
whether you want to parse / copy the full buffer out, it is useful.
* Use a variable rather than protocol.
* Revert grouping changes from the other PR.
* Add unit test to read from unowned UnsafePointer.
* Manifest changed.
* Moves addition to overflow addition in swift by using &+
Moves code to use Int instead of UInt32 & fixes functions
Updates swift performance to great
Updated version to 0.5.2
Updated swift package version to 5.2
Updated docker to swift 5.2
Removed all none & arithmetic operations
* Small refactoring
* [rust] Add force_defaults method FlatBufferBuilder
This works just like the same method already available in other
languages.
* Add binary format test for force_defaults
* [Java] Grow ArrayReadWriteBuf enough to match requested capacity.
Also handle requested capacity overflowing.
* [Java] Improve readability of ArrayReadWriteBuf.requestCapacity()
* [Java] prepare testBuilderGrowth() to fail again once FlexBuffersBuilder uses ByteBufferReadWriteBuf internally, add TestFail() as a better alternative to a plain "assert false"
* [Java] Revert some test changes and extract a small string that was used more than once; one could say three times, however, it might be worthy of a discussion if the third occasion also falls into this category, as it is an independent use case and thus would work in the same way even if the value changed.
Co-authored-by: Markus <markus@greenrobot>
* 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.
* 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
* 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
* 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>
* 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
* 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
* [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>
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.
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.
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.
* 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>
* 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'
* 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
* 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
* 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
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.
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.
* [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.
* [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