Commit Graph

112 Commits

Author SHA1 Message Date
Wouter van Oortmerssen 3a62813f0e Added missing generated code files.
Change-Id: Ie1cab284cb6e0fe5bd2b2c293c3136c148927ac3
2018-03-05 15:47:16 -08:00
Christian Helmich 9ce98dd77d Support attribute "cpp_ptr_type" on table elements marked as "hash" (#4643)
* 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
2018-03-05 08:40:55 -08:00
Mitchel 4ea1be53d4 Java + C#, reuse object in lookup_by_key (#4648)
* Java + C#, reuse object in lookup_by_key

* Java + C#, reuse object in lookup_by_key
2018-03-02 15:22:46 -08:00
Mitchel 55ddb84eb2 In Java, allow reusing ByteBuffer in getters (#4633)
* In Java, allow reusing ByteBuffer in getters

* In Java, allow reusing ByteBuffer in getters

* In Java, allow reusing ByteBuffer in getters
2018-02-23 14:01:05 -08:00
Christian Helmich 59e26017cb added support for parsing hash on vector elements (#4502)
* 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
2018-02-22 11:04:26 -08:00
Wouter van Oortmerssen 2265129e14 Removed date/time from generated code, causing commit polution.
Change-Id: I79724416110a3d2241d7eeecf0e12aa6d5b760a0
2018-01-18 11:21:10 -08:00
Yuri Finkelstein 99a8a68a80 new maven jar called flatbuffers-java-grpc which contains utility … (#4558)
* new maven jar called flatbuffers-java-grpc which contains utility class supporting generated code for grpc over flatbuffers; grpc java unit test based on maven and junit (maven is used only for simplicity of testing); removed straneous namespace_test/NamespaceA/TableInC.java which is not longer used in the test and no longer generated but contains complilation errors if java compiler picks it up

* moved java grpc tests files according to review request

* Added missing generated code for Java gRPC.

Change-Id: Iada090fe2e99b80a4b7c2f8e39c838a992a1feae

* added missing name and url
2017-12-28 15:26:29 -08:00
Dariusz Ostolski 5e4739184f Fix issue #4389, if field is ommitted the return type is the same for… (#4444)
* Fix issue #4389, if field is ommitted the return type is the same for python generator

* Fix issue #4389, bytes is returned when field is omitted

* Fix issue #4389, added generated python code after generator modification
2017-10-05 14:07:42 -07:00
Wouter van Oortmerssen 321a1c9dc0 Cleaned up namespace handling.
A Namespace object is now guaranteed unique.
This cleaned up some old workarounds and latent bugs.

Change-Id: Ic3f12d89947871b03b2c449ba51b3186f953adde
Tested: on Linux.
Bug: 21336857
2017-08-24 13:39:45 -07:00
MikkelFJ f2b3705c2c Add scalar type aliases for int8, uint8, ..., f32, f64 (#4400)
* Add type aliases

* Add generated code

* Rebase master
2017-08-02 08:07:43 -07:00
Kevin Rose 3282a84e30 [Python] (scalar) vector reading speedup via numpy (#4390)
* 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
2017-08-01 08:34:00 -07:00
Stewart Miles f064a6cc60 Test case for CreateVectorOfStructs() using a callback.
Fixes issue #4392, also fixed C++98 compatible code generation in tests.

Change-Id: Ia5833026e615ad19d24a0439bdba2e3b45c5f86c
2017-07-24 14:19:49 -07:00
Alex Wasserman 625c989875 Java: Added ByteBufferFactory interface and sizedInputStream method. (#4379)
The ByteBufferFactory interface gives the user an option to specify
the method in which the internal ByteBuffer is allocated. This provides
flexibility in the type of ByteBuffer that can be used.
The sizedInputStream method is an alternative to sizedByteArray that
does not make a copy of the data in memory.
2017-07-13 08:33:32 -07:00
Wouter van Oortmerssen dddd0865cb Added nested FlexBuffer parsing
Change-Id: I918b66eb5646d035e3aae675f745802eb54b03ea
2017-06-12 14:34:45 -07:00
schoetbi 0f5f7faa9f C#: Added <autogenerated> in cs generator file header comment (#4291)
* Added <autogenerated> in cs generator file header comment
#4287

* CS: Added xml-correct file header comment including "<auto-generated>...</auto-generated>"
code_generators.cpp: FlatBuffersGeneratedWarning() function replaced by compile time constant "GeneratedWarning"
 also removed extra newlines at end of GeneratedWarning to be able to generate a xml well formed file comment for cs files
#4291

* code_generators: Changed static string GeneratedWarning back to function FlatBuffersGeneratedWarning()
#4291

* Added modified Unit-Test files
#4291

* idl_gen_general: Add autogenerated only in C# code
#4291
2017-05-16 14:28:34 -07:00
Wouter van Oortmerssen 8468ea1ab4 Fixed LookupByKey for Java & C#
Change-Id: I05c02223675dee241d1ae8cb466e5186444058c8
Tested: on Linux.
2017-05-10 12:55:27 -07:00
Wouter van Oortmerssen cffd187fc7 Added missing generated code for C#
Change-Id: I1affced255eb96977119d8480793b5bba42f065f
2017-03-29 11:51:02 -07:00
Spencer Bench ccfa317486 C#: Fixed possible conflicts between usings and user-supplied namespace (#4247)
* C#: Fixed possible conflicts between usings and user-supplied namespace

C#: Added the global qualifier to using directives to prevent possible conflicts with the user-supplied namespace. Also prevents unintentional type hiding. Resolves issue #4242.

* Updated C# generated code files
2017-03-29 11:09:25 -07:00
tianyapiaozi a5cc2092a6 Support binary search for struct in cpp (#4245)
* 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
2017-03-29 09:51:12 -07:00
Wouter van Oortmerssen 2c4dce5ba7 Re-applied reverted fix, adding missing codegen files.
Change-Id: I301d29835fb0baffd859950eb0fb3056e4f4d66b
2017-01-04 10:41:31 -08:00
Robert 92a6ae93fa Merge pull request #3977 from gonzaloserrano/feature/go-generic-deserialitzation
Add a generic way to deserialize a flatbuffer in Go.
2016-12-07 11:17:55 -08:00
Ronak Jain a31ddd2bb3 Support for Golang GRPC (Experimental) (#4082)
* support for grpc golang

* refactored grpc go generator

* added grpc-go test and refactored

* refactored idl_gen_grpc.cpp

* fixed grpc generate method name

* refactored flatc and fixed line length issue

* added codec to go lib and fixed formatting issues

* fixed spacing issues
2016-12-05 13:20:38 -08:00
Baptiste Lepilleur 5b5fcbfc00 Java: fix unsigned default value code generation and add 'L' suffix for long default value (#4051)
* Java: emit "signed" equivalent of unsigned default value in generated code and add "L" suffix to long default value.

* Updated generated code

* Only convert ulong to "signed" equivalent. ubyte and ushort don't need specific handling as "user facing" type is int. uint need 'L' suffix as "user facing" type is long.

* Added missing cast to primitive type of default value which is in "user facing" type in builder.add<type>() calls.

* Do not cast default value to actual type in C#.
2016-10-21 14:27:15 -07:00
Baptiste Lepilleur 199157e8f4 flatc java generator: namespace_test2.fbs is missing namespace prefix for referToA2() return type (#4040)
* Fix flatc generating incorrect java/c# code for namespace_test2.fbs. In code for TableInC, method referToA2() returned type SecondTableInA instead of NamespaceA.SecondTableInA.

* Updated generated code.

* Fixed indendation.
2016-10-07 09:42:29 -07:00
Alberto Fernández 02dfa64a89 Allow access to underlying ByteBuffer 2016-09-12 09:35:08 +02:00
Wouter van Oortmerssen 52ca75506a Switched C# accessors from classes to structs 2016-08-31 17:34:51 -07:00
Wouter van Oortmerssen 481d332e72 Fixed compile error in LookupByKey fix.
Change-Id: Ice94f09197235cf71b41a22d0767bd7b119284e1
2016-08-26 14:18:04 -07:00
Wouter van Oortmerssen e1f8037cb5 Fixed Java LookupByKey functionality for Java 1.6
Tested: on Linux.

Change-Id: Iea336f75a3b6e722743563813c3c9ed9db4d02fe
2016-08-26 13:58:16 -07:00
Wouter van Oortmerssen 49ee30a207 Merge pull request #3978 from TGIshib/key
Find by key on C# and Java (2)
2016-08-26 12:03:28 -07:00
TGIshib 7c69c5dc3d Fix lookupByKey, improve compareStrings 2016-08-26 19:41:32 +03:00
gonzaloserrano 199a49b5b3 Add a generic way to deserialize a flatbuffer in Go.
Similar to what protobufs does with its `Message` interface, introduce here such interface and create a generic `GetRootAs` method to deserialize a flatbuffer.
2016-08-23 16:38:22 +02:00
TGIshib 9f16090f90 Improve `LookupByKey` , update docs 2016-08-22 18:10:52 +03:00
rw c4ba502f57 Remove invalid vector item heap alloc
Fixes #3986
2016-08-20 20:33:36 -07:00
TGIshib 8fdced4e11 Update 2016-08-14 14:58:51 +03:00
TGIshib 9031597f49 Merge remote-tracking branch 'refs/remotes/google/master' into key 2016-08-13 16:28:38 +03:00
TGIshib dc7f5bc0d8 Remake 2016-08-03 13:29:50 +03:00
gonzaloserrano ec20233fab Make most of the Go code comply with gofmt (except enums).
Enums are not fixed because depending on they have comments or not they
will be aligned alogn the asssignment character.
2016-08-02 18:21:47 +02:00
Kazuki Sakamoto 5f351a35a2 Add EnumNames to Go code
Tested: on Darwin
2016-07-25 19:37:16 -07:00
Wouter van Oortmerssen f98870715a Adding missing generated code from recent commits.
Also updated generated_code.sh to prevent this from happening in
the future.

Change-Id: Ib282e9b6c762a79d4b4e09bee06b14781cd2a4c1
2016-07-25 15:01:37 -07:00
Robert a56c6e5195 Merge pull request #363 from danring/fix-341
Emit GetRootAs methods for all types in Go and Python
2016-07-22 15:12:35 -07:00
Muhammed Thanish 53e9606ea2 Implement mutators for Go 2016-07-20 22:58:22 +05:30
lakedaemon e750268f0c clang formating cpp code generator and add missing generated classes 2016-07-15 16:08:59 +02:00
Wouter van Oortmerssen 3639032d1e Allow unions of table types with the same name but from different namespaces.
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
2016-06-20 11:47:04 -07:00
Wouter van Oortmerssen afa276288c Added additional convenience overloads to CreateVector().
Bug: 29337887, 29336299
Change-Id: Iad8b3b2263f6cea7ee7e45994369194960df293b
Tested: on Linux.
2016-06-15 14:31:34 -07:00
Dan Ring 1f8e3c13e6 Emit GetRootAs methods for all types in Go and Python 2016-06-14 18:41:33 -04:00
lakedaemon cd1493b082 sharing the Flatbuffers warning 2016-05-26 15:26:58 +02:00
Wouter van Oortmerssen fd542c71e3 Fixed float suffix not being added on implicit float defaults.
Change-Id: I8dcbb5e93836356511d411ef86452babd3dd3c0b
Tested: on Linux.
2016-04-20 12:06:32 -07:00
Wouter van Oortmerssen 4d7890c2c9 Fixed whole-number float default values missing a .0 suffix.
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
2016-04-18 11:50:46 -07:00
Wouter van Oortmerssen 29d957ed5e Fixed missing "f" on float default values in C++/Java/C#
Bug: 28145201
Change-Id: I5a1818c40c2f4fbd00cfec3362040407976f7a39
Tested: on Linux.
2016-04-13 17:29:03 -07:00
Armen Baghumian 28a3c939e7 Implement __vector_as_bytes and methods to get [ubyte] efficiently
Currently in order to get a value type of [ubyte] in PHP, iteration is
necessary which is not efficient. Helper __vector_as_bytes has been
implemented in order to return the byte arrays in PHP efficiently.

Appropriate methods also been added to use aforementioned method to return
the byte array. (e.g. get*Bytes()).

The reason the methods are named get*Bytes() and not for instance
get*ByteArray() is the fact that PHP doesn't support byte arrays and the
binary safe string implementation in PHP is used to simulate byte arrays
and since there is chance for PHP users to confuse this with PHP arrays
the name get*Bytes() has been chosen.

In the future __vector_as_bytebuffer() method can also be implemented to
return PHP implementation of ByteBuffer.
2016-03-29 14:56:09 +11:00