1// test schema file 2 3include "include_test1.fbs"; 4 5namespace MyGame; 6 7table InParentNamespace {} 8 9namespace MyGame.Example2; 10 11table Monster {} // Test having same name as below, but in different namespace. 12 13namespace MyGame.Example; 14 15attribute "priority"; 16 17enum Color:byte (bit_flags) { Red = 0, Green, Blue = 3, } 18 19union Any { Monster, TestSimpleTableWithEnum, MyGame.Example2.Monster } 20 21union AnyUniqueAliases { M: Monster, T: TestSimpleTableWithEnum, M2: MyGame.Example2.Monster } 22union AnyAmbiguousAliases { M1: Monster, M2: Monster, M3: Monster } 23 24struct Test { a:short; b:byte; } 25 26table TestSimpleTableWithEnum (csharp_partial, private) { 27 color: Color = Green; 28} 29 30struct Vec3 (force_align: 8) { 31 x:float; 32 y:float; 33 z:float; 34 test1:double; 35 test2:Color; 36 test3:Test; 37} 38 39struct Ability { 40 id:uint(key); 41 distance:uint; 42} 43 44table Stat { 45 id:string; 46 val:long; 47 count:ushort; 48} 49 50table Referrable { 51 id:ulong(key, hash:"fnv1a_64"); 52} 53 54/// an example documentation comment: monster object 55table Monster { 56 pos:Vec3 (id: 0); 57 hp:short = 100 (id: 2); 58 mana:short = 150 (id: 1); 59 name:string (id: 3, required, key); 60 color:Color = Blue (id: 6); 61 inventory:[ubyte] (id: 5); 62 friendly:bool = false (deprecated, priority: 1, id: 4); 63 /// an example documentation comment: this will end up in the generated code 64 /// multiline too 65 testarrayoftables:[Monster] (id: 11); 66 testarrayofstring:[string] (id: 10); 67 testarrayofstring2:[string] (id: 28); 68 testarrayofbools:[bool] (id: 24); 69 testarrayofsortedstruct:[Ability] (id: 29); 70 enemy:MyGame.Example.Monster (id:12); // Test referring by full namespace. 71 test:Any (id: 8); 72 test4:[Test] (id: 9); 73 test5:[Test] (id: 31); 74 testnestedflatbuffer:[ubyte] (id:13, nested_flatbuffer: "Monster"); 75 testempty:Stat (id:14); 76 testbool:bool (id:15); 77 testhashs32_fnv1:int (id:16, hash:"fnv1_32"); 78 testhashu32_fnv1:uint (id:17, hash:"fnv1_32"); 79 testhashs64_fnv1:long (id:18, hash:"fnv1_64"); 80 testhashu64_fnv1:ulong (id:19, hash:"fnv1_64"); 81 testhashs32_fnv1a:int (id:20, hash:"fnv1a_32"); 82 testhashu32_fnv1a:uint (id:21, hash:"fnv1a_32", cpp_type:"Stat"); 83 testhashs64_fnv1a:long (id:22, hash:"fnv1a_64"); 84 testhashu64_fnv1a:ulong (id:23, hash:"fnv1a_64"); 85 testf:float = 3.14159 (id:25); 86 testf2:float = 3 (id:26); 87 testf3:float (id:27); 88 flex:[ubyte] (id:30, flexbuffer); 89 vector_of_longs:[long] (id:32); 90 vector_of_doubles:[double] (id:33); 91 parent_namespace_test:InParentNamespace (id:34); 92 vector_of_referrables:[Referrable](id:35); 93 single_weak_reference:ulong(id:36, hash:"fnv1a_64", cpp_type:"ReferrableT"); 94 vector_of_weak_references:[ulong](id:37, hash:"fnv1a_64", cpp_type:"ReferrableT"); 95 vector_of_strong_referrables:[Referrable](id:38, cpp_ptr_type:"default_ptr_type"); //was shared_ptr 96 co_owning_reference:ulong(id:39, hash:"fnv1a_64", cpp_type:"ReferrableT", cpp_ptr_type:"naked"); //was shared_ptr as well 97 vector_of_co_owning_references:[ulong](id:40, hash:"fnv1a_64", cpp_type:"ReferrableT", cpp_ptr_type:"default_ptr_type", cpp_ptr_type_get:".get()"); //was shared_ptr 98 non_owning_reference:ulong(id:41, hash:"fnv1a_64", cpp_type:"ReferrableT", cpp_ptr_type:"naked", cpp_ptr_type_get:""); //was weak_ptr 99 vector_of_non_owning_references:[ulong](id:42, hash:"fnv1a_64", cpp_type:"ReferrableT", cpp_ptr_type:"naked", cpp_ptr_type_get:""); //was weak_ptr 100 any_unique:AnyUniqueAliases(id:44); 101 any_ambiguous:AnyAmbiguousAliases (id:46); 102 vector_of_enums:[Color] (id:47); 103} 104 105table TypeAliases { 106 i8:int8; 107 u8:uint8; 108 i16:int16; 109 u16:uint16; 110 i32:int32; 111 u32:uint32; 112 i64:int64; 113 u64:uint64; 114 f32:float32; 115 f64:float64; 116 v8:[int8]; 117 vf64:[float64]; 118} 119 120rpc_service MonsterStorage { 121 Store(Monster):Stat (streaming: "none"); 122 Retrieve(Stat):Monster (streaming: "server", idempotent); 123 GetMaxHitPoint(Monster):Stat (streaming: "client"); 124 GetMinMaxHitPoints(Monster):Stat (streaming: "bidi"); 125} 126 127root_type Monster; 128 129file_identifier "MONS"; 130file_extension "mon"; 131