diff options
author | Wouter van Oortmerssen <wvo@google.com> | 2015-05-21 16:33:29 -0700 |
---|---|---|
committer | Wouter van Oortmerssen <wvo@google.com> | 2015-06-15 15:53:10 -0700 |
commit | 81312c21281430449aef20f7a71ad9e0962791d3 (patch) | |
tree | 2fdacc478a58378b689805f417b68e4e1eca2cb2 /reflection/reflection.fbs | |
parent | 1808337adcf93d6d2b244c6d86f3b0965cce10b1 (diff) | |
download | flatbuffers-81312c21281430449aef20f7a71ad9e0962791d3.tar.gz flatbuffers-81312c21281430449aef20f7a71ad9e0962791d3.tar.bz2 flatbuffers-81312c21281430449aef20f7a71ad9e0962791d3.zip |
Initial reflection and resizing functionality.
Tested: on Linux.
Change-Id: I8f7bccf9b1ad87fea788f85e23fa69435758feca
Diffstat (limited to 'reflection/reflection.fbs')
-rw-r--r-- | reflection/reflection.fbs | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/reflection/reflection.fbs b/reflection/reflection.fbs new file mode 100644 index 00000000..b2a262a3 --- /dev/null +++ b/reflection/reflection.fbs @@ -0,0 +1,79 @@ +// This schema defines objects that represent a parsed schema, like +// the binary version of a .fbs file. +// This could be used to operate on unknown FlatBuffers at runtime. +// It can even ... represent itself (!) + +namespace reflection; + +// These must correspond to the enum in idl.h. +enum BaseType : byte { + None, + UType, + Bool, + Byte, + UByte, + Short, + UShort, + Int, + UInt, + Long, + ULong, + Float, + Double, + String, + Vector, + Obj, // Used for tables & structs. + Union // +} + +table Type { + base_type:BaseType; + element:BaseType = None; // Only if base_type == Vector. + index:int = -1; // If base_type == Object, index into "objects" below. + // If base_type == Union, UnionType, or integral derived + // from an enum, index into "enums" below. +} + +table EnumVal { + name:string (required); + value:long (key); + object:Object; // Only if part of a union. +} + +table Enum { + name:string (required, key); + values:[EnumVal] (required); // In order of their values. + is_union:bool = false; + underlying_type:Type (required); +} + +table Field { + name:string (required, key); + type:Type (required); + id:ushort; + offset:ushort; // Offset into the vtable for tables, or into the struct. + default_integer:long = 0; + default_real:double = 0.0; + deprecated:bool = false; + required:bool = false; + key:bool = false; +} + +table Object { // Used for both tables and structs. + name:string (required, key); + fields:[Field] (required); // Sorted. + is_struct:bool = false; +} + +table Schema { + objects:[Object] (required); // Sorted. + enums:[Enum] (required); // Sorted. + file_ident:string; + file_ext:string; + root_table:Object; +} + +root_type Schema; + +file_identifier "BFBS"; +file_extension "bfbs"; |