summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)AuthorFilesLines
2020-05-04Respect shared attribute in Parser (#5885)Mika Raento1-1/+1
Respects the 'shared' field attribute when reading data with Parser.
2020-05-04include/flatbuffers: typo fixes in comments (#5884)Even Rouault6-6/+6
2020-04-13[Swift] Object API support (#5826)mustiikhalil1-0/+4
* Adds Object-api support to swift * Fixed indentation issues * Removed indentation within namespaces
2020-03-27[CMake] : Add precompiled header support with FLATBUFFERS_ENABLE_PCH (#5827)Olivier Le Doeuff2-0/+77
* [CMake] : Add precompiled header support with FLATBUFFERS_ENABLE_PCH FLATBUFFERS_ENABLE_PCH enable precompile headers support for 'flatbuffers' and 'flatc'. Default if OFF. You need to set it to ON to make it work. 'cmake -DFLATBUFFERS_ENABLE_PCH=ON ..' This will only work if CMake version is >= 3.16, because target_precompile_headers is used. If CMake doesn't have target_precompile_headers, then nothing will happen. This can speed up compilation time. Precompiled header file for 'flatbuffers' is 'pch.h' Precompiled header file for 'flatc' is 'flatc_pch.h' * Enable FLATBUFFERS_ENABLE_PCH for VC 2017 and VS2019 builds * [CMake]: Fix error in FLATBUFFERS_ENABLE_PCH description * Add a function add_pch_to_target to avoid copy and pasting the same code like add_fsanitize_to_target Move pch.h and flatc_pch.h from include/flatbuffers to include/flatbuffers/pch Make flatc_pch.h depends on pch.h since it extend it
2020-03-26Correct calculation of vector element size (#5831)Dmitriy Kovalev1-1/+2
Number of elements on the stack shouldn't affect the calculation of ElemWidth(). Variable 'start' needs to be subtracted from the loop variable 'i' to make indexing zero-based. There is an additional unit test to pack nested vectors. Size of the packed buffer *without* this fix is 798 and only 664 bytes *with* the fix.
2020-03-23Fix Clang-trunk warnings about special members deprecated in C++20. (#5829)Arthur O'Dwyer2-10/+0
For example: include/flatbuffers/reflection.h:365:8: error: definition of implicit copy constructor for 'pointer_inside_vector<flatbuffers::Table, unsigned char>' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy] void operator=(const pointer_inside_vector &piv); ^ It's unclear why the old code wanted to declare a public `operator=` without defining it; that just seems like a misunderstanding of the C++03 idiom for deleting a member function. And anyway, we don't *want* to delete the assignment operator; these are polymorphic types that do not follow value semantics and nobody should ever be trying to copy them. So the simplest fix is just to go back to the Rule of Zero: remove the declaration of `operator=` and let the compiler do what it wanted to do originally anyway. "The best code is no code." Also, update the generated .h files. Fixes #5649.
2020-03-16[C++] Add max_depth and max_tables parameters to reflection::Verify (#5815)stefan3011-1/+3
* Added missing EndTable() call to VerifyObject() VerifyObject called VerifyTableStart() but not EndTable(). This made Verifier::VerifyComplexity() increase depth_ with each table, not with the depth of tables. https://groups.google.com/forum/#!topic/flatbuffers/OpxtW5UFAdg * Added Check to VerifyAlignment https://stackoverflow.com/questions/59376308/flatbuffers-verifier-returns-false-without-any-assertion-flatbuffers-debug-veri * [C++] Add max_depth and max_tables parameters to reflection::Verify Co-authored-by: Felkel <stefan@eas.local> Co-authored-by: stefan301 <Stefan.Felkel@de.Zuken.com>
2020-03-16Fix interpretation of 'nan(number)' by the idl_parser (#5810)Vladimir Glavnyy2-2/+2
* Parser reject "nan(n)" string as it does with nan(n) * Adjust scalar fuzzer to ignore '$schema' substrings - Scalar fuzzer ignores '$schema' substrings at the input - Added 'scalar_debug' target to simplify research of fuzzed cases * Improve formatting of './tests/fuzzer/CMakeLists.txt'
2020-03-12pre-tag version bump for 1.12v1.12.0Wouter van Oortmerssen1-1/+1
Change-Id: I84a9365e9d8a1afe333b1df85058401ffe0a6b7c
2020-03-05Removed assert that wasn't backwards compatible.Wouter van Oortmerssen1-2/+1
Change-Id: I8e74d6fddf91fe955fffc572af9d671160325731
2020-03-02Added --filename-suffix and --filename-ext to flatc (#5778)Derek Bailey5-37/+47
* Fixed refractoring issue in reflection/generate_code.sh. Also, mv deletes the original file, so I don't need to clean it up manually in that case. * Added --filename-suffix and --filename-ext to flatc * Fixed typo and added example generation of suffix and extension for C++ * Removed extra ; * Removed clang-format block from a region that didn't need it. Fixed an auto format of another clang-format block * Added docs, fixed pointer alignment, removed suffix test file
2020-02-24[Swift] Adds GRPC to Swift (#5758)mustiikhalil1-0/+6
* Adds the basic structure for required to add grpc support Added the message implementation Updated the code to confirm to the protocol flatbuffersobject Adds an example for Swift flatbuffers GRPC Started implementing the swift GRPC code Gen Generator generates protocols now Fixing ci issues Migrated the logic to use grpc_generator::File instead of string Refactored swift project Implemented GRPC in swift Finished implementing GRPC in swift Fixes issues Adds contiguousBytes initializer to swift Adds documentation + fixes buffer nameing in tables + structs Adds documentation + fixes buffer nameing in tables + structs Updated tests * Updated version
2020-02-10[C#] support Json Serialization (#5752)mugisoba1-7/+8
* support json serialization * fix invalid json format. * string must be written with double quotes. * remove commma after the last object member. * fix indent * Revert "fix invalid json format." This reverts commit d6820ed50c8e3d3cda3aa1849b3079f853608619. * quated string value. * add cs-gen-json-serializer flag. * fix preprocessor indent * ENABLE_JSON_SERIALIZATION -> ENABLE_JSON_SERIALIZATION_TEST * share TestBuffer method * remove ENABLE_JSON_SERIALIZATION * remove duplicated test data * [windows] add nuget restore and copy test data. * [docker mono] share msbuild settings with windows. add nuget restore and copy test data. * add some note for json api.
2020-02-06FlexBuffers: C++: scalar-only typed vectors were not aligned.Wouter van Oortmerssen1-0/+1
This means data written with older versions of this code has potentially misaligned data, which we'll need to support. This isn't a problem on most architectures, but could be on older ARM chips. To support them properly may require swapping out uses of `flatbuffers::ReadScalar` with a version that does a memcpy internally. Change-Id: Ib352aab4a586f3a8c6602fb25488dcfff61e06e0
2020-01-24Added the code to embed the binary schema to the source (--bfbs-gen-embed). ↵sjoblom652-0/+28
(#5701) * Added the code to embed the binary schema to the source. This is pulled forward from a old PR #5162 that will be closed. * Update idl_gen_cpp.cpp Added a small comment to trigger a new build. The build was failing in a strange location and doesn't look like it has anything to do with the code. * Moved the EscapeAndWrapBuffer to util.cpp and did some formating. * One more camelCases removed and renamed some variables. * wrapped_line_xxx should have been passed as a const reference in the first place. * Moved the bfbs embed sample to it's own file. * Missed moving the namespace back. * Moved the embedded bfbs to test.cpp instead of using a sample. * Missed adding the generation of embedded bfbs to the build. * See if this makes the build happier. * Fixed a in-compatable cpp output of the generated header. * Did some changes to reflect the code review comments. 1. Update the EscapeAndWrapBuffer to BufferToHexText and fixed a variable name. 2. Moved the include of the embedded binary schema to all the other includes. * Moved some code to inline the instead of using a local variable. * Moved the BufferToHexText back to be a inline function in util.h
2020-01-16[C++] Fix for printing of enum in case output_enum_identifiers=1. (#5706)Vladimir Glavnyy1-1/+10
* Add test-case for testing of the future Color in json (output_enum_identifiers = true) * Refactoring of idl_gen_text.cpp. Fix for printing of bit-enum with active output_enum_identifiers=1. * Move GenerateText implementation into class * Remove unnecessary code from flatbuffers.h
2020-01-09[Swift] Swift implementation 🎉🎉 (#5603)mustiikhalil1-18/+24
* Implemented the swift version of Flatbuffers Implemented serailzing, reading, and mutating data from object monster Fixes mis-aligned pointer issue Fixes issue when shared strings are removed from table Adds swift enum, structs code gen Fixed namespace issues + started implementing the table gen Added Mutate function to the code generator Generated linux test cases Fixed an issue with bools, and structs readers in table writer Swift docker image added Updated the test cases, and removed a method parameters in swift Fixed createVector api when called with scalars Fixed issues with scalar arrays, and fixed the code gen namespaces, added sample_binary.swift Cleaned up project Added enum vectors, and their readers Refactored code Added swift into the support document Added documentation in docs, and fixed a small issue with Data() not being returned correctly Fixes Lowercase issue, and prevents generating lookups for deprecated keys * Made all the required funcs to have const + removed unneeded code + fix lowercase func * Removed transform from lowercased and moved it to function * Fixes an issue with iOS allocation from read * Refactored cpp code to be more readable * casts position into int for position * Fix enums issue, moves scalar writer code to use memcpy * Removed c_str from struct function * Fixed script to generate new objects when ran on travis ci: fix * Handles deallocating space allocated for structs * Updated the test cases to adhere to the fileprivate lookup, no mutation for unions, and updated the names of the vector functions
2020-01-09Changed direct calls to strtod to use StringToNumberWouter van Oortmerssen1-1/+5
StringToNumber will correctly use locale-insensitive functions when available. Change-Id: I6bde11039a541634186f8f791012af2eb0d86b8d
2020-01-06(Optionally) add an additional suffix namespace to generated fbs files. (#5698)Michael Beardsworth1-0/+1
This change allows for the generation of fbs files (from proto) that don't contain name collisions with the protobuf generated C++ code, allowing both the proto and fbs message types to be linked into the same binary.
2019-12-26[C++] Add Builder and Table typedefs (#5685)Austin Schuh1-0/+27
* Add Builder and Table typedefs This gives us a way to use templates to go from a builder to a table and back again without having to pass both types in. * Fix tests/cpp17/generated_cpp17/monster_test_generated.h
2019-12-26Add support for absl::string_view when available (#5682)Austin Schuh1-0/+7
For C++11 platforms, absl::string_view is sometimes available. This can be used for string_view when std::string_view is not available.
2019-12-23Add flatc '--cpp_std' switch (#5656)Vladimir Glavnyy4-5/+32
* Add flatc '--cpp_std' switch and sandbox for C++17 code generator - Added 'flac --cpp_std legacy' for compatibility with old compilers (VS2010); - Added experimental switch 'flac --cpp_std c++17' for future development; - Added C++17 sandbox test_cpp17.cpp; - C++ code generator generates enums with explicit underlying type to avoid problems with the forward and backward schema compatibility; - Adjusted CMakeLists.txt, CI and generate code scripts to support of introduced '--cpp_std'; * Fix --cpp_std values: c++0x, c++11, c++17 * Add 'cpp::CppStandard' enum * Add testing engine into test_cpp17 * Rebase to upstream/master * Set default '--cpp-std C++0x' * Fix code generation (--cpp_std C++11) in CMakeLists.txt - Fix dependency declaration of grpctest target * Revert --cpp-std for the tests from explicit C++11 to flatc default value (C++0x)
2019-12-23Fix for FlexBuffers FBT_VECTOR_STRING size bit-width.Wouter van Oortmerssen1-13/+45
For details, test.cpp/FlexBuffersDeprecatedTest(), and also https://github.com/google/flatbuffers/issues/5627 Change-Id: I6e86e1138a5777e31055cfa2f79276d44732efbc
2019-12-23Added Check to VerifyAlignment (#5675)stefan3011-1/+1
* Added missing EndTable() call to VerifyObject() VerifyObject called VerifyTableStart() but not EndTable(). This made Verifier::VerifyComplexity() increase depth_ with each table, not with the depth of tables. https://groups.google.com/forum/#!topic/flatbuffers/OpxtW5UFAdg * Added Check to VerifyAlignment https://stackoverflow.com/questions/59376308/flatbuffers-verifier-returns-false-without-any-assertion-flatbuffers-debug-veri
2019-12-09Supress unsigned-integer-overflow for PaddingBytes (#5647)Björn Harrtell1-0/+1
2019-12-05Add --force-empty-vectors option (#5653)cryptocode1-4/+9
The rationale for this option is that JSON clients typically want empty arrays (i.e [] in the JSON) instead of missing properties, but not empty strings when the value isn't set. --force-empty is kept as-is, i.e. it will force both empty strings and vectors. Closes #5652
2019-12-02[Clang 10]: definition of implicit copy constructor for ↵Ivan Shynkarenka1-1/+5
'TableKeyComparatoris deprecated #5649 (#5650)
2019-11-25Fix ambiguity of a type deduction in TEST_EQ macro if arguments have `enum ↵Vladimir Glavnyy1-4/+24
class` type. (#5630)
2019-11-25Simplify declarations of x-macro FLATBUFFERS_TD (#5638)Vladimir Glavnyy1-7/+19
2019-11-25read vtable size through ReadScalar() (#5636)FujiZ1-1/+1
2019-11-18add namespace prefix in FLATBUFFERS_MAX_BUFFER_SIZE (#5629)FujiZ1-1/+1
2019-11-14Support for python grpc - continuing the work from the pull request #4270 ↵Malar Kannan1-0/+6
#4705 (#5613) * Support for python grpc * add few fixes * Fixes build * Fix python generator * Add tests * Fix grpc python test * Fix tests and add incomplete python generator * Fix python generator * Add python generator methods * Fix Appveyor build * grpc python support v0.1 * Update tests * update grpctest * Remove duplicated code and fix a brace * tests for flatbuffers grpc python * Updated tests + removed SerializeToString, From String * remove pickle import * include missing files in ci - BUILD and generated test result
2019-11-14Removed idl_gen_general.cpp and move contents to code_generators.cpp (#5625)Derek Bailey1-12/+7
2019-11-11[C++, C#, Java] Separated C# and Java generators into their own classes (#5618)Derek Bailey1-0/+10
* Cloned idl_gen_general.cpp to idl_gen_csharp.cpp and removed java references * Java generator changes
2019-11-11Ran src/clang-format-all.sh (#5617)Derek Bailey1-1/+1
2019-11-07[C++] Refactor to conform to Google C++ style guide (#5608)Derek Bailey9-241/+225
* Automatic refractor of C++ headers to Google C++ style guide * Automatic refractor of C++ source to Google C++ style guide * Automatic refractor of C++ tests to Google C++ style guide * Fixed clang-format issues by running clang-format twice to correct itself. Kotlin was missing clang-format on after turning it off, so it was changed,
2019-11-04include/flatbuffers/base.h: fix no_sanitize issue with old clang (#5610)Even Rouault1-1/+1
Older clang versions raise: ``` ./flatbuffers/base.h:365:1: error: unknown attribute 'no_sanitize' ignored [-Werror,-Wattributes] __supress_ubsan__("alignment") ^ ./flatbuffers/base.h:246:50: note: expanded from macro '__supress_ubsan__' #define __supress_ubsan__(type) __attribute__((no_sanitize(type))) ^ ``` Comparing https://releases.llvm.org/3.6.0/tools/clang/docs/AttributeReference.html with https://releases.llvm.org/3.7.0/tools/clang/docs/AttributeReference.html shows that __attribute__((no_sanitize(type))) is available since 3.7.0
2019-11-04[C++, Java, C#, TypeScript, JavaScript] Skip generation of mutable union ↵Derek Bailey1-37/+42
types (#5599) * Skip generation of mutable union types * Removed C# and Java unit tests that mutated a Union type
2019-11-04flatbuffers.h: fix documentation warning (#5607)Even Rouault1-1/+1
Fixes following clang -Wdocumentation warning: ``` flatbuffers.h:1762:17: error: parameter ']' not found in the function declaration [-Werror,-Wdocumentation] /// @param[in]] v A const reference to the `std::vector` of structs to ```
2019-10-28Fix typos in comments (#5590)Even Rouault4-5/+5
Found by the https://github.com/OSGeo/gdal/blob/master/gdal/scripts/fix_typos.sh script on the internal copy of flatbuffers inside GDAL
2019-10-17Avoid intentional unsigned integer overflow getting caught by sanitizers (#5572)Björn Harrtell1-0/+1
* Avoid intentional unsigned integer overflow getting caught by sanitizers * Adapt from suggested compiler compatible solution * And a third way :)
2019-10-17#5544 Fix of Array of table is not sorted if Create<type>Direct() is used ↵tira-misu1-22/+22
(#5546) * Fix C/C++ Create<Type>Direct with sorted vectors If a struct has a key the vector has to be sorted. To sort the vector you can't use "const". * Changes due to code review * Improve code readability
2019-10-15Fix build with gcc version 7.4.0 (#5570)Brian Harris1-1/+1
2019-09-26[flac] Add FlexBuffers option for generating data (#5519)Paulo Pinheiro2-1/+13
Alongside --binary and --json, an additional switch (--flexbuffers) can be passed to convert data using FlexBuffers
2019-09-23Fix Mutate() methods of Array<scalar/struct> (override 5508) (#5526)Vladimir Glavnyy3-22/+72
* Draft with Array specialization (#5508) * Array specialization + SFINAE to fold copy-paste (#5508) * Add implicit specialization of Array<scalar> and Array<struct> (#5508) - Tag dispatching is used for implicit specialization - Array<scalar> and Array<struct> have different iterators and accessors - Array<scalar> and Array<struct> have different Mutate() methods * Add implicit specialization of Array<scalar> and Array<struct> (#5508) - Tag dispatching is used for implicit specialization - Array<scalar> and Array<struct> have different iterators and accessors - Array<scalar> and Array<struct> have different Mutate() methods
2019-09-19Fixed DetachedBuffer self move assignment (#5521)mmoscicki21-0/+3
2019-09-16Fixed Reflection Verifier not handling vectors of unions.Wouter van Oortmerssen1-0/+5
Change-Id: Ie94386ff8e10fd2a964bd9155139b50953746a37
2019-09-10Annotate getters with @Pure when --java-checkerframework is specified. (#5510)jaceksur1-0/+2
Together with @Nullable, this allows users to use static analysis tools like CheckerFramework to catch NPEs caused by unset fields.
2019-09-03Doc typo fixes (#5505)Björn Harrtell1-8/+8
2019-08-26FlexBuffers: allow any values to be shared.Wouter van Oortmerssen1-1/+26
(see comments in the code). Change-Id: I5603abb0db436145739653692644bbcfd3c946e3