Files
flatbuffers/tests/bigfoot_ref_test.fbs
T
2026-07-31 02:43:43 +02:00

32 lines
1.3 KiB
Plaintext

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;