* [Kotlin] Add kotlin generate code for tests and add
kotlin test to TestAll.sh
* [Kotlin] Add Kotlin generator
This change adds support for generating Kotlin classes.
The approach of this generator is to keep it as close
as possible to the java generator for now, in order
to keep the change simple.
It uses the already implemented java runtime,
so we don't support cross-platform nor js Kotlin yet.
Kotlin tests are just a copy of the java tests.
* Add optional ident support for CodeWriter
Identation is important for some languages and
different projects have different ways of ident
code, e.g. tabs vs spaces, so we are adding optional
support on CodeWriter for identation.
* [Kotlin] Add Documentation for Kotlin
* [Kotlin] Modify generated code to use experimental Unsigned types.
* Extend the test of MonsterExtra
- Extend C++ test of MonsterExtra
- Add conversion of fbs/json NaNs to unsigned quiet-NaN
- Update documentation (cross-platform interoperability)
* Fix declaration of infinity constants int the test
* [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}
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.
* 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
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
* 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
* 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
* 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
* 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
* 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
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.
* 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
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.
* 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
* 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
* 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
* 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
* 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.