-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Support native_type for tables when using the C++ object API. #8668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This generally looks good, wonder if this does what people on the original issue wanted it for @buster3 @iceboy233 @sketch34 @lp35 @meniku |
de16b9f
to
f6c8b40
Compare
969d890
to
c112473
Compare
If native_type is specified on a table: - No object API struct type is generated. - The object API refers to the table by its native_type. - UnPack and Create<TableName> methods are declared but not defined; as they must be user-provided.
c112473
to
81b9789
Compare
Can you turn on |
0216f18
to
db1df79
Compare
db1df79
to
dbf2cce
Compare
Per the definition of --gen-compare: only generate comparators for object API generated structs. Tables and structs annoated with native_type must define their own comparators if `--gen-compare` is enabled.
Added. This was not working at main prior to this change. I'm also not sure the behavior for structs was correct: when a flatbuffer struct was annotated with native_type, it was generating a comparator for the flatbuffer struct. I think the desired behavior would be to only generate comparators for the object API generated types (suffixed with T), and not generate comparators for structs/tables with native_types (which need to define the comparators themselves). Let me know if this interpretation is correct (per the flatc description: |
Maybe it can be a separate change as it's not working prior. Is it feasible/align with existing code to allow user to implement the member |
Sounds good. Mailed #8681 for this.
Happy to do whatever you and @aardappel suggest. Let me try to draft. I think this will just reverse some of the current dependencies of autogenerated Pack() -> Create(), and require rewriting some of the autogenerated object API type code to use Pack instead of Create. |
@dbaileychess opinion? |
If native_type is specified on a table:
must be user-provided.
Addresses #4969