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
16 files changed
tree: b82db3dc05bab2f4c68f8be32547dc51e3980b66
  1. .github/
  2. .travis/
  3. android/
  4. biicode/
  5. CMake/
  6. docs/
  7. go/
  8. grpc/
  9. include/
  10. java/
  11. js/
  12. net/
  13. php/
  14. python/
  15. reflection/
  16. samples/
  17. src/
  18. tests/
  19. .clang-format
  20. .editorconfig
  21. .gitattributes
  22. .gitignore
  23. .travis.yml
  24. appveyor.yml
  25. biicode.conf
  26. BUILD
  27. CMakeLists.txt
  28. composer.json
  29. conanfile.py
  30. CONTRIBUTING.md
  31. LICENSE.txt
  32. package.json
  33. pom.xml
  34. readme.md
  35. WORKSPACE
readme.md

logo FlatBuffers

Join the chat at https://gitter.im/google/flatbuffers Build Status Build status

FlatBuffers is an efficient cross platform serialization library for games and other memory constrained apps. It allows you to directly access serialized data without unpacking/parsing it first, while still having great forwards/backwards compatibility.

Go to our landing page to browse our documentation.

Supported operating systems

  • Android
  • Windows
  • MacOS X
  • Linux

Supported programming languages

  • C++
  • C#
  • C
  • Go
  • Java
  • JavaScript
  • PHP
  • Python

and many more in progress...

Contribution

To contribute to this project, see CONTRIBUTING.

Integration

For applications on Google Play that integrate this tool, usage is tracked. This tracking is done automatically using the embedded version string (flatbuffer_version_string), and helps us continue to optimize it. Aside from consuming a few extra bytes in your application binary, it shouldn't affect your application at all. We use this information to let us know if FlatBuffers is useful and if we should continue to invest in it. Since this is open source, you are free to remove the version string but we would appreciate if you would leave it in.

Licensing

Flatbuffers is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.