mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-03 04:21:13 +00:00
External references for the object API thru a resolver function.
This allows hashed string fields to be used for lookup of any C++ objects, a pointer to which are then stored in the object besides the original hash for easy access. Change-Id: I2247a13c349b905f1c54660becde2c818ad23e97 Tested: on Linux. Bug: 30204449
This commit is contained in:
@@ -657,6 +657,11 @@ CheckedError Parser::ParseField(StructDef &struct_def) {
|
||||
"only int, uint, long and ulong data types support hashing.");
|
||||
}
|
||||
}
|
||||
auto cpp_type = field->attributes.Lookup("cpp_type");
|
||||
if (cpp_type) {
|
||||
if (!hash_name)
|
||||
return Error("cpp_type can only be used with a hashed field");
|
||||
}
|
||||
if (field->deprecated && struct_def.fixed)
|
||||
return Error("can't deprecate fields in a struct");
|
||||
field->required = field->attributes.Lookup("required") != nullptr;
|
||||
|
||||
Reference in New Issue
Block a user