* [docs] Added an example on how to convert a FlatBuffer binary to JSON
Slightly adjusted section on "Using flatc as a conversion tool".
Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
* [docs] Updated obsolete JSON data in example showing how to convert JSON to FlatBuffer binaries.
Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
* c++: Add command line option to add extra includes to gen files
Fixes#5351
We have an ability to pass custom types for strings, allocators, etc
but have no way to tell the generator to include the classes in gen code
* c++: remove std::strtok for std::string methods. passes msvc compile
* generate_code.sh: add --cpp-includes to the test gen script
* tests:generate.bat: update code gen scripts w/ --cpp-includes
* cpp: use command line parsing for extra includes
s/--cpp-includes/--cpp-include/g
Simplify command line parsing of includes by using a std::vector.
* cpp: idl.h: move std::vector for cpp_includes as the last member
msvc does not understand initalization list on our CI server
* cpp:msvc: CI fails on for-range loops
* cpp:codegen: fix error reporting on flatcc
* as per code review: remove unwated --cpp-include in the
tests/generate_code.{sh,bat}
This is done on purpose, to avoid API version mismatches that
can cause bad decoding results, see:
https://github.com/google/flatbuffers/issues/5368
Change-Id: I2c857438377e080caad0e2d8bcc758c9b19bd6ec
* Added a cpp UnPackSizePrefixed<struct_name> generated helper function
Missing helper function added to the cpp API generator for unpacking size prefixed structures
* Added generated test files
* [Go] Make enums into real types, add String()
This changes the generated code for enums: instead of type aliases,
they're now distinct types, allowing for better type-checking. Some
client code may have to be changed to add casts.
Enum types now have a String() method, so they implement fmt.Stringer.
An EnumValues map is now generated, in addition to the existing
EnumNames map, to easily map strings to values.
Generated enum files are now gofmt-clean.
Fixes#5207
* use example.ColorGreen explicitly
* use valid enum value in mutation test, add new test for "invalid" enum
* add length check and comment
* WIP size prefix support
* Consider size prefix in overloaded variant
* Work on code gen
* Disabled helper functions in code gen
* Enabled helper functions in code gen
* Fix size prefixed test
* Fix bad function call
* Add SIZE_PREFIX_LENGTH
* Fix review comments
- update C++ monster_test::Color to unsigned type
- update Go Color:ubyte in the go_test.go
- add workaround for unsigned enum in java test
- sync generate.bat and generate.sh
* Use a hash table to index existing vtables
This allows for quick deduplication even in situations where there
might be thousands of vtables due to 'combinatoric explosion'.
This fixes issue #5301.
* Refactor 0-offset trimming
* Improve deduplication benchmark
The routine now generates a set of realistic logical layouts and
uses a timer function that randomly picks a layout for each iteration.
The benchmark runs in batches of # of logical layouts = 1, 10, 100, 1000.
(Note that due to alignment, the actual number of vtables is usually slightly
higher.)
* Fix issues with uint64 enums
- hide the implementation of enums from code generators
- fix uint64 the issue in the cpp-generator
- fix#5108
- new tests
- enums with bit_flags attribute should be unsigned
* Refine objectives of EnumDef's FindByValue and ReverseLookup methods
- move EnumDef::ReverseLookup implementation to idl_parser.cpp
- fix typos
* Make the IsUInt64 method private
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.
* 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.