summaryrefslogtreecommitdiff
path: root/tests/MyGame
diff options
context:
space:
mode:
authorWouter van Oortmerssen <wvo@google.com>2014-01-27 16:52:49 -0800
committerWouter van Oortmerssen <wvo@google.com>2014-06-10 13:53:28 -0700
commit26a30738a4fa4e92300821fd761764ec8df2dcf2 (patch)
tree4b241e44398a6e216fac5e1d5bedfb3574569429 /tests/MyGame
parentc1b43e22b0dc56cb7a7a7ea8a1bf5f0244a23f5e (diff)
downloadflatbuffers-26a30738a4fa4e92300821fd761764ec8df2dcf2.tar.gz
flatbuffers-26a30738a4fa4e92300821fd761764ec8df2dcf2.tar.bz2
flatbuffers-26a30738a4fa4e92300821fd761764ec8df2dcf2.zip
Initial commit of the FlatBuffers code.
Change-Id: I4c9f0f722490b374257adb3fec63e44ae93da920 Tested: using VS2010 / Xcode / gcc on Linux.
Diffstat (limited to 'tests/MyGame')
-rwxr-xr-xtests/MyGame/Example/Any.java14
-rwxr-xr-xtests/MyGame/Example/Color.java15
-rwxr-xr-xtests/MyGame/Example/Monster.java42
-rwxr-xr-xtests/MyGame/Example/Test.java23
-rwxr-xr-xtests/MyGame/Example/Vec3.java37
5 files changed, 131 insertions, 0 deletions
diff --git a/tests/MyGame/Example/Any.java b/tests/MyGame/Example/Any.java
new file mode 100755
index 00000000..9cbafb15
--- /dev/null
+++ b/tests/MyGame/Example/Any.java
@@ -0,0 +1,14 @@
+// automatically generated, do not modify
+
+package MyGame.Example;
+
+import java.nio.*;
+import java.lang.*;
+import java.util.*;
+import flatbuffers.*;
+
+public class Any {
+ public static final byte NONE = 0;
+ public static final byte Monster = 1;
+};
+
diff --git a/tests/MyGame/Example/Color.java b/tests/MyGame/Example/Color.java
new file mode 100755
index 00000000..f983c392
--- /dev/null
+++ b/tests/MyGame/Example/Color.java
@@ -0,0 +1,15 @@
+// automatically generated, do not modify
+
+package MyGame.Example;
+
+import java.nio.*;
+import java.lang.*;
+import java.util.*;
+import flatbuffers.*;
+
+public class Color {
+ public static final byte Red = 0;
+ public static final byte Green = 1;
+ public static final byte Blue = 2;
+};
+
diff --git a/tests/MyGame/Example/Monster.java b/tests/MyGame/Example/Monster.java
new file mode 100755
index 00000000..e07d9b8c
--- /dev/null
+++ b/tests/MyGame/Example/Monster.java
@@ -0,0 +1,42 @@
+// automatically generated, do not modify
+
+package MyGame.Example;
+
+import java.nio.*;
+import java.lang.*;
+import java.util.*;
+import flatbuffers.*;
+
+public class Monster extends Table {
+ public static Monster getRootAsMonster(ByteBuffer _bb, int offset) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (new Monster()).__init(_bb.getInt(offset) + offset, _bb); }
+ public Monster __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; }
+ public Vec3 pos() { return pos(new Vec3()); }
+ public Vec3 pos(Vec3 obj) { int o = __offset(4); return o != 0 ? obj.__init(o + bb_pos, bb) : null; }
+ public short mana() { int o = __offset(6); return o != 0 ? bb.getShort(o + bb_pos) : 150; }
+ public short hp() { int o = __offset(8); return o != 0 ? bb.getShort(o + bb_pos) : 100; }
+ public String name() { int o = __offset(10); return o != 0 ? __string(o) : null; }
+ public byte inventory(int j) { int o = __offset(14); return o != 0 ? bb.get(__vector(o) + j * 1) : 0; }
+ public int inventoryLength() { int o = __offset(14); return o != 0 ? __vector_len(o) : 0; }
+ /// an example documentation comment: this will end up in the generated code multiline too
+ public byte color() { int o = __offset(16); return o != 0 ? bb.get(o + bb_pos) : 2; }
+ public byte testType() { int o = __offset(18); return o != 0 ? bb.get(o + bb_pos) : 0; }
+ public Table test(Table obj) { int o = __offset(20); return o != 0 ? __union(obj, o) : null; }
+ public Test test4(int j) { return test4(new Test(), j); }
+ public Test test4(Test obj, int j) { int o = __offset(22); return o != 0 ? obj.__init(__vector(o) + j * 4, bb) : null; }
+ public int test4Length() { int o = __offset(22); return o != 0 ? __vector_len(o) : 0; }
+
+ public static void startMonster(FlatBufferBuilder builder) { builder.startObject(10); }
+ public static void addPos(FlatBufferBuilder builder, int pos) { builder.addStruct(0, pos, 0); }
+ public static void addMana(FlatBufferBuilder builder, short mana) { builder.addShort(1, mana, 150); }
+ public static void addHp(FlatBufferBuilder builder, short hp) { builder.addShort(2, hp, 100); }
+ public static void addName(FlatBufferBuilder builder, int name) { builder.addOffset(3, name, 0); }
+ public static void addInventory(FlatBufferBuilder builder, int inventory) { builder.addOffset(5, inventory, 0); }
+ public static void startInventoryVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems); }
+ public static void addColor(FlatBufferBuilder builder, byte color) { builder.addByte(6, color, 2); }
+ public static void addTestType(FlatBufferBuilder builder, byte testType) { builder.addByte(7, testType, 0); }
+ public static void addTest(FlatBufferBuilder builder, int test) { builder.addOffset(8, test, 0); }
+ public static void addTest4(FlatBufferBuilder builder, int test4) { builder.addOffset(9, test4, 0); }
+ public static void startTest4Vector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems); }
+ public static int endMonster(FlatBufferBuilder builder) { return builder.endObject(); }
+};
+
diff --git a/tests/MyGame/Example/Test.java b/tests/MyGame/Example/Test.java
new file mode 100755
index 00000000..1773658b
--- /dev/null
+++ b/tests/MyGame/Example/Test.java
@@ -0,0 +1,23 @@
+// automatically generated, do not modify
+
+package MyGame.Example;
+
+import java.nio.*;
+import java.lang.*;
+import java.util.*;
+import flatbuffers.*;
+
+public class Test extends Struct {
+ public Test __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; }
+ public short a() { return bb.getShort(bb_pos + 0); }
+ public byte b() { return bb.get(bb_pos + 2); }
+
+ public static int createTest(FlatBufferBuilder builder, short a, byte b) {
+ builder.prep(2, 0);
+ builder.pad(1);
+ builder.putByte(b);
+ builder.putShort(a);
+ return builder.offset();
+ }
+};
+
diff --git a/tests/MyGame/Example/Vec3.java b/tests/MyGame/Example/Vec3.java
new file mode 100755
index 00000000..a71cbccd
--- /dev/null
+++ b/tests/MyGame/Example/Vec3.java
@@ -0,0 +1,37 @@
+// automatically generated, do not modify
+
+package MyGame.Example;
+
+import java.nio.*;
+import java.lang.*;
+import java.util.*;
+import flatbuffers.*;
+
+public class Vec3 extends Struct {
+ public Vec3 __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; return this; }
+ public float x() { return bb.getFloat(bb_pos + 0); }
+ public float y() { return bb.getFloat(bb_pos + 4); }
+ public float z() { return bb.getFloat(bb_pos + 8); }
+ public double test1() { return bb.getDouble(bb_pos + 16); }
+ public byte test2() { return bb.get(bb_pos + 24); }
+ public Test test3() { return test3(new Test()); }
+ public Test test3(Test obj) { return obj.__init(bb_pos + 26, bb); }
+
+ public static int createVec3(FlatBufferBuilder builder, float x, float y, float z, double test1, byte test2, short Test_a, byte Test_b) {
+ builder.prep(16, 0);
+ builder.pad(2);
+ builder.prep(2, 0);
+ builder.pad(1);
+ builder.putByte(Test_b);
+ builder.putShort(Test_a);
+ builder.pad(1);
+ builder.putByte(test2);
+ builder.putDouble(test1);
+ builder.pad(4);
+ builder.putFloat(z);
+ builder.putFloat(y);
+ builder.putFloat(x);
+ return builder.offset();
+ }
+};
+