mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-29 09:42:02 +00:00
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
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
4ea1be53d4
commit
9ce98dd77d
@@ -89,6 +89,11 @@ table Monster {
|
||||
vector_of_referrables:[Referrable](id:35);
|
||||
single_weak_reference:ulong(id:36, hash:"fnv1a_64", cpp_type:"ReferrableT");
|
||||
vector_of_weak_references:[ulong](id:37, hash:"fnv1a_64", cpp_type:"ReferrableT");
|
||||
vector_of_strong_referrables:[Referrable](id:38, cpp_ptr_type:"std::unique_ptr"); //was shared_ptr
|
||||
co_owning_reference:ulong(id:39, hash:"fnv1a_64", cpp_type:"ReferrableT", cpp_ptr_type:"naked"); //was shared_ptr as well
|
||||
vector_of_co_owning_references:[ulong](id:40, hash:"fnv1a_64", cpp_type:"ReferrableT", cpp_ptr_type:"std::unique_ptr", cpp_ptr_type_get:".get()"); //was shared_ptr
|
||||
non_owning_reference:ulong(id:41, hash:"fnv1a_64", cpp_type:"ReferrableT", cpp_ptr_type:"naked", cpp_ptr_type_get:""); //was weak_ptr
|
||||
vector_of_non_owning_references:[ulong](id:42, hash:"fnv1a_64", cpp_type:"ReferrableT", cpp_ptr_type:"naked", cpp_ptr_type_get:""); //was weak_ptr
|
||||
}
|
||||
|
||||
table TypeAliases {
|
||||
|
||||
Reference in New Issue
Block a user