Home | History | Annotate | Download | only in tests
      1 // test schema file
      2 
      3 include "include_test1.fbs";
      4 
      5 namespace MyGame.Example2;
      6 
      7 table Monster {}  // Test having same name as below, but in different namespace.
      8 
      9 namespace MyGame.Example;
     10 
     11 attribute "priority";
     12 
     13 enum Color:byte (bit_flags) { Red = 0, Green, Blue = 3, }
     14 
     15 union Any { Monster, TestSimpleTableWithEnum, MyGame.Example2.Monster }
     16 
     17 struct Test { a:short; b:byte; }
     18 
     19 table TestSimpleTableWithEnum (csharp_partial) {
     20   color: Color = Green;
     21 }
     22 
     23 struct Vec3 (force_align: 16) {
     24   x:float;
     25   y:float;
     26   z:float;
     27   test1:double;
     28   test2:Color;
     29   test3:Test;
     30 }
     31 
     32 table Stat {
     33   id:string;
     34   val:long;
     35   count:ushort;
     36 }
     37 
     38 /// an example documentation comment: monster object
     39 table Monster {
     40   pos:Vec3 (id: 0);
     41   hp:short = 100 (id: 2);
     42   mana:short = 150 (id: 1);
     43   name:string (id: 3, required, key);
     44   color:Color = Blue (id: 6);
     45   inventory:[ubyte] (id: 5);
     46   friendly:bool = false (deprecated, priority: 1, id: 4);
     47   /// an example documentation comment: this will end up in the generated code
     48   /// multiline too
     49   testarrayoftables:[Monster] (id: 11);
     50   testarrayofstring:[string] (id: 10);
     51   testarrayofstring2:[string] (id: 28);
     52   testarrayofbools:[bool] (id: 24);
     53   enemy:MyGame.Example.Monster (id:12);  // Test referring by full namespace.
     54   test:Any (id: 8);
     55   test4:[Test] (id: 9);
     56   testnestedflatbuffer:[ubyte] (id:13, nested_flatbuffer: "Monster");
     57   testempty:Stat (id:14);
     58   testbool:bool (id:15);
     59   testhashs32_fnv1:int (id:16, hash:"fnv1_32");
     60   testhashu32_fnv1:uint (id:17, hash:"fnv1_32");
     61   testhashs64_fnv1:long (id:18, hash:"fnv1_64");
     62   testhashu64_fnv1:ulong (id:19, hash:"fnv1_64");
     63   testhashs32_fnv1a:int (id:20, hash:"fnv1a_32");
     64   testhashu32_fnv1a:uint (id:21, hash:"fnv1a_32", cpp_type:"Stat");
     65   testhashs64_fnv1a:long (id:22, hash:"fnv1a_64");
     66   testhashu64_fnv1a:ulong (id:23, hash:"fnv1a_64");
     67   testf:float = 3.14159 (id:25);
     68   testf2:float = 3 (id:26);
     69   testf3:float (id:27);
     70 }
     71 
     72 rpc_service MonsterStorage {
     73   Store(Monster):Stat (streaming: "none");
     74   Retrieve(Stat):Monster (streaming: "server", idempotent);
     75 }
     76 
     77 root_type Monster;
     78 
     79 file_identifier "MONS";
     80 file_extension "mon";
     81