summaryrefslogtreecommitdiff
path: root/tests/MyGame
diff options
context:
space:
mode:
Diffstat (limited to 'tests/MyGame')
-rw-r--r--tests/MyGame/Example/Any.py8
-rw-r--r--tests/MyGame/Example/Color.py9
-rw-r--r--tests/MyGame/Example/Monster.py278
-rw-r--r--tests/MyGame/Example/Stat.py39
-rw-r--r--tests/MyGame/Example/Test.py24
-rw-r--r--tests/MyGame/Example/Vec3.py44
-rw-r--r--tests/MyGame/Example/__init__.py0
-rw-r--r--tests/MyGame/__init__.py0
8 files changed, 402 insertions, 0 deletions
diff --git a/tests/MyGame/Example/Any.py b/tests/MyGame/Example/Any.py
new file mode 100644
index 00000000..c88362ec
--- /dev/null
+++ b/tests/MyGame/Example/Any.py
@@ -0,0 +1,8 @@
+# automatically generated, do not modify
+
+# namespace: Example
+
+class Any(object):
+ NONE = 0
+ Monster = 1
+
diff --git a/tests/MyGame/Example/Color.py b/tests/MyGame/Example/Color.py
new file mode 100644
index 00000000..18b147dc
--- /dev/null
+++ b/tests/MyGame/Example/Color.py
@@ -0,0 +1,9 @@
+# automatically generated, do not modify
+
+# namespace: Example
+
+class Color(object):
+ Red = 1
+ Green = 2
+ Blue = 8
+
diff --git a/tests/MyGame/Example/Monster.py b/tests/MyGame/Example/Monster.py
new file mode 100644
index 00000000..2f0dc35e
--- /dev/null
+++ b/tests/MyGame/Example/Monster.py
@@ -0,0 +1,278 @@
+# automatically generated, do not modify
+
+# namespace: Example
+
+import flatbuffers
+
+class Monster(object):
+ __slots__ = ['_tab']
+
+ @classmethod
+ def GetRootAsMonster(cls, buf, offset):
+ n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
+ x = Monster()
+ x.Init(buf, n + offset)
+ return x
+
+
+ # Monster
+ def Init(self, buf, pos):
+ self._tab = flatbuffers.table.Table(buf, pos)
+
+ # Monster
+ def Pos(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
+ if o != 0:
+ x = o + self._tab.Pos
+ from .Vec3 import Vec3
+ obj = Vec3()
+ obj.Init(self._tab.Bytes, x)
+ return obj
+ return None
+
+ # Monster
+ def Mana(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
+ return 150
+
+ # Monster
+ def Hp(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
+ return 100
+
+ # Monster
+ def Name(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
+ if o != 0:
+ return self._tab.String(o + self._tab.Pos)
+ return ""
+
+ # Monster
+ def Inventory(self, j):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
+ if o != 0:
+ a = self._tab.Vector(o)
+ return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
+ return 0
+
+ # Monster
+ def InventoryLength(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
+ if o != 0:
+ return self._tab.VectorLen(o)
+ return 0
+
+ # Monster
+ def Color(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
+ return 8
+
+ # Monster
+ def TestType(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
+ return 0
+
+ # Monster
+ def Test(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
+ if o != 0:
+ from flatbuffers.table import Table
+ obj = Table(bytearray(), 0)
+ self._tab.Union(obj, o)
+ return obj
+ return None
+
+ # Monster
+ def Test4(self, j):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
+ if o != 0:
+ x = self._tab.Vector(o)
+ x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
+ from .Test import Test
+ obj = Test()
+ obj.Init(self._tab.Bytes, x)
+ return obj
+ return None
+
+ # Monster
+ def Test4Length(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
+ if o != 0:
+ return self._tab.VectorLen(o)
+ return 0
+
+ # Monster
+ def Testarrayofstring(self, j):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
+ if o != 0:
+ a = self._tab.Vector(o)
+ return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
+ return ""
+
+ # Monster
+ def TestarrayofstringLength(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
+ if o != 0:
+ return self._tab.VectorLen(o)
+ return 0
+
+# /// an example documentation comment: this will end up in the generated code
+# /// multiline too
+ # Monster
+ def Testarrayoftables(self, j):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
+ if o != 0:
+ x = self._tab.Vector(o)
+ x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
+ x = self._tab.Indirect(x)
+ from .Monster import Monster
+ obj = Monster()
+ obj.Init(self._tab.Bytes, x)
+ return obj
+ return None
+
+ # Monster
+ def TestarrayoftablesLength(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
+ if o != 0:
+ return self._tab.VectorLen(o)
+ return 0
+
+ # Monster
+ def Enemy(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
+ if o != 0:
+ x = self._tab.Indirect(o + self._tab.Pos)
+ from .Monster import Monster
+ obj = Monster()
+ obj.Init(self._tab.Bytes, x)
+ return obj
+ return None
+
+ # Monster
+ def Testnestedflatbuffer(self, j):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
+ if o != 0:
+ a = self._tab.Vector(o)
+ return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
+ return 0
+
+ # Monster
+ def TestnestedflatbufferLength(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
+ if o != 0:
+ return self._tab.VectorLen(o)
+ return 0
+
+ # Monster
+ def Testempty(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32))
+ if o != 0:
+ x = self._tab.Indirect(o + self._tab.Pos)
+ from .Stat import Stat
+ obj = Stat()
+ obj.Init(self._tab.Bytes, x)
+ return obj
+ return None
+
+ # Monster
+ def Testbool(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)
+ return 0
+
+ # Monster
+ def Testhashs32Fnv1(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
+ return 0
+
+ # Monster
+ def Testhashu32Fnv1(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
+ return 0
+
+ # Monster
+ def Testhashs64Fnv1(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(40))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos)
+ return 0
+
+ # Monster
+ def Testhashu64Fnv1(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(42))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
+ return 0
+
+ # Monster
+ def Testhashs32Fnv1a(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(44))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
+ return 0
+
+ # Monster
+ def Testhashu32Fnv1a(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(46))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
+ return 0
+
+ # Monster
+ def Testhashs64Fnv1a(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(48))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos)
+ return 0
+
+ # Monster
+ def Testhashu64Fnv1a(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(50))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
+ return 0
+
+def MonsterStart(builder): builder.StartObject(24)
+def MonsterAddPos(builder, pos): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pos), 0)
+def MonsterAddMana(builder, mana): builder.PrependInt16Slot(1, mana, 150)
+def MonsterAddHp(builder, hp): builder.PrependInt16Slot(2, hp, 100)
+def MonsterAddName(builder, name): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
+def MonsterAddInventory(builder, inventory): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(inventory), 0)
+def MonsterStartInventoryVector(builder, numElems): return builder.StartVector(1, numElems, 1)
+def MonsterAddColor(builder, color): builder.PrependInt8Slot(6, color, 8)
+def MonsterAddTestType(builder, testType): builder.PrependUint8Slot(7, testType, 0)
+def MonsterAddTest(builder, test): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(test), 0)
+def MonsterAddTest4(builder, test4): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(test4), 0)
+def MonsterStartTest4Vector(builder, numElems): return builder.StartVector(4, numElems, 2)
+def MonsterAddTestarrayofstring(builder, testarrayofstring): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofstring), 0)
+def MonsterStartTestarrayofstringVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def MonsterAddTestarrayoftables(builder, testarrayoftables): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayoftables), 0)
+def MonsterStartTestarrayoftablesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def MonsterAddEnemy(builder, enemy): builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(enemy), 0)
+def MonsterAddTestnestedflatbuffer(builder, testnestedflatbuffer): builder.PrependUOffsetTRelativeSlot(13, flatbuffers.number_types.UOffsetTFlags.py_type(testnestedflatbuffer), 0)
+def MonsterStartTestnestedflatbufferVector(builder, numElems): return builder.StartVector(1, numElems, 1)
+def MonsterAddTestempty(builder, testempty): builder.PrependUOffsetTRelativeSlot(14, flatbuffers.number_types.UOffsetTFlags.py_type(testempty), 0)
+def MonsterAddTestbool(builder, testbool): builder.PrependBoolSlot(15, testbool, 0)
+def MonsterAddTesthashs32Fnv1(builder, testhashs32Fnv1): builder.PrependInt32Slot(16, testhashs32Fnv1, 0)
+def MonsterAddTesthashu32Fnv1(builder, testhashu32Fnv1): builder.PrependUint32Slot(17, testhashu32Fnv1, 0)
+def MonsterAddTesthashs64Fnv1(builder, testhashs64Fnv1): builder.PrependInt64Slot(18, testhashs64Fnv1, 0)
+def MonsterAddTesthashu64Fnv1(builder, testhashu64Fnv1): builder.PrependUint64Slot(19, testhashu64Fnv1, 0)
+def MonsterAddTesthashs32Fnv1a(builder, testhashs32Fnv1a): builder.PrependInt32Slot(20, testhashs32Fnv1a, 0)
+def MonsterAddTesthashu32Fnv1a(builder, testhashu32Fnv1a): builder.PrependUint32Slot(21, testhashu32Fnv1a, 0)
+def MonsterAddTesthashs64Fnv1a(builder, testhashs64Fnv1a): builder.PrependInt64Slot(22, testhashs64Fnv1a, 0)
+def MonsterAddTesthashu64Fnv1a(builder, testhashu64Fnv1a): builder.PrependUint64Slot(23, testhashu64Fnv1a, 0)
+def MonsterEnd(builder): return builder.EndObject()
diff --git a/tests/MyGame/Example/Stat.py b/tests/MyGame/Example/Stat.py
new file mode 100644
index 00000000..23bef0db
--- /dev/null
+++ b/tests/MyGame/Example/Stat.py
@@ -0,0 +1,39 @@
+# automatically generated, do not modify
+
+# namespace: Example
+
+import flatbuffers
+
+class Stat(object):
+ __slots__ = ['_tab']
+
+ # Stat
+ def Init(self, buf, pos):
+ self._tab = flatbuffers.table.Table(buf, pos)
+
+ # Stat
+ def Id(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
+ if o != 0:
+ return self._tab.String(o + self._tab.Pos)
+ return ""
+
+ # Stat
+ def Val(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos)
+ return 0
+
+ # Stat
+ def Count(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint16Flags, o + self._tab.Pos)
+ return 0
+
+def StatStart(builder): builder.StartObject(3)
+def StatAddId(builder, id): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0)
+def StatAddVal(builder, val): builder.PrependInt64Slot(1, val, 0)
+def StatAddCount(builder, count): builder.PrependUint16Slot(2, count, 0)
+def StatEnd(builder): return builder.EndObject()
diff --git a/tests/MyGame/Example/Test.py b/tests/MyGame/Example/Test.py
new file mode 100644
index 00000000..4c4912a6
--- /dev/null
+++ b/tests/MyGame/Example/Test.py
@@ -0,0 +1,24 @@
+# automatically generated, do not modify
+
+# namespace: Example
+
+import flatbuffers
+
+class Test(object):
+ __slots__ = ['_tab']
+
+ # Test
+ def Init(self, buf, pos):
+ self._tab = flatbuffers.table.Table(buf, pos)
+
+ # Test
+ def A(self): return self._tab.Get(flatbuffers.number_types.Int16Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(0))
+ # Test
+ def B(self): return self._tab.Get(flatbuffers.number_types.Int8Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(2))
+
+def CreateTest(builder, a, b):
+ builder.Prep(2, 4)
+ builder.Pad(1)
+ builder.PrependInt8(b)
+ builder.PrependInt16(a)
+ return builder.Offset()
diff --git a/tests/MyGame/Example/Vec3.py b/tests/MyGame/Example/Vec3.py
new file mode 100644
index 00000000..3010d5bc
--- /dev/null
+++ b/tests/MyGame/Example/Vec3.py
@@ -0,0 +1,44 @@
+# automatically generated, do not modify
+
+# namespace: Example
+
+import flatbuffers
+
+class Vec3(object):
+ __slots__ = ['_tab']
+
+ # Vec3
+ def Init(self, buf, pos):
+ self._tab = flatbuffers.table.Table(buf, pos)
+
+ # Vec3
+ def X(self): return self._tab.Get(flatbuffers.number_types.Float32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(0))
+ # Vec3
+ def Y(self): return self._tab.Get(flatbuffers.number_types.Float32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(4))
+ # Vec3
+ def Z(self): return self._tab.Get(flatbuffers.number_types.Float32Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(8))
+ # Vec3
+ def Test1(self): return self._tab.Get(flatbuffers.number_types.Float64Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(16))
+ # Vec3
+ def Test2(self): return self._tab.Get(flatbuffers.number_types.Int8Flags, self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(24))
+ # Vec3
+ def Test3(self, obj):
+ obj.Init(self._tab.Bytes, self._tab.Pos + 26)
+ return obj
+
+
+def CreateVec3(builder, x, y, z, test1, test2, Test_a, Test_b):
+ builder.Prep(16, 32)
+ builder.Pad(2)
+ builder.Prep(2, 4)
+ builder.Pad(1)
+ builder.PrependInt8(Test_b)
+ builder.PrependInt16(Test_a)
+ builder.Pad(1)
+ builder.PrependInt8(test2)
+ builder.PrependFloat64(test1)
+ builder.Pad(4)
+ builder.PrependFloat32(z)
+ builder.PrependFloat32(y)
+ builder.PrependFloat32(x)
+ return builder.Offset()
diff --git a/tests/MyGame/Example/__init__.py b/tests/MyGame/Example/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/MyGame/Example/__init__.py
diff --git a/tests/MyGame/__init__.py b/tests/MyGame/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/MyGame/__init__.py