forked from BigfootDev/flatbuffers
bigfoot_ref
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
native_include "bigfoot_ref_test_impl.h";
|
||||
|
||||
namespace BigfootRefTestNS;
|
||||
|
||||
// Stands in for Bigfoot's real UUID - a `native_type` struct so RefId has a
|
||||
// distinct native/flat representation, matching the shape `bigfoot_ref`
|
||||
// requires of a wrapper's payload field.
|
||||
struct RefId (native_type: "Native::RefId") {
|
||||
value: uint64;
|
||||
}
|
||||
|
||||
// The reference-wrapper template itself. `bigfoot_ref_wrapper` marks Ref as
|
||||
// instantiable per referenced type via `bigfoot_ref` below.
|
||||
struct Ref (bigfoot_ref_wrapper: "Native::Ref") {
|
||||
uuid: RefId;
|
||||
}
|
||||
|
||||
// RefHolder references two distinct C++ types (Thing, OtherThing) that are
|
||||
// *never defined anywhere in this test* - only ever forward-declared, by
|
||||
// flatc itself, directly into the generated header. This is the property
|
||||
// `bigfoot_ref` exists to provide: a reference field never requires the
|
||||
// referenced type to be complete. It also references `Thing` twice (once as
|
||||
// a plain field, once in a vector), exercising the include-guard dedup for
|
||||
// two fields that resolve to the identical Pack/UnPack pair.
|
||||
table RefHolder {
|
||||
ref_a: Ref (native_inline, bigfoot_ref: "Native::Thing");
|
||||
ref_a_again: [Ref] (native_inline, bigfoot_ref: "Native::Thing");
|
||||
ref_b: Ref (native_inline, bigfoot_ref: "Native::OtherThing");
|
||||
}
|
||||
|
||||
root_type RefHolder;
|
||||
Reference in New Issue
Block a user