2014-09-23 00:17:13 +00:00
|
|
|
// test schema file
|
2014-01-28 00:52:49 +00:00
|
|
|
|
2014-08-19 21:20:05 +00:00
|
|
|
include "include_test1.fbs";
|
|
|
|
|
2017-08-24 19:55:35 +00:00
|
|
|
namespace MyGame;
|
|
|
|
|
|
|
|
table InParentNamespace {}
|
|
|
|
|
2016-06-18 01:16:11 +00:00
|
|
|
namespace MyGame.Example2;
|
|
|
|
|
|
|
|
table Monster {} // Test having same name as below, but in different namespace.
|
|
|
|
|
2014-01-28 00:52:49 +00:00
|
|
|
namespace MyGame.Example;
|
|
|
|
|
2014-11-18 01:27:26 +00:00
|
|
|
attribute "priority";
|
|
|
|
|
2014-08-21 22:17:45 +00:00
|
|
|
enum Color:byte (bit_flags) { Red = 0, Green, Blue = 3, }
|
2014-01-28 00:52:49 +00:00
|
|
|
|
2016-06-18 01:16:11 +00:00
|
|
|
union Any { Monster, TestSimpleTableWithEnum, MyGame.Example2.Monster }
|
2014-01-28 00:52:49 +00:00
|
|
|
|
2018-11-01 19:51:25 +00:00
|
|
|
union AnyUniqueAliases { M: Monster, T: TestSimpleTableWithEnum, M2: MyGame.Example2.Monster }
|
|
|
|
union AnyAmbiguousAliases { M1: Monster, M2: Monster, M3: Monster }
|
|
|
|
|
2014-01-28 00:52:49 +00:00
|
|
|
struct Test { a:short; b:byte; }
|
|
|
|
|
2018-08-16 22:25:33 +00:00
|
|
|
table TestSimpleTableWithEnum (csharp_partial, private) {
|
2015-08-11 16:01:43 +00:00
|
|
|
color: Color = Green;
|
|
|
|
}
|
|
|
|
|
2014-01-28 00:52:49 +00:00
|
|
|
struct Vec3 (force_align: 16) {
|
|
|
|
x:float;
|
|
|
|
y:float;
|
|
|
|
z:float;
|
|
|
|
test1:double;
|
2014-09-23 18:55:42 +00:00
|
|
|
test2:Color;
|
2014-01-28 00:52:49 +00:00
|
|
|
test3:Test;
|
|
|
|
}
|
|
|
|
|
2017-03-29 16:51:12 +00:00
|
|
|
struct Ability {
|
|
|
|
id:uint(key);
|
|
|
|
distance:uint;
|
|
|
|
}
|
|
|
|
|
2014-09-25 22:53:56 +00:00
|
|
|
table Stat {
|
|
|
|
id:string;
|
|
|
|
val:long;
|
2015-03-19 00:52:39 +00:00
|
|
|
count:ushort;
|
2014-09-25 22:53:56 +00:00
|
|
|
}
|
|
|
|
|
2018-02-22 19:04:26 +00:00
|
|
|
table Referrable {
|
|
|
|
id:ulong(key, hash:"fnv1a_64");
|
|
|
|
}
|
|
|
|
|
2015-08-28 15:48:28 +00:00
|
|
|
/// an example documentation comment: monster object
|
2014-01-28 00:52:49 +00:00
|
|
|
table Monster {
|
2014-07-08 00:34:23 +00:00
|
|
|
pos:Vec3 (id: 0);
|
|
|
|
hp:short = 100 (id: 2);
|
|
|
|
mana:short = 150 (id: 1);
|
2015-01-08 01:51:31 +00:00
|
|
|
name:string (id: 3, required, key);
|
2014-07-08 00:34:23 +00:00
|
|
|
color:Color = Blue (id: 6);
|
|
|
|
inventory:[ubyte] (id: 5);
|
|
|
|
friendly:bool = false (deprecated, priority: 1, id: 4);
|
2014-01-28 00:52:49 +00:00
|
|
|
/// an example documentation comment: this will end up in the generated code
|
|
|
|
/// multiline too
|
2014-07-08 00:34:23 +00:00
|
|
|
testarrayoftables:[Monster] (id: 11);
|
|
|
|
testarrayofstring:[string] (id: 10);
|
2016-06-15 19:10:01 +00:00
|
|
|
testarrayofstring2:[string] (id: 28);
|
2015-08-16 07:34:56 +00:00
|
|
|
testarrayofbools:[bool] (id: 24);
|
2017-03-29 16:51:12 +00:00
|
|
|
testarrayofsortedstruct:[Ability] (id: 29);
|
2015-05-08 22:04:53 +00:00
|
|
|
enemy:MyGame.Example.Monster (id:12); // Test referring by full namespace.
|
2014-07-08 00:34:23 +00:00
|
|
|
test:Any (id: 8);
|
|
|
|
test4:[Test] (id: 9);
|
2017-07-24 21:11:59 +00:00
|
|
|
test5:[Test] (id: 31);
|
2014-07-16 00:50:22 +00:00
|
|
|
testnestedflatbuffer:[ubyte] (id:13, nested_flatbuffer: "Monster");
|
2014-09-25 22:53:56 +00:00
|
|
|
testempty:Stat (id:14);
|
2015-01-17 01:48:51 +00:00
|
|
|
testbool:bool (id:15);
|
2015-02-13 23:58:29 +00:00
|
|
|
testhashs32_fnv1:int (id:16, hash:"fnv1_32");
|
|
|
|
testhashu32_fnv1:uint (id:17, hash:"fnv1_32");
|
|
|
|
testhashs64_fnv1:long (id:18, hash:"fnv1_64");
|
|
|
|
testhashu64_fnv1:ulong (id:19, hash:"fnv1_64");
|
|
|
|
testhashs32_fnv1a:int (id:20, hash:"fnv1a_32");
|
2016-10-05 23:59:15 +00:00
|
|
|
testhashu32_fnv1a:uint (id:21, hash:"fnv1a_32", cpp_type:"Stat");
|
2015-02-13 23:58:29 +00:00
|
|
|
testhashs64_fnv1a:long (id:22, hash:"fnv1a_64");
|
|
|
|
testhashu64_fnv1a:ulong (id:23, hash:"fnv1a_64");
|
2016-04-14 00:29:03 +00:00
|
|
|
testf:float = 3.14159 (id:25);
|
2016-04-18 18:48:53 +00:00
|
|
|
testf2:float = 3 (id:26);
|
2016-04-20 19:05:21 +00:00
|
|
|
testf3:float (id:27);
|
2017-06-02 23:41:22 +00:00
|
|
|
flex:[ubyte] (id:30, flexbuffer);
|
2017-08-01 15:34:00 +00:00
|
|
|
vector_of_longs:[long] (id:32);
|
|
|
|
vector_of_doubles:[double] (id:33);
|
2017-08-24 19:55:35 +00:00
|
|
|
parent_namespace_test:InParentNamespace (id:34);
|
2018-02-22 19:04:26 +00:00
|
|
|
vector_of_referrables:[Referrable](id:35);
|
|
|
|
single_weak_reference:ulong(id:36, hash:"fnv1a_64", cpp_type:"ReferrableT");
|
|
|
|
vector_of_weak_references:[ulong](id:37, hash:"fnv1a_64", cpp_type:"ReferrableT");
|
2018-10-08 19:43:57 +00:00
|
|
|
vector_of_strong_referrables:[Referrable](id:38, cpp_ptr_type:"default_ptr_type"); //was shared_ptr
|
2018-03-05 16:40:56 +00:00
|
|
|
co_owning_reference:ulong(id:39, hash:"fnv1a_64", cpp_type:"ReferrableT", cpp_ptr_type:"naked"); //was shared_ptr as well
|
2018-10-08 19:43:57 +00:00
|
|
|
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
|
2018-03-05 16:40:56 +00:00
|
|
|
non_owning_reference:ulong(id:41, hash:"fnv1a_64", cpp_type:"ReferrableT", cpp_ptr_type:"naked", cpp_ptr_type_get:""); //was weak_ptr
|
|
|
|
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
|
2018-11-01 19:51:25 +00:00
|
|
|
any_unique:AnyUniqueAliases(id:44);
|
|
|
|
any_ambiguous:AnyAmbiguousAliases (id:46);
|
2018-11-05 22:33:36 +00:00
|
|
|
vector_of_enums:[Color] (id:47);
|
2014-01-28 00:52:49 +00:00
|
|
|
}
|
|
|
|
|
2017-08-02 15:07:43 +00:00
|
|
|
table TypeAliases {
|
|
|
|
i8:int8;
|
|
|
|
u8:uint8;
|
|
|
|
i16:int16;
|
|
|
|
u16:uint16;
|
|
|
|
i32:int32;
|
|
|
|
u32:uint32;
|
|
|
|
i64:int64;
|
|
|
|
u64:uint64;
|
|
|
|
f32:float32;
|
|
|
|
f64:float64;
|
|
|
|
v8:[int8];
|
|
|
|
vf64:[float64];
|
|
|
|
}
|
|
|
|
|
2016-03-08 02:07:10 +00:00
|
|
|
rpc_service MonsterStorage {
|
2016-04-14 01:16:05 +00:00
|
|
|
Store(Monster):Stat (streaming: "none");
|
2016-12-28 19:50:41 +00:00
|
|
|
Retrieve(Stat):Monster (streaming: "server", idempotent);
|
2016-03-08 02:07:10 +00:00
|
|
|
}
|
|
|
|
|
2014-01-28 00:52:49 +00:00
|
|
|
root_type Monster;
|
2014-07-31 22:11:03 +00:00
|
|
|
|
|
|
|
file_identifier "MONS";
|
|
|
|
file_extension "mon";
|