xref: /aosp_15_r20/external/flatbuffers/tests/annotated_binary/annotated_binary.fbs (revision 890232f25432b36107d06881e0a25aaa6b473652)
1namespace AnnotatedBinary;
2
3enum Food : byte {
4  None = 0,
5  Apple = 1,
6  Banana = 2,
7  Kiwi = 3,
8}
9
10table Baz {
11  meal:Food = Banana;
12}
13
14table Bar {
15  a:double = 3.14;
16  b:float = 1.68;
17  c:Baz;
18}
19
20union BarBaz {
21  Bar, Baz
22}
23
24union Measurement {
25  Tolerance, Dimension
26}
27
28struct Tolerance {
29  width:uint8;
30}
31
32union Any {
33  Bar, Tolerance
34}
35
36struct Dimension {
37  values:[int:3];
38  tolerances:[Tolerance:3];
39}
40
41struct Building {
42  floors:int;
43  doors:int;
44  windows:int;
45  dimensions:Dimension;
46}
47
48struct Location {
49  latitude:double;
50  longitude:double;
51}
52
53table Foo {
54  counter:int;
55  healthy:bool;
56  level:long = 99;
57  meal:Food = Apple;
58  bar:Bar;
59  home:Building;
60  name:string;
61  // Vector of tables
62  bars:[Bar];
63  // Union of tables
64  bar_baz:BarBaz;
65  // Vector of Scalars
66  accounts:[uint16];
67  bob:string;
68  alice:string;
69  // Optional Scalars
70  maybe_i32: int32 = null;
71  default_i32: int32 = 42;
72  just_i32: int32;
73  // Vector of strings
74  names:[string];
75  // Vector of structs
76  points_of_interest:[Location];
77  // Vector of unions
78  foobars:[BarBaz];
79  // Union of structs
80  measurement:Measurement;
81  // Union of struct/table
82  anything:Any;
83  // Default floating point
84  temperature:float=98.6;
85  // Not present object
86  teetotaler:Bar;
87  charlie:string;
88}
89
90file_identifier "ANNO";
91
92root_type Foo;