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.
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.
* 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
* 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
A Namespace object is now guaranteed unique.
This cleaned up some old workarounds and latent bugs.
Change-Id: Ic3f12d89947871b03b2c449ba51b3186f953adde
Tested: on Linux.
Bug: 21336857
* 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
* 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
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
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
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
This is the first step in RPC support. Actual code generation
to follow.
Change-Id: I96c40fec3db671d100dd9eb509a71c5cbe55bfb2
Tested: on Linux.
Bug: 20122696
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.
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.
(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
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
This is such that if you mis-spell an attribute, it doesn't get
silently ignored.
Bug: 18294628
Change-Id: I10013f5b2a21048b7daba2e9410678f528e09761
Tested: on Linux.
Also fixed Go unit tests not being up to date with recent schema
changes.
Change-Id: I42e619f9c5ea05f6f937c68a5c8a92462c46bce3
Tested: on Linux and Windows.
Accessors and constructors now take enum types rather than ints.
Bug: 16570507
Change-Id: I4b50fd64ad2e662ea2481bc0ccea784326fb31c0
Tested: on Linux and Windows.
Looks like MSVC on Windows and like gcc everywhere else.
For enhanced IDE clickability.
Bug: 17208371
Change-Id: Ie3e02658fccd3edfd464b4bacf4bc68c613a8570
Tested: on Linux and Windows.
Allows you to add, and test for the presence of a magic 4-char
string in a FlatBuffer.
Tested: on OS X.
Change-Id: I090692a9e4fb53bed3543279a28563e67132cba0
It was outputting the type instead of the field name, and didn't deal
with NULL fields. Added test case.
Also fixed token enums having the wrong value, resulting in
unreadable error messages.
Change-Id: Icd9b4d22f417bfad5824c0f58e067ce3f2e2dc6f
Tested: on Windows and Linux.
New attribute:
- `id: n` (on a table field): manually set the field identifier to `n`.
If you use this attribute, you must use it on ALL fields of this table,
and the numbers must be a contiguous range from 0 onwards.
Additionally, since a union type effectively adds two fields, its
id must be that of the second field (the first field is the type
field and not explicitly declared in the schema).
For example, if the last field before the union field had id 6,
the union field should have id 8, and the unions type field will
implicitly be 7.
IDs allow the fields to be placed in any order in the schema.
When a new field is added to the schema is must use the next available ID.
Change-Id: I8690f105f3a2d31fdcb75a4fab4130692b12c62f
Tested: on Windows