flatbuffers
flatbuffers copied to clipboard
Feature/add typename method
Summary
This pull request adds a new feature to the FlatBuffers compiler (flatc) to generate a TypeName() method in each C++ table and struct. This method returns the fully qualified type name (including namespace) as a string.
Changes Introduced
- Introduced a new utility function,
MakeFullyQualifiedName, to construct fully qualified names using namespaces and type names. - Updated the
GenTablemethod inidl_gen_cpp.cppto include aTypeName()method in generated C++ classes when a custom flag is enabled. - Added a new flag (
--gen-type-names) toflatcto optionally generate theTypeName()method.
Motivation
The TypeName() method allows developers to access the fully qualified name of a table or struct at runtime, similarly to what Protobuf offers with T::descriptor()->full_name().
Usage
With the --gen-type-names flag, generated C++ code will include a TypeName() method
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
This pull request is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.
This pull request was automatically closed due to no activity for 6 months plus the 14 day notice period.