mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-09 06:30:54 +00:00
Add cpp_vec_type attribute for object API vector customization
Mirrors cpp_str_type and cpp_ptr_type: a per-field cpp_vec_type attribute lets users substitute any std::vector-compatible container in generated T-structs, and --cpp-vec-type sets the global default. NativeVector() resolves the attribute (falling back to the global option, then std::vector). Changes applied to GenTypeNative, GenMember, GenParam (CreateDirect), and the CreateVectorOfStrings fast-path guard. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -676,6 +676,7 @@ struct IDLOptions {
|
||||
bool gen_absl_hash;
|
||||
std::string cpp_object_api_pointer_type;
|
||||
std::string cpp_object_api_string_type;
|
||||
std::string cpp_object_api_vector_type;
|
||||
bool cpp_object_api_string_flexible_constructor;
|
||||
CaseStyle cpp_object_api_field_case_style;
|
||||
bool cpp_direct_copy;
|
||||
@@ -1012,6 +1013,7 @@ class Parser : public ParserState {
|
||||
known_attributes_["cpp_ptr_type_get"] = true;
|
||||
known_attributes_["cpp_str_type"] = true;
|
||||
known_attributes_["cpp_str_flex_ctor"] = true;
|
||||
known_attributes_["cpp_vec_type"] = true;
|
||||
known_attributes_["native_inline"] = true;
|
||||
known_attributes_["native_custom_alloc"] = true;
|
||||
known_attributes_["native_type"] = true;
|
||||
|
||||
Reference in New Issue
Block a user