- 23 Jan, 2017 1 commit
-
-
Florin Pățan authored
-
- 19 Jan, 2017 3 commits
-
-
Wouter van Oortmerssen authored
Allow tables to be mapped to native types directly. For example, a table representing a vector3 (eg. table Vec3 { x:float; y:float; z:float; }) can be mapped to a "mathfu::vec3" native type in NativeTables. This requires users to provide Pack and UnPack functions that convert between the Table and native types. This is done by adding the "native_type" attribute to the table definition. To support user-defined flatbuffers::Pack and flatbuffers::UnPack functions, support a "native_include" markup that will generate a corresponding Also add an UnPackTo function which allows users to pass in a pointer to a NativeTable object into which to UnPack the Table. The existing UnPack function is now simply: NativeTable* UnPack() { NativeTable* obj = new NativeTable(); Table::UnPackTo(obj); return obj; } Finally, allow native types to be given a default value as well which are set in the NativeTable constructor. This is done by providing a "native_default" attribute to the member of a table. Change-Id: Ic45cb48b0e6d7cfa5734b24819e54aa96d847cfd
-
Wouter van Oortmerssen authored
Change-Id: I119ee7109bfa2b0be0f468d2b2be459f45d1bb11
-
Wouter van Oortmerssen authored
Change-Id: Ifda5f2c32c6484508d5e12a463d6373798f1f523
-
- 18 Jan, 2017 3 commits
-
-
-
Wouter van Oortmerssen authored
This would happen if they were supplied in an order that does not match the schema relative to other fields. It now supports any ordering. Change-Id: I9d309cd4e6e5c470f01d9d431806eba4f9f46559 Tested: on Linux.
-
Georges Savoundararadj authored
The conditions to add the "NONE" or "ANY" value in the enum were useless because the user cannot provide a zero value or a bitmask (for "ANY") in the bit_flags enum type.
-
- 14 Jan, 2017 2 commits
-
-
Wouter van Oortmerssen authored
Change-Id: I71d590a1e5b2709f0e2dcf97faaebda5cb918fc7 Tested: on Linux.
-
Wouter van Oortmerssen authored
Helps simplify code generation code. Instead of this: code += "inline const " + cpp_qualified_name + " *Get"; code += name; code += "(const void *buf) {\n return flatbuffers::GetRoot<"; code += cpp_qualified_name + ">(buf);\n}\n\n"; You do this: code.SetValue("NAME", struct_def.name); code.SetValue("CPP_NAME", cpp_qualified_name); code += "inline const {{CPP_NAME}} *Get{{NAME}}(const void *buf) {"; code += " return flatbuffers::GetRoot<{{CPP_NAME}}>(buf);"; code += "}"; code += ""; Updated the CPP code generator to use the CodeWriter class. Most of the changes in the generated code are white-space changes, esp. around new lines (since the code generator class automatically appends new lines when appending a string). Actual code changes include: * Renamed "rehasher" to "_rehasher" for consistency with other args in Pack function. * Renamed "union_obj" to "obj: in UnPack function. * Always do "(void)_o;" to prevent unused variable warning in Create function (instead of only doing it if there are no fields) in order to avoid two-passes. * Renamed padding variables from __paddingX to paddingX__. "Each name that contains a double underscore (_ _) [...] is reserved to the implementation for any use." C++ standards 17.4.3.1.2. * Add braces around switch cases. * Calculate index as a separate statement in EnumName function, eg. const size_t index = ...; return EnumNamesX()[index]; vs. return EnumNamesX()[...]; * Stored end table offset in variable in Finish() functions, eg. const auto end = fbb_.EndTable(start_, ...); auto o = flatbuffers::Offset<T>(end); vs. auto o = flatbuffers::Offset<T>(fbb_.EndTable(start, ...)); * Separate reinterpret_cast calls from function calls in Union functions, eg. auto ptr = reinterpret_cast<const T *>(obj); return ptr->UnPack(resolver); vs. return reinterpret_cast<const T *>(obj)->UnPack(resolver); * Removed unecessary (void)(padding__X) no-ops from constructors, eg. Test(int16_t a, int8_t b) : ... { (void)__padding0; // <-- Removed this line. } In the idl_gen_cpp.cpp file itself, I refactored some code generation into new functions: GenParam, GenNativeTable, GenVerifyCall, GenBuilders, GenUnpackFieldStatement, and GenCreateParam. Change-Id: I727b1bd8719d05b7ce33cbce00eb58fda817b25d
-
- 11 Jan, 2017 1 commit
-
-
gbeili authored
* Add a builder option to enable/disable vtables deduplication. * address code review comments
-
- 10 Jan, 2017 1 commit
-
-
Pascal S. de Kloe authored
* Resolve Go fmt and vet warnings. * Undo generated code gofmt.
-
- 09 Jan, 2017 3 commits
-
-
-
Wouter van Oortmerssen authored
Change-Id: I827b7e9aee1edb77752322455f7b6fafac16fb1d Tested: on Linux.
-
Mateusz Pusz authored
Change makes make_space() code much friendlier for the compiler to inline which makes significant (measurable) performance improvements.
-
- 04 Jan, 2017 2 commits
-
-
Wouter van Oortmerssen authored
Change-Id: I301d29835fb0baffd859950eb0fb3056e4f4d66b
-
Wouter van Oortmerssen authored
- Update to be const-correct where possible. - Consistently pass |code| as pointer instead of non-const-ref. - No newlines (\n) characters in the middle of code strings. - Use if-else if-else statements instead of nested ternary operators. - Ensure all lines end at 80 chars. - Make utility functions static. From cl/143505731. Change-Id: If0fab9ee75de5af963367a948dddf53af93f73b4
-
- 03 Jan, 2017 2 commits
-
-
Wouter van Oortmerssen authored
Change-Id: I34007829cdd3ad024df21f68bb369016d5d21131
-
Yonggang Li authored
-
- 28 Dec, 2016 1 commit
-
-
CarsarSky authored
-
- 22 Dec, 2016 6 commits
-
-
-
Wouter van Oortmerssen authored
Change-Id: I60418d597b497c3cfa655ad76b3128351e9139f2
-
Ankur Dave authored
3a1f7761 added a required identifier parameter to Verifier::VerifyBuffer but did not update the templated call site in BufferRef. This causes errors like the following when trying to instantiate the call site by calling BufferRef::Verify(): include/flatbuffers/flatbuffers.h: In instantiation of ‘bool flatbuffers::BufferRef<T>::Verify() [with T = MyType]’: MyApp.cpp:16:3: required from here include/flatbuffers/flatbuffers.h:1421:37: error: no matching function for call to ‘flatbuffers::Verifier::VerifyBuffer()’ return verifier.VerifyBuffer<T>(); ^ include/flatbuffers/flatbuffers.h:1421:37: note: candidate is: include/flatbuffers/flatbuffers.h:1352:29: note: template<class T> bool flatbuffers::Verifier::VerifyBuffer(const char*) template<typename T> bool VerifyBuffer(const char *identifier) { ^ include/flatbuffers/flatbuffers.h:1352:29: note: template argument deduction/substitution failed: include/flatbuffers/flatbuffers.h:1421:37: note: candidate expects 1 argument, 0 provided return verifier.VerifyBuffer<T>(); ^ This commit fixes the BufferRef call site by adding a nullptr argument.
-
Zarian Waheed authored
* Added helper methods to access struct through reflection. Also added unit test for it. * Added a TODO comment to check for the is_struct flag.
-
Wouter van Oortmerssen authored
Change-Id: I556e1c103e8501dc144b16c8698463253de6f4fb
-
Wouter van Oortmerssen authored
Change-Id: I12b31227d4545a8897f638754d6a9ccd029f177e
-
- 21 Dec, 2016 1 commit
-
-
wvo authored
Change-Id: Ie854ace69a21ef685e1ade5584f9d9ce4e8b41f1
-
- 20 Dec, 2016 5 commits
-
-
Wouter van Oortmerssen authored
Change-Id: I11548bfa3cfe307598eb59c56412974c349d614d
-
Wouter van Oortmerssen authored
Change-Id: Id7053e4cb5a085a4b047c86ff1f2269329ff7f54
-
-
Wouter van Oortmerssen authored
-
Wouter van Oortmerssen authored
Bug: 22346508 Change-Id: I3f6e6b2811adaaf9d79faca8cdd00af3927299b5
-
- 19 Dec, 2016 2 commits
-
-
Wouter van Oortmerssen authored
From cl/142307012. Change-Id: I54d550573f6506b92ad18e7cc90bcd8589259e52
-
Wouter van Oortmerssen authored
Unions own the NativeTable* value member because they need to destroy them when the Union goes out of scope. Currently, the data is destroyed by calling delete, which means that the member needs to be allocated with new. However, making the allocation the responsibility of the client and the destruction the responsibility of the Union can lead to potential errors. Adding a Set function will ensure that the memory is allocated correctly so that it can be deleted later. From cl/142161569. Change-Id: I4605f26d2749164819bfae0140e5fae08442b50a
-
- 16 Dec, 2016 2 commits
-
-
Zarian Waheed authored
* Changes for verifying a buffer dynamically using reflection. * Fixing build issues on linux and applied code reformatting. * Fixing the file order in cmake file that was messing up the macro based code inclusion. Added tests for reflection based verification. * Changes for verifying a buffer dynamically using reflection. Fixing build issues on linux and applied code reformatting. Fixing the file order in cmake file that was messing up the macro based code inclusion. Added tests for reflection based verification. * Incorporated the code review changes that were requested: 1. Changed the Verify function signature. 2. Changed the variable names to use snake_case. 3. Added better comments. 4. Refactored duplicate code. 5. Changed the verifier class so that it has the same size when compiled with or without FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE macro. * Setting FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE and FLATBUFFERS_DEBUG_VERIFICATION_FAILURE through cmake for flattests so that it gets propagted to all translation units of flattests. * Making the Verifier struct fields the same in all cases. Also reverting the target_compile_definitions change in cmake file because build machine on travis does not have cmake version 3.0 or higher which was the version when target_compile_definitions was added in cmake. * Defining macros through cmake in a portable way using functions that are available in cmake 2.8.
-
krupnov authored
* random access iterator for vector added * Style changes
-
- 14 Dec, 2016 2 commits
-
-
Wouter van Oortmerssen authored
Change-Id: I7d23fa3416feb78ea18d2c451e7b4e1d9be11bfc
-
Wouter van Oortmerssen authored
Change-Id: Iceb1f5b78cff6227905b8a23eb70e9ef6ce909ed
-
- 13 Dec, 2016 1 commit
-
-
Wouter van Oortmerssen authored
Change-Id: Iff630905b5f90814c5f728e3c0e10f7fcd67c7fe
-
- 12 Dec, 2016 1 commit
-
-
Ricardo Quesada authored
update json with documentation removed comments
-
- 09 Dec, 2016 1 commit
-